ERC-721
NFT
Overview
Max Total Supply
1,716 PRIMADONNA
Holders
707
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
5 PRIMADONNALoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
OriginalsPrimaDonna
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
petersburg EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// // ,. ;-. ,--. ,-. ,. ,-. // / \ | ) | | \ / \ / \ // |--| |-' |- | | |--| | | // | | | | | / | | \ / // ' ' ' `--' `-' ' ' `-' // // .......................................................................... // .......................................................................... // .......................................................................... // .......................................................................... // ..........................*&&&&&,........&&&&&&........................... // .....................,(....&&&&&(.......&&*..,&&.......................... // .................,&&/.&&....&&&&#.........&&&&&...,&&&&&&................. // ...................&&&.........................../&#&&&&.................. // ....................#&............***.***.............&&....,............. // ...........&&&&&&&&...............***.***................*&&&*&&.......... // ............&&&&..........................................&&...&&......... // .............&&.......&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%......,&&&&.......... // ....................&&&&&.....,*#&&&&&&&&&#*,.....&&&&%................... // ....................&&&............&&&&&...........,&&&................... // ...................&&&&............,&&&,............&&&&.................. // ...................&&&&%........*%&&&&&&&#*........&&&&&.................. // ...................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.................. // ..............,......&&&&&&&&%&&&&&&...&&&&&&%&&&&&&&&......*............. // ...............*.............&&&&&.......&&&&&............**.............. // ...............,**..........&&&&%....&....&&&&&.........***............... // ................****........&&&&&&&&&&&&&&&&&&&.......****................ // ...............*******.......&&&&&&&&&&&&&&&&&......,******............... // .................****.......&&&&&&,(&&&&*&&&&&&......****................. // ..................****..............................****.................. // ..................******.....&&&.*&&&&&&&.,&&&....******.................. // .....................**.......&&&&&&&&&&&&&&&......**..................... // .......................**......&&&&&&&&&&&&&.....**....................... // ..................................#&&&&&(................................. // .......................................................................... // ....................................***................................... // .......................................................................... // .......................................................................... /* 888~-_ 888~-_ 888 e e e 888 \ 888 \ 888 d8b d8b d8b 888 | 888 | 888 d888bdY88b /Y88b 888 / 888 / 888 / Y88Y Y888b / Y88b 888_-~ 888_-~ 888 / YY Y888b /____Y88b 888 888 ~-_ 888 / Y888b / Y88b 888~-_ ,88~-_ 888b | 888b | e 888 \ d888 \ |Y88b | |Y88b | d8b 888 | 88888 | | Y88b | | Y88b | /Y88b 888 | 88888 | | Y88b | | Y88b | / Y88b 888 / Y888 / | Y88b| | Y88b| /____Y88b 888_-~ `88_-~ | Y888 | Y888 / Y88b */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; // ========== Imports ========== import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "./RemixMintClub.sol"; import "./ApeDaoRemix.sol"; contract OriginalsPrimaDonna is ERC721, ERC721Burnable, ERC721Enumerable, ERC721URIStorage, AccessControl, Ownable, Pausable, ReentrancyGuard { using Counters for Counters.Counter; Counters.Counter private _tokenIdCounter; uint256 private _goldTokenIdCount; bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); uint8 constant GOLD_TOKEN_ID = 1; uint8 constant BASIC_TOKEN_ID = 2; // ========== Immutable Variables ========== /// @notice Mint Token Address address payable public immutable MINT_TOKEN_CONTRACT_ADDRESS; /// @notice Remix Contract Address address payable public immutable REMIX_CONTRACT_ADDRESS; /// @notice An address to withdraw balance to address payable public immutable PAYABLE_ADDRESS_1; /// @notice An address to withdraw balance to address payable public immutable PAYABLE_ADDRESS_2; // ========== Mutable Variables ========== string public baseURI; string public provenanceHash; uint16 public maximumSupply; uint16 public maximumGoldSupply; uint8 public transactionLimit; uint256 public mintCost; mapping(address => mapping(TokenRequirementType => uint256)) numMintsPerAddress; mapping(TokenRequirementType => uint16) walletLimitByWindow; mapping(address => bool) doubleGoldWalletHolder; address[] doubleGoldWalletHolderAddresses; TokenRequirementType public mintTokenRequirement; enum TokenRequirementType { NONE, GOLD, BASIC, ANY } bool public remixHolderRequired = true; // ========== Constructor ========== constructor( address payable _MINT_TOKEN_CONTRACT_ADDRESS, address payable _REMIX_CONTRACT_ADDRESS, uint16 _maximumSupply, uint16 _maximumGoldSupply, uint256 _mintCost, uint8 _transactionLimit, address _payableAddress1, address _payableAddress2, bool _remixHolderRequired, string memory _provenanceHash ) ERC721("Prima Donna", "PRIMADONNA") { MINT_TOKEN_CONTRACT_ADDRESS = _MINT_TOKEN_CONTRACT_ADDRESS; REMIX_CONTRACT_ADDRESS = _REMIX_CONTRACT_ADDRESS; maximumSupply = _maximumSupply; maximumGoldSupply = _maximumGoldSupply; mintCost = _mintCost; _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(ADMIN_ROLE, msg.sender); mintTokenRequirement = TokenRequirementType.GOLD; remixHolderRequired = _remixHolderRequired; PAYABLE_ADDRESS_1 = payable(_payableAddress1); PAYABLE_ADDRESS_2 = payable(_payableAddress2); transactionLimit = _transactionLimit; walletLimitByWindow[TokenRequirementType.NONE] = 10; walletLimitByWindow[TokenRequirementType.GOLD] = 10; walletLimitByWindow[TokenRequirementType.BASIC] = 10; walletLimitByWindow[TokenRequirementType.ANY] = 10; provenanceHash = _provenanceHash; _pause(); } // ========== Minting ========== // @notice Mints tokens to the caller when there is no Mint token requirement function mintADC(uint256 _quantity) public payable whenNotPaused nonReentrant { require(mintTokenRequirement == TokenRequirementType.NONE, "Mint tokens are required to mint."); checkMintValid(_quantity); mint(_quantity); } // @notice Mints tokens to the caller when Mint tokens are required function mintADCWithToken(uint8 numGoldTokens, uint8 numBasicTokens) public payable whenNotPaused nonReentrant { require(mintTokenRequirement != TokenRequirementType.NONE, "Mint tokens are not required to mint."); if(mintTokenRequirement == TokenRequirementType.GOLD) { require(numGoldTokens > 0, "Gold token must be greater than 0"); require(numBasicTokens == 0, "only gold tokens are required to mint"); } if(mintTokenRequirement == TokenRequirementType.BASIC) { require(numBasicTokens > 0, "Basic token must be greater than 0"); require(numGoldTokens == 0, "only basic tokens are required to mint"); } uint256 _quantity = numGoldTokens + numBasicTokens; checkMintValid(_quantity); RemixMintClub mintClubContract = RemixMintClub(MINT_TOKEN_CONTRACT_ADDRESS); // If Gold token is required if((mintTokenRequirement == TokenRequirementType.GOLD || mintTokenRequirement == TokenRequirementType.ANY) && numGoldTokens > 0) { mintClubContract.burn(msg.sender, GOLD_TOKEN_ID, numGoldTokens); } // If Basic token is required if((mintTokenRequirement == TokenRequirementType.BASIC || mintTokenRequirement == TokenRequirementType.ANY) && numBasicTokens > 0) { mintClubContract.burn(msg.sender, BASIC_TOKEN_ID, numBasicTokens); } mint(_quantity); } function checkMintValid(uint256 _quantity) internal { if(mintTokenRequirement == TokenRequirementType.GOLD) { require(_goldTokenIdCount + _quantity <= maximumGoldSupply, "Quantity must be less than remaining supply for Gold tokens"); } require(_quantity > 0, "Quantity must be greater than 0"); require(_tokenIdCounter.current() + _quantity <= maximumSupply, "Quantity must be less than remaining supply"); uint16 walletLimit = getMintAllowance(msg.sender, mintTokenRequirement); require(numMintsPerAddress[msg.sender][mintTokenRequirement] + _quantity <= walletLimit, "Exceeds wallet limit for window"); require(_quantity <= transactionLimit, "Too many tokens to mint"); require(msg.value >= mintCost * _quantity, "Insufficient funds for minting"); if(remixHolderRequired) { ApeDaoRemix remixContract = ApeDaoRemix(REMIX_CONTRACT_ADDRESS); require(remixContract.balanceOf(msg.sender) > 0, "You must be a Remix holder to mint"); } } function mint(uint256 _quantity) internal { numMintsPerAddress[msg.sender][mintTokenRequirement] += _quantity; if(mintTokenRequirement == TokenRequirementType.GOLD) { _goldTokenIdCount += _quantity; } internalMint(_quantity); } function getMintAllowance(address _signer, TokenRequirementType _tokenRequirement) public view returns (uint16) { uint16 walletLimit = walletLimitByWindow[_tokenRequirement]; if(_tokenRequirement == TokenRequirementType.GOLD && doubleGoldWalletHolder[_signer]) { walletLimit = walletLimit * 2; } return walletLimit; } function getNumMints(address _signer, TokenRequirementType _tokenRequirement) public view returns (uint256) { return numMintsPerAddress[_signer][_tokenRequirement]; } function getDoubleGoldWalletHolder(address _address) public view returns (bool) { return doubleGoldWalletHolder[_address]; } function getDoubleGoldWalletHolderAddresses() public view returns (address[] memory) { return doubleGoldWalletHolderAddresses; } function internalMint(uint256 _quantity) internal { for(uint8 i = 0; i < _quantity; i++) { _tokenIdCounter.increment(); // Increment first so that we start at token 1 _safeMint(_msgSender(), _tokenIdCounter.current()); } } // ========== Admin ========== function adminMint(uint256 _quantity) public onlyAdmin { require(_quantity > 0, "Quantity must be greater than 0"); require(_tokenIdCounter.current() + _quantity <= maximumSupply, "Quantity must be less than remaining supply"); internalMint(_quantity); } function setMintTokenRequirement(TokenRequirementType _mintTokenRequirement) public onlyAdmin { mintTokenRequirement = _mintTokenRequirement; } function setMaximumGoldSupply(uint16 _maximumGoldSupply) public onlyAdmin { maximumGoldSupply = _maximumGoldSupply; } function setMintCost(uint256 _mintCost) public onlyAdmin { mintCost = _mintCost; } function setDoubleGoldWalletHolders(address[] calldata _addresses) public onlyAdmin { for(uint8 i = 0; i < doubleGoldWalletHolderAddresses.length; i++) { doubleGoldWalletHolder[doubleGoldWalletHolderAddresses[i]] = false; } delete doubleGoldWalletHolderAddresses; for(uint8 i = 0; i < _addresses.length; i++) { doubleGoldWalletHolder[_addresses[i]] = true; doubleGoldWalletHolderAddresses.push(_addresses[i]); } } function setRemixHolderRequired(bool value) public onlyAdmin { remixHolderRequired = value; } function withdraw() public onlyAdmin { Address.sendValue(payable(PAYABLE_ADDRESS_1), address(this).balance * 60 / 100); Address.sendValue(payable(PAYABLE_ADDRESS_2), address(this).balance); } function pause() public onlyAdmin { _pause(); } function unpause() public onlyAdmin { _unpause(); } // ========== ERC721Enumerable Overrides ========== function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable, AccessControl) returns (bool) { return super.supportsInterface(interfaceId); } // ========== ERC721URIStorage Overrides ========== function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) { super._burn(tokenId); } function setBaseURI(string memory baseURI_) public onlyAdmin { baseURI = baseURI_; } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory) { return super.tokenURI(tokenId); } // ========== Modifiers ========== modifier onlyAdmin() { require(hasRole(ADMIN_ROLE, msg.sender), "Caller is not an admin"); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _setOwner(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and make it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: balance query for the zero address"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(_msgSender() != operator, "ERC1155: setting approval status for self"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not owner nor approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: transfer caller is not owner nor approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`. * * Emits a {TransferSingle} event. * * Requirements: * * - `account` cannot be the zero address. * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address account, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(account != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][account] += amount; emit TransferSingle(operator, address(0), account, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `account` * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens of token type `id`. */ function _burn( address account, uint256 id, uint256 amount ) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), ""); uint256 accountBalance = _balances[id][account]; require(accountBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][account] = accountBalance - amount; } emit TransferSingle(operator, account, address(0), id, amount); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address account, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(account != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, account, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 accountBalance = _balances[id][account]; require(accountBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][account] = accountBalance - amount; } } emit TransferBatch(operator, account, address(0), ids, amounts); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** @dev Handles the receipt of a single ERC1155 token type. This function is called at the end of a `safeTransferFrom` after the balance has been updated. To accept the transfer, this must return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61, or its own function selector). @param operator The address which initiated the transfer (i.e. msg.sender) @param from The address which previously owned the token @param id The ID of the token being transferred @param value The amount of tokens being transferred @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** @dev Handles the receipt of a multiple ERC1155 token types. This function is called at the end of a `safeBatchTransferFrom` after the balances have been updated. To accept the transfer(s), this must return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81, or its own function selector). @param operator The address which initiated the batch transfer (i.e. msg.sender) @param from The address which previously owned the token @param ids An array containing ids of each token being transferred (order and length must match values array) @param values An array containing amounts of each token being transferred (order and length must match ids array) @param data Additional data with no specified format @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC1155.sol"; /** * @dev Extension of {ERC1155} that allows token holders to destroy both their * own tokens and those that they have been approved to use. * * _Available since v3.1._ */ abstract contract ERC1155Burnable is ERC1155 { function burn( address account, uint256 id, uint256 value ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not owner nor approved" ); _burn(account, id, value); } function burnBatch( address account, uint256[] memory ids, uint256[] memory values ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not owner nor approved" ); _burnBatch(account, ids, values); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC1155.sol"; /** * @dev Extension of ERC1155 that adds tracking of total supply per id. * * Useful for scenarios where Fungible and Non-fungible tokens have to be * clearly identified. Note: While a totalSupply of 1 might mean the * corresponding is an NFT, there is no guarantees that no other token with the * same id are not going to be minted. */ abstract contract ERC1155Supply is ERC1155 { mapping(uint256 => uint256) private _totalSupply; /** * @dev Total amount of tokens in with a given id. */ function totalSupply(uint256 id) public view virtual returns (uint256) { return _totalSupply[id]; } /** * @dev Indicates weither any token exist with a given id, or not. */ function exists(uint256 id) public view virtual returns (bool) { return ERC1155Supply.totalSupply(id) > 0; } /** * @dev See {ERC1155-_mint}. */ function _mint( address account, uint256 id, uint256 amount, bytes memory data ) internal virtual override { super._mint(account, id, amount, data); _totalSupply[id] += amount; } /** * @dev See {ERC1155-_mintBatch}. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._mintBatch(to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { _totalSupply[ids[i]] += amounts[i]; } } /** * @dev See {ERC1155-_burn}. */ function _burn( address account, uint256 id, uint256 amount ) internal virtual override { super._burn(account, id, amount); _totalSupply[id] -= amount; } /** * @dev See {ERC1155-_burnBatch}. */ function _burnBatch( address account, uint256[] memory ids, uint256[] memory amounts ) internal virtual override { super._burnBatch(account, ids, amounts); for (uint256 i = 0; i < ids.length; ++i) { _totalSupply[ids[i]] -= amounts[i]; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = keccak256(abi.encodePacked(computedHash, proofElement)); } else { // Hash(current element of the proof + current computed hash) computedHash = keccak256(abi.encodePacked(proofElement, computedHash)); } } // Check if the computed hash (root) is equal to the provided root return computedHash == root; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// .......................................................................... // .......................................................................... // .......................................................................... // .......................................................................... // ..........................*&&&&&,........&&&&&&........................... // .....................,(....&&&&&(.......&&*..,&&.......................... // .................,&&/.&&....&&&&#.........&&&&&...,&&&&&&................. // ...................&&&.........................../&#&&&&.................. // ....................#&............***.***.............&&....,............. // ...........&&&&&&&&...............***.***................*&&&*&&.......... // ............&&&&..........................................&&...&&......... // .............&&.......&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%......,&&&&.......... // ....................&&&&&.....,*#&&&&&&&&&#*,.....&&&&%................... // ....................&&&............&&&&&...........,&&&................... // ...................&&&&............,&&&,............&&&&.................. // ...................&&&&%........*%&&&&&&&#*........&&&&&.................. // ...................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.................. // ..............,......&&&&&&&&%&&&&&&...&&&&&&%&&&&&&&&......*............. // ...............*.............&&&&&.......&&&&&............**.............. // ...............,**..........&&&&%....&....&&&&&.........***............... // ................****........&&&&&&&&&&&&&&&&&&&.......****................ // ...............*******.......&&&&&&&&&&&&&&&&&......,******............... // .................****.......&&&&&&,(&&&&*&&&&&&......****................. // ..................****..............................****.................. // ..................******.....&&&.*&&&&&&&.,&&&....******.................. // .....................**.......&&&&&&&&&&&&&&&......**..................... // .......................**......&&&&&&&&&&&&&.....**....................... // ..................................#&&&&&(................................. // .......................................................................... // ....................................***................................... // .......................................................................... // .......................................................................... // @chrishol // SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; contract ApeDaoRemix is ERC721, ERC721Enumerable, ERC721URIStorage, Pausable, Ownable, ERC721Burnable, ReentrancyGuard { using Counters for Counters.Counter; Counters.Counter private _tokenIdCounter; string public baseURI; string public provenanceHash; address public apedTokenAddress; uint256 public constant mintPrice = 200000000000000000; // 0.2 ETH uint256 public constant maximumSupply = 50 * 111; // 50 editions of 111 uint256 public constant maximumMintLimit = 5; // Maximum 5 per transaction uint256[3] public apedTokensForTier; mapping(uint256 => uint256) internal apedTokensClaimedByToken; mapping(uint256 => uint8) internal tokenTier; mapping(address => uint256) internal amountPreMintableByAddress; mapping(address => uint256) internal restrictedTokensMinted; /* Distribution of APED Tokens */ function claimApedTokens(uint256[] memory _tokenIds) public nonReentrant { require(distributionActive); require(_tokenIds.length <= 20, "Can only claim 20 per tx"); uint256 totalClaimable = 0; for (uint8 i = 0; i < _tokenIds.length; i++) { require(_isApprovedOrOwner(_msgSender(), _tokenIds[i]), "Token not approved"); uint256 amount = getClaimableApedTokens(_tokenIds[i]); totalClaimable += amount; apedTokensClaimedByToken[_tokenIds[i]] += amount; } require(totalClaimable > 0, "Nothing to claim"); IERC20(apedTokenAddress).transfer(_msgSender(), totalClaimable); // Assumes enough APED in the contract } function getClaimableApedTokens(uint256 _tokenId) public view returns (uint256) { require(_exists(_tokenId), "Token not minted"); return max(apedTokensForTier[tokenTier[_tokenId]] - apedTokensClaimedByToken[_tokenId], 0); } /* Configuration of APED Token Distribution */ function setTokenTiers(uint256[] memory _tokenIds, uint8 _tier) public onlyOwner { require(_tier <= 2); // Only three possible tiers for (uint8 i = 0; i < _tokenIds.length; i++) { tokenTier[_tokenIds[i]] = _tier; } } bool public distributionActive = false; function toggleDistributionActive() public onlyOwner { distributionActive = !distributionActive; } /* Constructor */ constructor(address _apeDaoContract, string memory _provenance) ERC721("APE DAO REMIX!", "APEDREMIX") { pause(); // Start with main sale paused provenanceHash = _provenance; apedTokenAddress = _apeDaoContract; apedTokensForTier[0] = 10000000000000000000; // 10 APED per basic token apedTokensForTier[1] = 50000000000000000000; // 50 APED per silver token apedTokensForTier[2] = 250000000000000000000; // 250 APED per gold token } /* Minting */ bool public walletRestrictionActive = true; function toggleWalletRestrictionActive() public onlyOwner { walletRestrictionActive = !walletRestrictionActive; } function pause() public onlyOwner { _pause(); } function unpause() public onlyOwner { _unpause(); } event ApeDaoRemixMinted( address account, uint256 tokenId ); function mintApeDaoRemix(uint256 _quantity) public payable whenNotPaused nonReentrant { require(_tokenIdCounter.current() + _quantity <= maximumSupply, "Not enough left"); require(_quantity <= maximumMintLimit, "Max 5 per tx"); require(mintPrice * _quantity <= msg.value, "Not enough ETH"); // Limit to 10 mints per address until we take the handbrake off if (walletRestrictionActive) { require(restrictedTokensMinted[_msgSender()] + _quantity <= 10, "Only 10 per address"); restrictedTokensMinted[_msgSender()] += _quantity; } mint(_quantity); } function mint(uint256 _quantity) internal { for(uint8 i = 0; i < _quantity; i++) { _tokenIdCounter.increment(); // Increment first so that we start at token 1 _safeMint(_msgSender(), _tokenIdCounter.current()); emit ApeDaoRemixMinted(_msgSender(), _tokenIdCounter.current()); } } /* Pre-Minting - For APED holders */ bool public preMintingActive = false; function togglePreMintingActive() public onlyOwner { preMintingActive = !preMintingActive; } function preMint(uint256 _quantity) public payable nonReentrant { require(preMintingActive); require(_tokenIdCounter.current() + _quantity <= maximumSupply, "Not enough left"); require(_quantity < amountPreMintableByAddress[_msgSender()] + 1, "Over allowance"); require(_quantity <= maximumMintLimit, "Max 5 per tx"); require(mintPrice * _quantity <= msg.value, "Not enough ETH"); amountPreMintableByAddress[_msgSender()] -= _quantity; mint(_quantity); } function pushPreMinters(address[] memory _preMinters, uint256 _amount) public onlyOwner { for(uint8 i = 0; i < _preMinters.length; i++) { amountPreMintableByAddress[_preMinters[i]] += _amount; } } function getAmountPreMintable(address _userAddress) public view returns (uint256 amountPreMintable) { amountPreMintable = amountPreMintableByAddress[_userAddress]; } /* Owner Minting - Allow a small number of pre-mints without ETH payment required */ function ownerMint(uint256 _quantity) public onlyOwner { require(_tokenIdCounter.current() + _quantity <= 10); mint(_quantity); } /* Helpers */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /* Open Zeppelin Overrides and Default Methods */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); } function setTokenURI(uint256 _tokenId, string memory _tokenURI) public onlyOwner { _setTokenURI(_tokenId, _tokenURI); } function setBaseURI(string memory baseURI_) public onlyOwner { baseURI = baseURI_; } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage) { super._burn(tokenId); } function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory) { return super.tokenURI(tokenId); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } function withdraw() public onlyOwner { Address.sendValue(payable(0xCa52757875aBDFc1DDed370828DFc2bE2d4D53c4), address(this).balance * 2 / 100); Address.sendValue(payable(0xA7Ab7a265F274FA664187698932D3CaBb851023d), address(this).balance); } function withdrawTokens(IERC20 token) public onlyOwner { require(address(token) != address(0)); token.transfer(_msgSender(), token.balanceOf(address(this))); } receive() external payable {} }
// // ,. ;-. ,--. ,-. ,. ,-. // / \ | ) | | \ / \ / \ // |--| |-' |- | | |--| | | // | | | | | / | | \ / // ' ' ' `--' `-' ' ' `-' // // .......................................................................... // .......................................................................... // .......................................................................... // .......................................................................... // ..........................*&&&&&,........&&&&&&........................... // .....................,(....&&&&&(.......&&*..,&&.......................... // .................,&&/.&&....&&&&#.........&&&&&...,&&&&&&................. // ...................&&&.........................../&#&&&&.................. // ....................#&............***.***.............&&....,............. // ...........&&&&&&&&...............***.***................*&&&*&&.......... // ............&&&&..........................................&&...&&......... // .............&&.......&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%......,&&&&.......... // ....................&&&&&.....,*#&&&&&&&&&#*,.....&&&&%................... // ....................&&&............&&&&&...........,&&&................... // ...................&&&&............,&&&,............&&&&.................. // ...................&&&&%........*%&&&&&&&#*........&&&&&.................. // ...................&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&.................. // ..............,......&&&&&&&&%&&&&&&...&&&&&&%&&&&&&&&......*............. // ...............*.............&&&&&.......&&&&&............**.............. // ...............,**..........&&&&%....&....&&&&&.........***............... // ................****........&&&&&&&&&&&&&&&&&&&.......****................ // ...............*******.......&&&&&&&&&&&&&&&&&......,******............... // .................****.......&&&&&&,(&&&&*&&&&&&......****................. // ..................****..............................****.................. // ..................******.....&&&.*&&&&&&&.,&&&....******.................. // .....................**.......&&&&&&&&&&&&&&&......**..................... // .......................**......&&&&&&&&&&&&&.....**....................... // ..................................#&&&&&(................................. // .......................................................................... // ....................................***................................... // .......................................................................... // .......................................................................... /* ██████╗ ███████╗███╗ ███╗██╗██╗ ██╗██╗ ██╔══██╗██╔════╝████╗ ████║██║╚██╗██╔╝██║ ██████╔╝█████╗ ██╔████╔██║██║ ╚███╔╝ ██║ ██╔══██╗██╔══╝ ██║╚██╔╝██║██║ ██╔██╗ ╚═╝ ██║ ██║███████╗██║ ╚═╝ ██║██║██╔╝ ██╗██╗ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚═╝ ███╗ ███╗██╗███╗ ██╗████████╗ ████╗ ████║██║████╗ ██║╚══██╔══╝ ██╔████╔██║██║██╔██╗ ██║ ██║ ██║╚██╔╝██║██║██║╚██╗██║ ██║ ██║ ╚═╝ ██║██║██║ ╚████║ ██║ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝ ╚═╝ ██████╗██╗ ██╗ ██╗██████╗ ██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║ ██║ ██║██████╔╝ ██║ ██║ ██║ ██║██╔══██╗ ╚██████╗███████╗╚██████╔╝██████╔╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract RemixMintClub is ERC1155, ERC1155Burnable, ERC1155Supply, Ownable, Pausable, ReentrancyGuard { using Strings for uint256; using Counters for Counters.Counter; bytes32 public currentMerkleRoot; Counters.Counter public merkleCounter; mapping(address => uint256) public lastClaimed; string public baseURI; // 1 = Gold Token // 2 = Mint Token // 3 = Promotional Token uint256 internal MAX_TOKEN_COUNT = 3; constructor(string memory _baseURI) ERC1155(_baseURI) { baseURI = _baseURI; pauseSale(); // Start paused } function uri(uint256 _tokenId) public view override returns (string memory) { require(_tokenId > 0 && _tokenId <= MAX_TOKEN_COUNT, "URI requested for invalid token"); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, _tokenId.toString())) : baseURI; } /* Minting */ function claim(uint256[] memory _tokenIds, uint256[] memory _quantities, bytes32[] calldata _proof) public whenNotPaused nonReentrant { require(_tokenIds.length == _quantities.length); require(lastClaimed[msg.sender] < merkleCounter.current()); require(verify(leaf(msg.sender, _tokenIds, _quantities), _proof), "Invalid merkle proof"); lastClaimed[msg.sender] = merkleCounter.current(); for (uint256 i = 0; i < _tokenIds.length; i++) { mintInternal(msg.sender, _tokenIds[i], _quantities[i]); } } function ownerMint(address _to, uint256 _tokenId, uint256 _quantity) public onlyOwner { mintInternal(_to, _tokenId, _quantity); } function mintInternal(address _account, uint256 _tokenId, uint256 _quantity) internal { require(_tokenId > 0 && _tokenId <= MAX_TOKEN_COUNT); _mint(_account, _tokenId, _quantity, ""); } /* Merkle Tree Helper Functions */ function leaf(address _account, uint256[] memory _tokenIds, uint256[] memory _quantities) internal pure returns (bytes32) { bytes memory concatResult = abi.encodePacked(_account); for (uint256 i = 0; i < _tokenIds.length; i++) { concatResult = abi.encodePacked(concatResult, ','); concatResult = abi.encodePacked(concatResult, _tokenIds[i]); concatResult = abi.encodePacked(concatResult, ','); concatResult = abi.encodePacked(concatResult, _quantities[i]); } return keccak256(concatResult); } function verify(bytes32 _leaf, bytes32[] memory _proof) internal view returns (bool) { return MerkleProof.verify(_proof, currentMerkleRoot, _leaf); } /* Owner Functions */ function setMerkleRoot(bytes32 _merkleRoot) public onlyOwner { merkleCounter.increment(); currentMerkleRoot = _merkleRoot; } function pauseSale() public onlyOwner { _pause(); } function unpauseSale() public onlyOwner { _unpause(); } function setBaseURI(string memory _baseURI) public onlyOwner { baseURI = _baseURI; } function withdraw() public onlyOwner { Address.sendValue(payable(0xA7Ab7a265F274FA664187698932D3CaBb851023d), address(this).balance); } function withdrawTokens(IERC20 token) public onlyOwner { require(address(token) != address(0)); token.transfer(_msgSender(), token.balanceOf(address(this))); } receive() external payable {} /* Overrides */ function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal override(ERC1155, ERC1155Supply) { super._mint(account, id, amount, data); } function _mintBatch(address account, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal override(ERC1155, ERC1155Supply) { super._mintBatch(account, ids, amounts, data); } function _burn(address account, uint256 id, uint256 amount) internal override(ERC1155, ERC1155Supply) { super._burn(account, id, amount); } function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal override(ERC1155, ERC1155Supply) { super._burnBatch(account, ids, amounts); } } /* Contract by: _ _ _ _ ____ | | (_) | | | | / __ \ ___ | |__ _ __ _ ___ | |__ ___ | | / / _` | / __|| '_ \ | '__|| |/ __|| '_ \ / _ \ | | | | (_| || (__ | | | || | | |\__ \| | | || (_) || | \ \__,_| \___||_| |_||_| |_||___/|_| |_| \___/ |_| \____/ */
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "petersburg", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address payable","name":"_MINT_TOKEN_CONTRACT_ADDRESS","type":"address"},{"internalType":"address payable","name":"_REMIX_CONTRACT_ADDRESS","type":"address"},{"internalType":"uint16","name":"_maximumSupply","type":"uint16"},{"internalType":"uint16","name":"_maximumGoldSupply","type":"uint16"},{"internalType":"uint256","name":"_mintCost","type":"uint256"},{"internalType":"uint8","name":"_transactionLimit","type":"uint8"},{"internalType":"address","name":"_payableAddress1","type":"address"},{"internalType":"address","name":"_payableAddress2","type":"address"},{"internalType":"bool","name":"_remixHolderRequired","type":"bool"},{"internalType":"string","name":"_provenanceHash","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"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":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_TOKEN_CONTRACT_ADDRESS","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAYABLE_ADDRESS_1","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAYABLE_ADDRESS_2","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REMIX_CONTRACT_ADDRESS","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"adminMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getDoubleGoldWalletHolder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDoubleGoldWalletHolderAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"},{"internalType":"enum OriginalsPrimaDonna.TokenRequirementType","name":"_tokenRequirement","type":"uint8"}],"name":"getMintAllowance","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"},{"internalType":"enum OriginalsPrimaDonna.TokenRequirementType","name":"_tokenRequirement","type":"uint8"}],"name":"getNumMints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maximumGoldSupply","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maximumSupply","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"mintADC","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint8","name":"numGoldTokens","type":"uint8"},{"internalType":"uint8","name":"numBasicTokens","type":"uint8"}],"name":"mintADCWithToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintTokenRequirement","outputs":[{"internalType":"enum OriginalsPrimaDonna.TokenRequirementType","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"remixHolderRequired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseURI_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"setDoubleGoldWalletHolders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_maximumGoldSupply","type":"uint16"}],"name":"setMaximumGoldSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mintCost","type":"uint256"}],"name":"setMintCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum OriginalsPrimaDonna.TokenRequirementType","name":"_mintTokenRequirement","type":"uint8"}],"name":"setMintTokenRequirement","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setRemixHolderRequired","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transactionLimit","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
61010060408190526018805461ff00191690911790553480156200002257600080fd5b50604051620049b8380380620049b88339810160408190526200004591620006eb565b604080518082018252600b81527f5072696d6120446f6e6e6100000000000000000000000000000000000000000060208083019182528351808501909452600a84527f5052494d41444f4e4e4100000000000000000000000000000000000000000000908401528151919291620000bf9160009162000510565b508051620000d590600190602084019062000510565b505050620000f2620000ec6200030b60201b60201c565b6200030f565b600c805460ff60a01b191690556001600d556001600160a01b03808b16608052891660a0526012805461ffff898116620100000263ffffffff19909216908b161717905560138690556200014860003362000361565b620001747fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217753362000361565b60188054600161ffff19918216610100861515021781179092556001600160a01b0386811660c052851660e0526012805460ff60201b191664010000000060ff8a16021790556000808052601560208190527fa31547ce6245cdb9ecea19cf8c7eb9f5974025bb4075011409251ae855b30aed8054600a94168417905591926003811115620002075762000207620007d9565b815260200190815260200160002060006101000a81548161ffff021916908361ffff160217905550600a60156000600260038111156200024b576200024b620007d9565b60038111156200025f576200025f620007d9565b815260200190815260200160002060006101000a81548161ffff021916908361ffff160217905550600a60156000600380811115620002a257620002a2620007d9565b6003811115620002b657620002b6620007d9565b8152602080820192909252604001600020805461ffff191661ffff93909316929092179091558151620002f0916011919084019062000510565b50620002fb62000371565b505050505050505050506200085e565b3390565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6200036d82826200046c565b5050565b62000396600c5474010000000000000000000000000000000000000000900460ff1690565b1562000402576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640160405180910390fd5b600c805460ff60a01b1916740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586200044f3390565b6040516001600160a01b03909116815260200160405180910390a1565b6000828152600b602090815260408083206001600160a01b038516845290915290205460ff166200036d576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620004cc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b8280546200051e9062000808565b90600052602060002090601f0160209004810192826200054257600085556200058d565b82601f106200055d57805160ff19168380011785556200058d565b828001600101855582156200058d579182015b828111156200058d57825182559160200191906001019062000570565b506200059b9291506200059f565b5090565b5b808211156200059b5760008155600101620005a0565b6001600160a01b0381168114620005cc57600080fd5b50565b805161ffff81168114620005e257600080fd5b919050565b8051620005e281620005b6565b80518015158114620005e257600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f8301126200064657600080fd5b81516001600160401b038082111562000663576200066362000605565b604051601f8301601f19908116603f011681019082821181831017156200068e576200068e62000605565b81604052838152602092508683858801011115620006ab57600080fd5b600091505b83821015620006cf5785820183015181830184015290820190620006b0565b83821115620006e15760008385830101525b9695505050505050565b6000806000806000806000806000806101408b8d0312156200070c57600080fd5b8a516200071981620005b6565b60208c0151909a506200072c81620005b6565b98506200073c60408c01620005cf565b97506200074c60608c01620005cf565b965060808b0151955060a08b015160ff811681146200076a57600080fd5b94506200077a60c08c01620005e7565b93506200078a60e08c01620005e7565b92506200079b6101008c01620005f4565b6101208c01519092506001600160401b03811115620007b957600080fd5b620007c78d828e0162000634565b9150509295989b9194979a5092959850565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600181811c908216806200081d57607f821691505b6020821081141562000858577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60805160a05160c05160e051614104620008b4600039600081816108ec01526110350152600081816108820152610ff401526000818161068401526123170152600081816109ef0152611c8c01526141046000f3fe60806040526004361061036b5760003560e01c8063784eadcf116101c6578063bf9aa9d0116100f7578063e6fa08da11610095578063f19605d61161006f578063f19605d614610a5a578063f2fde38b14610a8e578063f8843e3714610aae578063fab84db614610ad057600080fd5b8063e6fa08da146109ca578063e87176f0146109dd578063e985e9c514610a1157600080fd5b8063c6ab67a3116100d1578063c6ab67a31461094e578063c87b56dd14610963578063d547741f14610983578063da1def47146109a357600080fd5b8063bf9aa9d0146108da578063c1f261231461090e578063c4ddce431461092e57600080fd5b806391d1485411610164578063a22cb4651161013e578063a22cb46514610850578063b5f26dcf14610870578063b88d4fde146108a4578063bdb4b848146108c457600080fd5b806391d148541461080657806395d89b4114610826578063a217fddf1461083b57600080fd5b80638456cb59116101a05780638456cb59146107925780638545f4ea146107a75780638b9f2f08146107c75780638da5cb5b146107e857600080fd5b8063784eadcf14610732578063837ad07b14610752578063841d95521461077257600080fd5b806342842e0e116102a05780635c975abb1161023e5780636c0360eb116102185780636c0360eb146106c657806370a08231146106db578063715018a6146106fb57806375b238fc1461071057600080fd5b80635c975abb146106535780636113494c146106725780636352211e146106a657600080fd5b80634b410d0a1161027a5780634b410d0a146105d45780634f6ccce7146105f457806355f804b31461061457806357957ab21461063457600080fd5b806342842e0e1461055b57806342966c681461057b578063463aa1851461059b57600080fd5b806323b872dd1161030d5780632f745c59116102e75780632f745c59146104f157806336568abe146105115780633ccfd60b146105315780633f4ba83a1461054657600080fd5b806323b872dd14610481578063248a9ca3146104a15780632f2ff15d146104d157600080fd5b8063081812fc11610349578063081812fc146103f5578063095ea7b31461042d57806316809fe21461044f57806318160ddd1461046257600080fd5b806301ffc9a7146103705780630480e58b146103a557806306fdde03146103d3575b600080fd5b34801561037c57600080fd5b5061039061038b3660046137b8565b610af0565b60405190151581526020015b60405180910390f35b3480156103b157600080fd5b506012546103c09061ffff1681565b60405161ffff909116815260200161039c565b3480156103df57600080fd5b506103e8610b01565b60405161039c919061382d565b34801561040157600080fd5b50610415610410366004613840565b610b93565b6040516001600160a01b03909116815260200161039c565b34801561043957600080fd5b5061044d610448366004613875565b610c2d565b005b61044d61045d366004613840565b610d43565b34801561046e57600080fd5b506008545b60405190815260200161039c565b34801561048d57600080fd5b5061044d61049c36600461389f565b610e4f565b3480156104ad57600080fd5b506104736104bc366004613840565b6000908152600b602052604090206001015490565b3480156104dd57600080fd5b5061044d6104ec3660046138db565b610e81565b3480156104fd57600080fd5b5061047361050c366004613875565b610ea7565b34801561051d57600080fd5b5061044d61052c3660046138db565b610f3d565b34801561053d57600080fd5b5061044d610fbb565b34801561055257600080fd5b5061044d61105d565b34801561056757600080fd5b5061044d61057636600461389f565b611099565b34801561058757600080fd5b5061044d610596366004613840565b6110b4565b3480156105a757600080fd5b506103906105b6366004613907565b6001600160a01b031660009081526016602052604090205460ff1690565b3480156105e057600080fd5b506104736105ef366004613931565b61112e565b34801561060057600080fd5b5061047361060f366004613840565b611181565b34801561062057600080fd5b5061044d61062f3660046139e7565b611214565b34801561064057600080fd5b5060185461039090610100900460ff1681565b34801561065f57600080fd5b50600c54600160a01b900460ff16610390565b34801561067e57600080fd5b506104157f000000000000000000000000000000000000000000000000000000000000000081565b3480156106b257600080fd5b506104156106c1366004613840565b61125b565b3480156106d257600080fd5b506103e86112d2565b3480156106e757600080fd5b506104736106f6366004613907565b611360565b34801561070757600080fd5b5061044d6113e7565b34801561071c57600080fd5b506104736000805160206140af83398151915281565b34801561073e57600080fd5b5061044d61074d366004613a40565b61144b565b34801561075e57600080fd5b506103c061076d366004613931565b611499565b34801561077e57600080fd5b5061044d61078d366004613a5b565b61152d565b34801561079e57600080fd5b5061044d611588565b3480156107b357600080fd5b5061044d6107c2366004613840565b6115c4565b3480156107d357600080fd5b506012546103c09062010000900461ffff1681565b3480156107f457600080fd5b50600c546001600160a01b0316610415565b34801561081257600080fd5b506103906108213660046138db565b6115fd565b34801561083257600080fd5b506103e8611628565b34801561084757600080fd5b50610473600081565b34801561085c57600080fd5b5061044d61086b366004613a76565b611637565b34801561087c57600080fd5b506104157f000000000000000000000000000000000000000000000000000000000000000081565b3480156108b057600080fd5b5061044d6108bf366004613aa0565b6116fc565b3480156108d057600080fd5b5061047360135481565b3480156108e657600080fd5b506104157f000000000000000000000000000000000000000000000000000000000000000081565b34801561091a57600080fd5b5061044d610929366004613840565b611734565b34801561093a57600080fd5b5061044d610949366004613b1c565b6117fa565b34801561095a57600080fd5b506103e8611983565b34801561096f57600080fd5b506103e861097e366004613840565b611990565b34801561098f57600080fd5b5061044d61099e3660046138db565b61199b565b3480156109af57600080fd5b506018546109bd9060ff1681565b60405161039c9190613ba7565b61044d6109d8366004613be0565b6119c1565b3480156109e957600080fd5b506104157f000000000000000000000000000000000000000000000000000000000000000081565b348015610a1d57600080fd5b50610390610a2c366004613c0a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610a6657600080fd5b50601254610a7c90640100000000900460ff1681565b60405160ff909116815260200161039c565b348015610a9a57600080fd5b5061044d610aa9366004613907565b611e31565b348015610aba57600080fd5b50610ac3611ef9565b60405161039c9190613c34565b348015610adc57600080fd5b5061044d610aeb366004613c81565b611f5a565b6000610afb82611fae565b92915050565b606060008054610b1090613ca5565b80601f0160208091040260200160405190810160405280929190818152602001828054610b3c90613ca5565b8015610b895780601f10610b5e57610100808354040283529160200191610b89565b820191906000526020600020905b815481529060010190602001808311610b6c57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610c115760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610c388261125b565b9050806001600160a01b0316836001600160a01b03161415610ca65760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c08565b336001600160a01b0382161480610cc25750610cc28133610a2c565b610d345760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610c08565b610d3e8383611fd3565b505050565b600c54600160a01b900460ff1615610d6d5760405162461bcd60e51b8152600401610c0890613ce0565b6002600d541415610dc05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c08565b6002600d55600060185460ff166003811115610dde57610dde613b91565b14610e355760405162461bcd60e51b815260206004820152602160248201527f4d696e7420746f6b656e732061726520726571756972656420746f206d696e746044820152601760f91b6064820152608401610c08565b610e3e81612041565b610e47816123f6565b506001600d55565b610e5a335b82612492565b610e765760405162461bcd60e51b8152600401610c0890613d0a565b610d3e838383612589565b6000828152600b6020526040902060010154610e9d8133612734565b610d3e8383612798565b6000610eb283611360565b8210610f145760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610c08565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6001600160a01b0381163314610fad5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c08565b610fb7828261281e565b5050565b610fd36000805160206140af833981519152336115fd565b610fef5760405162461bcd60e51b8152600401610c0890613d5b565b6110307f000000000000000000000000000000000000000000000000000000000000000060646110213031603c613da1565b61102b9190613dd6565b612885565b61105b7f00000000000000000000000000000000000000000000000000000000000000003031612885565b565b6110756000805160206140af833981519152336115fd565b6110915760405162461bcd60e51b8152600401610c0890613d5b565b61105b61299f565b610d3e838383604051806020016040528060008152506116fc565b6110bd33610e54565b6111225760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201526f1b995c881b9bdc88185c1c1c9bdd995960821b6064820152608401610c08565b61112b81612a3c565b50565b6001600160a01b03821660009081526014602052604081208183600381111561115957611159613b91565b600381111561116a5761116a613b91565b815260200190815260200160002054905092915050565b600061118c60085490565b82106111ef5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610c08565b6008828154811061120257611202613dea565b90600052602060002001549050919050565b61122c6000805160206140af833981519152336115fd565b6112485760405162461bcd60e51b8152600401610c0890613d5b565b8051610fb79060109060208401906136b5565b6000818152600260205260408120546001600160a01b031680610afb5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c08565b601080546112df90613ca5565b80601f016020809104026020016040519081016040528092919081815260200182805461130b90613ca5565b80156113585780601f1061132d57610100808354040283529160200191611358565b820191906000526020600020905b81548152906001019060200180831161133b57829003601f168201915b505050505081565b60006001600160a01b0382166113cb5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c08565b506001600160a01b031660009081526003602052604090205490565b600c546001600160a01b031633146114415760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c08565b61105b6000612a45565b6114636000805160206140af833981519152336115fd565b61147f5760405162461bcd60e51b8152600401610c0890613d5b565b601880549115156101000261ff0019909216919091179055565b600080601560008460038111156114b2576114b2613b91565b60038111156114c3576114c3613b91565b815260208101919091526040016000205461ffff16905060018360038111156114ee576114ee613b91565b14801561151357506001600160a01b03841660009081526016602052604090205460ff165b1561152657611523816002613e00565b90505b9392505050565b6115456000805160206140af833981519152336115fd565b6115615760405162461bcd60e51b8152600401610c0890613d5b565b6018805482919060ff1916600183600381111561158057611580613b91565b021790555050565b6115a06000805160206140af833981519152336115fd565b6115bc5760405162461bcd60e51b8152600401610c0890613d5b565b61105b612a97565b6115dc6000805160206140af833981519152336115fd565b6115f85760405162461bcd60e51b8152600401610c0890613d5b565b601355565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060018054610b1090613ca5565b6001600160a01b0382163314156116905760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c08565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6117063383612492565b6117225760405162461bcd60e51b8152600401610c0890613d0a565b61172e84848484612afc565b50505050565b61174c6000805160206140af833981519152336115fd565b6117685760405162461bcd60e51b8152600401610c0890613d5b565b600081116117b85760405162461bcd60e51b815260206004820152601f60248201527f5175616e74697479206d7573742062652067726561746572207468616e2030006044820152606401610c08565b60125461ffff16816117c9600e5490565b6117d39190613e2a565b11156117f15760405162461bcd60e51b8152600401610c0890613e42565b61112b81612b2f565b6118126000805160206140af833981519152336115fd565b61182e5760405162461bcd60e51b8152600401610c0890613d5b565b60005b60175460ff821610156118a05760006016600060178460ff168154811061185a5761185a613dea565b6000918252602080832091909101546001600160a01b031683528201929092526040019020805460ff19169115159190911790558061189881613e8d565b915050611831565b506118ad60176000613739565b60005b60ff8116821115610d3e5760016016600085858560ff168181106118d6576118d6613dea565b90506020020160208101906118eb9190613907565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790556017838360ff841681811061192a5761192a613dea565b905060200201602081019061193f9190613907565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790558061197b81613e8d565b9150506118b0565b601180546112df90613ca5565b6060610afb82612b69565b6000828152600b60205260409020600101546119b78133612734565b610d3e838361281e565b600c54600160a01b900460ff16156119eb5760405162461bcd60e51b8152600401610c0890613ce0565b6002600d541415611a3e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c08565b6002600d55600060185460ff166003811115611a5c57611a5c613b91565b1415611ab85760405162461bcd60e51b815260206004820152602560248201527f4d696e7420746f6b656e7320617265206e6f7420726571756972656420746f2060448201526436b4b73a1760d91b6064820152608401610c08565b600160185460ff166003811115611ad157611ad1613b91565b1415611b935760008260ff1611611b345760405162461bcd60e51b815260206004820152602160248201527f476f6c6420746f6b656e206d7573742062652067726561746572207468616e206044820152600360fc1b6064820152608401610c08565b60ff811615611b935760405162461bcd60e51b815260206004820152602560248201527f6f6e6c7920676f6c6420746f6b656e732061726520726571756972656420746f604482015264081b5a5b9d60da1b6064820152608401610c08565b600260185460ff166003811115611bac57611bac613b91565b1415611c705760008160ff1611611c105760405162461bcd60e51b815260206004820152602260248201527f426173696320746f6b656e206d7573742062652067726561746572207468616e604482015261020360f41b6064820152608401610c08565b60ff821615611c705760405162461bcd60e51b815260206004820152602660248201527f6f6e6c7920626173696320746f6b656e732061726520726571756972656420746044820152651bc81b5a5b9d60d21b6064820152608401610c08565b6000611c7c8284613ead565b60ff169050611c8a81612041565b7f0000000000000000000000000000000000000000000000000000000000000000600160185460ff166003811115611cc457611cc4613b91565b1480611ce65750600360185460ff166003811115611ce457611ce4613b91565b145b8015611cf5575060008460ff16115b15611d6457604051637a94c56560e11b81523360048201526001602482015260ff851660448201526001600160a01b0382169063f5298aca90606401600060405180830381600087803b158015611d4b57600080fd5b505af1158015611d5f573d6000803e3d6000fd5b505050505b600260185460ff166003811115611d7d57611d7d613b91565b1480611d9f5750600360185460ff166003811115611d9d57611d9d613b91565b145b8015611dae575060008360ff16115b15611e1d57604051637a94c56560e11b81523360048201526002602482015260ff841660448201526001600160a01b0382169063f5298aca90606401600060405180830381600087803b158015611e0457600080fd5b505af1158015611e18573d6000803e3d6000fd5b505050505b611e26826123f6565b50506001600d555050565b600c546001600160a01b03163314611e8b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c08565b6001600160a01b038116611ef05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c08565b61112b81612a45565b60606017805480602002602001604051908101604052809291908181526020018280548015610b8957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611f33575050505050905090565b611f726000805160206140af833981519152336115fd565b611f8e5760405162461bcd60e51b8152600401610c0890613d5b565b6012805461ffff909216620100000263ffff000019909216919091179055565b60006001600160e01b03198216637965db0b60e01b1480610afb5750610afb82612cdb565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906120088261125b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600160185460ff16600381111561205a5761205a613b91565b14156120f157601254600f546201000090910461ffff169061207d908390613e2a565b11156120f15760405162461bcd60e51b815260206004820152603b60248201527f5175616e74697479206d757374206265206c657373207468616e2072656d616960448201527f6e696e6720737570706c7920666f7220476f6c6420746f6b656e7300000000006064820152608401610c08565b600081116121415760405162461bcd60e51b815260206004820152601f60248201527f5175616e74697479206d7573742062652067726561746572207468616e2030006044820152606401610c08565b60125461ffff1681612152600e5490565b61215c9190613e2a565b111561217a5760405162461bcd60e51b8152600401610c0890613e42565b60185460009061218e90339060ff16611499565b33600090815260146020526040812060185492935061ffff84169285929060ff1660038111156121c0576121c0613b91565b60038111156121d1576121d1613b91565b8152602001908152602001600020546121ea9190613e2a565b11156122385760405162461bcd60e51b815260206004820152601f60248201527f457863656564732077616c6c6574206c696d697420666f722077696e646f77006044820152606401610c08565b601254640100000000900460ff168211156122955760405162461bcd60e51b815260206004820152601760248201527f546f6f206d616e7920746f6b656e7320746f206d696e740000000000000000006044820152606401610c08565b816013546122a39190613da1565b3410156122f25760405162461bcd60e51b815260206004820152601e60248201527f496e73756666696369656e742066756e647320666f72206d696e74696e6700006044820152606401610c08565b601854610100900460ff1615610fb7576040516370a0823160e01b81523360048201527f0000000000000000000000000000000000000000000000000000000000000000906000906001600160a01b038316906370a082319060240160206040518083038186803b15801561236657600080fd5b505afa15801561237a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239e9190613ed2565b11610d3e5760405162461bcd60e51b815260206004820152602260248201527f596f75206d75737420626520612052656d697820686f6c64657220746f206d696044820152611b9d60f21b6064820152608401610c08565b33600090815260146020526040812060185483929060ff16600381111561241f5761241f613b91565b600381111561243057612430613b91565b8152602001908152602001600020600082825461244d9190613e2a565b909155506001905060185460ff16600381111561246c5761246c613b91565b14156117f15780600f60008282546124849190613e2a565b909155505061112b81612b2f565b6000818152600260205260408120546001600160a01b031661250b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c08565b60006125168361125b565b9050806001600160a01b0316846001600160a01b031614806125515750836001600160a01b031661254684610b93565b6001600160a01b0316145b8061258157506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661259c8261125b565b6001600160a01b0316146126045760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610c08565b6001600160a01b0382166126665760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c08565b612671838383612d00565b61267c600082611fd3565b6001600160a01b03831660009081526003602052604081208054600192906126a5908490613eeb565b90915550506001600160a01b03821660009081526003602052604081208054600192906126d3908490613e2a565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61273e82826115fd565b610fb757612756816001600160a01b03166014612d0b565b612761836020612d0b565b604051602001612772929190613f02565b60408051601f198184030181529082905262461bcd60e51b8252610c089160040161382d565b6127a282826115fd565b610fb7576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556127da3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61282882826115fd565b15610fb7576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b30318111156128d65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c08565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612923576040519150601f19603f3d011682016040523d82523d6000602084013e612928565b606091505b5050905080610d3e5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c08565b600c54600160a01b900460ff166129ef5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c08565b600c805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61112b81612ea7565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600c54600160a01b900460ff1615612ac15760405162461bcd60e51b8152600401610c0890613ce0565b600c805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612a1f3390565b612b07848484612589565b612b1384848484612ee7565b61172e5760405162461bcd60e51b8152600401610c0890613f77565b60005b818160ff161015610fb757612b4b600e80546001019055565b612b5733600e54612ff4565b80612b6181613e8d565b915050612b32565b6000818152600260205260409020546060906001600160a01b0316612bea5760405162461bcd60e51b815260206004820152603160248201527f45524337323155524953746f726167653a2055524920717565727920666f72206044820152703737b732bc34b9ba32b73a103a37b5b2b760791b6064820152608401610c08565b6000828152600a602052604081208054612c0390613ca5565b80601f0160208091040260200160405190810160405280929190818152602001828054612c2f90613ca5565b8015612c7c5780601f10612c5157610100808354040283529160200191612c7c565b820191906000526020600020905b815481529060010190602001808311612c5f57829003601f168201915b505050505090506000612c8d61300e565b9050805160001415612ca0575092915050565b815115612cd2578082604051602001612cba929190613fc9565b60405160208183030381529060405292505050919050565b6125818461301d565b60006001600160e01b0319821663780e9d6360e01b1480610afb5750610afb826130f7565b610d3e838383613147565b60606000612d1a836002613da1565b612d25906002613e2a565b67ffffffffffffffff811115612d3d57612d3d61395b565b6040519080825280601f01601f191660200182016040528015612d67576020820181803683370190505b509050600360fc1b81600081518110612d8257612d82613dea565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612db157612db1613dea565b60200101906001600160f81b031916908160001a9053506000612dd5846002613da1565b612de0906001613e2a565b90505b6001811115612e58576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612e1457612e14613dea565b1a60f81b828281518110612e2a57612e2a613dea565b60200101906001600160f81b031916908160001a90535060049490941c93612e5181613ff8565b9050612de3565b5083156115265760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c08565b612eb0816131ff565b6000818152600a602052604090208054612ec990613ca5565b15905061112b576000818152600a6020526040812061112b91613757565b60006001600160a01b0384163b15612fe957604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612f2b90339089908890889060040161400f565b602060405180830381600087803b158015612f4557600080fd5b505af1925050508015612f75575060408051601f3d908101601f19168201909252612f729181019061404c565b60015b612fcf573d808015612fa3576040519150601f19603f3d011682016040523d82523d6000602084013e612fa8565b606091505b508051612fc75760405162461bcd60e51b8152600401610c0890613f77565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612581565b506001949350505050565b610fb78282604051806020016040528060008152506132a6565b606060108054610b1090613ca5565b6000818152600260205260409020546060906001600160a01b031661309c5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610c08565b60006130a661300e565b905060008151116130c65760405180602001604052806000815250611526565b806130d0846132d9565b6040516020016130e1929190613fc9565b6040516020818303038152906040529392505050565b60006001600160e01b031982166380ac58cd60e01b148061312857506001600160e01b03198216635b5e139f60e01b145b80610afb57506301ffc9a760e01b6001600160e01b0319831614610afb565b6001600160a01b0383166131a25761319d81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6131c5565b816001600160a01b0316836001600160a01b0316146131c5576131c583826133d7565b6001600160a01b0382166131dc57610d3e81613474565b826001600160a01b0316826001600160a01b031614610d3e57610d3e8282613523565b600061320a8261125b565b905061321881600084612d00565b613223600083611fd3565b6001600160a01b038116600090815260036020526040812080546001929061324c908490613eeb565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6132b08383613567565b6132bd6000848484612ee7565b610d3e5760405162461bcd60e51b8152600401610c0890613f77565b6060816132fd5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613327578061331181614069565b91506133209050600a83613dd6565b9150613301565b60008167ffffffffffffffff8111156133425761334261395b565b6040519080825280601f01601f19166020018201604052801561336c576020820181803683370190505b5090505b841561258157613381600183613eeb565b915061338e600a86614084565b613399906030613e2a565b60f81b8183815181106133ae576133ae613dea565b60200101906001600160f81b031916908160001a9053506133d0600a86613dd6565b9450613370565b600060016133e484611360565b6133ee9190613eeb565b600083815260076020526040902054909150808214613441576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061348690600190613eeb565b600083815260096020526040812054600880549394509092849081106134ae576134ae613dea565b9060005260206000200154905080600883815481106134cf576134cf613dea565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061350757613507614098565b6001900381819060005260206000200160009055905550505050565b600061352e83611360565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166135bd5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c08565b6000818152600260205260409020546001600160a01b0316156136225760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c08565b61362e60008383612d00565b6001600160a01b0382166000908152600360205260408120805460019290613657908490613e2a565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546136c190613ca5565b90600052602060002090601f0160209004810192826136e35760008555613729565b82601f106136fc57805160ff1916838001178555613729565b82800160010185558215613729579182015b8281111561372957825182559160200191906001019061370e565b5061373592915061378d565b5090565b508054600082559060005260206000209081019061112b919061378d565b50805461376390613ca5565b6000825580601f10613773575050565b601f01602090049060005260206000209081019061112b91905b5b80821115613735576000815560010161378e565b6001600160e01b03198116811461112b57600080fd5b6000602082840312156137ca57600080fd5b8135611526816137a2565b60005b838110156137f05781810151838201526020016137d8565b8381111561172e5750506000910152565b600081518084526138198160208601602086016137d5565b601f01601f19169290920160200192915050565b6020815260006115266020830184613801565b60006020828403121561385257600080fd5b5035919050565b80356001600160a01b038116811461387057600080fd5b919050565b6000806040838503121561388857600080fd5b61389183613859565b946020939093013593505050565b6000806000606084860312156138b457600080fd5b6138bd84613859565b92506138cb60208501613859565b9150604084013590509250925092565b600080604083850312156138ee57600080fd5b823591506138fe60208401613859565b90509250929050565b60006020828403121561391957600080fd5b61152682613859565b80356004811061387057600080fd5b6000806040838503121561394457600080fd5b61394d83613859565b91506138fe60208401613922565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561398c5761398c61395b565b604051601f8501601f19908116603f011681019082821181831017156139b4576139b461395b565b816040528093508581528686860111156139cd57600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156139f957600080fd5b813567ffffffffffffffff811115613a1057600080fd5b8201601f81018413613a2157600080fd5b61258184823560208401613971565b8035801515811461387057600080fd5b600060208284031215613a5257600080fd5b61152682613a30565b600060208284031215613a6d57600080fd5b61152682613922565b60008060408385031215613a8957600080fd5b613a9283613859565b91506138fe60208401613a30565b60008060008060808587031215613ab657600080fd5b613abf85613859565b9350613acd60208601613859565b925060408501359150606085013567ffffffffffffffff811115613af057600080fd5b8501601f81018713613b0157600080fd5b613b1087823560208401613971565b91505092959194509250565b60008060208385031215613b2f57600080fd5b823567ffffffffffffffff80821115613b4757600080fd5b818501915085601f830112613b5b57600080fd5b813581811115613b6a57600080fd5b8660208260051b8501011115613b7f57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310613bc957634e487b7160e01b600052602160045260246000fd5b91905290565b803560ff8116811461387057600080fd5b60008060408385031215613bf357600080fd5b613bfc83613bcf565b91506138fe60208401613bcf565b60008060408385031215613c1d57600080fd5b613c2683613859565b91506138fe60208401613859565b6020808252825182820181905260009190848201906040850190845b81811015613c755783516001600160a01b031683529284019291840191600101613c50565b50909695505050505050565b600060208284031215613c9357600080fd5b813561ffff8116811461152657600080fd5b600181811c90821680613cb957607f821691505b60208210811415613cda57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526016908201527521b0b63632b91034b9903737ba1030b71030b236b4b760511b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615613dbb57613dbb613d8b565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613de557613de5613dc0565b500490565b634e487b7160e01b600052603260045260246000fd5b600061ffff80831681851681830481118215151615613e2157613e21613d8b565b02949350505050565b60008219821115613e3d57613e3d613d8b565b500190565b6020808252602b908201527f5175616e74697479206d757374206265206c657373207468616e2072656d616960408201526a6e696e6720737570706c7960a81b606082015260800190565b600060ff821660ff811415613ea457613ea4613d8b565b60010192915050565b600060ff821660ff84168060ff03821115613eca57613eca613d8b565b019392505050565b600060208284031215613ee457600080fd5b5051919050565b600082821015613efd57613efd613d8b565b500390565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613f3a8160178501602088016137d5565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613f6b8160288401602088016137d5565b01602801949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008351613fdb8184602088016137d5565b835190830190613fef8183602088016137d5565b01949350505050565b60008161400757614007613d8b565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061404290830184613801565b9695505050505050565b60006020828403121561405e57600080fd5b8151611526816137a2565b600060001982141561407d5761407d613d8b565b5060010190565b60008261409357614093613dc0565b500690565b634e487b7160e01b600052603160045260246000fdfea49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220776230f1cbcdac02fd6fdaf04c2ffb191a61fef1bbd791aff881667d27eac5c864736f6c63430008090033000000000000000000000000c2faa7cf625b8adadbe423738c269558dc909d41000000000000000000000000fb61bd914d4cd5509ecbd4b16a0f96349e52db3d00000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000006a94d74f430000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000054196238400305778bff5fa200ee1896f6a9d5c2000000000000000000000000bda1e2757f9a8973926120f6977756b2468b79bb00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000004037623862386266323833353834656433353234346139383330343239386539623839656539356431646238343939346332393135376164363031616366363439
Deployed Bytecode
0x60806040526004361061036b5760003560e01c8063784eadcf116101c6578063bf9aa9d0116100f7578063e6fa08da11610095578063f19605d61161006f578063f19605d614610a5a578063f2fde38b14610a8e578063f8843e3714610aae578063fab84db614610ad057600080fd5b8063e6fa08da146109ca578063e87176f0146109dd578063e985e9c514610a1157600080fd5b8063c6ab67a3116100d1578063c6ab67a31461094e578063c87b56dd14610963578063d547741f14610983578063da1def47146109a357600080fd5b8063bf9aa9d0146108da578063c1f261231461090e578063c4ddce431461092e57600080fd5b806391d1485411610164578063a22cb4651161013e578063a22cb46514610850578063b5f26dcf14610870578063b88d4fde146108a4578063bdb4b848146108c457600080fd5b806391d148541461080657806395d89b4114610826578063a217fddf1461083b57600080fd5b80638456cb59116101a05780638456cb59146107925780638545f4ea146107a75780638b9f2f08146107c75780638da5cb5b146107e857600080fd5b8063784eadcf14610732578063837ad07b14610752578063841d95521461077257600080fd5b806342842e0e116102a05780635c975abb1161023e5780636c0360eb116102185780636c0360eb146106c657806370a08231146106db578063715018a6146106fb57806375b238fc1461071057600080fd5b80635c975abb146106535780636113494c146106725780636352211e146106a657600080fd5b80634b410d0a1161027a5780634b410d0a146105d45780634f6ccce7146105f457806355f804b31461061457806357957ab21461063457600080fd5b806342842e0e1461055b57806342966c681461057b578063463aa1851461059b57600080fd5b806323b872dd1161030d5780632f745c59116102e75780632f745c59146104f157806336568abe146105115780633ccfd60b146105315780633f4ba83a1461054657600080fd5b806323b872dd14610481578063248a9ca3146104a15780632f2ff15d146104d157600080fd5b8063081812fc11610349578063081812fc146103f5578063095ea7b31461042d57806316809fe21461044f57806318160ddd1461046257600080fd5b806301ffc9a7146103705780630480e58b146103a557806306fdde03146103d3575b600080fd5b34801561037c57600080fd5b5061039061038b3660046137b8565b610af0565b60405190151581526020015b60405180910390f35b3480156103b157600080fd5b506012546103c09061ffff1681565b60405161ffff909116815260200161039c565b3480156103df57600080fd5b506103e8610b01565b60405161039c919061382d565b34801561040157600080fd5b50610415610410366004613840565b610b93565b6040516001600160a01b03909116815260200161039c565b34801561043957600080fd5b5061044d610448366004613875565b610c2d565b005b61044d61045d366004613840565b610d43565b34801561046e57600080fd5b506008545b60405190815260200161039c565b34801561048d57600080fd5b5061044d61049c36600461389f565b610e4f565b3480156104ad57600080fd5b506104736104bc366004613840565b6000908152600b602052604090206001015490565b3480156104dd57600080fd5b5061044d6104ec3660046138db565b610e81565b3480156104fd57600080fd5b5061047361050c366004613875565b610ea7565b34801561051d57600080fd5b5061044d61052c3660046138db565b610f3d565b34801561053d57600080fd5b5061044d610fbb565b34801561055257600080fd5b5061044d61105d565b34801561056757600080fd5b5061044d61057636600461389f565b611099565b34801561058757600080fd5b5061044d610596366004613840565b6110b4565b3480156105a757600080fd5b506103906105b6366004613907565b6001600160a01b031660009081526016602052604090205460ff1690565b3480156105e057600080fd5b506104736105ef366004613931565b61112e565b34801561060057600080fd5b5061047361060f366004613840565b611181565b34801561062057600080fd5b5061044d61062f3660046139e7565b611214565b34801561064057600080fd5b5060185461039090610100900460ff1681565b34801561065f57600080fd5b50600c54600160a01b900460ff16610390565b34801561067e57600080fd5b506104157f000000000000000000000000fb61bd914d4cd5509ecbd4b16a0f96349e52db3d81565b3480156106b257600080fd5b506104156106c1366004613840565b61125b565b3480156106d257600080fd5b506103e86112d2565b3480156106e757600080fd5b506104736106f6366004613907565b611360565b34801561070757600080fd5b5061044d6113e7565b34801561071c57600080fd5b506104736000805160206140af83398151915281565b34801561073e57600080fd5b5061044d61074d366004613a40565b61144b565b34801561075e57600080fd5b506103c061076d366004613931565b611499565b34801561077e57600080fd5b5061044d61078d366004613a5b565b61152d565b34801561079e57600080fd5b5061044d611588565b3480156107b357600080fd5b5061044d6107c2366004613840565b6115c4565b3480156107d357600080fd5b506012546103c09062010000900461ffff1681565b3480156107f457600080fd5b50600c546001600160a01b0316610415565b34801561081257600080fd5b506103906108213660046138db565b6115fd565b34801561083257600080fd5b506103e8611628565b34801561084757600080fd5b50610473600081565b34801561085c57600080fd5b5061044d61086b366004613a76565b611637565b34801561087c57600080fd5b506104157f00000000000000000000000054196238400305778bff5fa200ee1896f6a9d5c281565b3480156108b057600080fd5b5061044d6108bf366004613aa0565b6116fc565b3480156108d057600080fd5b5061047360135481565b3480156108e657600080fd5b506104157f000000000000000000000000bda1e2757f9a8973926120f6977756b2468b79bb81565b34801561091a57600080fd5b5061044d610929366004613840565b611734565b34801561093a57600080fd5b5061044d610949366004613b1c565b6117fa565b34801561095a57600080fd5b506103e8611983565b34801561096f57600080fd5b506103e861097e366004613840565b611990565b34801561098f57600080fd5b5061044d61099e3660046138db565b61199b565b3480156109af57600080fd5b506018546109bd9060ff1681565b60405161039c9190613ba7565b61044d6109d8366004613be0565b6119c1565b3480156109e957600080fd5b506104157f000000000000000000000000c2faa7cf625b8adadbe423738c269558dc909d4181565b348015610a1d57600080fd5b50610390610a2c366004613c0a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b348015610a6657600080fd5b50601254610a7c90640100000000900460ff1681565b60405160ff909116815260200161039c565b348015610a9a57600080fd5b5061044d610aa9366004613907565b611e31565b348015610aba57600080fd5b50610ac3611ef9565b60405161039c9190613c34565b348015610adc57600080fd5b5061044d610aeb366004613c81565b611f5a565b6000610afb82611fae565b92915050565b606060008054610b1090613ca5565b80601f0160208091040260200160405190810160405280929190818152602001828054610b3c90613ca5565b8015610b895780601f10610b5e57610100808354040283529160200191610b89565b820191906000526020600020905b815481529060010190602001808311610b6c57829003601f168201915b5050505050905090565b6000818152600260205260408120546001600160a01b0316610c115760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610c388261125b565b9050806001600160a01b0316836001600160a01b03161415610ca65760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c08565b336001600160a01b0382161480610cc25750610cc28133610a2c565b610d345760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610c08565b610d3e8383611fd3565b505050565b600c54600160a01b900460ff1615610d6d5760405162461bcd60e51b8152600401610c0890613ce0565b6002600d541415610dc05760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c08565b6002600d55600060185460ff166003811115610dde57610dde613b91565b14610e355760405162461bcd60e51b815260206004820152602160248201527f4d696e7420746f6b656e732061726520726571756972656420746f206d696e746044820152601760f91b6064820152608401610c08565b610e3e81612041565b610e47816123f6565b506001600d55565b610e5a335b82612492565b610e765760405162461bcd60e51b8152600401610c0890613d0a565b610d3e838383612589565b6000828152600b6020526040902060010154610e9d8133612734565b610d3e8383612798565b6000610eb283611360565b8210610f145760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610c08565b506001600160a01b03919091166000908152600660209081526040808320938352929052205490565b6001600160a01b0381163314610fad5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c08565b610fb7828261281e565b5050565b610fd36000805160206140af833981519152336115fd565b610fef5760405162461bcd60e51b8152600401610c0890613d5b565b6110307f00000000000000000000000054196238400305778bff5fa200ee1896f6a9d5c260646110213031603c613da1565b61102b9190613dd6565b612885565b61105b7f000000000000000000000000bda1e2757f9a8973926120f6977756b2468b79bb3031612885565b565b6110756000805160206140af833981519152336115fd565b6110915760405162461bcd60e51b8152600401610c0890613d5b565b61105b61299f565b610d3e838383604051806020016040528060008152506116fc565b6110bd33610e54565b6111225760405162461bcd60e51b815260206004820152603060248201527f4552433732314275726e61626c653a2063616c6c6572206973206e6f74206f7760448201526f1b995c881b9bdc88185c1c1c9bdd995960821b6064820152608401610c08565b61112b81612a3c565b50565b6001600160a01b03821660009081526014602052604081208183600381111561115957611159613b91565b600381111561116a5761116a613b91565b815260200190815260200160002054905092915050565b600061118c60085490565b82106111ef5760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610c08565b6008828154811061120257611202613dea565b90600052602060002001549050919050565b61122c6000805160206140af833981519152336115fd565b6112485760405162461bcd60e51b8152600401610c0890613d5b565b8051610fb79060109060208401906136b5565b6000818152600260205260408120546001600160a01b031680610afb5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c08565b601080546112df90613ca5565b80601f016020809104026020016040519081016040528092919081815260200182805461130b90613ca5565b80156113585780601f1061132d57610100808354040283529160200191611358565b820191906000526020600020905b81548152906001019060200180831161133b57829003601f168201915b505050505081565b60006001600160a01b0382166113cb5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c08565b506001600160a01b031660009081526003602052604090205490565b600c546001600160a01b031633146114415760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c08565b61105b6000612a45565b6114636000805160206140af833981519152336115fd565b61147f5760405162461bcd60e51b8152600401610c0890613d5b565b601880549115156101000261ff0019909216919091179055565b600080601560008460038111156114b2576114b2613b91565b60038111156114c3576114c3613b91565b815260208101919091526040016000205461ffff16905060018360038111156114ee576114ee613b91565b14801561151357506001600160a01b03841660009081526016602052604090205460ff165b1561152657611523816002613e00565b90505b9392505050565b6115456000805160206140af833981519152336115fd565b6115615760405162461bcd60e51b8152600401610c0890613d5b565b6018805482919060ff1916600183600381111561158057611580613b91565b021790555050565b6115a06000805160206140af833981519152336115fd565b6115bc5760405162461bcd60e51b8152600401610c0890613d5b565b61105b612a97565b6115dc6000805160206140af833981519152336115fd565b6115f85760405162461bcd60e51b8152600401610c0890613d5b565b601355565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060018054610b1090613ca5565b6001600160a01b0382163314156116905760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610c08565b3360008181526005602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6117063383612492565b6117225760405162461bcd60e51b8152600401610c0890613d0a565b61172e84848484612afc565b50505050565b61174c6000805160206140af833981519152336115fd565b6117685760405162461bcd60e51b8152600401610c0890613d5b565b600081116117b85760405162461bcd60e51b815260206004820152601f60248201527f5175616e74697479206d7573742062652067726561746572207468616e2030006044820152606401610c08565b60125461ffff16816117c9600e5490565b6117d39190613e2a565b11156117f15760405162461bcd60e51b8152600401610c0890613e42565b61112b81612b2f565b6118126000805160206140af833981519152336115fd565b61182e5760405162461bcd60e51b8152600401610c0890613d5b565b60005b60175460ff821610156118a05760006016600060178460ff168154811061185a5761185a613dea565b6000918252602080832091909101546001600160a01b031683528201929092526040019020805460ff19169115159190911790558061189881613e8d565b915050611831565b506118ad60176000613739565b60005b60ff8116821115610d3e5760016016600085858560ff168181106118d6576118d6613dea565b90506020020160208101906118eb9190613907565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790556017838360ff841681811061192a5761192a613dea565b905060200201602081019061193f9190613907565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790558061197b81613e8d565b9150506118b0565b601180546112df90613ca5565b6060610afb82612b69565b6000828152600b60205260409020600101546119b78133612734565b610d3e838361281e565b600c54600160a01b900460ff16156119eb5760405162461bcd60e51b8152600401610c0890613ce0565b6002600d541415611a3e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610c08565b6002600d55600060185460ff166003811115611a5c57611a5c613b91565b1415611ab85760405162461bcd60e51b815260206004820152602560248201527f4d696e7420746f6b656e7320617265206e6f7420726571756972656420746f2060448201526436b4b73a1760d91b6064820152608401610c08565b600160185460ff166003811115611ad157611ad1613b91565b1415611b935760008260ff1611611b345760405162461bcd60e51b815260206004820152602160248201527f476f6c6420746f6b656e206d7573742062652067726561746572207468616e206044820152600360fc1b6064820152608401610c08565b60ff811615611b935760405162461bcd60e51b815260206004820152602560248201527f6f6e6c7920676f6c6420746f6b656e732061726520726571756972656420746f604482015264081b5a5b9d60da1b6064820152608401610c08565b600260185460ff166003811115611bac57611bac613b91565b1415611c705760008160ff1611611c105760405162461bcd60e51b815260206004820152602260248201527f426173696320746f6b656e206d7573742062652067726561746572207468616e604482015261020360f41b6064820152608401610c08565b60ff821615611c705760405162461bcd60e51b815260206004820152602660248201527f6f6e6c7920626173696320746f6b656e732061726520726571756972656420746044820152651bc81b5a5b9d60d21b6064820152608401610c08565b6000611c7c8284613ead565b60ff169050611c8a81612041565b7f000000000000000000000000c2faa7cf625b8adadbe423738c269558dc909d41600160185460ff166003811115611cc457611cc4613b91565b1480611ce65750600360185460ff166003811115611ce457611ce4613b91565b145b8015611cf5575060008460ff16115b15611d6457604051637a94c56560e11b81523360048201526001602482015260ff851660448201526001600160a01b0382169063f5298aca90606401600060405180830381600087803b158015611d4b57600080fd5b505af1158015611d5f573d6000803e3d6000fd5b505050505b600260185460ff166003811115611d7d57611d7d613b91565b1480611d9f5750600360185460ff166003811115611d9d57611d9d613b91565b145b8015611dae575060008360ff16115b15611e1d57604051637a94c56560e11b81523360048201526002602482015260ff841660448201526001600160a01b0382169063f5298aca90606401600060405180830381600087803b158015611e0457600080fd5b505af1158015611e18573d6000803e3d6000fd5b505050505b611e26826123f6565b50506001600d555050565b600c546001600160a01b03163314611e8b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c08565b6001600160a01b038116611ef05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c08565b61112b81612a45565b60606017805480602002602001604051908101604052809291908181526020018280548015610b8957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611f33575050505050905090565b611f726000805160206140af833981519152336115fd565b611f8e5760405162461bcd60e51b8152600401610c0890613d5b565b6012805461ffff909216620100000263ffff000019909216919091179055565b60006001600160e01b03198216637965db0b60e01b1480610afb5750610afb82612cdb565b600081815260046020526040902080546001600160a01b0319166001600160a01b03841690811790915581906120088261125b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600160185460ff16600381111561205a5761205a613b91565b14156120f157601254600f546201000090910461ffff169061207d908390613e2a565b11156120f15760405162461bcd60e51b815260206004820152603b60248201527f5175616e74697479206d757374206265206c657373207468616e2072656d616960448201527f6e696e6720737570706c7920666f7220476f6c6420746f6b656e7300000000006064820152608401610c08565b600081116121415760405162461bcd60e51b815260206004820152601f60248201527f5175616e74697479206d7573742062652067726561746572207468616e2030006044820152606401610c08565b60125461ffff1681612152600e5490565b61215c9190613e2a565b111561217a5760405162461bcd60e51b8152600401610c0890613e42565b60185460009061218e90339060ff16611499565b33600090815260146020526040812060185492935061ffff84169285929060ff1660038111156121c0576121c0613b91565b60038111156121d1576121d1613b91565b8152602001908152602001600020546121ea9190613e2a565b11156122385760405162461bcd60e51b815260206004820152601f60248201527f457863656564732077616c6c6574206c696d697420666f722077696e646f77006044820152606401610c08565b601254640100000000900460ff168211156122955760405162461bcd60e51b815260206004820152601760248201527f546f6f206d616e7920746f6b656e7320746f206d696e740000000000000000006044820152606401610c08565b816013546122a39190613da1565b3410156122f25760405162461bcd60e51b815260206004820152601e60248201527f496e73756666696369656e742066756e647320666f72206d696e74696e6700006044820152606401610c08565b601854610100900460ff1615610fb7576040516370a0823160e01b81523360048201527f000000000000000000000000fb61bd914d4cd5509ecbd4b16a0f96349e52db3d906000906001600160a01b038316906370a082319060240160206040518083038186803b15801561236657600080fd5b505afa15801561237a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239e9190613ed2565b11610d3e5760405162461bcd60e51b815260206004820152602260248201527f596f75206d75737420626520612052656d697820686f6c64657220746f206d696044820152611b9d60f21b6064820152608401610c08565b33600090815260146020526040812060185483929060ff16600381111561241f5761241f613b91565b600381111561243057612430613b91565b8152602001908152602001600020600082825461244d9190613e2a565b909155506001905060185460ff16600381111561246c5761246c613b91565b14156117f15780600f60008282546124849190613e2a565b909155505061112b81612b2f565b6000818152600260205260408120546001600160a01b031661250b5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c08565b60006125168361125b565b9050806001600160a01b0316846001600160a01b031614806125515750836001600160a01b031661254684610b93565b6001600160a01b0316145b8061258157506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b031661259c8261125b565b6001600160a01b0316146126045760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610c08565b6001600160a01b0382166126665760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c08565b612671838383612d00565b61267c600082611fd3565b6001600160a01b03831660009081526003602052604081208054600192906126a5908490613eeb565b90915550506001600160a01b03821660009081526003602052604081208054600192906126d3908490613e2a565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b61273e82826115fd565b610fb757612756816001600160a01b03166014612d0b565b612761836020612d0b565b604051602001612772929190613f02565b60408051601f198184030181529082905262461bcd60e51b8252610c089160040161382d565b6127a282826115fd565b610fb7576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556127da3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61282882826115fd565b15610fb7576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b30318111156128d65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c08565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612923576040519150601f19603f3d011682016040523d82523d6000602084013e612928565b606091505b5050905080610d3e5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c08565b600c54600160a01b900460ff166129ef5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610c08565b600c805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61112b81612ea7565b600c80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600c54600160a01b900460ff1615612ac15760405162461bcd60e51b8152600401610c0890613ce0565b600c805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612a1f3390565b612b07848484612589565b612b1384848484612ee7565b61172e5760405162461bcd60e51b8152600401610c0890613f77565b60005b818160ff161015610fb757612b4b600e80546001019055565b612b5733600e54612ff4565b80612b6181613e8d565b915050612b32565b6000818152600260205260409020546060906001600160a01b0316612bea5760405162461bcd60e51b815260206004820152603160248201527f45524337323155524953746f726167653a2055524920717565727920666f72206044820152703737b732bc34b9ba32b73a103a37b5b2b760791b6064820152608401610c08565b6000828152600a602052604081208054612c0390613ca5565b80601f0160208091040260200160405190810160405280929190818152602001828054612c2f90613ca5565b8015612c7c5780601f10612c5157610100808354040283529160200191612c7c565b820191906000526020600020905b815481529060010190602001808311612c5f57829003601f168201915b505050505090506000612c8d61300e565b9050805160001415612ca0575092915050565b815115612cd2578082604051602001612cba929190613fc9565b60405160208183030381529060405292505050919050565b6125818461301d565b60006001600160e01b0319821663780e9d6360e01b1480610afb5750610afb826130f7565b610d3e838383613147565b60606000612d1a836002613da1565b612d25906002613e2a565b67ffffffffffffffff811115612d3d57612d3d61395b565b6040519080825280601f01601f191660200182016040528015612d67576020820181803683370190505b509050600360fc1b81600081518110612d8257612d82613dea565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612db157612db1613dea565b60200101906001600160f81b031916908160001a9053506000612dd5846002613da1565b612de0906001613e2a565b90505b6001811115612e58576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612e1457612e14613dea565b1a60f81b828281518110612e2a57612e2a613dea565b60200101906001600160f81b031916908160001a90535060049490941c93612e5181613ff8565b9050612de3565b5083156115265760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c08565b612eb0816131ff565b6000818152600a602052604090208054612ec990613ca5565b15905061112b576000818152600a6020526040812061112b91613757565b60006001600160a01b0384163b15612fe957604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612f2b90339089908890889060040161400f565b602060405180830381600087803b158015612f4557600080fd5b505af1925050508015612f75575060408051601f3d908101601f19168201909252612f729181019061404c565b60015b612fcf573d808015612fa3576040519150601f19603f3d011682016040523d82523d6000602084013e612fa8565b606091505b508051612fc75760405162461bcd60e51b8152600401610c0890613f77565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612581565b506001949350505050565b610fb78282604051806020016040528060008152506132a6565b606060108054610b1090613ca5565b6000818152600260205260409020546060906001600160a01b031661309c5760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610c08565b60006130a661300e565b905060008151116130c65760405180602001604052806000815250611526565b806130d0846132d9565b6040516020016130e1929190613fc9565b6040516020818303038152906040529392505050565b60006001600160e01b031982166380ac58cd60e01b148061312857506001600160e01b03198216635b5e139f60e01b145b80610afb57506301ffc9a760e01b6001600160e01b0319831614610afb565b6001600160a01b0383166131a25761319d81600880546000838152600960205260408120829055600182018355919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30155565b6131c5565b816001600160a01b0316836001600160a01b0316146131c5576131c583826133d7565b6001600160a01b0382166131dc57610d3e81613474565b826001600160a01b0316826001600160a01b031614610d3e57610d3e8282613523565b600061320a8261125b565b905061321881600084612d00565b613223600083611fd3565b6001600160a01b038116600090815260036020526040812080546001929061324c908490613eeb565b909155505060008281526002602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6132b08383613567565b6132bd6000848484612ee7565b610d3e5760405162461bcd60e51b8152600401610c0890613f77565b6060816132fd5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613327578061331181614069565b91506133209050600a83613dd6565b9150613301565b60008167ffffffffffffffff8111156133425761334261395b565b6040519080825280601f01601f19166020018201604052801561336c576020820181803683370190505b5090505b841561258157613381600183613eeb565b915061338e600a86614084565b613399906030613e2a565b60f81b8183815181106133ae576133ae613dea565b60200101906001600160f81b031916908160001a9053506133d0600a86613dd6565b9450613370565b600060016133e484611360565b6133ee9190613eeb565b600083815260076020526040902054909150808214613441576001600160a01b03841660009081526006602090815260408083208584528252808320548484528184208190558352600790915290208190555b5060009182526007602090815260408084208490556001600160a01b039094168352600681528383209183525290812055565b60085460009061348690600190613eeb565b600083815260096020526040812054600880549394509092849081106134ae576134ae613dea565b9060005260206000200154905080600883815481106134cf576134cf613dea565b600091825260208083209091019290925582815260099091526040808220849055858252812055600880548061350757613507614098565b6001900381819060005260206000200160009055905550505050565b600061352e83611360565b6001600160a01b039093166000908152600660209081526040808320868452825280832085905593825260079052919091209190915550565b6001600160a01b0382166135bd5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c08565b6000818152600260205260409020546001600160a01b0316156136225760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610c08565b61362e60008383612d00565b6001600160a01b0382166000908152600360205260408120805460019290613657908490613e2a565b909155505060008181526002602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8280546136c190613ca5565b90600052602060002090601f0160209004810192826136e35760008555613729565b82601f106136fc57805160ff1916838001178555613729565b82800160010185558215613729579182015b8281111561372957825182559160200191906001019061370e565b5061373592915061378d565b5090565b508054600082559060005260206000209081019061112b919061378d565b50805461376390613ca5565b6000825580601f10613773575050565b601f01602090049060005260206000209081019061112b91905b5b80821115613735576000815560010161378e565b6001600160e01b03198116811461112b57600080fd5b6000602082840312156137ca57600080fd5b8135611526816137a2565b60005b838110156137f05781810151838201526020016137d8565b8381111561172e5750506000910152565b600081518084526138198160208601602086016137d5565b601f01601f19169290920160200192915050565b6020815260006115266020830184613801565b60006020828403121561385257600080fd5b5035919050565b80356001600160a01b038116811461387057600080fd5b919050565b6000806040838503121561388857600080fd5b61389183613859565b946020939093013593505050565b6000806000606084860312156138b457600080fd5b6138bd84613859565b92506138cb60208501613859565b9150604084013590509250925092565b600080604083850312156138ee57600080fd5b823591506138fe60208401613859565b90509250929050565b60006020828403121561391957600080fd5b61152682613859565b80356004811061387057600080fd5b6000806040838503121561394457600080fd5b61394d83613859565b91506138fe60208401613922565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561398c5761398c61395b565b604051601f8501601f19908116603f011681019082821181831017156139b4576139b461395b565b816040528093508581528686860111156139cd57600080fd5b858560208301376000602087830101525050509392505050565b6000602082840312156139f957600080fd5b813567ffffffffffffffff811115613a1057600080fd5b8201601f81018413613a2157600080fd5b61258184823560208401613971565b8035801515811461387057600080fd5b600060208284031215613a5257600080fd5b61152682613a30565b600060208284031215613a6d57600080fd5b61152682613922565b60008060408385031215613a8957600080fd5b613a9283613859565b91506138fe60208401613a30565b60008060008060808587031215613ab657600080fd5b613abf85613859565b9350613acd60208601613859565b925060408501359150606085013567ffffffffffffffff811115613af057600080fd5b8501601f81018713613b0157600080fd5b613b1087823560208401613971565b91505092959194509250565b60008060208385031215613b2f57600080fd5b823567ffffffffffffffff80821115613b4757600080fd5b818501915085601f830112613b5b57600080fd5b813581811115613b6a57600080fd5b8660208260051b8501011115613b7f57600080fd5b60209290920196919550909350505050565b634e487b7160e01b600052602160045260246000fd5b6020810160048310613bc957634e487b7160e01b600052602160045260246000fd5b91905290565b803560ff8116811461387057600080fd5b60008060408385031215613bf357600080fd5b613bfc83613bcf565b91506138fe60208401613bcf565b60008060408385031215613c1d57600080fd5b613c2683613859565b91506138fe60208401613859565b6020808252825182820181905260009190848201906040850190845b81811015613c755783516001600160a01b031683529284019291840191600101613c50565b50909695505050505050565b600060208284031215613c9357600080fd5b813561ffff8116811461152657600080fd5b600181811c90821680613cb957607f821691505b60208210811415613cda57634e487b7160e01b600052602260045260246000fd5b50919050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526016908201527521b0b63632b91034b9903737ba1030b71030b236b4b760511b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615613dbb57613dbb613d8b565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613de557613de5613dc0565b500490565b634e487b7160e01b600052603260045260246000fd5b600061ffff80831681851681830481118215151615613e2157613e21613d8b565b02949350505050565b60008219821115613e3d57613e3d613d8b565b500190565b6020808252602b908201527f5175616e74697479206d757374206265206c657373207468616e2072656d616960408201526a6e696e6720737570706c7960a81b606082015260800190565b600060ff821660ff811415613ea457613ea4613d8b565b60010192915050565b600060ff821660ff84168060ff03821115613eca57613eca613d8b565b019392505050565b600060208284031215613ee457600080fd5b5051919050565b600082821015613efd57613efd613d8b565b500390565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613f3a8160178501602088016137d5565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613f6b8160288401602088016137d5565b01602801949350505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008351613fdb8184602088016137d5565b835190830190613fef8183602088016137d5565b01949350505050565b60008161400757614007613d8b565b506000190190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061404290830184613801565b9695505050505050565b60006020828403121561405e57600080fd5b8151611526816137a2565b600060001982141561407d5761407d613d8b565b5060010190565b60008261409357614093613dc0565b500690565b634e487b7160e01b600052603160045260246000fdfea49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a2646970667358221220776230f1cbcdac02fd6fdaf04c2ffb191a61fef1bbd791aff881667d27eac5c864736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c2faa7cf625b8adadbe423738c269558dc909d41000000000000000000000000fb61bd914d4cd5509ecbd4b16a0f96349e52db3d00000000000000000000000000000000000000000000000000000000000007d00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000006a94d74f430000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000054196238400305778bff5fa200ee1896f6a9d5c2000000000000000000000000bda1e2757f9a8973926120f6977756b2468b79bb00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000004037623862386266323833353834656433353234346139383330343239386539623839656539356431646238343939346332393135376164363031616366363439
-----Decoded View---------------
Arg [0] : _MINT_TOKEN_CONTRACT_ADDRESS (address): 0xc2fAA7CF625b8adadBE423738c269558Dc909D41
Arg [1] : _REMIX_CONTRACT_ADDRESS (address): 0xfb61bD914d4Cd5509ECbd4B16A0F96349e52DB3d
Arg [2] : _maximumSupply (uint16): 2000
Arg [3] : _maximumGoldSupply (uint16): 400
Arg [4] : _mintCost (uint256): 30000000000000000
Arg [5] : _transactionLimit (uint8): 10
Arg [6] : _payableAddress1 (address): 0x54196238400305778bFf5Fa200Ee1896f6A9d5C2
Arg [7] : _payableAddress2 (address): 0xbda1E2757f9A8973926120F6977756B2468B79bb
Arg [8] : _remixHolderRequired (bool): True
Arg [9] : _provenanceHash (string): 7b8b8bf283584ed35244a98304298e9b89ee95d1db84994c29157ad601acf649
-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 000000000000000000000000c2faa7cf625b8adadbe423738c269558dc909d41
Arg [1] : 000000000000000000000000fb61bd914d4cd5509ecbd4b16a0f96349e52db3d
Arg [2] : 00000000000000000000000000000000000000000000000000000000000007d0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000190
Arg [4] : 000000000000000000000000000000000000000000000000006a94d74f430000
Arg [5] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [6] : 00000000000000000000000054196238400305778bff5fa200ee1896f6a9d5c2
Arg [7] : 000000000000000000000000bda1e2757f9a8973926120f6977756b2468b79bb
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [11] : 3762386238626632383335383465643335323434613938333034323938653962
Arg [12] : 3839656539356431646238343939346332393135376164363031616366363439
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.