Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 2,567 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Withdraw Fund | 17535220 | 377 days ago | IN | 0 ETH | 0.00060792 | ||||
Mint | 17072660 | 442 days ago | IN | 0 ETH | 0.01908294 | ||||
Request Mint | 17072659 | 442 days ago | IN | 0.134 ETH | 0.00497908 | ||||
Withdraw Fund | 16889156 | 468 days ago | IN | 0 ETH | 0.00039364 | ||||
Mint | 16860286 | 472 days ago | IN | 0 ETH | 0.00369643 | ||||
Request Mint | 16860285 | 472 days ago | IN | 0.067 ETH | 0.00133088 | ||||
Mint | 16833775 | 476 days ago | IN | 0 ETH | 0.00858868 | ||||
Request Mint | 16833774 | 476 days ago | IN | 0.067 ETH | 0.00319011 | ||||
Withdraw Fund | 16769388 | 485 days ago | IN | 0 ETH | 0.00076879 | ||||
Mint | 16753150 | 487 days ago | IN | 0 ETH | 0.00509399 | ||||
Request Mint | 16753149 | 487 days ago | IN | 0.067 ETH | 0.00175249 | ||||
Mint | 16743237 | 488 days ago | IN | 0 ETH | 0.00675292 | ||||
Request Mint | 16743236 | 488 days ago | IN | 0.067 ETH | 0.00201898 | ||||
Mint | 16743229 | 488 days ago | IN | 0 ETH | 0.006447 | ||||
Request Mint | 16743228 | 488 days ago | IN | 0.067 ETH | 0.00218262 | ||||
Mint | 16743221 | 488 days ago | IN | 0 ETH | 0.00719204 | ||||
Request Mint | 16743220 | 488 days ago | IN | 0.067 ETH | 0.0023779 | ||||
Mint | 16729617 | 490 days ago | IN | 0 ETH | 0.00750609 | ||||
Request Mint | 16729616 | 490 days ago | IN | 0.067 ETH | 0.0022514 | ||||
Mint | 16725682 | 491 days ago | IN | 0 ETH | 0.0051103 | ||||
Request Mint | 16725681 | 491 days ago | IN | 0.067 ETH | 0.0021284 | ||||
Mint | 16695029 | 495 days ago | IN | 0 ETH | 0.00864622 | ||||
Request Mint | 16695028 | 495 days ago | IN | 0.067 ETH | 0.00294309 | ||||
Mint | 16695020 | 495 days ago | IN | 0 ETH | 0.00910179 | ||||
Request Mint | 16695019 | 495 days ago | IN | 0.067 ETH | 0.00305374 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | Value | ||
---|---|---|---|---|---|---|
17535220 | 377 days ago | 0.12 ETH | ||||
17072659 | 442 days ago | 0.014 ETH | ||||
16889156 | 468 days ago | 0.12 ETH | ||||
16860285 | 472 days ago | 0.007 ETH | ||||
16833774 | 476 days ago | 0.007 ETH | ||||
16769388 | 485 days ago | 5.16 ETH | ||||
16753149 | 487 days ago | 0.007 ETH | ||||
16743236 | 488 days ago | 0.007 ETH | ||||
16743228 | 488 days ago | 0.007 ETH | ||||
16743220 | 488 days ago | 0.007 ETH | ||||
16729616 | 490 days ago | 0.007 ETH | ||||
16725681 | 491 days ago | 0.007 ETH | ||||
16695028 | 495 days ago | 0.007 ETH | ||||
16695019 | 495 days ago | 0.007 ETH | ||||
16695006 | 495 days ago | 0.007 ETH | ||||
16694993 | 495 days ago | 0.007 ETH | ||||
16661808 | 500 days ago | 0.007 ETH | ||||
16651665 | 501 days ago | 0.007 ETH | ||||
16649731 | 501 days ago | 0.007 ETH | ||||
16649709 | 501 days ago | 0.007 ETH | ||||
16649697 | 501 days ago | 0.007 ETH | ||||
16649685 | 501 days ago | 0.007 ETH | ||||
16649664 | 501 days ago | 0.007 ETH | ||||
16649608 | 501 days ago | 0.007 ETH | ||||
16646907 | 502 days ago | 0.007 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
TeritoriMinter
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/proxy/Clones.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./TeritoriNft.sol"; import "../lib/UniSafeERC20.sol"; contract TeritoriMinter is Ownable, Pausable, ReentrancyGuard { using UniSafeERC20 for IERC20; event MintRequest(address user); event WithdrawFund(address token, uint256 amount); struct WhitelistConfig { uint256 mintMax; uint256 mintPeriod; uint256 mintPrice; } struct Config { uint256 maxSupply; address mintToken; // address(0) for ETH payment uint256 mintStartTime; uint256 whitelistCount; uint256 publicMintPrice; uint256 publicMintMax; } address public minter; address public nft; Config public config; mapping(uint256 => WhitelistConfig) public whitelists; // whitelist phase => config mapping(uint256 => mapping(address => bool)) public userWhitelisted; // whitelist phase => user address => whitelisted mapping(uint256 => uint256) public whitelistSize; // whitelist phase => whitelisted addresses count mapping(address => uint256) public userMinted; // user address => minted count mapping(uint256 => address) public tokenRequests; // mint request index => user address uint256 public tokenRequestsCount; uint256 public currentSupply; uint256 public minterFee; constructor( string memory _name, string memory _symbol, string memory _contractURI, address _nft_impl, address _minter, uint256 _minterFee ) Ownable() Pausable() ReentrancyGuard() { nft = Clones.clone(_nft_impl); TeritoriNft(nft).initialize(_name, _symbol, _contractURI); minter = _minter; minterFee = _minterFee; } function pause() external onlyOwner whenNotPaused { _pause(); } function unpause() external onlyOwner whenPaused { _unpause(); } function setMinter(address newMinter) external onlyOwner { minter = newMinter; } function setMinterFee(uint256 newMinterFee) external onlyOwner { minterFee = newMinterFee; } function setConfig(Config memory newConfig) external onlyOwner { config = newConfig; } function startMint() external onlyOwner { config.mintStartTime = block.timestamp; } function setWhitelistConfig( uint256[] memory whitelistPhases, WhitelistConfig[] memory newWhitelistMintConfigs ) external onlyOwner { require( whitelistPhases.length == newWhitelistMintConfigs.length, "INVALID_LENGTH" ); uint256 length = whitelistPhases.length; for (uint256 i = 0; i < length; i++) { whitelists[whitelistPhases[i]] = newWhitelistMintConfigs[i]; } } function setWhitelist( uint256 whitelistPhase, address[] memory users, bool whitelisted ) external onlyOwner { uint256 changes = 0; for (uint256 i = 0; i < users.length; i++) { if (userWhitelisted[whitelistPhase][users[i]] != whitelisted) { userWhitelisted[whitelistPhase][users[i]] = whitelisted; changes++; } } if (whitelisted) { whitelistSize[whitelistPhase] += changes; } else { whitelistSize[whitelistPhase] -= changes; } } function requestMint(address user, uint256 count) external payable whenNotPaused nonReentrant { require( config.mintStartTime != 0 && config.mintStartTime <= block.timestamp, "MINT_NOT_STARTED" ); uint256 mintCount = userMinted[user]; uint256 currentPhaseStart = config.mintStartTime; uint256 mintPrice = config.publicMintPrice; for (uint256 i = 0; i < config.whitelistCount; i++) { WhitelistConfig memory whitelist = whitelists[i]; if (currentPhaseStart + whitelist.mintPeriod >= block.timestamp) { mintPrice = whitelist.mintPrice; require(userWhitelisted[i][user], "NOT_WHITELISTED"); require( mintCount + count <= whitelist.mintMax, "EXCEED_WHITELIST_MINT_MAX" ); break; } currentPhaseStart += whitelist.mintPeriod; } require(mintCount + count <= config.publicMintMax, "EXCEED_MINT_MAX"); if (mintPrice > 0) { IERC20(config.mintToken).uniSafeTransferFrom( msg.sender, mintPrice * count ); IERC20(config.mintToken).uniSafeTransfer(minter, minterFee * count); } userMinted[user] += count; for (uint256 i = 0; i < count; i++) { tokenRequests[tokenRequestsCount + i] = user; } tokenRequestsCount += count; emit MintRequest(user); } struct MintData { uint256 tokenId; address royaltyReceiver; uint96 royaltyPercentage; string tokenUri; } function mint(MintData[] memory mintData) external nonReentrant { require(msg.sender == minter, "UNAUTHORIZED"); require( currentSupply + mintData.length <= tokenRequestsCount, "NO_TOKEN_REQUEST" ); for (uint256 i = 0; i < mintData.length; i++) { address user = tokenRequests[currentSupply]; currentSupply++; TeritoriNft(nft).mint( user, mintData[i].tokenId, mintData[i].royaltyReceiver, mintData[i].royaltyPercentage, mintData[i].tokenUri ); } } struct MintDataWithMetadata { uint256 tokenId; address royaltyReceiver; uint96 royaltyPercentage; string tokenUri; TeritoriNft.Metadata extension; } function mintWithMetadata(MintDataWithMetadata[] memory mintData) external nonReentrant { require(msg.sender == minter, "UNAUTHORIZED"); require( currentSupply + mintData.length <= tokenRequestsCount, "NO_TOKEN_REQUEST" ); for (uint256 i = 0; i < mintData.length; i++) { address user = tokenRequests[currentSupply]; currentSupply++; TeritoriNft(nft).mintWithMetadata( user, mintData[i].tokenId, mintData[i].royaltyReceiver, mintData[i].royaltyPercentage, mintData[i].tokenUri, mintData[i].extension ); } } function withdrawFund() external onlyOwner { uint256 withdrawBalance = 0; if (config.mintToken == UniSafeERC20.NATIVE_TOKEN) { withdrawBalance = address(this).balance; } else { withdrawBalance = IERC20(config.mintToken).balanceOf(address(this)); } require(withdrawBalance > 0, "NO_AVAILABLE_FUND"); IERC20(config.mintToken).uniSafeTransfer(msg.sender, withdrawBalance); emit WithdrawFund(config.mintToken, withdrawBalance); } function userState(address user) external view returns ( uint256 currentPhase, uint256 mintPrice, bool userCanMint ) { require( config.mintStartTime != 0 && config.mintStartTime <= block.timestamp, "MINT_NOT_STARTED" ); uint256 mintCount = userMinted[user]; uint256 currentPhaseStart = config.mintStartTime; currentPhase = config.whitelistCount; mintPrice = config.publicMintPrice; for (uint256 i = 0; i < config.whitelistCount; i++) { WhitelistConfig memory whitelist = whitelists[i]; if (currentPhaseStart + whitelist.mintPeriod >= block.timestamp) { mintPrice = whitelist.mintPrice; currentPhase = i; userCanMint = userWhitelisted[i][user] && mintCount < whitelist.mintMax; break; } currentPhaseStart += whitelist.mintPeriod; } userCanMint = userCanMint && mintCount < config.publicMintMax; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/Clones.sol) pragma solidity ^0.8.0; /** * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for * deploying minimal proxy contracts, also known as "clones". * * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies * > a minimal bytecode implementation that delegates all calls to a known, fixed address. * * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2` * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the * deterministic method. * * _Available since v3.4._ */ library Clones { /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create opcode, which should never revert. */ function clone(address implementation) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create(0, ptr, 0x37) } require(instance != address(0), "ERC1167: create failed"); } /** * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`. * * This function uses the create2 opcode and a `salt` to deterministically deploy * the clone. Using the same `implementation` and `salt` multiple time will revert, since * the clones cannot be deployed twice at the same address. */ function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000) instance := create2(0, ptr, 0x37, salt) } require(instance != address(0), "ERC1167: create2 failed"); } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress( address implementation, bytes32 salt, address deployer ) internal pure returns (address predicted) { assembly { let ptr := mload(0x40) mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000) mstore(add(ptr, 0x14), shl(0x60, implementation)) mstore(add(ptr, 0x28), 0x5af43d82803e903d91602b57fd5bf3ff00000000000000000000000000000000) mstore(add(ptr, 0x38), shl(0x60, deployer)) mstore(add(ptr, 0x4c), salt) mstore(add(ptr, 0x6c), keccak256(ptr, 0x37)) predicted := keccak256(add(ptr, 0x37), 0x55) } } /** * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}. */ function predictDeterministicAddress(address implementation, bytes32 salt) internal view returns (address predicted) { return predictDeterministicAddress(implementation, salt, address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721RoyaltyUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol"; contract TeritoriNft is ERC721EnumerableUpgradeable, ERC721RoyaltyUpgradeable, ERC721URIStorageUpgradeable { struct Attribute { string trait_type; string value; } struct Metadata { string name; string description; string image; string external_url; string animation_url; Attribute[] attributes; } address public minter; string public contractURI; mapping(uint256 => Metadata) internal _extensions; function initialize( string memory _name, string memory _symbol, string memory _contractURI ) external initializer { __ERC721_init(_name, _symbol); minter = msg.sender; contractURI = _contractURI; } function nftInfo(uint256 tokenId) external view returns (Metadata memory) { return _extensions[tokenId]; } function mint( address receiver, uint256 tokenId, address royaltyReceiver, uint96 royaltyPercentage, string memory tokenUri ) external { require(msg.sender == minter, "unauthorized"); _safeMint(receiver, tokenId); _setTokenRoyalty(tokenId, royaltyReceiver, royaltyPercentage); _setTokenURI(tokenId, tokenUri); } function mintWithMetadata( address receiver, uint256 tokenId, address royaltyReceiver, uint96 royaltyPercentage, string memory tokenUri, Metadata memory extension ) external { require(msg.sender == minter, "unauthorized"); _safeMint(receiver, tokenId); _setTokenRoyalty(tokenId, royaltyReceiver, royaltyPercentage); _setTokenURI(tokenId, tokenUri); _extensions[tokenId].name = extension.name; _extensions[tokenId].description = extension.description; _extensions[tokenId].image = extension.image; _extensions[tokenId].external_url = extension.external_url; _extensions[tokenId].animation_url = extension.animation_url; for (uint256 i = 0; i < extension.attributes.length; i++) { _extensions[tokenId].attributes.push(extension.attributes[i]); } } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override( ERC721Upgradeable, ERC721RoyaltyUpgradeable, ERC721EnumerableUpgradeable ) returns (bool) { return ERC721Upgradeable.supportsInterface(interfaceId) || ERC721RoyaltyUpgradeable.supportsInterface(interfaceId) || ERC721EnumerableUpgradeable.supportsInterface(interfaceId); } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override(ERC721Upgradeable, ERC721URIStorageUpgradeable) returns (string memory) { return ERC721URIStorageUpgradeable.tokenURI(tokenId); } /** * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token. */ function _burn(uint256 tokenId) internal override( ERC721Upgradeable, ERC721RoyaltyUpgradeable, ERC721URIStorageUpgradeable ) { super._burn(tokenId); } /** * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token. */ function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal override(ERC721Upgradeable, ERC721EnumerableUpgradeable) { super._beforeTokenTransfer(from, to, firstTokenId, batchSize); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; library UniSafeERC20 { using SafeERC20 for IERC20; address public constant NATIVE_TOKEN = address(0); function uniSafeTransferFrom( IERC20 asset, address from, uint256 value ) internal { if (address(asset) == NATIVE_TOKEN) { require(value == msg.value, "INVALID_MSG_VALUE"); } else { asset.safeTransferFrom(from, address(this), value); } } function uniSafeTransfer( IERC20 asset, address to, uint256 value ) internal { if (address(asset) == NATIVE_TOKEN) { (bool sent, ) = payable(to).call{value: value}(""); require(sent, "NATIVE_TOKEN_TRANSFER_FAILED"); } else { asset.safeTransfer(to, value); } } }
// 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.8.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: 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 = _ownerOf(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 = ERC721Upgradeable.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 the owner of the `tokenId`. Does NOT revert if token doesn't exist */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @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 _ownerOf(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 = ERC721Upgradeable.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, 1); // 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, 1); } /** * @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 = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId, 1); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721Upgradeable.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, 1); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId, 1); // Check that tokenId was not transferred by `_beforeTokenTransfer` hook require(ERC721Upgradeable.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, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits 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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @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. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`. * - When `from` is zero, the tokens will be minted for `to`. * - When `to` is zero, ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256, /* firstTokenId */ uint256 batchSize ) internal virtual { if (batchSize > 1) { if (from != address(0)) { _balances[from] -= batchSize; } if (to != address(0)) { _balances[to] += batchSize; } } } /** * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`. * - When `from` is zero, the tokens were minted for `to`. * - When `to` is zero, ``from``'s tokens were burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[44] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Royalty.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "../../common/ERC2981Upgradeable.sol"; import "../../../utils/introspection/ERC165Upgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment * information. * * Royalty information can be specified globally for all token ids via {ERC2981-_setDefaultRoyalty}, and/or individually for * specific token ids via {ERC2981-_setTokenRoyalty}. The latter takes precedence over the first. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC721RoyaltyUpgradeable is Initializable, ERC2981Upgradeable, ERC721Upgradeable { function __ERC721Royalty_init() internal onlyInitializing { } function __ERC721Royalty_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, ERC2981Upgradeable) returns (bool) { return super.supportsInterface(interfaceId); } /** * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); _resetTokenRoyalty(tokenId); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "./IERC721EnumerableUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable { function __ERC721Enumerable_init() internal onlyInitializing { } function __ERC721Enumerable_init_unchained() internal onlyInitializing { } // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721Upgradeable.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721EnumerableUpgradeable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev See {ERC721-_beforeTokenTransfer}. */ function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual override { super._beforeTokenTransfer(from, to, firstTokenId, batchSize); if (batchSize > 1) { // Will only trigger during construction. Batch transferring (minting) is not available afterwards. revert("ERC721Enumerable: consecutive transfers not supported"); } uint256 tokenId = firstTokenId; if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721Upgradeable.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[46] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorageUpgradeable is Initializable, ERC721Upgradeable { function __ERC721URIStorage_init() internal onlyInitializing { } function __ERC721URIStorage_init_unchained() internal onlyInitializing { } using StringsUpgradeable for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev See {ERC721-_burn}. This override additionally checks to see if a * token-specific URI was set for the token, and if so, it deletes the token URI from * the storage mapping. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * 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 IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `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/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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 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; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { 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 = MathUpgradeable.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 { return toHexString(value, MathUpgradeable.log256(value) + 1); } } /** * @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 "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981Upgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable { function __ERC2981_init() internal onlyInitializing { } function __ERC2981_init_unchained() internal onlyInitializing { } struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981Upgradeable */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[48] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981Upgradeable is IERC165Upgradeable { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @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/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_contractURI","type":"string"},{"internalType":"address","name":"_nft_impl","type":"address"},{"internalType":"address","name":"_minter","type":"address"},{"internalType":"uint256","name":"_minterFee","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"}],"name":"MintRequest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawFund","type":"event"},{"inputs":[],"name":"config","outputs":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"address","name":"mintToken","type":"address"},{"internalType":"uint256","name":"mintStartTime","type":"uint256"},{"internalType":"uint256","name":"whitelistCount","type":"uint256"},{"internalType":"uint256","name":"publicMintPrice","type":"uint256"},{"internalType":"uint256","name":"publicMintMax","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"royaltyReceiver","type":"address"},{"internalType":"uint96","name":"royaltyPercentage","type":"uint96"},{"internalType":"string","name":"tokenUri","type":"string"}],"internalType":"struct TeritoriMinter.MintData[]","name":"mintData","type":"tuple[]"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"royaltyReceiver","type":"address"},{"internalType":"uint96","name":"royaltyPercentage","type":"uint96"},{"internalType":"string","name":"tokenUri","type":"string"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"image","type":"string"},{"internalType":"string","name":"external_url","type":"string"},{"internalType":"string","name":"animation_url","type":"string"},{"components":[{"internalType":"string","name":"trait_type","type":"string"},{"internalType":"string","name":"value","type":"string"}],"internalType":"struct TeritoriNft.Attribute[]","name":"attributes","type":"tuple[]"}],"internalType":"struct TeritoriNft.Metadata","name":"extension","type":"tuple"}],"internalType":"struct TeritoriMinter.MintDataWithMetadata[]","name":"mintData","type":"tuple[]"}],"name":"mintWithMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minterFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nft","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"requestMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"address","name":"mintToken","type":"address"},{"internalType":"uint256","name":"mintStartTime","type":"uint256"},{"internalType":"uint256","name":"whitelistCount","type":"uint256"},{"internalType":"uint256","name":"publicMintPrice","type":"uint256"},{"internalType":"uint256","name":"publicMintMax","type":"uint256"}],"internalType":"struct TeritoriMinter.Config","name":"newConfig","type":"tuple"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newMinter","type":"address"}],"name":"setMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMinterFee","type":"uint256"}],"name":"setMinterFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"whitelistPhase","type":"uint256"},{"internalType":"address[]","name":"users","type":"address[]"},{"internalType":"bool","name":"whitelisted","type":"bool"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"whitelistPhases","type":"uint256[]"},{"components":[{"internalType":"uint256","name":"mintMax","type":"uint256"},{"internalType":"uint256","name":"mintPeriod","type":"uint256"},{"internalType":"uint256","name":"mintPrice","type":"uint256"}],"internalType":"struct TeritoriMinter.WhitelistConfig[]","name":"newWhitelistMintConfigs","type":"tuple[]"}],"name":"setWhitelistConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenRequests","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenRequestsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"userState","outputs":[{"internalType":"uint256","name":"currentPhase","type":"uint256"},{"internalType":"uint256","name":"mintPrice","type":"uint256"},{"internalType":"bool","name":"userCanMint","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"whitelistSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"whitelists","outputs":[{"internalType":"uint256","name":"mintMax","type":"uint256"},{"internalType":"uint256","name":"mintPeriod","type":"uint256"},{"internalType":"uint256","name":"mintPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawFund","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506040516200308e3803806200308e8339810160408190526200003491620002b9565b6200003f3362000110565b6000805460ff60a01b1916905560018055620000678362000160602090811b6200193017901c565b600380546001600160a01b0319166001600160a01b0392909216918217905560405163a6487c5360e01b815263a6487c5390620000ad90899089908990600401620003a2565b600060405180830381600087803b158015620000c857600080fd5b505af1158015620000dd573d6000803e3d6000fd5b5050600280546001600160a01b0319166001600160a01b03959095169490941790935550601155506200042a9350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201526e5af43d82803e903d91602b57fd5bf360881b60288201526037816000f09150506001600160a01b0381166200020d5760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c656400000000000000000000604482015260640160405180910390fd5b919050565b80516001600160a01b03811681146200020d57600080fd5b600082601f8301126200023b578081fd5b81516001600160401b038082111562000258576200025862000414565b604051601f8301601f19908116603f0116810190828211818310171562000283576200028362000414565b816040528381528660208588010111156200029c578485fd5b620002af846020830160208901620003e1565b9695505050505050565b60008060008060008060c08789031215620002d2578182fd5b86516001600160401b0380821115620002e9578384fd5b620002f78a838b016200022a565b975060208901519150808211156200030d578384fd5b6200031b8a838b016200022a565b9650604089015191508082111562000331578384fd5b506200034089828a016200022a565b945050620003516060880162000212565b9250620003616080880162000212565b915060a087015190509295509295509295565b600081518084526200038e816020860160208601620003e1565b601f01601f19169290920160200192915050565b606081526000620003b7606083018662000374565b8281036020840152620003cb818662000374565b90508281036040840152620002af818562000374565b60005b83811015620003fe578181015183820152602001620003e4565b838111156200040e576000848401525b50505050565b634e487b7160e01b600052604160045260246000fd5b612c54806200043a6000396000f3fe6080604052600436106101b75760003560e01c8063715018a6116100ec578063e07fa3c11161008a578063fa7783fd11610064578063fa7783fd1461054f578063fad9a11f14610565578063fca3b5aa14610585578063fe4d5add146105a557600080fd5b8063e07fa3c1146104fa578063f1053f7c1461050f578063f2fde38b1461052f57600080fd5b80638456cb59116100c65780638456cb59146104875780638da5cb5b1461049c57806392548bbe146104ba578063db2cc25d146104da57600080fd5b8063715018a6146103f3578063771282f61461040857806379502c551461041e57600080fd5b80633f4ba83a116101595780634d722295116101335780634d7222951461035e5780635c975abb1461037e5780635e124dcf1461039d5780635e94c98e146103d357600080fd5b80633f4ba83a1461031357806347ccca021461032857806348a9d0ce1461034857600080fd5b80631aa5e872116101955780631aa5e872146102815780632be09561146102bc57806331a02bce146102d35780633dac1ecb146102e657600080fd5b806306b1bd0e146101bc578063075461721461020c5780630c8f81b514610244575b600080fd5b3480156101c857600080fd5b506101f76101d736600461274d565b600b60209081526000928352604080842090915290825290205460ff1681565b60405190151581526020015b60405180910390f35b34801561021857600080fd5b5060025461022c906001600160a01b031681565b6040516001600160a01b039091168152602001610203565b34801561025057600080fd5b5061026461025f366004612355565b6105fc565b604080519384526020840192909252151590820152606001610203565b34801561028d57600080fd5b506102ae61029c366004612355565b600d6020526000908152604090205481565b604051908152602001610203565b3480156102c857600080fd5b506102d1610769565b005b6102d16102e136600461236f565b6107b7565b3480156102f257600080fd5b506102ae61030136600461271d565b600c6020526000908152604090205481565b34801561031f57600080fd5b506102d1610bdd565b34801561033457600080fd5b5060035461022c906001600160a01b031681565b34801561035457600080fd5b506102ae60115481565b34801561036a57600080fd5b506102d16103793660046124ca565b610c88565b34801561038a57600080fd5b50600054600160a01b900460ff166101f7565b3480156103a957600080fd5b5061022c6103b836600461271d565b600e602052600090815260409020546001600160a01b031681565b3480156103df57600080fd5b506102d16103ee36600461271d565b610ef8565b3480156103ff57600080fd5b506102d1610f45565b34801561041457600080fd5b506102ae60105481565b34801561042a57600080fd5b5060045460055460065460075460085460095461045295946001600160a01b03169392919086565b604080519687526001600160a01b039095166020870152938501929092526060840152608083015260a082015260c001610203565b34801561049357600080fd5b506102d1610f97565b3480156104a857600080fd5b506000546001600160a01b031661022c565b3480156104c657600080fd5b506102d16104d5366004612398565b611034565b3480156104e657600080fd5b506102d16104f53660046125c9565b6112c9565b34801561050657600080fd5b506102d161140b565b34801561051b57600080fd5b506102d161052a36600461269f565b6115b4565b34801561053b57600080fd5b506102d161054a366004612355565b611653565b34801561055b57600080fd5b506102ae600f5481565b34801561057157600080fd5b506102d1610580366004612778565b611723565b34801561059157600080fd5b506102d16105a0366004612355565b6118b9565b3480156105b157600080fd5b506105e16105c036600461271d565b600a6020526000908152604090208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610203565b600080600060046002015460001415801561061957506006544210155b61066a5760405162461bcd60e51b815260206004820152601060248201527f4d494e545f4e4f545f535441525445440000000000000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b0384166000908152600d6020526040812054600654600754600854909650945090915b600754811015610750576000818152600a602090815260409182902082516060810184528154815260018201549281018390526002909101549281019290925242906106e09085612b2f565b1061072b576040808201516000848152600b60209081528382206001600160a01b038d168352905291909120549297509550869160ff1680156107235750805184105b945050610750565b602081015161073a9084612b2f565b925050808061074890612ba9565b915050610694565b5082801561075f575060095482105b9496939550505050565b6000546001600160a01b031633146107b15760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b42600655565b600054600160a01b900460ff16156108045760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610661565b600260015414156108575760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610661565b60026001556006541580159061086f57506006544210155b6108bb5760405162461bcd60e51b815260206004820152601060248201527f4d494e545f4e4f545f53544152544544000000000000000000000000000000006044820152606401610661565b6001600160a01b0382166000908152600d602052604081205460065460085491929091905b600754811015610a30576000818152600a6020908152604091829020825160608101845281548152600182015492810183905260029091015492810192909252429061092c9086612b2f565b10610a0b576040808201516000848152600b60209081528382206001600160a01b038c1683529052919091205490935060ff166109ab5760405162461bcd60e51b815260206004820152600f60248201527f4e4f545f57484954454c495354454400000000000000000000000000000000006044820152606401610661565b80516109b78787612b2f565b1115610a055760405162461bcd60e51b815260206004820152601960248201527f4558434545445f57484954454c4953545f4d494e545f4d4158000000000000006044820152606401610661565b50610a30565b6020810151610a1a9085612b2f565b9350508080610a2890612ba9565b9150506108e0565b50600954610a3e8585612b2f565b1115610a8c5760405162461bcd60e51b815260206004820152600f60248201527f4558434545445f4d494e545f4d415800000000000000000000000000000000006044820152606401610661565b8015610ae557610ab333610aa08684612b47565b6005546001600160a01b031691906119eb565b600254601154610ae5916001600160a01b031690610ad2908790612b47565b6005546001600160a01b03169190611a62565b6001600160a01b0385166000908152600d602052604081208054869290610b0d908490612b2f565b90915550600090505b84811015610b7e5785600e600083600f54610b319190612b2f565b81526020810191909152604001600020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039290921691909117905580610b7681612ba9565b915050610b16565b5083600f6000828254610b919190612b2f565b90915550506040516001600160a01b03861681527f0af7474cbbd1ef068605cf3d04b3b0f187241620cc71f4dff74d398eb5e4e2069060200160405180910390a1505060018055505050565b6000546001600160a01b03163314610c255760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b600054600160a01b900460ff16610c7e5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610661565b610c86611b27565b565b60026001541415610cdb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610661565b60026001819055546001600160a01b03163314610d295760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610661565b600f548151601054610d3b9190612b2f565b1115610d895760405162461bcd60e51b815260206004820152601060248201527f4e4f5f544f4b454e5f52455155455354000000000000000000000000000000006044820152606401610661565b60005b8151811015610ef057601080546000818152600e60205260408120546001600160a01b03169290610dbc83612ba9565b909155505060035483516001600160a01b039091169063b55f92b2908390869086908110610dfa57634e487b7160e01b600052603260045260246000fd5b602002602001015160000151868681518110610e2657634e487b7160e01b600052603260045260246000fd5b602002602001015160200151878781518110610e5257634e487b7160e01b600052603260045260246000fd5b602002602001015160400151888881518110610e7e57634e487b7160e01b600052603260045260246000fd5b6020026020010151606001516040518663ffffffff1660e01b8152600401610eaa959493929190612876565b600060405180830381600087803b158015610ec457600080fd5b505af1158015610ed8573d6000803e3d6000fd5b50505050508080610ee890612ba9565b915050610d8c565b505060018055565b6000546001600160a01b03163314610f405760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b601155565b6000546001600160a01b03163314610f8d5760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b610c866000611bcd565b6000546001600160a01b03163314610fdf5760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b600054600160a01b900460ff161561102c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610661565b610c86611c2a565b600260015414156110875760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610661565b60026001819055546001600160a01b031633146110d55760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610661565b600f5481516010546110e79190612b2f565b11156111355760405162461bcd60e51b815260206004820152601060248201527f4e4f5f544f4b454e5f52455155455354000000000000000000000000000000006044820152606401610661565b60005b8151811015610ef057601080546000818152600e60205260408120546001600160a01b0316929061116883612ba9565b909155505060035483516001600160a01b0390911690638b6678029083908690869081106111a657634e487b7160e01b600052603260045260246000fd5b6020026020010151600001518686815181106111d257634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518787815181106111fe57634e487b7160e01b600052603260045260246000fd5b60200260200101516040015188888151811061122a57634e487b7160e01b600052603260045260246000fd5b60200260200101516060015189898151811061125657634e487b7160e01b600052603260045260246000fd5b6020026020010151608001516040518763ffffffff1660e01b8152600401611283969594939291906128bc565b600060405180830381600087803b15801561129d57600080fd5b505af11580156112b1573d6000803e3d6000fd5b505050505080806112c190612ba9565b915050611138565b6000546001600160a01b031633146113115760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b80518251146113625760405162461bcd60e51b815260206004820152600e60248201527f494e56414c49445f4c454e4754480000000000000000000000000000000000006044820152606401610661565b815160005b818110156114055782818151811061138f57634e487b7160e01b600052603260045260246000fd5b6020026020010151600a60008684815181106113bb57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060008201518160000155602082015181600101556040820151816002015590505080806113fd90612ba9565b915050611367565b50505050565b6000546001600160a01b031633146114535760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b6005546000906001600160a01b031661146d575047611504565b6005546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156114c957600080fd5b505afa1580156114dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115019190612735565b90505b600081116115545760405162461bcd60e51b815260206004820152601160248201527f4e4f5f415641494c41424c455f46554e440000000000000000000000000000006044820152606401610661565b60055461156b906001600160a01b03163383611a62565b600554604080516001600160a01b039092168252602082018390527f09ad672d4e7c4892da934d1051932ebe9ec4b6ec8c3f40d569176db3e93e5abe910160405180910390a150565b6000546001600160a01b031633146115fc5760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b805160045560208101516005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0390921691909117905560408101516006556060810151600755608081015160085560a00151600955565b6000546001600160a01b0316331461169b5760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b6001600160a01b0381166117175760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610661565b61172081611bcd565b50565b6000546001600160a01b0316331461176b5760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b6000805b8351811015611860576000858152600b60205260408120855185151592908790859081106117ad57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1615151461184e576000858152600b60205260408120855185929087908590811061180e57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558161184a81612ba9565b9250505b8061185881612ba9565b91505061176f565b508115611890576000848152600c602052604081208054839290611885908490612b2f565b909155506114059050565b6000848152600c6020526040812080548392906118ae908490612b66565b909155505050505050565b6000546001600160a01b031633146119015760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060288201526037816000f09150506001600160a01b0381166119e65760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606401610661565b919050565b6001600160a01b038316611a4d57348114611a485760405162461bcd60e51b815260206004820152601160248201527f494e56414c49445f4d53475f56414c55450000000000000000000000000000006044820152606401610661565b505050565b611a486001600160a01b038416833084611cb2565b6001600160a01b038316611b13576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611abd576040519150601f19603f3d011682016040523d82523d6000602084013e611ac2565b606091505b50509050806114055760405162461bcd60e51b815260206004820152601c60248201527f4e41544956455f544f4b454e5f5452414e534645525f4641494c4544000000006044820152606401610661565b611a486001600160a01b0384168383611d63565b600054600160a01b900460ff16611b805760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610661565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600054600160a01b900460ff1615611c775760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610661565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611bb03390565b6040516001600160a01b03808516602483015283166044820152606481018290526114059085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611dac565b6040516001600160a01b038316602482015260448101829052611a489084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611cff565b6000611e01826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611e919092919063ffffffff16565b805190915015611a485780806020019051810190611e1f9190612683565b611a485760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610661565b6060611ea08484600085611eaa565b90505b9392505050565b606082471015611f225760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610661565b6001600160a01b0385163b611f795760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610661565b600080866001600160a01b03168587604051611f95919061285a565b60006040518083038185875af1925050503d8060008114611fd2576040519150601f19603f3d011682016040523d82523d6000602084013e611fd7565b606091505b5091509150611fe7828286611ff2565b979650505050505050565b60608315612001575081611ea3565b8251156120115782518084602001fd5b8160405162461bcd60e51b81526004016106619190612a12565b80356001600160a01b03811681146119e657600080fd5b600082601f830112612052578081fd5b8135602061206761206283612b0b565b612ada565b80838252828201915082860187848660051b8901011115612086578586fd5b855b8581101561212057813567ffffffffffffffff808211156120a7578889fd5b908901906040828c03601f19018113156120bf57898afd5b6120c7612a25565b88840135838111156120d7578b8cfd5b6120e58e8b838801016121cc565b8252509083013590828211156120f9578a8bfd5b6121078d8a848701016121cc565b818a015287525050509284019290840190600101612088565b5090979650505050505050565b600082601f83011261213d578081fd5b8135602061214d61206283612b0b565b8281528181019085830160608086028801850189101561216b578687fd5b865b868110156121b35781838b031215612183578788fd5b61218b612a4e565b833581528684013587820152604080850135908201528552938501939181019160010161216d565b509198975050505050505050565b80356119e681612bf0565b600082601f8301126121dc578081fd5b813567ffffffffffffffff8111156121f6576121f6612bda565b612209601f8201601f1916602001612ada565b81815284602083860101111561221d578283fd5b816020850160208301379081016020019190915292915050565b600060c08284031215612248578081fd5b612250612a71565b9050813567ffffffffffffffff8082111561226a57600080fd5b612276858386016121cc565b8352602084013591508082111561228c57600080fd5b612298858386016121cc565b602084015260408401359150808211156122b157600080fd5b6122bd858386016121cc565b604084015260608401359150808211156122d657600080fd5b6122e2858386016121cc565b606084015260808401359150808211156122fb57600080fd5b612307858386016121cc565b608084015260a084013591508082111561232057600080fd5b5061232d84828501612042565b60a08301525092915050565b80356bffffffffffffffffffffffff811681146119e657600080fd5b600060208284031215612366578081fd5b611ea38261202b565b60008060408385031215612381578081fd5b61238a8361202b565b946020939093013593505050565b600060208083850312156123aa578182fd5b823567ffffffffffffffff808211156123c1578384fd5b818501915085601f8301126123d4578384fd5b81356123e261206282612b0b565b80828252858201915085850189878560051b8801011115612401578788fd5b875b848110156124bb5781358681111561241957898afd5b870160a0818d03601f190181131561242f578a8bfd5b612437612a94565b8a83013581526124496040840161202b565b8b82015261245960608401612339565b604082015260808301358981111561246f578c8dfd5b61247d8f8d838701016121cc565b606083015250908201359088821115612494578b8cfd5b6124a28e8c84860101612237565b6080820152865250509287019290870190600101612403565b50909998505050505050505050565b600060208083850312156124dc578182fd5b823567ffffffffffffffff808211156124f3578384fd5b818501915085601f830112612506578384fd5b813561251461206282612b0b565b80828252858201915085850189878560051b8801011115612533578788fd5b875b848110156124bb5781358681111561254b57898afd5b87016080818d03601f1901121561256057898afd5b612568612ab7565b898201358152604061257b81840161202b565b8b830152606061258c818501612339565b8284015260808401359150898211156125a3578c8dfd5b6125b18f8d848701016121cc565b90830152508552509287019290870190600101612535565b600080604083850312156125db578182fd5b823567ffffffffffffffff808211156125f2578384fd5b818501915085601f830112612605578384fd5b8135602061261561206283612b0b565b8083825282820191508286018a848660051b8901011115612634578889fd5b8896505b84871015612656578035835260019690960195918301918301612638565b509650508601359250508082111561266c578283fd5b506126798582860161212d565b9150509250929050565b600060208284031215612694578081fd5b8151611ea381612bf0565b600060c082840312156126b0578081fd5b60405160c0810181811067ffffffffffffffff821117156126d3576126d3612bda565b604052823581526126e66020840161202b565b602082015260408301356040820152606083013560608201526080830135608082015260a083013560a08201528091505092915050565b60006020828403121561272e578081fd5b5035919050565b600060208284031215612746578081fd5b5051919050565b6000806040838503121561275f578182fd5b8235915061276f6020840161202b565b90509250929050565b60008060006060848603121561278c578081fd5b8335925060208085013567ffffffffffffffff8111156127aa578283fd5b8501601f810187136127ba578283fd5b80356127c861206282612b0b565b8082825284820191508484018a868560051b87010111156127e7578687fd5b8694505b83851015612810576127fc8161202b565b8352600194909401939185019185016127eb565b508096505050505050612825604085016121c1565b90509250925092565b60008151808452612846816020860160208601612b7d565b601f01601f19169290920160200192915050565b6000825161286c818460208701612b7d565b9190910192915050565b60006001600160a01b0380881683528660208401528086166040840152506bffffffffffffffffffffffff8416606083015260a06080830152611fe760a083018461282e565b60006001600160a01b038089168352602088818501526040828916818601526bffffffffffffffffffffffff8816606086015260c0608086015261290360c086018861282e565b925084830360a0860152855160c0845261292060c085018261282e565b90508287015184820384860152612937828261282e565b915050818701518482038386015261294f828261282e565b91505060608701518482036060860152612969828261282e565b91505060808701518482036080860152612983828261282e565b91505060a087015184820360a086015281945080518083528483019550848160051b8401018583019250875b828110156129ff57848203601f19018852835180518784526129d38885018261282e565b91890151848303858b01529190506129eb818361282e565b9989019995890195935050506001016129af565b509e9d5050505050505050505050505050565b602081526000611ea3602083018461282e565b6040805190810167ffffffffffffffff81118282101715612a4857612a48612bda565b60405290565b6040516060810167ffffffffffffffff81118282101715612a4857612a48612bda565b60405160c0810167ffffffffffffffff81118282101715612a4857612a48612bda565b60405160a0810167ffffffffffffffff81118282101715612a4857612a48612bda565b6040516080810167ffffffffffffffff81118282101715612a4857612a48612bda565b604051601f8201601f1916810167ffffffffffffffff81118282101715612b0357612b03612bda565b604052919050565b600067ffffffffffffffff821115612b2557612b25612bda565b5060051b60200190565b60008219821115612b4257612b42612bc4565b500190565b6000816000190483118215151615612b6157612b61612bc4565b500290565b600082821015612b7857612b78612bc4565b500390565b60005b83811015612b98578181015183820152602001612b80565b838111156114055750506000910152565b6000600019821415612bbd57612bbd612bc4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b801515811461172057600080fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220ea070662ea71131670f03cd57cd4801283da93d5d825aaf537fb63fe8174483064736f6c6343000804003300000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001400000000000000000000000002ef3e76ea2470ef7507407634a1c25c9cc531a60000000000000000000000000479a7e0fbe936504854b8bc6418622cecf17b3590000000000000000000000000000000000000000000000000018de76816d8000000000000000000000000000000000000000000000000000000000000000000e5468652052216f7420284554482900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054552494f54000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006868747470733a2f2f62616679626569673634343268636d64677869706d79786e74676566686c77726e6932736278686134616e34716c6f796965677735337334676f712e697066732e6e667473746f726167652e6c696e6b2f636f6c6c656374696f6e2e6a736f6e000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106101b75760003560e01c8063715018a6116100ec578063e07fa3c11161008a578063fa7783fd11610064578063fa7783fd1461054f578063fad9a11f14610565578063fca3b5aa14610585578063fe4d5add146105a557600080fd5b8063e07fa3c1146104fa578063f1053f7c1461050f578063f2fde38b1461052f57600080fd5b80638456cb59116100c65780638456cb59146104875780638da5cb5b1461049c57806392548bbe146104ba578063db2cc25d146104da57600080fd5b8063715018a6146103f3578063771282f61461040857806379502c551461041e57600080fd5b80633f4ba83a116101595780634d722295116101335780634d7222951461035e5780635c975abb1461037e5780635e124dcf1461039d5780635e94c98e146103d357600080fd5b80633f4ba83a1461031357806347ccca021461032857806348a9d0ce1461034857600080fd5b80631aa5e872116101955780631aa5e872146102815780632be09561146102bc57806331a02bce146102d35780633dac1ecb146102e657600080fd5b806306b1bd0e146101bc578063075461721461020c5780630c8f81b514610244575b600080fd5b3480156101c857600080fd5b506101f76101d736600461274d565b600b60209081526000928352604080842090915290825290205460ff1681565b60405190151581526020015b60405180910390f35b34801561021857600080fd5b5060025461022c906001600160a01b031681565b6040516001600160a01b039091168152602001610203565b34801561025057600080fd5b5061026461025f366004612355565b6105fc565b604080519384526020840192909252151590820152606001610203565b34801561028d57600080fd5b506102ae61029c366004612355565b600d6020526000908152604090205481565b604051908152602001610203565b3480156102c857600080fd5b506102d1610769565b005b6102d16102e136600461236f565b6107b7565b3480156102f257600080fd5b506102ae61030136600461271d565b600c6020526000908152604090205481565b34801561031f57600080fd5b506102d1610bdd565b34801561033457600080fd5b5060035461022c906001600160a01b031681565b34801561035457600080fd5b506102ae60115481565b34801561036a57600080fd5b506102d16103793660046124ca565b610c88565b34801561038a57600080fd5b50600054600160a01b900460ff166101f7565b3480156103a957600080fd5b5061022c6103b836600461271d565b600e602052600090815260409020546001600160a01b031681565b3480156103df57600080fd5b506102d16103ee36600461271d565b610ef8565b3480156103ff57600080fd5b506102d1610f45565b34801561041457600080fd5b506102ae60105481565b34801561042a57600080fd5b5060045460055460065460075460085460095461045295946001600160a01b03169392919086565b604080519687526001600160a01b039095166020870152938501929092526060840152608083015260a082015260c001610203565b34801561049357600080fd5b506102d1610f97565b3480156104a857600080fd5b506000546001600160a01b031661022c565b3480156104c657600080fd5b506102d16104d5366004612398565b611034565b3480156104e657600080fd5b506102d16104f53660046125c9565b6112c9565b34801561050657600080fd5b506102d161140b565b34801561051b57600080fd5b506102d161052a36600461269f565b6115b4565b34801561053b57600080fd5b506102d161054a366004612355565b611653565b34801561055b57600080fd5b506102ae600f5481565b34801561057157600080fd5b506102d1610580366004612778565b611723565b34801561059157600080fd5b506102d16105a0366004612355565b6118b9565b3480156105b157600080fd5b506105e16105c036600461271d565b600a6020526000908152604090208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610203565b600080600060046002015460001415801561061957506006544210155b61066a5760405162461bcd60e51b815260206004820152601060248201527f4d494e545f4e4f545f535441525445440000000000000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b0384166000908152600d6020526040812054600654600754600854909650945090915b600754811015610750576000818152600a602090815260409182902082516060810184528154815260018201549281018390526002909101549281019290925242906106e09085612b2f565b1061072b576040808201516000848152600b60209081528382206001600160a01b038d168352905291909120549297509550869160ff1680156107235750805184105b945050610750565b602081015161073a9084612b2f565b925050808061074890612ba9565b915050610694565b5082801561075f575060095482105b9496939550505050565b6000546001600160a01b031633146107b15760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b42600655565b600054600160a01b900460ff16156108045760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610661565b600260015414156108575760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610661565b60026001556006541580159061086f57506006544210155b6108bb5760405162461bcd60e51b815260206004820152601060248201527f4d494e545f4e4f545f53544152544544000000000000000000000000000000006044820152606401610661565b6001600160a01b0382166000908152600d602052604081205460065460085491929091905b600754811015610a30576000818152600a6020908152604091829020825160608101845281548152600182015492810183905260029091015492810192909252429061092c9086612b2f565b10610a0b576040808201516000848152600b60209081528382206001600160a01b038c1683529052919091205490935060ff166109ab5760405162461bcd60e51b815260206004820152600f60248201527f4e4f545f57484954454c495354454400000000000000000000000000000000006044820152606401610661565b80516109b78787612b2f565b1115610a055760405162461bcd60e51b815260206004820152601960248201527f4558434545445f57484954454c4953545f4d494e545f4d4158000000000000006044820152606401610661565b50610a30565b6020810151610a1a9085612b2f565b9350508080610a2890612ba9565b9150506108e0565b50600954610a3e8585612b2f565b1115610a8c5760405162461bcd60e51b815260206004820152600f60248201527f4558434545445f4d494e545f4d415800000000000000000000000000000000006044820152606401610661565b8015610ae557610ab333610aa08684612b47565b6005546001600160a01b031691906119eb565b600254601154610ae5916001600160a01b031690610ad2908790612b47565b6005546001600160a01b03169190611a62565b6001600160a01b0385166000908152600d602052604081208054869290610b0d908490612b2f565b90915550600090505b84811015610b7e5785600e600083600f54610b319190612b2f565b81526020810191909152604001600020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b039290921691909117905580610b7681612ba9565b915050610b16565b5083600f6000828254610b919190612b2f565b90915550506040516001600160a01b03861681527f0af7474cbbd1ef068605cf3d04b3b0f187241620cc71f4dff74d398eb5e4e2069060200160405180910390a1505060018055505050565b6000546001600160a01b03163314610c255760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b600054600160a01b900460ff16610c7e5760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610661565b610c86611b27565b565b60026001541415610cdb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610661565b60026001819055546001600160a01b03163314610d295760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610661565b600f548151601054610d3b9190612b2f565b1115610d895760405162461bcd60e51b815260206004820152601060248201527f4e4f5f544f4b454e5f52455155455354000000000000000000000000000000006044820152606401610661565b60005b8151811015610ef057601080546000818152600e60205260408120546001600160a01b03169290610dbc83612ba9565b909155505060035483516001600160a01b039091169063b55f92b2908390869086908110610dfa57634e487b7160e01b600052603260045260246000fd5b602002602001015160000151868681518110610e2657634e487b7160e01b600052603260045260246000fd5b602002602001015160200151878781518110610e5257634e487b7160e01b600052603260045260246000fd5b602002602001015160400151888881518110610e7e57634e487b7160e01b600052603260045260246000fd5b6020026020010151606001516040518663ffffffff1660e01b8152600401610eaa959493929190612876565b600060405180830381600087803b158015610ec457600080fd5b505af1158015610ed8573d6000803e3d6000fd5b50505050508080610ee890612ba9565b915050610d8c565b505060018055565b6000546001600160a01b03163314610f405760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b601155565b6000546001600160a01b03163314610f8d5760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b610c866000611bcd565b6000546001600160a01b03163314610fdf5760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b600054600160a01b900460ff161561102c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610661565b610c86611c2a565b600260015414156110875760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610661565b60026001819055546001600160a01b031633146110d55760405162461bcd60e51b815260206004820152600c60248201526b15539055551213d49256915160a21b6044820152606401610661565b600f5481516010546110e79190612b2f565b11156111355760405162461bcd60e51b815260206004820152601060248201527f4e4f5f544f4b454e5f52455155455354000000000000000000000000000000006044820152606401610661565b60005b8151811015610ef057601080546000818152600e60205260408120546001600160a01b0316929061116883612ba9565b909155505060035483516001600160a01b0390911690638b6678029083908690869081106111a657634e487b7160e01b600052603260045260246000fd5b6020026020010151600001518686815181106111d257634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518787815181106111fe57634e487b7160e01b600052603260045260246000fd5b60200260200101516040015188888151811061122a57634e487b7160e01b600052603260045260246000fd5b60200260200101516060015189898151811061125657634e487b7160e01b600052603260045260246000fd5b6020026020010151608001516040518763ffffffff1660e01b8152600401611283969594939291906128bc565b600060405180830381600087803b15801561129d57600080fd5b505af11580156112b1573d6000803e3d6000fd5b505050505080806112c190612ba9565b915050611138565b6000546001600160a01b031633146113115760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b80518251146113625760405162461bcd60e51b815260206004820152600e60248201527f494e56414c49445f4c454e4754480000000000000000000000000000000000006044820152606401610661565b815160005b818110156114055782818151811061138f57634e487b7160e01b600052603260045260246000fd5b6020026020010151600a60008684815181106113bb57634e487b7160e01b600052603260045260246000fd5b6020026020010151815260200190815260200160002060008201518160000155602082015181600101556040820151816002015590505080806113fd90612ba9565b915050611367565b50505050565b6000546001600160a01b031633146114535760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b6005546000906001600160a01b031661146d575047611504565b6005546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156114c957600080fd5b505afa1580156114dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115019190612735565b90505b600081116115545760405162461bcd60e51b815260206004820152601160248201527f4e4f5f415641494c41424c455f46554e440000000000000000000000000000006044820152606401610661565b60055461156b906001600160a01b03163383611a62565b600554604080516001600160a01b039092168252602082018390527f09ad672d4e7c4892da934d1051932ebe9ec4b6ec8c3f40d569176db3e93e5abe910160405180910390a150565b6000546001600160a01b031633146115fc5760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b805160045560208101516005805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0390921691909117905560408101516006556060810151600755608081015160085560a00151600955565b6000546001600160a01b0316331461169b5760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b6001600160a01b0381166117175760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610661565b61172081611bcd565b50565b6000546001600160a01b0316331461176b5760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b6000805b8351811015611860576000858152600b60205260408120855185151592908790859081106117ad57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b031682528101919091526040016000205460ff1615151461184e576000858152600b60205260408120855185929087908590811061180e57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558161184a81612ba9565b9250505b8061185881612ba9565b91505061176f565b508115611890576000848152600c602052604081208054839290611885908490612b2f565b909155506114059050565b6000848152600c6020526040812080548392906118ae908490612b66565b909155505050505050565b6000546001600160a01b031633146119015760405162461bcd60e51b81526020600482018190526024820152600080516020612bff8339815191526044820152606401610661565b6002805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60006040517f3d602d80600a3d3981f3363d3d373d3d3d363d7300000000000000000000000081528260601b60148201527f5af43d82803e903d91602b57fd5bf3000000000000000000000000000000000060288201526037816000f09150506001600160a01b0381166119e65760405162461bcd60e51b815260206004820152601660248201527f455243313136373a20637265617465206661696c6564000000000000000000006044820152606401610661565b919050565b6001600160a01b038316611a4d57348114611a485760405162461bcd60e51b815260206004820152601160248201527f494e56414c49445f4d53475f56414c55450000000000000000000000000000006044820152606401610661565b505050565b611a486001600160a01b038416833084611cb2565b6001600160a01b038316611b13576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611abd576040519150601f19603f3d011682016040523d82523d6000602084013e611ac2565b606091505b50509050806114055760405162461bcd60e51b815260206004820152601c60248201527f4e41544956455f544f4b454e5f5452414e534645525f4641494c4544000000006044820152606401610661565b611a486001600160a01b0384168383611d63565b600054600160a01b900460ff16611b805760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610661565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600054600160a01b900460ff1615611c775760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610661565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611bb03390565b6040516001600160a01b03808516602483015283166044820152606481018290526114059085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611dac565b6040516001600160a01b038316602482015260448101829052611a489084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611cff565b6000611e01826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611e919092919063ffffffff16565b805190915015611a485780806020019051810190611e1f9190612683565b611a485760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610661565b6060611ea08484600085611eaa565b90505b9392505050565b606082471015611f225760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610661565b6001600160a01b0385163b611f795760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610661565b600080866001600160a01b03168587604051611f95919061285a565b60006040518083038185875af1925050503d8060008114611fd2576040519150601f19603f3d011682016040523d82523d6000602084013e611fd7565b606091505b5091509150611fe7828286611ff2565b979650505050505050565b60608315612001575081611ea3565b8251156120115782518084602001fd5b8160405162461bcd60e51b81526004016106619190612a12565b80356001600160a01b03811681146119e657600080fd5b600082601f830112612052578081fd5b8135602061206761206283612b0b565b612ada565b80838252828201915082860187848660051b8901011115612086578586fd5b855b8581101561212057813567ffffffffffffffff808211156120a7578889fd5b908901906040828c03601f19018113156120bf57898afd5b6120c7612a25565b88840135838111156120d7578b8cfd5b6120e58e8b838801016121cc565b8252509083013590828211156120f9578a8bfd5b6121078d8a848701016121cc565b818a015287525050509284019290840190600101612088565b5090979650505050505050565b600082601f83011261213d578081fd5b8135602061214d61206283612b0b565b8281528181019085830160608086028801850189101561216b578687fd5b865b868110156121b35781838b031215612183578788fd5b61218b612a4e565b833581528684013587820152604080850135908201528552938501939181019160010161216d565b509198975050505050505050565b80356119e681612bf0565b600082601f8301126121dc578081fd5b813567ffffffffffffffff8111156121f6576121f6612bda565b612209601f8201601f1916602001612ada565b81815284602083860101111561221d578283fd5b816020850160208301379081016020019190915292915050565b600060c08284031215612248578081fd5b612250612a71565b9050813567ffffffffffffffff8082111561226a57600080fd5b612276858386016121cc565b8352602084013591508082111561228c57600080fd5b612298858386016121cc565b602084015260408401359150808211156122b157600080fd5b6122bd858386016121cc565b604084015260608401359150808211156122d657600080fd5b6122e2858386016121cc565b606084015260808401359150808211156122fb57600080fd5b612307858386016121cc565b608084015260a084013591508082111561232057600080fd5b5061232d84828501612042565b60a08301525092915050565b80356bffffffffffffffffffffffff811681146119e657600080fd5b600060208284031215612366578081fd5b611ea38261202b565b60008060408385031215612381578081fd5b61238a8361202b565b946020939093013593505050565b600060208083850312156123aa578182fd5b823567ffffffffffffffff808211156123c1578384fd5b818501915085601f8301126123d4578384fd5b81356123e261206282612b0b565b80828252858201915085850189878560051b8801011115612401578788fd5b875b848110156124bb5781358681111561241957898afd5b870160a0818d03601f190181131561242f578a8bfd5b612437612a94565b8a83013581526124496040840161202b565b8b82015261245960608401612339565b604082015260808301358981111561246f578c8dfd5b61247d8f8d838701016121cc565b606083015250908201359088821115612494578b8cfd5b6124a28e8c84860101612237565b6080820152865250509287019290870190600101612403565b50909998505050505050505050565b600060208083850312156124dc578182fd5b823567ffffffffffffffff808211156124f3578384fd5b818501915085601f830112612506578384fd5b813561251461206282612b0b565b80828252858201915085850189878560051b8801011115612533578788fd5b875b848110156124bb5781358681111561254b57898afd5b87016080818d03601f1901121561256057898afd5b612568612ab7565b898201358152604061257b81840161202b565b8b830152606061258c818501612339565b8284015260808401359150898211156125a3578c8dfd5b6125b18f8d848701016121cc565b90830152508552509287019290870190600101612535565b600080604083850312156125db578182fd5b823567ffffffffffffffff808211156125f2578384fd5b818501915085601f830112612605578384fd5b8135602061261561206283612b0b565b8083825282820191508286018a848660051b8901011115612634578889fd5b8896505b84871015612656578035835260019690960195918301918301612638565b509650508601359250508082111561266c578283fd5b506126798582860161212d565b9150509250929050565b600060208284031215612694578081fd5b8151611ea381612bf0565b600060c082840312156126b0578081fd5b60405160c0810181811067ffffffffffffffff821117156126d3576126d3612bda565b604052823581526126e66020840161202b565b602082015260408301356040820152606083013560608201526080830135608082015260a083013560a08201528091505092915050565b60006020828403121561272e578081fd5b5035919050565b600060208284031215612746578081fd5b5051919050565b6000806040838503121561275f578182fd5b8235915061276f6020840161202b565b90509250929050565b60008060006060848603121561278c578081fd5b8335925060208085013567ffffffffffffffff8111156127aa578283fd5b8501601f810187136127ba578283fd5b80356127c861206282612b0b565b8082825284820191508484018a868560051b87010111156127e7578687fd5b8694505b83851015612810576127fc8161202b565b8352600194909401939185019185016127eb565b508096505050505050612825604085016121c1565b90509250925092565b60008151808452612846816020860160208601612b7d565b601f01601f19169290920160200192915050565b6000825161286c818460208701612b7d565b9190910192915050565b60006001600160a01b0380881683528660208401528086166040840152506bffffffffffffffffffffffff8416606083015260a06080830152611fe760a083018461282e565b60006001600160a01b038089168352602088818501526040828916818601526bffffffffffffffffffffffff8816606086015260c0608086015261290360c086018861282e565b925084830360a0860152855160c0845261292060c085018261282e565b90508287015184820384860152612937828261282e565b915050818701518482038386015261294f828261282e565b91505060608701518482036060860152612969828261282e565b91505060808701518482036080860152612983828261282e565b91505060a087015184820360a086015281945080518083528483019550848160051b8401018583019250875b828110156129ff57848203601f19018852835180518784526129d38885018261282e565b91890151848303858b01529190506129eb818361282e565b9989019995890195935050506001016129af565b509e9d5050505050505050505050505050565b602081526000611ea3602083018461282e565b6040805190810167ffffffffffffffff81118282101715612a4857612a48612bda565b60405290565b6040516060810167ffffffffffffffff81118282101715612a4857612a48612bda565b60405160c0810167ffffffffffffffff81118282101715612a4857612a48612bda565b60405160a0810167ffffffffffffffff81118282101715612a4857612a48612bda565b6040516080810167ffffffffffffffff81118282101715612a4857612a48612bda565b604051601f8201601f1916810167ffffffffffffffff81118282101715612b0357612b03612bda565b604052919050565b600067ffffffffffffffff821115612b2557612b25612bda565b5060051b60200190565b60008219821115612b4257612b42612bc4565b500190565b6000816000190483118215151615612b6157612b61612bc4565b500290565b600082821015612b7857612b78612bc4565b500390565b60005b83811015612b98578181015183820152602001612b80565b838111156114055750506000910152565b6000600019821415612bbd57612bbd612bc4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b801515811461172057600080fdfe4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220ea070662ea71131670f03cd57cd4801283da93d5d825aaf537fb63fe8174483064736f6c63430008040033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001400000000000000000000000002ef3e76ea2470ef7507407634a1c25c9cc531a60000000000000000000000000479a7e0fbe936504854b8bc6418622cecf17b3590000000000000000000000000000000000000000000000000018de76816d8000000000000000000000000000000000000000000000000000000000000000000e5468652052216f7420284554482900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000054552494f54000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006868747470733a2f2f62616679626569673634343268636d64677869706d79786e74676566686c77726e6932736278686134616e34716c6f796965677735337334676f712e697066732e6e667473746f726167652e6c696e6b2f636f6c6c656374696f6e2e6a736f6e000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): The R!ot (ETH)
Arg [1] : _symbol (string): ERIOT
Arg [2] : _contractURI (string): https://bafybeig6442hcmdgxipmyxntgefhlwrni2sbxha4an4qloyiegw53s4goq.ipfs.nftstorage.link/collection.json
Arg [3] : _nft_impl (address): 0x2Ef3E76eA2470eF7507407634A1C25c9cC531A60
Arg [4] : _minter (address): 0x479a7E0fbe936504854b8Bc6418622ceCF17B359
Arg [5] : _minterFee (uint256): 7000000000000000
-----Encoded View---------------
15 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [3] : 0000000000000000000000002ef3e76ea2470ef7507407634a1c25c9cc531a60
Arg [4] : 000000000000000000000000479a7e0fbe936504854b8bc6418622cecf17b359
Arg [5] : 0000000000000000000000000000000000000000000000000018de76816d8000
Arg [6] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [7] : 5468652052216f74202845544829000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [9] : 4552494f54000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000068
Arg [11] : 68747470733a2f2f62616679626569673634343268636d64677869706d79786e
Arg [12] : 74676566686c77726e6932736278686134616e34716c6f796965677735337334
Arg [13] : 676f712e697066732e6e667473746f726167652e6c696e6b2f636f6c6c656374
Arg [14] : 696f6e2e6a736f6e000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.