ERC-721
Overview
Max Total Supply
381 SPIES
Holders
206
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
4 SPIESLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
SpyNFT
Compiler Version
v0.8.14+commit.80d49f37
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; import {IERC721, ERC721, ERC721Enumerable} from "@openzeppelin/token/ERC721/extensions/ERC721Enumerable.sol"; import {Ownable} from "@openzeppelin/access/Ownable.sol"; import {toWadUnsafe, toDaysWadUnsafe} from "solmate/utils/SignedWadMath.sol"; import {LibGOO} from "goo-issuance/LibGOO.sol"; /// @dev An enum for representing whether to /// increase or decrease a user's goo balance. enum GooBalanceUpdateType { INCREASE, DECREASE } /// @notice Struct holding data relevant to each user's account. struct UserData { // User's goo balance at time of last checkpointing. uint128 lastBalance; // Timestamp of the last goo balance checkpoint. uint64 lastTimestamp; } contract OwnedEnumerableNFT is ERC721Enumerable, Ownable { constructor(string memory name, string memory symbol) ERC721(name, symbol) Ownable() {} function mint(address recipient) public virtual onlyOwner returns (uint256 id) { id = totalSupply(); _safeMint(recipient, id); } function burn(uint256 id) public onlyOwner { _burn(id); } } // SPY NFT will produce Goo contract SpyNFT is OwnedEnumerableNFT { /*////////////////////////////////////////////////////////////// Variables //////////////////////////////////////////////////////////////*/ /// Random emission multiple to massage the curve into place uint256 public constant EMISSION_MULTIPLE = 69; /// Keeps track of virtual GOO Balance mapping(address => UserData) public getUserData; /*////////////////////////////////////////////////////////////// Events //////////////////////////////////////////////////////////////*/ event GooBalanceUpdated(address indexed user, uint256 newGooBalance); /*////////////////////////////////////////////////////////////// Errors //////////////////////////////////////////////////////////////*/ error TooEarly(); /*////////////////////////////////////////////////////////////// Constructor //////////////////////////////////////////////////////////////*/ constructor() OwnedEnumerableNFT("Spy", "SPIES") {} /*////////////////////////////////////////////////////////////// Goo Functionality (Read only) //////////////////////////////////////////////////////////////*/ /// @notice Calculate a user's virtual goo balance. /// @param user The user to query balance for. function gooBalance(address user) public view returns (uint256) { // Compute the user's virtual goo balance using LibGOO. // prettier-ignore return LibGOO.computeGOOBalance( EMISSION_MULTIPLE * balanceOf(user), getUserData[user].lastBalance, uint256(toDaysWadUnsafe(block.timestamp - getUserData[user].lastTimestamp)) ); } /*////////////////////////////////////////////////////////////// Goo Functionality (Permissioned) //////////////////////////////////////////////////////////////*/ /// @notice Update a user's virtual goo balance. /// @param user The user whose virtual goo balance we should update. /// @param gooAmount The amount of goo to update the user's virtual balance by. /// @param updateType Whether to increase or decrease the user's balance by gooAmount. function updateUserGooBalance(address user, uint256 gooAmount, GooBalanceUpdateType updateType) public onlyOwner { // Will revert due to underflow if we're decreasing by more than the user's current balance. // Don't need to do checked addition in the increase case, but we do it anyway for convenience. uint256 updatedBalance = updateType == GooBalanceUpdateType.INCREASE ? gooBalance(user) + gooAmount : gooBalance(user) - gooAmount; // Snapshot the user's new goo balance with the current timestamp. getUserData[user].lastBalance = uint128(updatedBalance); getUserData[user].lastTimestamp = uint64(block.timestamp); emit GooBalanceUpdated(user, updatedBalance); } /// @notice Superuser transferFrom function sudoTransferFrom(address from, address to, uint256 tokenId) public onlyOwner { unchecked { // We update their last balance before updating their emission multiple to avoid // penalizing them by retroactively applying their new (lower) balanceOf getUserData[from].lastBalance = uint128(gooBalance(from)); getUserData[from].lastTimestamp = uint64(block.timestamp); // We update their last balance before updating their emission multiple to avoid // overpaying them by retroactively applying their new (higher) balanceOf getUserData[to].lastBalance = uint128(gooBalance(to)); getUserData[to].lastTimestamp = uint64(block.timestamp); } // State changes happen *after* gooBalance is update _transfer(from, to, tokenId); } /*////////////////////////////////////////////////////////////// ERC721 Functionality //////////////////////////////////////////////////////////////*/ function mint(address recipient, uint256 timestamp) public onlyOwner returns (uint256 id) { // Prevent bugs if (timestamp < block.timestamp) { revert TooEarly(); } // If we can't get the gooBalance, then minting hasn't start yet // If we can get the gooBal then we good try this.gooBalance(recipient) returns (uint256 existingGooBal) { getUserData[recipient].lastBalance = uint128(existingGooBal); } catch {} getUserData[recipient].lastTimestamp = uint64(timestamp); id = totalSupply(); _safeMint(recipient, id); } function transferFrom(address from, address to, uint256 tokenId) public override (ERC721, IERC721) { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); unchecked { // We update their last balance before updating their emission multiple to avoid // penalizing them by retroactively applying their new (lower) balanceOf getUserData[from].lastBalance = uint128(gooBalance(from)); getUserData[from].lastTimestamp = uint64(block.timestamp); // We update their last balance before updating their emission multiple to avoid // overpaying them by retroactively applying their new (higher) balanceOf getUserData[to].lastBalance = uint128(gooBalance(to)); getUserData[to].lastTimestamp = uint64(block.timestamp); } // State changes happen *after* gooBalance is update _transfer(from, to, tokenId); } function tokenURI(uint256 tokenId) public pure override returns (string memory) { string[4] memory parts; parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="black" /><text x="10" y="20" class="base">'; parts[1] = "SPY #"; parts[2] = SVGUtils.toString(tokenId); parts[3] = "</text></svg>"; string memory output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3])); string memory json = Base64.encode( bytes( string( abi.encodePacked( '{"name": "Spy #', SVGUtils.toString(tokenId), '", "description": "A Spy in the Knife Game Universe.", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}' ) ) ) ); output = string(abi.encodePacked("data:application/json;base64,", json)); return output; } } contract KnifeNFT is OwnedEnumerableNFT { constructor() OwnedEnumerableNFT("Knife", "KNIVES") {} function sudoTransferFrom(address from, address to, uint256 tokenId) public onlyOwner { _transfer(from, to, tokenId); } function tokenURI(uint256 tokenId) public pure override returns (string memory) { string[4] memory parts; parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMinYMin meet" viewBox="0 0 350 350"><style>.base { fill: white; font-family: serif; font-size: 14px; }</style><rect width="100%" height="100%" fill="black" /><text x="10" y="20" class="base">'; parts[1] = "Knife #"; parts[2] = SVGUtils.toString(tokenId); parts[3] = "</text></svg>"; string memory output = string(abi.encodePacked(parts[0], parts[1], parts[2], parts[3])); string memory json = Base64.encode( bytes( string( abi.encodePacked( '{"name": "Knife #', SVGUtils.toString(tokenId), '", "description": "A Knife the Knife Game Universe.", "image": "data:image/svg+xml;base64,', Base64.encode(bytes(output)), '"}' ) ) ) ); output = string(abi.encodePacked("data:application/json;base64,", json)); return output; } } /// [MIT License] /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <[email protected]> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((len + 2) / 3); // Add some extra buffer at the end bytes memory result = new bytes(encodedLen + 32); bytes memory table = TABLE; assembly { let tablePtr := add(table, 1) let resultPtr := add(result, 32) for { let i := 0 } lt(i, len) {} { i := add(i, 3) let input := and(mload(add(data, i)), 0xffffff) let out := mload(add(tablePtr, and(shr(18, input), 0x3F))) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)) out := shl(8, out) out := add(out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)) out := shl(224, out) mstore(resultPtr, out) resultPtr := add(resultPtr, 4) } switch mod(len, 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } mstore(result, encodedLen) } return string(result); } } library SVGUtils { function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT license // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol"; /// @title GOO (Gradual Ownership Optimization) Issuance /// @author transmissions11 <[email protected]> /// @author FrankieIsLost <[email protected]> /// @notice Implementation of the GOO Issuance mechanism. library LibGOO { using FixedPointMathLib for uint256; /// @notice Compute goo balance based on emission multiple, last balance, and time elapsed. /// @param emissionMultiple The multiple on emissions to consider when computing the balance. /// @param lastBalanceWad The last checkpointed balance to apply the emission multiple over time to, scaled by 1e18. /// @param timeElapsedWad The time elapsed since the last checkpoint, scaled by 1e18. function computeGOOBalance( uint256 emissionMultiple, uint256 lastBalanceWad, uint256 timeElapsedWad ) internal pure returns (uint256) { unchecked { // We use wad math here because timeElapsedWad is, as the name indicates, a wad. uint256 timeElapsedSquaredWad = timeElapsedWad.mulWadDown(timeElapsedWad); // prettier-ignore return lastBalanceWad + // The last recorded balance. // Don't need to do wad multiplication since we're // multiplying by a plain integer with no decimals. // Shift right by 2 is equivalent to division by 4. ((emissionMultiple * timeElapsedSquaredWad) >> 2) + timeElapsedWad.mulWadDown( // Terms are wads, so must mulWad. // No wad multiplication for emissionMultiple * lastBalance // because emissionMultiple is a plain integer with no decimals. // We multiply the sqrt's radicand by 1e18 because it expects ints. (emissionMultiple * lastBalanceWad * 1e18).sqrt() ); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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 Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { 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.7.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: address zero is not a valid owner"); 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: invalid token ID"); 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) { _requireMinted(tokenId); 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 overridden 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 token owner or approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); 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: caller is not token owner or 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: caller is not token owner or 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) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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); // Check that tokenId was not minted by `_beforeTokenTransfer` hook require(!_exists(tokenId), "ERC721: token already minted"); unchecked { // Will not overflow unless all 2**256 token ids are minted to the same owner. // Given that tokens are minted one by one, it is impossible in practice that // this ever happens. Might change if we allow batch minting. // The ERC fails to describe this case. _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. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721.ownerOf(tokenId); // Clear approvals delete _tokenApprovals[tokenId]; unchecked { // Cannot overflow, as that would require more tokens to be burned/transferred // out than the owner initially received through minting and transferring in. _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); // Check that tokenId was not transferred by `_beforeTokenTransfer` hook require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; unchecked { // `_balances[from]` cannot overflow for the same reason as described in `_burn`: // `from`'s balance is the number of token held, which is at least one before the current // transfer. // `_balances[to]` could overflow in the conditions described in `_mint`. That would require // all 2**256 token ids to be minted, which in practice is impossible. _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 an {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 an {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 Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @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 { /// @solidity memory-safe-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` 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 (last updated v4.7.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`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.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 `IERC721Receiver.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/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` and 'to' cannot be the zero address at the same time. * * 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 (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 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.7.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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 /// @solidity memory-safe-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 (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = 1; // compute log10(value), and add it to length uint256 valueCopy = value; if (valueCopy >= 10**64) { valueCopy /= 10**64; length += 64; } if (valueCopy >= 10**32) { valueCopy /= 10**32; length += 32; } if (valueCopy >= 10**16) { valueCopy /= 10**16; length += 16; } if (valueCopy >= 10**8) { valueCopy /= 10**8; length += 8; } if (valueCopy >= 10**4) { valueCopy /= 10**4; length += 4; } if (valueCopy >= 10**2) { valueCopy /= 10**2; length += 2; } if (valueCopy >= 10**1) { length += 1; } // now, length is log10(value) + 1 string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = 1; // compute log256(value), and add it to length uint256 valueCopy = value; if (valueCopy >= 1 << 128) { valueCopy >>= 128; length += 16; } if (valueCopy >= 1 << 64) { valueCopy >>= 64; length += 8; } if (valueCopy >= 1 << 32) { valueCopy >>= 32; length += 4; } if (valueCopy >= 1 << 16) { valueCopy >>= 16; length += 2; } if (valueCopy >= 1 << 8) { valueCopy >>= 8; length += 1; } // now, length is log256(value) + 1 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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// 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: AGPL-3.0-only pragma solidity >=0.8.0; /// @notice Arithmetic library with operations for fixed-point numbers. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol) /// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol) library FixedPointMathLib { /*////////////////////////////////////////////////////////////// SIMPLIFIED FIXED POINT OPERATIONS //////////////////////////////////////////////////////////////*/ uint256 internal constant MAX_UINT256 = 2**256 - 1; uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s. function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) { return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down. } function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) { return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up. } function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) { return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down. } function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) { return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up. } /*////////////////////////////////////////////////////////////// LOW LEVEL FIXED POINT OPERATIONS //////////////////////////////////////////////////////////////*/ function mulDivDown( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y)) if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) { revert(0, 0) } // Divide x * y by the denominator. z := div(mul(x, y), denominator) } } function mulDivUp( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y)) if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) { revert(0, 0) } // If x * y modulo the denominator is strictly greater than 0, // 1 is added to round up the division of x * y by the denominator. z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator)) } } function rpow( uint256 x, uint256 n, uint256 scalar ) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { switch x case 0 { switch n case 0 { // 0 ** 0 = 1 z := scalar } default { // 0 ** n = 0 z := 0 } } default { switch mod(n, 2) case 0 { // If n is even, store scalar in z for now. z := scalar } default { // If n is odd, store x in z for now. z := x } // Shifting right by 1 is like dividing by 2. let half := shr(1, scalar) for { // Shift n right by 1 before looping to halve it. n := shr(1, n) } n { // Shift n right by 1 each iteration to halve it. n := shr(1, n) } { // Revert immediately if x ** 2 would overflow. // Equivalent to iszero(eq(div(xx, x), x)) here. if shr(128, x) { revert(0, 0) } // Store x squared. let xx := mul(x, x) // Round to the nearest number. let xxRound := add(xx, half) // Revert if xx + half overflowed. if lt(xxRound, xx) { revert(0, 0) } // Set x to scaled xxRound. x := div(xxRound, scalar) // If n is even: if mod(n, 2) { // Compute z * x. let zx := mul(z, x) // If z * x overflowed: if iszero(eq(div(zx, x), z)) { // Revert if x is non-zero. if iszero(iszero(x)) { revert(0, 0) } } // Round to the nearest number. let zxRound := add(zx, half) // Revert if zx + half overflowed. if lt(zxRound, zx) { revert(0, 0) } // Return properly scaled zxRound. z := div(zxRound, scalar) } } } } } /*////////////////////////////////////////////////////////////// GENERAL NUMBER UTILITIES //////////////////////////////////////////////////////////////*/ function sqrt(uint256 x) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { let y := x // We start y at x, which will help us make our initial estimate. z := 181 // The "correct" value is 1, but this saves a multiplication later. // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically. // We check y >= 2^(k + 8) but shift right by k bits // each branch to ensure that if x >= 256, then y >= 256. if iszero(lt(y, 0x10000000000000000000000000000000000)) { y := shr(128, y) z := shl(64, z) } if iszero(lt(y, 0x1000000000000000000)) { y := shr(64, y) z := shl(32, z) } if iszero(lt(y, 0x10000000000)) { y := shr(32, y) z := shl(16, z) } if iszero(lt(y, 0x1000000)) { y := shr(16, y) z := shl(8, z) } // Goal was to get z*z*y within a small factor of x. More iterations could // get y in a tighter range. Currently, we will have y in [256, 256*2^16). // We ensured y >= 256 so that the relative difference between y and y+1 is small. // That's not possible if x < 256 but we can just verify those cases exhaustively. // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256. // Correctness can be checked exhaustively for x < 256, so we assume y >= 256. // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps. // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256. // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18. // There is no overflow risk here since y < 2^136 after the first branch above. z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181. // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough. z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) // If x+1 is a perfect square, the Babylonian method cycles between // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor. // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case. // If you don't care whether the floor or ceil square root is returned, you can remove this statement. z := sub(z, lt(div(x, z), z)) } } function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Mod x by y. Note this will return // 0 instead of reverting if y is zero. z := mod(x, y) } } function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { // Divide x by y. Note this will return // 0 instead of reverting if y is zero. r := div(x, y) } } function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Add 1 to x * y if x % y > 0. Note this will // return 0 instead of reverting if y is zero. z := add(gt(mod(x, y), 0), div(x, y)) } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @notice Signed 18 decimal fixed point (wad) arithmetic library. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SignedWadMath.sol) /// @author Modified from Remco Bloemen (https://xn--2-umb.com/22/exp-ln/index.html) /// @dev Will not revert on overflow, only use where overflow is not possible. function toWadUnsafe(uint256 x) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 1e18. r := mul(x, 1000000000000000000) } } /// @dev Takes an integer amount of seconds and converts it to a wad amount of days. /// @dev Will not revert on overflow, only use where overflow is not possible. /// @dev Not meant for negative second amounts, it assumes x is positive. function toDaysWadUnsafe(uint256 x) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 1e18 and then divide it by 86400. r := div(mul(x, 1000000000000000000), 86400) } } /// @dev Takes a wad amount of days and converts it to an integer amount of seconds. /// @dev Will not revert on overflow, only use where overflow is not possible. /// @dev Not meant for negative day amounts, it assumes x is positive. function fromDaysWadUnsafe(int256 x) pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 86400 and then divide it by 1e18. r := div(mul(x, 86400), 1000000000000000000) } } /// @dev Will not revert on overflow, only use where overflow is not possible. function unsafeWadMul(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by y and divide by 1e18. r := sdiv(mul(x, y), 1000000000000000000) } } /// @dev Will return 0 instead of reverting if y is zero and will /// not revert on overflow, only use where overflow is not possible. function unsafeWadDiv(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 1e18 and divide it by y. r := sdiv(mul(x, 1000000000000000000), y) } } function wadMul(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Store x * y in r for now. r := mul(x, y) // Equivalent to require(x == 0 || (x * y) / x == y) if iszero(or(iszero(x), eq(sdiv(r, x), y))) { revert(0, 0) } // Scale the result down by 1e18. r := sdiv(r, 1000000000000000000) } } function wadDiv(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Store x * 1e18 in r for now. r := mul(x, 1000000000000000000) // Equivalent to require(y != 0 && ((x * 1e18) / 1e18 == x)) if iszero(and(iszero(iszero(y)), eq(sdiv(r, 1000000000000000000), x))) { revert(0, 0) } // Divide r by y. r := sdiv(r, y) } } function wadExp(int256 x) pure returns (int256 r) { unchecked { // When the result is < 0.5 we return zero. This happens when // x <= floor(log(0.5e18) * 1e18) ~ -42e18 if (x <= -42139678854452767551) return 0; // When the result is > (2**255 - 1) / 1e18 we can not represent it as an // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135. if (x >= 135305999368893231589) revert("EXP_OVERFLOW"); // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96 // for more intermediate precision and a binary basis. This base conversion // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78. x = (x << 78) / 5**18; // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers // of two such that exp(x) = exp(x') * 2**k, where k is an integer. // Solving this gives k = round(x / log(2)) and x' = x - k * log(2). int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96; x = x - k * 54916777467707473351141471128; // k is in the range [-61, 195]. // Evaluate using a (6, 7)-term rational approximation. // p is made monic, we'll multiply by a scale factor later. int256 y = x + 1346386616545796478920950773328; y = ((y * x) >> 96) + 57155421227552351082224309758442; int256 p = y + x - 94201549194550492254356042504812; p = ((p * y) >> 96) + 28719021644029726153956944680412240; p = p * x + (4385272521454847904659076985693276 << 96); // We leave p in 2**192 basis so we don't need to scale it back up for the division. int256 q = x - 2855989394907223263936484059900; q = ((q * x) >> 96) + 50020603652535783019961831881945; q = ((q * x) >> 96) - 533845033583426703283633433725380; q = ((q * x) >> 96) + 3604857256930695427073651918091429; q = ((q * x) >> 96) - 14423608567350463180887372962807573; q = ((q * x) >> 96) + 26449188498355588339934803723976023; /// @solidity memory-safe-assembly assembly { // Div in assembly because solidity adds a zero check despite the unchecked. // The q polynomial won't have zeros in the domain as all its roots are complex. // No scaling is necessary because p is already 2**96 too large. r := sdiv(p, q) } // r should be in the range (0.09, 0.25) * 2**96. // We now need to multiply r by: // * the scale factor s = ~6.031367120. // * the 2**k factor from the range reduction. // * the 1e18 / 2**96 factor for base conversion. // We do this all at once, with an intermediate result in 2**213 // basis, so the final right shift is always by a positive amount. r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k)); } } function wadLn(int256 x) pure returns (int256 r) { unchecked { require(x > 0, "UNDEFINED"); // We want to convert x from 10**18 fixed point to 2**96 fixed point. // We do this by multiplying by 2**96 / 10**18. But since // ln(x * C) = ln(x) + ln(C), we can simply do nothing here // and add ln(2**96 / 10**18) at the end. /// @solidity memory-safe-assembly assembly { r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) r := or(r, shl(2, lt(0xf, shr(r, x)))) r := or(r, shl(1, lt(0x3, shr(r, x)))) r := or(r, lt(0x1, shr(r, x))) } // Reduce range of x to (1, 2) * 2**96 // ln(2^k * x) = k * ln(2) + ln(x) int256 k = r - 96; x <<= uint256(159 - k); x = int256(uint256(x) >> 159); // Evaluate using a (8, 8)-term rational approximation. // p is made monic, we will multiply by a scale factor later. int256 p = x + 3273285459638523848632254066296; p = ((p * x) >> 96) + 24828157081833163892658089445524; p = ((p * x) >> 96) + 43456485725739037958740375743393; p = ((p * x) >> 96) - 11111509109440967052023855526967; p = ((p * x) >> 96) - 45023709667254063763336534515857; p = ((p * x) >> 96) - 14706773417378608786704636184526; p = p * x - (795164235651350426258249787498 << 96); // We leave p in 2**192 basis so we don't need to scale it back up for the division. // q is monic by convention. int256 q = x + 5573035233440673466300451813936; q = ((q * x) >> 96) + 71694874799317883764090561454958; q = ((q * x) >> 96) + 283447036172924575727196451306956; q = ((q * x) >> 96) + 401686690394027663651624208769553; q = ((q * x) >> 96) + 204048457590392012362485061816622; q = ((q * x) >> 96) + 31853899698501571402653359427138; q = ((q * x) >> 96) + 909429971244387300277376558375; /// @solidity memory-safe-assembly assembly { // Div in assembly because solidity adds a zero check despite the unchecked. // The q polynomial is known not to have zeros in the domain. // No scaling required because p is already 2**96 too large. r := sdiv(p, q) } // r is in the range (0, 0.125) * 2**96 // Finalization, we need to: // * multiply by the scale factor s = 5.549… // * add ln(2**96 / 10**18) // * add k * ln(2) // * multiply by 10**18 / 2**96 = 5**18 >> 78 // mul s * 5e18 * 2**96, base is now 5**18 * 2**192 r *= 1677202110996718588342820967067443963516166; // add ln(2) * k * 5e18 * 2**192 r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k; // add ln(2**96 / 10**18) * 5e18 * 2**192 r += 600920179829731861736702779321621459595472258049074101567377883020018308; // base conversion: mul 2**18 / 2**192 r >>= 174; } } /// @dev Will return 0 instead of reverting if y is zero. function unsafeDiv(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Divide x by y. r := sdiv(x, y) } }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/contracts/", "VRGDAs/=lib/VRGDAs/src/", "chainlink/=lib/chainlink/contracts/src/", "ds-test/=lib/VRGDAs/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "goo-issuance/=lib/goo-issuance/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"TooEarly","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"newGooBalance","type":"uint256"}],"name":"GooBalanceUpdated","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":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"EMISSION_MULTIPLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getUserData","outputs":[{"internalType":"uint128","name":"lastBalance","type":"uint128"},{"internalType":"uint64","name":"lastTimestamp","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"gooBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"mint","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"sudoTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"gooAmount","type":"uint256"},{"internalType":"enum GooBalanceUpdateType","name":"updateType","type":"uint8"}],"name":"updateUserGooBalance","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604080518082018252600381526253707960e81b602080830191825283518085019094526005845264535049455360d81b908401528151919291839183916200005e91600091620000ef565b50805162000074906001906020840190620000ef565b505050620000916200008b6200009960201b60201c565b6200009d565b5050620001d1565b3390565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620000fd9062000195565b90600052602060002090601f0160209004810192826200012157600085556200016c565b82601f106200013c57805160ff19168380011785556200016c565b828001600101855582156200016c579182015b828111156200016c5782518255916020019190600101906200014f565b506200017a9291506200017e565b5090565b5b808211156200017a57600081556001016200017f565b600181811c90821680620001aa57607f821691505b602082108103620001cb57634e487b7160e01b600052602260045260246000fd5b50919050565b6124ad80620001e16000396000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c80636a627842116100f9578063c87b56dd11610097578063e985e9c511610071578063e985e9c514610370578063f2fde38b146103ac578063f66e9ac3146103bf578063ffc9896b146103d257600080fd5b8063c87b56dd14610342578063cb1a29b514610355578063d075fbba1461035d57600080fd5b80638da5cb5b116100d35780638da5cb5b1461030357806395d89b4114610314578063a22cb4651461031c578063b88d4fde1461032f57600080fd5b80636a627842146102d557806370a08231146102e8578063715018a6146102fb57600080fd5b806323b872dd1161016657806342842e0e1161014057806342842e0e1461028957806342966c681461029c5780634f6ccce7146102af5780636352211e146102c257600080fd5b806323b872dd146102505780632f745c591461026357806340c10f191461027657600080fd5b806301ffc9a7146101ae57806306fdde03146101d6578063081812fc146101eb578063095ea7b31461021657806318160ddd1461022b57806320dd4c021461023d575b600080fd5b6101c16101bc366004611cb0565b610436565b60405190151581526020015b60405180910390f35b6101de610461565b6040516101cd9190611d25565b6101fe6101f9366004611d38565b6104f3565b6040516001600160a01b0390911681526020016101cd565b610229610224366004611d68565b61051a565b005b6008545b6040519081526020016101cd565b61022961024b366004611d92565b610634565b61022961025e366004611d92565b6106ed565b61022f610271366004611d68565b61075d565b61022f610284366004611d68565b6107f3565b610229610297366004611d92565b61090e565b6102296102aa366004611d38565b610929565b61022f6102bd366004611d38565b61093d565b6101fe6102d0366004611d38565b6109d0565b61022f6102e3366004611dce565b610a30565b61022f6102f6366004611dce565b610a4d565b610229610ad3565b600a546001600160a01b03166101fe565b6101de610ae7565b61022961032a366004611de9565b610af6565b61022961033d366004611e3b565b610b05565b6101de610350366004611d38565b610b83565b61022f604581565b61022f61036b366004611dce565b610ca0565b6101c161037e366004611f17565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6102296103ba366004611dce565b610d16565b6102296103cd366004611f4a565b610d8c565b61040e6103e0366004611dce565b600b602052600090815260409020546001600160801b03811690600160801b900467ffffffffffffffff1682565b604080516001600160801b03909316835267ffffffffffffffff9091166020830152016101cd565b60006001600160e01b0319821663780e9d6360e01b148061045b575061045b82610e64565b92915050565b60606000805461047090611f8e565b80601f016020809104026020016040519081016040528092919081815260200182805461049c90611f8e565b80156104e95780601f106104be576101008083540402835291602001916104e9565b820191906000526020600020905b8154815290600101906020018083116104cc57829003601f168201915b5050505050905090565b60006104fe82610eb4565b506000908152600460205260409020546001600160a01b031690565b6000610525826109d0565b9050806001600160a01b0316836001600160a01b0316036105975760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806105b357506105b3813361037e565b6106255760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161058e565b61062f8383610f13565b505050565b61063c610f81565b61064583610ca0565b6001600160a01b0384166000908152600b6020526040902080546001600160801b03929092166001600160c01b031990921691909117600160801b4267ffffffffffffffff160217905561069882610ca0565b6001600160a01b0383166000908152600b6020526040902080546001600160801b03929092166001600160c01b031990921691909117600160801b4267ffffffffffffffff160217905561062f838383610fdb565b6106f7338261114a565b61063c5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6044820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606482015260840161058e565b600061076883610a4d565b82106107ca5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161058e565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b60006107fd610f81565b4282101561081e5760405163085de62560e01b815260040160405180910390fd5b60405163683afddd60e11b81526001600160a01b0384166004820152309063d075fbba90602401602060405180830381865afa92505050801561087e575060408051601f3d908101601f1916820190925261087b91810190611fc8565b60015b156108c3576001600160a01b0384166000908152600b6020526040902080546fffffffffffffffffffffffffffffffff19166001600160801b03929092169190911790555b6001600160a01b0383166000908152600b60205260409020805467ffffffffffffffff60801b1916600160801b67ffffffffffffffff851602179055600854905061045b83826111c9565b61062f83838360405180602001604052806000815250610b05565b610931610f81565b61093a816111e3565b50565b600061094860085490565b82106109ab5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161058e565b600882815481106109be576109be611fe1565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b03168061045b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161058e565b6000610a3a610f81565b50600854610a4882826111c9565b919050565b60006001600160a01b038216610ab75760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161058e565b506001600160a01b031660009081526003602052604090205490565b610adb610f81565b610ae56000611284565b565b60606001805461047090611f8e565b610b013383836112d6565b5050565b610b0f338361114a565b610b715760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b606482015260840161058e565b610b7d848484846113a4565b50505050565b6060610b8d611c73565b60405180610120016040528060fd815260200161233b60fd91398152604080518082019091526005815264535059202360d81b60208201528160016020020152610bd6836113d7565b604082810191825280518082018252600d81526c1e17ba32bc3a1f1e17b9bb339f60991b6020808301919091526060850182905284518186015194519351600095610c279592949093909101611ff7565b60405160208183030381529060405290506000610c74610c46866113d7565b610c4f846114d8565b604051602001610c6092919061204e565b6040516020818303038152906040526114d8565b905080604051602001610c87919061211d565b60408051601f1981840301815291905295945050505050565b600061045b610cae83610a4d565b610cb9906045612178565b6001600160a01b0384166000908152600b60205260409020546001600160801b03811690610d1190610cfc90600160801b900467ffffffffffffffff1642612197565b62015180670de0b6b3a7640000919091020490565b611642565b610d1e610f81565b6001600160a01b038116610d835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161058e565b61093a81611284565b610d94610f81565b600080826001811115610da957610da96121ae565b14610dc75782610db885610ca0565b610dc29190612197565b610ddb565b82610dd185610ca0565b610ddb91906121c4565b6001600160a01b0385166000818152600b602052604090819020805467ffffffffffffffff4216600160801b026001600160c01b03199091166001600160801b0386161717905551919250907f2171f1d8b6b7927c42287fd11040aa8c3569c5c2040b8453104ced365ed84cd490610e569084815260200190565b60405180910390a250505050565b60006001600160e01b031982166380ac58cd60e01b1480610e9557506001600160e01b03198216635b5e139f60e01b145b8061045b57506301ffc9a760e01b6001600160e01b031983161461045b565b6000818152600260205260409020546001600160a01b031661093a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161058e565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610f48826109d0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600a546001600160a01b03163314610ae55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058e565b826001600160a01b0316610fee826109d0565b6001600160a01b0316146110145760405162461bcd60e51b815260040161058e906121dc565b6001600160a01b0382166110765760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161058e565b611081838383611682565b826001600160a01b0316611094826109d0565b6001600160a01b0316146110ba5760405162461bcd60e51b815260040161058e906121dc565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600080611156836109d0565b9050806001600160a01b0316846001600160a01b0316148061119d57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806111c15750836001600160a01b03166111b6846104f3565b6001600160a01b0316145b949350505050565b610b0182826040518060200160405280600081525061173a565b60006111ee826109d0565b90506111fc81600084611682565b611205826109d0565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036113375760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161058e565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6113af848484610fdb565b6113bb8484848461176d565b610b7d5760405162461bcd60e51b815260040161058e90612221565b6060816000036113fe5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611428578061141281612273565b91506114219050600a836122a2565b9150611402565b60008167ffffffffffffffff81111561144357611443611e25565b6040519080825280601f01601f19166020018201604052801561146d576020820181803683370190505b5090505b84156111c157611482600183612197565b915061148f600a866122b6565b61149a9060306121c4565b60f81b8183815181106114af576114af611fe1565b60200101906001600160f81b031916908160001a9053506114d1600a866122a2565b9450611471565b805160609060008190036114fc575050604080516020810190915260008152919050565b6000600361150b8360026121c4565b61151591906122a2565b611520906004612178565b9050600061152f8260206121c4565b67ffffffffffffffff81111561154757611547611e25565b6040519080825280601f01601f191660200182016040528015611571576020820181803683370190505b5090506000604051806060016040528060408152602001612438604091399050600181016020830160005b868110156115fd576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b83526004909201910161159c565b506003860660018114611617576002811461162857611634565b613d3d60f01b600119830152611634565b603d60f81b6000198301525b505050918152949350505050565b60008061164f838061186e565b9050611670611669858702670de0b6b3a76400000261188a565b849061186e565b90850260021c84010190509392505050565b6001600160a01b0383166116dd576116d881600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611700565b816001600160a01b0316836001600160a01b03161461170057611700838261192e565b6001600160a01b0382166117175761062f816119cb565b826001600160a01b0316826001600160a01b03161461062f5761062f8282611a7a565b6117448383611abe565b611751600084848461176d565b61062f5760405162461bcd60e51b815260040161058e90612221565b60006001600160a01b0384163b1561186357604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906117b19033908990889088906004016122ca565b6020604051808303816000875af19250505080156117ec575060408051601f3d908101601f191682019092526117e991810190612307565b60015b611849573d80801561181a576040519150601f19603f3d011682016040523d82523d6000602084013e61181f565b606091505b5080516000036118415760405162461bcd60e51b815260040161058e90612221565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506111c1565b506001949350505050565b60006118838383670de0b6b3a7640000611c55565b9392505050565b60b581600160881b81106118a35760409190911b9060801c5b690100000000000000000081106118bf5760209190911b9060401c5b6501000000000081106118d75760109190911b9060201c5b630100000081106118ed5760089190911b9060101c5b62010000010260121c80820401600190811c80830401811c80830401811c80830401811c80830401811c80830401811c80830401901c908190048111900390565b6000600161193b84610a4d565b6119459190612197565b600083815260076020526040902054909150808214611998576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906119dd90600190612197565b60008381526009602052604081205460088054939450909284908110611a0557611a05611fe1565b906000526020600020015490508060088381548110611a2657611a26611fe1565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611a5e57611a5e612324565b6001900381819060005260206000200160009055905550505050565b6000611a8583610a4d565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216611b145760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161058e565b6000818152600260205260409020546001600160a01b031615611b795760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161058e565b611b8560008383611682565b6000818152600260205260409020546001600160a01b031615611bea5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161058e565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000826000190484118302158202611c6c57600080fd5b5091020490565b60405180608001604052806004905b6060815260200190600190039081611c825790505090565b6001600160e01b03198116811461093a57600080fd5b600060208284031215611cc257600080fd5b813561188381611c9a565b60005b83811015611ce8578181015183820152602001611cd0565b83811115610b7d5750506000910152565b60008151808452611d11816020860160208601611ccd565b601f01601f19169290920160200192915050565b6020815260006118836020830184611cf9565b600060208284031215611d4a57600080fd5b5035919050565b80356001600160a01b0381168114610a4857600080fd5b60008060408385031215611d7b57600080fd5b611d8483611d51565b946020939093013593505050565b600080600060608486031215611da757600080fd5b611db084611d51565b9250611dbe60208501611d51565b9150604084013590509250925092565b600060208284031215611de057600080fd5b61188382611d51565b60008060408385031215611dfc57600080fd5b611e0583611d51565b915060208301358015158114611e1a57600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611e5157600080fd5b611e5a85611d51565b9350611e6860208601611d51565b925060408501359150606085013567ffffffffffffffff80821115611e8c57600080fd5b818701915087601f830112611ea057600080fd5b813581811115611eb257611eb2611e25565b604051601f8201601f19908116603f01168101908382118183101715611eda57611eda611e25565b816040528281528a6020848701011115611ef357600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215611f2a57600080fd5b611f3383611d51565b9150611f4160208401611d51565b90509250929050565b600080600060608486031215611f5f57600080fd5b611f6884611d51565b925060208401359150604084013560028110611f8357600080fd5b809150509250925092565b600181811c90821680611fa257607f821691505b602082108103611fc257634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611fda57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60008551612009818460208a01611ccd565b85519083019061201d818360208a01611ccd565b8551910190612030818360208901611ccd565b8451910190612043818360208801611ccd565b019695505050505050565b6e7b226e616d65223a2022537079202360881b8152825160009061207981600f850160208801611ccd565b7f222c20226465736372697074696f6e223a2022412053707920696e2074686520600f918401918201527f4b6e6966652047616d6520556e6976657273652e222c2022696d616765223a20602f8201527f22646174613a696d6167652f7376672b786d6c3b6261736536342c0000000000604f820152835161210281606a840160208801611ccd565b61227d60f01b606a9290910191820152606c01949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161215581601d850160208701611ccd565b91909101601d0192915050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561219257612192612162565b500290565b6000828210156121a9576121a9612162565b500390565b634e487b7160e01b600052602160045260246000fd5b600082198211156121d7576121d7612162565b500190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60006001820161228557612285612162565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826122b1576122b161228c565b500490565b6000826122c5576122c561228c565b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906122fd90830184611cf9565b9695505050505050565b60006020828403121561231957600080fd5b815161188381611c9a565b634e487b7160e01b600052603160045260246000fdfe3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d223020302033353020333530223e3c7374796c653e2e62617365207b2066696c6c3a2077686974653b20666f6e742d66616d696c793a2073657269663b20666f6e742d73697a653a20313470783b207d3c2f7374796c653e3c726563742077696474683d223130302522206865696768743d2231303025222066696c6c3d22626c61636b22202f3e3c7465787420783d2231302220793d2232302220636c6173733d2262617365223e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220d463800700e533ac39d8eb0fc21456079a2fa26db8bdfd2f46083e73fd506fdd64736f6c634300080e0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80636a627842116100f9578063c87b56dd11610097578063e985e9c511610071578063e985e9c514610370578063f2fde38b146103ac578063f66e9ac3146103bf578063ffc9896b146103d257600080fd5b8063c87b56dd14610342578063cb1a29b514610355578063d075fbba1461035d57600080fd5b80638da5cb5b116100d35780638da5cb5b1461030357806395d89b4114610314578063a22cb4651461031c578063b88d4fde1461032f57600080fd5b80636a627842146102d557806370a08231146102e8578063715018a6146102fb57600080fd5b806323b872dd1161016657806342842e0e1161014057806342842e0e1461028957806342966c681461029c5780634f6ccce7146102af5780636352211e146102c257600080fd5b806323b872dd146102505780632f745c591461026357806340c10f191461027657600080fd5b806301ffc9a7146101ae57806306fdde03146101d6578063081812fc146101eb578063095ea7b31461021657806318160ddd1461022b57806320dd4c021461023d575b600080fd5b6101c16101bc366004611cb0565b610436565b60405190151581526020015b60405180910390f35b6101de610461565b6040516101cd9190611d25565b6101fe6101f9366004611d38565b6104f3565b6040516001600160a01b0390911681526020016101cd565b610229610224366004611d68565b61051a565b005b6008545b6040519081526020016101cd565b61022961024b366004611d92565b610634565b61022961025e366004611d92565b6106ed565b61022f610271366004611d68565b61075d565b61022f610284366004611d68565b6107f3565b610229610297366004611d92565b61090e565b6102296102aa366004611d38565b610929565b61022f6102bd366004611d38565b61093d565b6101fe6102d0366004611d38565b6109d0565b61022f6102e3366004611dce565b610a30565b61022f6102f6366004611dce565b610a4d565b610229610ad3565b600a546001600160a01b03166101fe565b6101de610ae7565b61022961032a366004611de9565b610af6565b61022961033d366004611e3b565b610b05565b6101de610350366004611d38565b610b83565b61022f604581565b61022f61036b366004611dce565b610ca0565b6101c161037e366004611f17565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b6102296103ba366004611dce565b610d16565b6102296103cd366004611f4a565b610d8c565b61040e6103e0366004611dce565b600b602052600090815260409020546001600160801b03811690600160801b900467ffffffffffffffff1682565b604080516001600160801b03909316835267ffffffffffffffff9091166020830152016101cd565b60006001600160e01b0319821663780e9d6360e01b148061045b575061045b82610e64565b92915050565b60606000805461047090611f8e565b80601f016020809104026020016040519081016040528092919081815260200182805461049c90611f8e565b80156104e95780601f106104be576101008083540402835291602001916104e9565b820191906000526020600020905b8154815290600101906020018083116104cc57829003601f168201915b5050505050905090565b60006104fe82610eb4565b506000908152600460205260409020546001600160a01b031690565b6000610525826109d0565b9050806001600160a01b0316836001600160a01b0316036105975760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806105b357506105b3813361037e565b6106255760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c000000606482015260840161058e565b61062f8383610f13565b505050565b61063c610f81565b61064583610ca0565b6001600160a01b0384166000908152600b6020526040902080546001600160801b03929092166001600160c01b031990921691909117600160801b4267ffffffffffffffff160217905561069882610ca0565b6001600160a01b0383166000908152600b6020526040902080546001600160801b03929092166001600160c01b031990921691909117600160801b4267ffffffffffffffff160217905561062f838383610fdb565b6106f7338261114a565b61063c5760405162461bcd60e51b815260206004820152603160248201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6044820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606482015260840161058e565b600061076883610a4d565b82106107ca5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161058e565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b60006107fd610f81565b4282101561081e5760405163085de62560e01b815260040160405180910390fd5b60405163683afddd60e11b81526001600160a01b0384166004820152309063d075fbba90602401602060405180830381865afa92505050801561087e575060408051601f3d908101601f1916820190925261087b91810190611fc8565b60015b156108c3576001600160a01b0384166000908152600b6020526040902080546fffffffffffffffffffffffffffffffff19166001600160801b03929092169190911790555b6001600160a01b0383166000908152600b60205260409020805467ffffffffffffffff60801b1916600160801b67ffffffffffffffff851602179055600854905061045b83826111c9565b61062f83838360405180602001604052806000815250610b05565b610931610f81565b61093a816111e3565b50565b600061094860085490565b82106109ab5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161058e565b600882815481106109be576109be611fe1565b90600052602060002001549050919050565b6000818152600260205260408120546001600160a01b03168061045b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161058e565b6000610a3a610f81565b50600854610a4882826111c9565b919050565b60006001600160a01b038216610ab75760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161058e565b506001600160a01b031660009081526003602052604090205490565b610adb610f81565b610ae56000611284565b565b60606001805461047090611f8e565b610b013383836112d6565b5050565b610b0f338361114a565b610b715760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201526c1c881bdc88185c1c1c9bdd9959609a1b606482015260840161058e565b610b7d848484846113a4565b50505050565b6060610b8d611c73565b60405180610120016040528060fd815260200161233b60fd91398152604080518082019091526005815264535059202360d81b60208201528160016020020152610bd6836113d7565b604082810191825280518082018252600d81526c1e17ba32bc3a1f1e17b9bb339f60991b6020808301919091526060850182905284518186015194519351600095610c279592949093909101611ff7565b60405160208183030381529060405290506000610c74610c46866113d7565b610c4f846114d8565b604051602001610c6092919061204e565b6040516020818303038152906040526114d8565b905080604051602001610c87919061211d565b60408051601f1981840301815291905295945050505050565b600061045b610cae83610a4d565b610cb9906045612178565b6001600160a01b0384166000908152600b60205260409020546001600160801b03811690610d1190610cfc90600160801b900467ffffffffffffffff1642612197565b62015180670de0b6b3a7640000919091020490565b611642565b610d1e610f81565b6001600160a01b038116610d835760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161058e565b61093a81611284565b610d94610f81565b600080826001811115610da957610da96121ae565b14610dc75782610db885610ca0565b610dc29190612197565b610ddb565b82610dd185610ca0565b610ddb91906121c4565b6001600160a01b0385166000818152600b602052604090819020805467ffffffffffffffff4216600160801b026001600160c01b03199091166001600160801b0386161717905551919250907f2171f1d8b6b7927c42287fd11040aa8c3569c5c2040b8453104ced365ed84cd490610e569084815260200190565b60405180910390a250505050565b60006001600160e01b031982166380ac58cd60e01b1480610e9557506001600160e01b03198216635b5e139f60e01b145b8061045b57506301ffc9a760e01b6001600160e01b031983161461045b565b6000818152600260205260409020546001600160a01b031661093a5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161058e565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190610f48826109d0565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600a546001600160a01b03163314610ae55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058e565b826001600160a01b0316610fee826109d0565b6001600160a01b0316146110145760405162461bcd60e51b815260040161058e906121dc565b6001600160a01b0382166110765760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161058e565b611081838383611682565b826001600160a01b0316611094826109d0565b6001600160a01b0316146110ba5760405162461bcd60e51b815260040161058e906121dc565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600080611156836109d0565b9050806001600160a01b0316846001600160a01b0316148061119d57506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b806111c15750836001600160a01b03166111b6846104f3565b6001600160a01b0316145b949350505050565b610b0182826040518060200160405280600081525061173a565b60006111ee826109d0565b90506111fc81600084611682565b611205826109d0565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b816001600160a01b0316836001600160a01b0316036113375760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161058e565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6113af848484610fdb565b6113bb8484848461176d565b610b7d5760405162461bcd60e51b815260040161058e90612221565b6060816000036113fe5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611428578061141281612273565b91506114219050600a836122a2565b9150611402565b60008167ffffffffffffffff81111561144357611443611e25565b6040519080825280601f01601f19166020018201604052801561146d576020820181803683370190505b5090505b84156111c157611482600183612197565b915061148f600a866122b6565b61149a9060306121c4565b60f81b8183815181106114af576114af611fe1565b60200101906001600160f81b031916908160001a9053506114d1600a866122a2565b9450611471565b805160609060008190036114fc575050604080516020810190915260008152919050565b6000600361150b8360026121c4565b61151591906122a2565b611520906004612178565b9050600061152f8260206121c4565b67ffffffffffffffff81111561154757611547611e25565b6040519080825280601f01601f191660200182016040528015611571576020820181803683370190505b5090506000604051806060016040528060408152602001612438604091399050600181016020830160005b868110156115fd576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b83526004909201910161159c565b506003860660018114611617576002811461162857611634565b613d3d60f01b600119830152611634565b603d60f81b6000198301525b505050918152949350505050565b60008061164f838061186e565b9050611670611669858702670de0b6b3a76400000261188a565b849061186e565b90850260021c84010190509392505050565b6001600160a01b0383166116dd576116d881600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b611700565b816001600160a01b0316836001600160a01b03161461170057611700838261192e565b6001600160a01b0382166117175761062f816119cb565b826001600160a01b0316826001600160a01b03161461062f5761062f8282611a7a565b6117448383611abe565b611751600084848461176d565b61062f5760405162461bcd60e51b815260040161058e90612221565b60006001600160a01b0384163b1561186357604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906117b19033908990889088906004016122ca565b6020604051808303816000875af19250505080156117ec575060408051601f3d908101601f191682019092526117e991810190612307565b60015b611849573d80801561181a576040519150601f19603f3d011682016040523d82523d6000602084013e61181f565b606091505b5080516000036118415760405162461bcd60e51b815260040161058e90612221565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506111c1565b506001949350505050565b60006118838383670de0b6b3a7640000611c55565b9392505050565b60b581600160881b81106118a35760409190911b9060801c5b690100000000000000000081106118bf5760209190911b9060401c5b6501000000000081106118d75760109190911b9060201c5b630100000081106118ed5760089190911b9060101c5b62010000010260121c80820401600190811c80830401811c80830401811c80830401811c80830401811c80830401811c80830401901c908190048111900390565b6000600161193b84610a4d565b6119459190612197565b600083815260076020526040902054909150808214611998576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b6008546000906119dd90600190612197565b60008381526009602052604081205460088054939450909284908110611a0557611a05611fe1565b906000526020600020015490508060088381548110611a2657611a26611fe1565b6000918252602080832090910192909255828152600990915260408082208490558582528120556008805480611a5e57611a5e612324565b6001900381819060005260206000200160009055905550505050565b6000611a8583610a4d565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b038216611b145760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161058e565b6000818152600260205260409020546001600160a01b031615611b795760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161058e565b611b8560008383611682565b6000818152600260205260409020546001600160a01b031615611bea5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161058e565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6000826000190484118302158202611c6c57600080fd5b5091020490565b60405180608001604052806004905b6060815260200190600190039081611c825790505090565b6001600160e01b03198116811461093a57600080fd5b600060208284031215611cc257600080fd5b813561188381611c9a565b60005b83811015611ce8578181015183820152602001611cd0565b83811115610b7d5750506000910152565b60008151808452611d11816020860160208601611ccd565b601f01601f19169290920160200192915050565b6020815260006118836020830184611cf9565b600060208284031215611d4a57600080fd5b5035919050565b80356001600160a01b0381168114610a4857600080fd5b60008060408385031215611d7b57600080fd5b611d8483611d51565b946020939093013593505050565b600080600060608486031215611da757600080fd5b611db084611d51565b9250611dbe60208501611d51565b9150604084013590509250925092565b600060208284031215611de057600080fd5b61188382611d51565b60008060408385031215611dfc57600080fd5b611e0583611d51565b915060208301358015158114611e1a57600080fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215611e5157600080fd5b611e5a85611d51565b9350611e6860208601611d51565b925060408501359150606085013567ffffffffffffffff80821115611e8c57600080fd5b818701915087601f830112611ea057600080fd5b813581811115611eb257611eb2611e25565b604051601f8201601f19908116603f01168101908382118183101715611eda57611eda611e25565b816040528281528a6020848701011115611ef357600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b60008060408385031215611f2a57600080fd5b611f3383611d51565b9150611f4160208401611d51565b90509250929050565b600080600060608486031215611f5f57600080fd5b611f6884611d51565b925060208401359150604084013560028110611f8357600080fd5b809150509250925092565b600181811c90821680611fa257607f821691505b602082108103611fc257634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611fda57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60008551612009818460208a01611ccd565b85519083019061201d818360208a01611ccd565b8551910190612030818360208901611ccd565b8451910190612043818360208801611ccd565b019695505050505050565b6e7b226e616d65223a2022537079202360881b8152825160009061207981600f850160208801611ccd565b7f222c20226465736372697074696f6e223a2022412053707920696e2074686520600f918401918201527f4b6e6966652047616d6520556e6976657273652e222c2022696d616765223a20602f8201527f22646174613a696d6167652f7376672b786d6c3b6261736536342c0000000000604f820152835161210281606a840160208801611ccd565b61227d60f01b606a9290910191820152606c01949350505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161215581601d850160208701611ccd565b91909101601d0192915050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561219257612192612162565b500290565b6000828210156121a9576121a9612162565b500390565b634e487b7160e01b600052602160045260246000fd5b600082198211156121d7576121d7612162565b500190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60006001820161228557612285612162565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826122b1576122b161228c565b500490565b6000826122c5576122c561228c565b500690565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906122fd90830184611cf9565b9695505050505050565b60006020828403121561231957600080fd5b815161188381611c9a565b634e487b7160e01b600052603160045260246000fdfe3c73766720786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207072657365727665417370656374526174696f3d22784d696e594d696e206d656574222076696577426f783d223020302033353020333530223e3c7374796c653e2e62617365207b2066696c6c3a2077686974653b20666f6e742d66616d696c793a2073657269663b20666f6e742d73697a653a20313470783b207d3c2f7374796c653e3c726563742077696474683d223130302522206865696768743d2231303025222066696c6c3d22626c61636b22202f3e3c7465787420783d2231302220793d2232302220636c6173733d2262617365223e4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220d463800700e533ac39d8eb0fc21456079a2fa26db8bdfd2f46083e73fd506fdd64736f6c634300080e0033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.