More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 16,504 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Claim Tokens | 17927464 | 519 days ago | IN | 0 ETH | 0.00066785 | ||||
Transfer | 16571318 | 709 days ago | IN | 0.2 ETH | 0.00057809 | ||||
Transfer | 16571315 | 709 days ago | IN | 0.2 ETH | 0.00063961 | ||||
Claim Tokens | 16464797 | 724 days ago | IN | 0 ETH | 0.00066858 | ||||
Transfer | 15962414 | 794 days ago | IN | 0.0029 ETH | 0.00037418 | ||||
Claim Tokens | 14967366 | 946 days ago | IN | 0 ETH | 0.02262061 | ||||
Claim Tokens | 14967340 | 946 days ago | IN | 0 ETH | 0.01979285 | ||||
Claim Tokens | 14966576 | 946 days ago | IN | 0 ETH | 0.02732298 | ||||
Claim Tokens | 14966360 | 946 days ago | IN | 0 ETH | 0.0068365 | ||||
Claim Tokens | 14966342 | 946 days ago | IN | 0 ETH | 0.00634235 | ||||
Claim Tokens | 14966310 | 946 days ago | IN | 0 ETH | 0.00271454 | ||||
Claim Tokens | 14966219 | 946 days ago | IN | 0 ETH | 0.00470288 | ||||
Claim Tokens | 14966156 | 946 days ago | IN | 0 ETH | 0.00373746 | ||||
Claim Tokens | 14966020 | 946 days ago | IN | 0 ETH | 0.00580324 | ||||
Claim Tokens | 14965442 | 946 days ago | IN | 0 ETH | 0.00322966 | ||||
Claim Tokens | 14965239 | 946 days ago | IN | 0 ETH | 0.00477511 | ||||
Claim Tokens | 14965155 | 946 days ago | IN | 0 ETH | 0.00600369 | ||||
Claim Tokens | 14964430 | 946 days ago | IN | 0 ETH | 0.0110571 | ||||
Claim Tokens | 14964314 | 946 days ago | IN | 0 ETH | 0.01045625 | ||||
Claim Tokens | 14964232 | 946 days ago | IN | 0 ETH | 0.00827083 | ||||
Claim Tokens | 14964183 | 946 days ago | IN | 0 ETH | 0.00956867 | ||||
Claim Tokens | 14964010 | 946 days ago | IN | 0 ETH | 0.00537714 | ||||
Claim Tokens | 14963709 | 946 days ago | IN | 0 ETH | 0.00575701 | ||||
Claim Tokens | 14963173 | 946 days ago | IN | 0 ETH | 0.0104127 | ||||
Claim Tokens | 14962253 | 947 days ago | IN | 0 ETH | 0.01895808 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
AirdropGrapesToken
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.10; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; contract AirdropGrapesToken is Ownable, Pausable { using SafeERC20 for IERC20; IERC20 public immutable grapesToken; ERC721Enumerable public immutable alpha; ERC721Enumerable public immutable beta; ERC721Enumerable public immutable gamma; uint256 public immutable ALPHA_DISTRIBUTION_AMOUNT; uint256 public immutable BETA_DISTRIBUTION_AMOUNT; uint256 public immutable GAMMA_DISTRIBUTION_AMOUNT; uint256 public totalClaimed; uint256 public claimDuration; uint256 public claimStartTime; mapping (uint256 => bool) public alphaClaimed; mapping (uint256 => bool) public betaClaimed; mapping (uint256 => bool) public gammaClaimed; event ClaimStart( uint256 _claimDuration, uint256 _claimStartTime ); event AlphaClaimed( uint256 indexed tokenId, address indexed account, uint256 timestamp ); event BetaClaimed( uint256 indexed tokenId, address indexed account, uint256 timestamp ); event GammaClaimed( uint256 indexed tokenId, address indexed account, uint256 timestamp ); event AirDrop( address indexed account, uint256 indexed amount, uint256 timestamp ); constructor( address _grapesTokenAddress, address _alphaContractAddress, address _betaContractAddress, address _gammaContractAddress, uint256 _ALPHA_DISTRIBUTION_AMOUNT, uint256 _BETA_DISTRIBUTION_AMOUNT, uint256 _GAMMA_DISTRIBUTION_AMOUNT ) { require(_grapesTokenAddress != address(0), "The Grapes token address can't be 0"); require(_alphaContractAddress != address(0), "The Alpha contract address can't be 0"); require(_betaContractAddress != address(0), "The Beta contract address can't be 0"); require(_gammaContractAddress != address(0), "The Gamma contract address can't be 0"); grapesToken = IERC20(_grapesTokenAddress); alpha = ERC721Enumerable(_alphaContractAddress); beta = ERC721Enumerable(_betaContractAddress); gamma = ERC721Enumerable(_gammaContractAddress); ALPHA_DISTRIBUTION_AMOUNT = _ALPHA_DISTRIBUTION_AMOUNT; BETA_DISTRIBUTION_AMOUNT = _BETA_DISTRIBUTION_AMOUNT; GAMMA_DISTRIBUTION_AMOUNT = _GAMMA_DISTRIBUTION_AMOUNT; _pause(); } function startClaimablePeriod(uint256 _claimDuration) external onlyOwner whenPaused { require(_claimDuration > 0, "Claim duration should be greater than 0"); claimDuration = _claimDuration; claimStartTime = block.timestamp; _unpause(); emit ClaimStart(_claimDuration, claimStartTime); } function pauseClaimablePeriod() external onlyOwner { _pause(); } function claimTokens() external whenNotPaused { require(block.timestamp >= claimStartTime && block.timestamp < claimStartTime + claimDuration, "Claimable period is finished"); require((beta.balanceOf(msg.sender) > 0 || alpha.balanceOf(msg.sender) > 0), "Nothing to claim"); uint256 tokensToClaim; uint256 gammaToBeClaim; (tokensToClaim, gammaToBeClaim) = getClaimableTokenAmountAndGammaToClaim(msg.sender); for(uint256 i; i < alpha.balanceOf(msg.sender); ++i) { uint256 tokenId = alpha.tokenOfOwnerByIndex(msg.sender, i); if(!alphaClaimed[tokenId]) { alphaClaimed[tokenId] = true; emit AlphaClaimed(tokenId, msg.sender, block.timestamp); } } for(uint256 i; i < beta.balanceOf(msg.sender); ++i) { uint256 tokenId = beta.tokenOfOwnerByIndex(msg.sender, i); if(!betaClaimed[tokenId]) { betaClaimed[tokenId] = true; emit BetaClaimed(tokenId, msg.sender, block.timestamp); } } uint256 currentGammaClaimed; for(uint256 i; i < gamma.balanceOf(msg.sender); ++i) { uint256 tokenId = gamma.tokenOfOwnerByIndex(msg.sender, i); if(!gammaClaimed[tokenId] && currentGammaClaimed < gammaToBeClaim) { gammaClaimed[tokenId] = true; emit GammaClaimed(tokenId, msg.sender, block.timestamp); currentGammaClaimed++; } } grapesToken.safeTransfer(msg.sender, tokensToClaim); totalClaimed += tokensToClaim; emit AirDrop(msg.sender, tokensToClaim, block.timestamp); } function getClaimableTokenAmount(address _account) public view returns (uint256) { uint256 tokensAmount; (tokensAmount,) = getClaimableTokenAmountAndGammaToClaim(_account); return tokensAmount; } function getClaimableTokenAmountAndGammaToClaim(address _account) private view returns (uint256, uint256) { uint256 unclaimedAlphaBalance; for(uint256 i; i < alpha.balanceOf(_account); ++i) { uint256 tokenId = alpha.tokenOfOwnerByIndex(_account, i); if(!alphaClaimed[tokenId]) { ++unclaimedAlphaBalance; } } uint256 unclaimedBetaBalance; for(uint256 i; i < beta.balanceOf(_account); ++i) { uint256 tokenId = beta.tokenOfOwnerByIndex(_account, i); if(!betaClaimed[tokenId]) { ++unclaimedBetaBalance; } } uint256 unclaimedGamaBalance; for(uint256 i; i < gamma.balanceOf(_account); ++i) { uint256 tokenId = gamma.tokenOfOwnerByIndex(_account, i); if(!gammaClaimed[tokenId]) { ++unclaimedGamaBalance; } } uint256 gammaToBeClaim = min(unclaimedAlphaBalance + unclaimedBetaBalance, unclaimedGamaBalance); uint256 tokensAmount = (unclaimedAlphaBalance * ALPHA_DISTRIBUTION_AMOUNT) + (unclaimedBetaBalance * BETA_DISTRIBUTION_AMOUNT) + (gammaToBeClaim * GAMMA_DISTRIBUTION_AMOUNT); return (tokensAmount, gammaToBeClaim); } function min(uint256 a, uint256 b) private pure returns(uint256) { if (a <= b) { return a; } else { return b; } } function claimUnclaimedTokens() external onlyOwner { require(block.timestamp > claimStartTime + claimDuration, "Claimable period is not finished yet"); grapesToken.safeTransfer(owner(), grapesToken.balanceOf(address(this))); uint256 balance = address(this).balance; if (balance > 0) { Address.sendValue(payable(owner()), balance); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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/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/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_grapesTokenAddress","type":"address"},{"internalType":"address","name":"_alphaContractAddress","type":"address"},{"internalType":"address","name":"_betaContractAddress","type":"address"},{"internalType":"address","name":"_gammaContractAddress","type":"address"},{"internalType":"uint256","name":"_ALPHA_DISTRIBUTION_AMOUNT","type":"uint256"},{"internalType":"uint256","name":"_BETA_DISTRIBUTION_AMOUNT","type":"uint256"},{"internalType":"uint256","name":"_GAMMA_DISTRIBUTION_AMOUNT","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"AirDrop","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"AlphaClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"BetaClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_claimDuration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_claimStartTime","type":"uint256"}],"name":"ClaimStart","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"GammaClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ALPHA_DISTRIBUTION_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BETA_DISTRIBUTION_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"GAMMA_DISTRIBUTION_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"alpha","outputs":[{"internalType":"contract ERC721Enumerable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"alphaClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"beta","outputs":[{"internalType":"contract ERC721Enumerable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"betaClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimUnclaimedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"gamma","outputs":[{"internalType":"contract ERC721Enumerable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"gammaClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"getClaimableTokenAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"grapesToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseClaimablePeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_claimDuration","type":"uint256"}],"name":"startClaimablePeriod","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101606040523480156200001257600080fd5b5060405162001fc438038062001fc4833981016040819052620000359162000349565b62000040336200022d565b6000805460ff60a01b191690556001600160a01b038716620000b55760405162461bcd60e51b815260206004820152602360248201527f5468652047726170657320746f6b656e20616464726573732063616e2774206260448201526206520360ec1b60648201526084015b60405180910390fd5b6001600160a01b0386166200011b5760405162461bcd60e51b815260206004820152602560248201527f54686520416c70686120636f6e747261637420616464726573732063616e2774604482015264020626520360dc1b6064820152608401620000ac565b6001600160a01b0385166200017f5760405162461bcd60e51b8152602060048201526024808201527f546865204265746120636f6e747261637420616464726573732063616e2774206044820152630626520360e41b6064820152608401620000ac565b6001600160a01b038416620001e55760405162461bcd60e51b815260206004820152602560248201527f5468652047616d6d6120636f6e747261637420616464726573732063616e2774604482015264020626520360dc1b6064820152608401620000ac565b6001600160a01b0380881660805286811660a05285811660c052841660e052610100839052610120829052610140819052620002206200027d565b50505050505050620003c3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b62000291600054600160a01b900460ff1690565b15620002d35760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401620000ac565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586200030f3390565b6040516001600160a01b03909116815260200160405180910390a1565b80516001600160a01b03811681146200034457600080fd5b919050565b600080600080600080600060e0888a0312156200036557600080fd5b62000370886200032c565b965062000380602089016200032c565b955062000390604089016200032c565b9450620003a0606089016200032c565b93506080880151925060a0880151915060c0880151905092959891949750929550565b60805160a05160c05160e051610100516101205161014051611b1a620004aa6000396000818161032c01526114030152600081816101ff015261142d01526000818161028201526114570152600081816102e201528181610a6801528181610b01015281816112a601526113410152600081816102a9015281816105aa015281816108c0015281816109590152818161114401526111df01526000818161035c0152818161063c01528181610719015281816107b201528181610fe2015261107d01526000818161025b01528181610c1e01528181610dbe0152610e3b0152611b1a6000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c806398d0e0c6116100b8578063b13739291161007c578063b1373929146102dd578063b7c1f6fa14610304578063c89645f514610327578063d54ad2a11461034e578063db1d0fd514610357578063f2fde38b1461037e57600080fd5b806398d0e0c6146102565780639c1688ac1461027d5780639faa3c91146102a4578063a6a11bb1146102cb578063ab1a4d94146102d457600080fd5b80635c975abb1161010a5780635c975abb146101e05780636362bab5146101f25780636fc334fc146101fa578063715018a61461022157806388c5db27146102295780638da5cb5b1461023157600080fd5b806304b62fd3146101475780632f1f38ae1461015c5780633a6afc251461019457806348c54b9d146101b55780634f2a7abb146101bd575b600080fd5b61015a61015536600461194b565b610391565b005b61017f61016a36600461194b565b60056020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6101a76101a2366004611964565b6104c5565b60405190815260200161018b565b61015a6104d9565b61017f6101cb36600461194b565b60046020526000908152604090205460ff1681565b600054600160a01b900460ff1661017f565b61015a610c98565b6101a77f000000000000000000000000000000000000000000000000000000000000000081565b61015a610ccc565b61015a610d00565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161018b565b61023e7f000000000000000000000000000000000000000000000000000000000000000081565b6101a77f000000000000000000000000000000000000000000000000000000000000000081565b61023e7f000000000000000000000000000000000000000000000000000000000000000081565b6101a760035481565b6101a760025481565b61023e7f000000000000000000000000000000000000000000000000000000000000000081565b61017f61031236600461194b565b60066020526000908152604090205460ff1681565b6101a77f000000000000000000000000000000000000000000000000000000000000000081565b6101a760015481565b61023e7f000000000000000000000000000000000000000000000000000000000000000081565b61015a61038c366004611964565b610e87565b6000546001600160a01b031633146103c45760405162461bcd60e51b81526004016103bb9061198d565b60405180910390fd5b600054600160a01b900460ff166104145760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103bb565b600081116104745760405162461bcd60e51b815260206004820152602760248201527f436c61696d206475726174696f6e2073686f756c6420626520677265617465726044820152660207468616e20360cc1b60648201526084016103bb565b600281905542600355610485610f1f565b6003546040805183815260208101929092527f173cfce21d858913a305a9349759fce57ca02969c9500cc06f06a52eb325ac53910160405180910390a150565b6000806104d183610fbc565b509392505050565b600054600160a01b900460ff16156105265760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103bb565b6003544210158015610546575060025460035461054391906119d8565b42105b6105925760405162461bcd60e51b815260206004820152601c60248201527f436c61696d61626c6520706572696f642069732066696e69736865640000000060448201526064016103bb565b6040516370a0823160e01b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156105f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061d91906119f0565b11806106b157506040516370a0823160e01b81523360048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561068b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106af91906119f0565b115b6106f05760405162461bcd60e51b815260206004820152601060248201526f4e6f7468696e6720746f20636c61696d60801b60448201526064016103bb565b6000806106fc33610fbc565b909250905060005b6040516370a0823160e01b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610768573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078c91906119f0565b8110156108a757604051632f745c5960e01b8152336004820152602481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f745c5990604401602060405180830381865afa158015610801573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082591906119f0565b60008181526004602052604090205490915060ff166108965760008181526004602052604090819020805460ff1916600117905551339082907f592993b07849bd4ab51c2de371aea3db52156da6f3cd8476b1c585454b254f489061088d9042815260200190565b60405180910390a35b506108a081611a09565b9050610704565b5060005b6040516370a0823160e01b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa15801561090f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093391906119f0565b811015610a4e57604051632f745c5960e01b8152336004820152602481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f745c5990604401602060405180830381865afa1580156109a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cc91906119f0565b60008181526005602052604090205490915060ff16610a3d5760008181526005602052604090819020805460ff1916600117905551339082907f60a71155ef46ccb54dcf7272c207d5c8115509a8f30aa6c09b8fc4cbbe3fa48690610a349042815260200190565b60405180910390a35b50610a4781611a09565b90506108ab565b506000805b6040516370a0823160e01b81523360048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adb91906119f0565b811015610c1057604051632f745c5960e01b8152336004820152602481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632f745c5990604401602060405180830381865afa158015610b50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7491906119f0565b60008181526006602052604090205490915060ff16158015610b9557508383105b15610bff5760008181526006602052604090819020805460ff1916600117905551339082907fe76cdf9bb2f0219ea4bb21f5df9c962806cc82832dc5c7789f0f2ef7b57b176190610be99042815260200190565b60405180910390a382610bfb81611a09565b9350505b50610c0981611a09565b9050610a53565b50610c456001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338561149e565b8260016000828254610c5791906119d8565b9091555050604051428152839033907fc804beabd6deef69632486188d3b1a0fc6837d20bf348393884d368fa5bf10cd9060200160405180910390a3505050565b6000546001600160a01b03163314610cc25760405162461bcd60e51b81526004016103bb9061198d565b610cca6114f5565b565b6000546001600160a01b03163314610cf65760405162461bcd60e51b81526004016103bb9061198d565b610cca600061157d565b6000546001600160a01b03163314610d2a5760405162461bcd60e51b81526004016103bb9061198d565b600254600354610d3a91906119d8565b4211610d945760405162461bcd60e51b8152602060048201526024808201527f436c61696d61626c6520706572696f64206973206e6f742066696e6973686564604482015263081e595d60e21b60648201526084016103bb565b610e62610da96000546001600160a01b031690565b6040516370a0823160e01b81523060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015610e0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3191906119f0565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016919061149e565b478015610e8457610e84610e7e6000546001600160a01b031690565b826115cd565b50565b6000546001600160a01b03163314610eb15760405162461bcd60e51b81526004016103bb9061198d565b6001600160a01b038116610f165760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103bb565b610e848161157d565b600054600160a01b900460ff16610f6f5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103bb565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000806000805b6040516370a0823160e01b81526001600160a01b0386811660048301527f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611029573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104d91906119f0565b81101561112057604051632f745c5960e01b81526001600160a01b038681166004830152602482018390526000917f000000000000000000000000000000000000000000000000000000000000000090911690632f745c5990604401602060405180830381865afa1580156110c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ea91906119f0565b60008181526004602052604090205490915060ff1661110f5761110c83611a09565b92505b5061111981611a09565b9050610fc3565b506000805b6040516370a0823160e01b81526001600160a01b0387811660048301527f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa15801561118b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111af91906119f0565b81101561128257604051632f745c5960e01b81526001600160a01b038781166004830152602482018390526000917f000000000000000000000000000000000000000000000000000000000000000090911690632f745c5990604401602060405180830381865afa158015611228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124c91906119f0565b60008181526005602052604090205490915060ff166112715761126e83611a09565b92505b5061127b81611a09565b9050611125565b506000805b6040516370a0823160e01b81526001600160a01b0388811660048301527f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa1580156112ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131191906119f0565b8110156113e457604051632f745c5960e01b81526001600160a01b038881166004830152602482018390526000917f000000000000000000000000000000000000000000000000000000000000000090911690632f745c5990604401602060405180830381865afa15801561138a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ae91906119f0565b60008181526006602052604090205490915060ff166113d3576113d083611a09565b92505b506113dd81611a09565b9050611287565b5060006113fa6113f484866119d8565b836116e6565b905060006114287f000000000000000000000000000000000000000000000000000000000000000083611a24565b6114527f000000000000000000000000000000000000000000000000000000000000000086611a24565b61147c7f000000000000000000000000000000000000000000000000000000000000000088611a24565b61148691906119d8565b61149091906119d8565b989197509095505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526114f09084906116ff565b505050565b600054600160a01b900460ff16156115425760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103bb565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610f9f3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8047101561161d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016103bb565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461166a576040519150601f19603f3d011682016040523d82523d6000602084013e61166f565b606091505b50509050806114f05760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016103bb565b60008183116116f65750816116f9565b50805b92915050565b6000611754826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166117d19092919063ffffffff16565b8051909150156114f057808060200190518101906117729190611a43565b6114f05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103bb565b60606117e084846000856117ea565b90505b9392505050565b60608247101561184b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103bb565b843b6118995760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103bb565b600080866001600160a01b031685876040516118b59190611a95565b60006040518083038185875af1925050503d80600081146118f2576040519150601f19603f3d011682016040523d82523d6000602084013e6118f7565b606091505b5091509150611907828286611912565b979650505050505050565b606083156119215750816117e3565b8251156119315782518084602001fd5b8160405162461bcd60e51b81526004016103bb9190611ab1565b60006020828403121561195d57600080fd5b5035919050565b60006020828403121561197657600080fd5b81356001600160a01b03811681146117e357600080fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156119eb576119eb6119c2565b500190565b600060208284031215611a0257600080fd5b5051919050565b6000600019821415611a1d57611a1d6119c2565b5060010190565b6000816000190483118215151615611a3e57611a3e6119c2565b500290565b600060208284031215611a5557600080fd5b815180151581146117e357600080fd5b60005b83811015611a80578181015183820152602001611a68565b83811115611a8f576000848401525b50505050565b60008251611aa7818460208701611a65565b9190910192915050565b6020815260008251806020840152611ad0816040850160208701611a65565b601f01601f1916919091016040019291505056fea264697066735822122067e6a0ed09dffd151ee0ad8ab0063e55072c6095af26cdf620d9dfdf190e584264736f6c634300080a00330000000000000000000000004d224452801aced8b2f0aebe155379bb5d594381000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d00000000000000000000000060e4d786628fea6478f785a6d7e704777c86a7c6000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf956230000000000000000000000000000000000000000000002233263dfb228f8000000000000000000000000000000000000000000000000006eb271550533a8000000000000000000000000000000000000000000000000002e6762e8b7b6600000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101425760003560e01c806398d0e0c6116100b8578063b13739291161007c578063b1373929146102dd578063b7c1f6fa14610304578063c89645f514610327578063d54ad2a11461034e578063db1d0fd514610357578063f2fde38b1461037e57600080fd5b806398d0e0c6146102565780639c1688ac1461027d5780639faa3c91146102a4578063a6a11bb1146102cb578063ab1a4d94146102d457600080fd5b80635c975abb1161010a5780635c975abb146101e05780636362bab5146101f25780636fc334fc146101fa578063715018a61461022157806388c5db27146102295780638da5cb5b1461023157600080fd5b806304b62fd3146101475780632f1f38ae1461015c5780633a6afc251461019457806348c54b9d146101b55780634f2a7abb146101bd575b600080fd5b61015a61015536600461194b565b610391565b005b61017f61016a36600461194b565b60056020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6101a76101a2366004611964565b6104c5565b60405190815260200161018b565b61015a6104d9565b61017f6101cb36600461194b565b60046020526000908152604090205460ff1681565b600054600160a01b900460ff1661017f565b61015a610c98565b6101a77f00000000000000000000000000000000000000000000006eb271550533a8000081565b61015a610ccc565b61015a610d00565b6000546001600160a01b03165b6040516001600160a01b03909116815260200161018b565b61023e7f0000000000000000000000004d224452801aced8b2f0aebe155379bb5d59438181565b6101a77f0000000000000000000000000000000000000000000002233263dfb228f8000081565b61023e7f00000000000000000000000060e4d786628fea6478f785a6d7e704777c86a7c681565b6101a760035481565b6101a760025481565b61023e7f000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf9562381565b61017f61031236600461194b565b60066020526000908152604090205460ff1681565b6101a77f00000000000000000000000000000000000000000000002e6762e8b7b660000081565b6101a760015481565b61023e7f000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d81565b61015a61038c366004611964565b610e87565b6000546001600160a01b031633146103c45760405162461bcd60e51b81526004016103bb9061198d565b60405180910390fd5b600054600160a01b900460ff166104145760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103bb565b600081116104745760405162461bcd60e51b815260206004820152602760248201527f436c61696d206475726174696f6e2073686f756c6420626520677265617465726044820152660207468616e20360cc1b60648201526084016103bb565b600281905542600355610485610f1f565b6003546040805183815260208101929092527f173cfce21d858913a305a9349759fce57ca02969c9500cc06f06a52eb325ac53910160405180910390a150565b6000806104d183610fbc565b509392505050565b600054600160a01b900460ff16156105265760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103bb565b6003544210158015610546575060025460035461054391906119d8565b42105b6105925760405162461bcd60e51b815260206004820152601c60248201527f436c61696d61626c6520706572696f642069732066696e69736865640000000060448201526064016103bb565b6040516370a0823160e01b81523360048201526000907f00000000000000000000000060e4d786628fea6478f785a6d7e704777c86a7c66001600160a01b0316906370a0823190602401602060405180830381865afa1580156105f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061061d91906119f0565b11806106b157506040516370a0823160e01b81523360048201526000907f000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d6001600160a01b0316906370a0823190602401602060405180830381865afa15801561068b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106af91906119f0565b115b6106f05760405162461bcd60e51b815260206004820152601060248201526f4e6f7468696e6720746f20636c61696d60801b60448201526064016103bb565b6000806106fc33610fbc565b909250905060005b6040516370a0823160e01b81523360048201527f000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d6001600160a01b0316906370a0823190602401602060405180830381865afa158015610768573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078c91906119f0565b8110156108a757604051632f745c5960e01b8152336004820152602481018290526000907f000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d6001600160a01b031690632f745c5990604401602060405180830381865afa158015610801573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082591906119f0565b60008181526004602052604090205490915060ff166108965760008181526004602052604090819020805460ff1916600117905551339082907f592993b07849bd4ab51c2de371aea3db52156da6f3cd8476b1c585454b254f489061088d9042815260200190565b60405180910390a35b506108a081611a09565b9050610704565b5060005b6040516370a0823160e01b81523360048201527f00000000000000000000000060e4d786628fea6478f785a6d7e704777c86a7c66001600160a01b0316906370a0823190602401602060405180830381865afa15801561090f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093391906119f0565b811015610a4e57604051632f745c5960e01b8152336004820152602481018290526000907f00000000000000000000000060e4d786628fea6478f785a6d7e704777c86a7c66001600160a01b031690632f745c5990604401602060405180830381865afa1580156109a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cc91906119f0565b60008181526005602052604090205490915060ff16610a3d5760008181526005602052604090819020805460ff1916600117905551339082907f60a71155ef46ccb54dcf7272c207d5c8115509a8f30aa6c09b8fc4cbbe3fa48690610a349042815260200190565b60405180910390a35b50610a4781611a09565b90506108ab565b506000805b6040516370a0823160e01b81523360048201527f000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf956236001600160a01b0316906370a0823190602401602060405180830381865afa158015610ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adb91906119f0565b811015610c1057604051632f745c5960e01b8152336004820152602481018290526000907f000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf956236001600160a01b031690632f745c5990604401602060405180830381865afa158015610b50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7491906119f0565b60008181526006602052604090205490915060ff16158015610b9557508383105b15610bff5760008181526006602052604090819020805460ff1916600117905551339082907fe76cdf9bb2f0219ea4bb21f5df9c962806cc82832dc5c7789f0f2ef7b57b176190610be99042815260200190565b60405180910390a382610bfb81611a09565b9350505b50610c0981611a09565b9050610a53565b50610c456001600160a01b037f0000000000000000000000004d224452801aced8b2f0aebe155379bb5d59438116338561149e565b8260016000828254610c5791906119d8565b9091555050604051428152839033907fc804beabd6deef69632486188d3b1a0fc6837d20bf348393884d368fa5bf10cd9060200160405180910390a3505050565b6000546001600160a01b03163314610cc25760405162461bcd60e51b81526004016103bb9061198d565b610cca6114f5565b565b6000546001600160a01b03163314610cf65760405162461bcd60e51b81526004016103bb9061198d565b610cca600061157d565b6000546001600160a01b03163314610d2a5760405162461bcd60e51b81526004016103bb9061198d565b600254600354610d3a91906119d8565b4211610d945760405162461bcd60e51b8152602060048201526024808201527f436c61696d61626c6520706572696f64206973206e6f742066696e6973686564604482015263081e595d60e21b60648201526084016103bb565b610e62610da96000546001600160a01b031690565b6040516370a0823160e01b81523060048201527f0000000000000000000000004d224452801aced8b2f0aebe155379bb5d5943816001600160a01b0316906370a0823190602401602060405180830381865afa158015610e0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3191906119f0565b6001600160a01b037f0000000000000000000000004d224452801aced8b2f0aebe155379bb5d59438116919061149e565b478015610e8457610e84610e7e6000546001600160a01b031690565b826115cd565b50565b6000546001600160a01b03163314610eb15760405162461bcd60e51b81526004016103bb9061198d565b6001600160a01b038116610f165760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103bb565b610e848161157d565b600054600160a01b900460ff16610f6f5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016103bb565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000806000805b6040516370a0823160e01b81526001600160a01b0386811660048301527f000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d16906370a0823190602401602060405180830381865afa158015611029573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061104d91906119f0565b81101561112057604051632f745c5960e01b81526001600160a01b038681166004830152602482018390526000917f000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d90911690632f745c5990604401602060405180830381865afa1580156110c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ea91906119f0565b60008181526004602052604090205490915060ff1661110f5761110c83611a09565b92505b5061111981611a09565b9050610fc3565b506000805b6040516370a0823160e01b81526001600160a01b0387811660048301527f00000000000000000000000060e4d786628fea6478f785a6d7e704777c86a7c616906370a0823190602401602060405180830381865afa15801561118b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111af91906119f0565b81101561128257604051632f745c5960e01b81526001600160a01b038781166004830152602482018390526000917f00000000000000000000000060e4d786628fea6478f785a6d7e704777c86a7c690911690632f745c5990604401602060405180830381865afa158015611228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124c91906119f0565b60008181526005602052604090205490915060ff166112715761126e83611a09565b92505b5061127b81611a09565b9050611125565b506000805b6040516370a0823160e01b81526001600160a01b0388811660048301527f000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf9562316906370a0823190602401602060405180830381865afa1580156112ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131191906119f0565b8110156113e457604051632f745c5960e01b81526001600160a01b038881166004830152602482018390526000917f000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf9562390911690632f745c5990604401602060405180830381865afa15801561138a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ae91906119f0565b60008181526006602052604090205490915060ff166113d3576113d083611a09565b92505b506113dd81611a09565b9050611287565b5060006113fa6113f484866119d8565b836116e6565b905060006114287f00000000000000000000000000000000000000000000002e6762e8b7b660000083611a24565b6114527f00000000000000000000000000000000000000000000006eb271550533a8000086611a24565b61147c7f0000000000000000000000000000000000000000000002233263dfb228f8000088611a24565b61148691906119d8565b61149091906119d8565b989197509095505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526114f09084906116ff565b505050565b600054600160a01b900460ff16156115425760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016103bb565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610f9f3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8047101561161d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016103bb565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461166a576040519150601f19603f3d011682016040523d82523d6000602084013e61166f565b606091505b50509050806114f05760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016103bb565b60008183116116f65750816116f9565b50805b92915050565b6000611754826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166117d19092919063ffffffff16565b8051909150156114f057808060200190518101906117729190611a43565b6114f05760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103bb565b60606117e084846000856117ea565b90505b9392505050565b60608247101561184b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103bb565b843b6118995760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103bb565b600080866001600160a01b031685876040516118b59190611a95565b60006040518083038185875af1925050503d80600081146118f2576040519150601f19603f3d011682016040523d82523d6000602084013e6118f7565b606091505b5091509150611907828286611912565b979650505050505050565b606083156119215750816117e3565b8251156119315782518084602001fd5b8160405162461bcd60e51b81526004016103bb9190611ab1565b60006020828403121561195d57600080fd5b5035919050565b60006020828403121561197657600080fd5b81356001600160a01b03811681146117e357600080fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082198211156119eb576119eb6119c2565b500190565b600060208284031215611a0257600080fd5b5051919050565b6000600019821415611a1d57611a1d6119c2565b5060010190565b6000816000190483118215151615611a3e57611a3e6119c2565b500290565b600060208284031215611a5557600080fd5b815180151581146117e357600080fd5b60005b83811015611a80578181015183820152602001611a68565b83811115611a8f576000848401525b50505050565b60008251611aa7818460208701611a65565b9190910192915050565b6020815260008251806020840152611ad0816040850160208701611a65565b601f01601f1916919091016040019291505056fea264697066735822122067e6a0ed09dffd151ee0ad8ab0063e55072c6095af26cdf620d9dfdf190e584264736f6c634300080a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004d224452801aced8b2f0aebe155379bb5d594381000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d00000000000000000000000060e4d786628fea6478f785a6d7e704777c86a7c6000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf956230000000000000000000000000000000000000000000002233263dfb228f8000000000000000000000000000000000000000000000000006eb271550533a8000000000000000000000000000000000000000000000000002e6762e8b7b6600000
-----Decoded View---------------
Arg [0] : _grapesTokenAddress (address): 0x4d224452801ACEd8B2F0aebE155379bb5D594381
Arg [1] : _alphaContractAddress (address): 0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D
Arg [2] : _betaContractAddress (address): 0x60E4d786628Fea6478F785A6d7e704777c86a7c6
Arg [3] : _gammaContractAddress (address): 0xba30E5F9Bb24caa003E9f2f0497Ad287FDF95623
Arg [4] : _ALPHA_DISTRIBUTION_AMOUNT (uint256): 10094000000000000000000
Arg [5] : _BETA_DISTRIBUTION_AMOUNT (uint256): 2042000000000000000000
Arg [6] : _GAMMA_DISTRIBUTION_AMOUNT (uint256): 856000000000000000000
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000004d224452801aced8b2f0aebe155379bb5d594381
Arg [1] : 000000000000000000000000bc4ca0eda7647a8ab7c2061c2e118a18a936f13d
Arg [2] : 00000000000000000000000060e4d786628fea6478f785a6d7e704777c86a7c6
Arg [3] : 000000000000000000000000ba30e5f9bb24caa003e9f2f0497ad287fdf95623
Arg [4] : 0000000000000000000000000000000000000000000002233263dfb228f80000
Arg [5] : 00000000000000000000000000000000000000000000006eb271550533a80000
Arg [6] : 00000000000000000000000000000000000000000000002e6762e8b7b6600000
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.