Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
Latest 25 from a total of 10,667 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Mint Treats | 21690425 | 22 days ago | IN | 0 ETH | 0.00077864 | ||||
Mint Treats | 21647396 | 28 days ago | IN | 0 ETH | 0.00069222 | ||||
Mint Treats | 21579184 | 37 days ago | IN | 0 ETH | 0.00052093 | ||||
Mint Treats | 21436700 | 57 days ago | IN | 0 ETH | 0.00134451 | ||||
Mint Treats | 21405898 | 62 days ago | IN | 0 ETH | 0.00068002 | ||||
Mint Treats | 21363071 | 68 days ago | IN | 0 ETH | 0.00640522 | ||||
Mint Treats | 21320463 | 73 days ago | IN | 0 ETH | 0.0061986 | ||||
Mint Treats | 20953370 | 125 days ago | IN | 0 ETH | 0.00095223 | ||||
Mint Treats | 20932641 | 128 days ago | IN | 0 ETH | 0.0009595 | ||||
Mint Treats | 20739032 | 155 days ago | IN | 0 ETH | 0.00019656 | ||||
Mint Treats | 20699456 | 160 days ago | IN | 0 ETH | 0.00021762 | ||||
Mint Treats | 20689092 | 162 days ago | IN | 0 ETH | 0.00018757 | ||||
Mint Treats | 20689072 | 162 days ago | IN | 0 ETH | 0.00019936 | ||||
Mint Treats | 20680098 | 163 days ago | IN | 0 ETH | 0.00049948 | ||||
Mint Treats | 20635029 | 169 days ago | IN | 0 ETH | 0.00061397 | ||||
Mint Treats | 20611910 | 172 days ago | IN | 0 ETH | 0.00070324 | ||||
Mint Treats | 20606262 | 173 days ago | IN | 0 ETH | 0.00007789 | ||||
Mint Treats | 20606245 | 173 days ago | IN | 0 ETH | 0.0000891 | ||||
Mint Treats | 20596735 | 175 days ago | IN | 0 ETH | 0.0000794 | ||||
Mint Treats | 20586678 | 176 days ago | IN | 0 ETH | 0.00009031 | ||||
Mint Treats | 20585174 | 176 days ago | IN | 0 ETH | 0.0007445 | ||||
Mint Treats | 20585168 | 176 days ago | IN | 0 ETH | 0.00072382 | ||||
Mint Treats | 20543190 | 182 days ago | IN | 0 ETH | 0.00006184 | ||||
Mint Treats | 20543188 | 182 days ago | IN | 0 ETH | 0.00042036 | ||||
Mint Treats | 20543166 | 182 days ago | IN | 0 ETH | 0.00187773 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
NightmareImpDoor
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "../util/Ownablearama.sol"; import "../treats/ForgottenRunesTreats.sol"; import "../treats/ForgottenRunesTricks.sol"; import "./NightmareImpTreasureBox.sol"; interface IPunks { function punkIndexToAddress(uint256 index) external view returns (address); } interface IDelegationRegistry { function checkDelegateForToken( address delegate, address vault, address contract_, uint256 tokenId ) external view returns (bool); } interface IShapeshifter { function mint(address receiver, uint256 tokenId) external; } contract NightmareImpDoor is EIP712, Ownablearama { uint256 public startTimestamp = type(uint256).max; ForgottenRunesTricks public tricks; ForgottenRunesTreats public treats; NightmareImpTreasureBox public treasureBox; IDelegationRegistry public delegationRegistry; IPunks public punks; address public signer; address public beasts; address public souls; mapping(uint256 => bool) public boxClaimedStatus; mapping(address => mapping(uint256 => uint256)) public partnerTokenToClaimsCount; mapping(address => uint256) public partnerCollectionToBoxesClaimedCount; mapping(address => address) public partnerCollectionToShapeshiftContract; mapping(address => bool) public earlyMinters; event TrickMinted( address indexed to, address indexed partnerContract, uint256 indexed partnerToken, uint256 trickTokenId ); constructor( ForgottenRunesTricks _tricks, ForgottenRunesTreats _treats, NightmareImpTreasureBox _treasureBox, IPunks _punks, IDelegationRegistry _delegationRegistry, address _souls, address _beasts ) EIP712("NightmareImpDoor", "1") { tricks = _tricks; treats = _treats; treasureBox = _treasureBox; punks = _punks; delegationRegistry = _delegationRegistry; souls = _souls; beasts = _beasts; } function requireSenderIsTokenOwnerAndAllocationNotClaimed( address partnerContract, uint256 partnerTokenId ) public view { if (partnerContract == address(punks)) { address punkOwner = punks.punkIndexToAddress(partnerTokenId); require( punkOwner == msg.sender || delegationRegistry.checkDelegateForToken( msg.sender, punkOwner, address(punks), partnerTokenId ), "You do not own this punk" ); } else { address nftOwner = IERC721(partnerContract).ownerOf(partnerTokenId); require( nftOwner == msg.sender || delegationRegistry.checkDelegateForToken( msg.sender, nftOwner, partnerContract, partnerTokenId ), "You do not own this partner token" ); } uint256 trickOrTreatAllocation = 1; if (partnerContract == souls) { trickOrTreatAllocation = 3; } else if (partnerContract == beasts) { trickOrTreatAllocation = 10; } require( partnerTokenToClaimsCount[partnerContract][partnerTokenId] < trickOrTreatAllocation, "Max trick or treat allocation already claimed by this token" ); } function mintTricksAndBoxes( address[] calldata partnerContracts, uint256[] calldata partnerTokenIds, bool[] calldata isBox, uint256[] calldata trickTokenIds, bytes calldata signature ) public { require( block.timestamp >= startTimestamp || earlyMinters[msg.sender], "Not yet started" ); require( partnerContracts.length == partnerTokenIds.length && partnerContracts.length == isBox.length && partnerContracts.length == trickTokenIds.length, "Arrays must be same length" ); bytes32 digest = _hashTypedDataV4( keccak256( abi.encode( keccak256( "TricksAndBoxes(address to,address[] partnerContracts,uint256[] partnerTokenIds,bool[] isBox,uint256[] trickTokenIds)" ), msg.sender, keccak256(abi.encodePacked(partnerContracts)), keccak256(abi.encodePacked(partnerTokenIds)), keccak256(abi.encodePacked(isBox)), keccak256(abi.encodePacked(trickTokenIds)) ) ) ); require( ECDSA.recover(digest, signature) == signer, "Signature not by signer" ); for (uint256 i = 0; i < partnerContracts.length; i++) { address partnerContract = partnerContracts[i]; uint256 partnerTokenId = partnerTokenIds[i]; requireSenderIsTokenOwnerAndAllocationNotClaimed( partnerContract, partnerTokenId ); partnerTokenToClaimsCount[partnerContract][partnerTokenId]++; if (isBox[i]) { treasureBox.mint(msg.sender, partnerContract); } else { tricks.mint(msg.sender, trickTokenIds[i], 1, ""); IShapeshifter( partnerCollectionToShapeshiftContract[partnerContract] ).mint(msg.sender, partnerTokenId); emit TrickMinted( msg.sender, partnerContract, partnerTokenId, trickTokenIds[i] ); } } } function mintTreats( uint256[] calldata tokenIds, uint256[] calldata boxIds, bytes calldata signature ) public { require( block.timestamp >= startTimestamp || earlyMinters[msg.sender], "Not yet started" ); require( tokenIds.length == boxIds.length, "Token ids and box ids must be same length" ); bytes32 digest = _hashTypedDataV4( keccak256( abi.encode( keccak256( "Treats(address to,uint256[] tokenIds,uint256[] boxIds)" ), msg.sender, keccak256(abi.encodePacked(tokenIds)), keccak256(abi.encodePacked(boxIds)) ) ) ); require( ECDSA.recover(digest, signature) == signer, "Signature not by signer" ); for (uint256 i = 0; i < tokenIds.length; i++) { uint256 boxId = boxIds[i]; require( treasureBox.burnedTokenIdToBurner(boxId) == msg.sender, "Box must have been burnt by sender" ); require( !boxClaimedStatus[boxId], "Treat already claimed for this box" ); boxClaimedStatus[boxId] = true; treats.mint(msg.sender, tokenIds[i], 1, ""); } } function setSigner(address _signer) external onlyOwner { signer = _signer; } function setTreats(ForgottenRunesTreats _treats) external onlyOwner { treats = _treats; } function setTricks(ForgottenRunesTricks _tricks) external onlyOwner { tricks = _tricks; } function setPunks(IPunks _punks) external onlyOwner { punks = _punks; } function setDelegationRegistry(IDelegationRegistry _delegationRegistry) external onlyOwner { delegationRegistry = _delegationRegistry; } function setTreasureBox(NightmareImpTreasureBox _treasureBox) external onlyOwner { treasureBox = _treasureBox; } function setSoulsAndBeasts(address _souls, address _beasts) external onlyOwner { souls = _souls; beasts = _beasts; } function setPartnerCollectionToShapeshiftContract( address partnerContract, address shapeshiftContract ) external onlyOwner { partnerCollectionToShapeshiftContract[ partnerContract ] = shapeshiftContract; } function setStartTimestamp(uint256 _startTimestamp) external onlyOwner { startTimestamp = _startTimestamp; } function setIsEarlyMinter(address minterAddress, bool isMinter) external onlyOwner { earlyMinters[minterAddress] = isMinter; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
pragma solidity ^0.8.0; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /** * @dev This implements Ownable plus a few utilities */ contract Ownablearama is Ownable { /** * @dev ETH should not be sent to this contract, but in the case that it is * sent by accident, this function allows the owner to withdraw it. */ function withdrawAll() public payable onlyOwner { require(payable(msg.sender).send(address(this).balance)); } /** * @dev Again, ERC20s should not be sent to this contract, but if someone * does, it's nice to be able to recover them * @param token IERC20 the token address * @param amount uint256 the amount to send */ function forwardERC20s(IERC20 token, uint256 amount) public onlyOwner { require(address(msg.sender) != address(0)); token.transfer(msg.sender, amount); } // disable renouncing ownership function renounceOwnership() public override onlyOwner {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "./ForgottenRunesTricksOrTreats.sol"; contract ForgottenRunesTreats is ForgottenRunesTricksOrTreats { string constant name = "TREATS"; constructor(string memory _uri) ERC1155(_uri) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "./ForgottenRunesTricksOrTreats.sol"; contract ForgottenRunesTricks is ForgottenRunesTricksOrTreats { string constant name = "TRICKS"; constructor(string memory _uri) ERC1155(_uri) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "../util/Ownablearama.sol"; contract NightmareImpTreasureBox is ERC721Burnable, ERC721Enumerable, Ownablearama { uint256 public constant MAX_MINTABLE_SUPPLY = 23100; uint256 public constant DEFAULT_MAX_SUPPLY_PER_PARTNER_COLLECTION = 500; uint256 public numMinted = 0; address public minter; mapping(address => uint256[]) public burnerToBurnedTokenIds; mapping(uint256 => address) public burnedTokenIdToBurner; mapping(address => uint256) public partnerCollectionToMaxSupplyOverride; mapping(address => uint256) public partnerCollectionToNumMinted; string public baseURI; constructor(string memory _baseURI) ERC721("NightmareImpTreasureBox", "IMPTREASURE") { setBaseURI(_baseURI); } function mint(address to, address partnerCollection) public { require(msg.sender == minter, "Only minter can mint"); require(numMinted < MAX_MINTABLE_SUPPLY, "Max mintable supply reached"); uint256 maxSupplyForCollection = partnerCollectionToMaxSupplyOverride[ partnerCollection ] == 0 ? DEFAULT_MAX_SUPPLY_PER_PARTNER_COLLECTION : partnerCollectionToMaxSupplyOverride[partnerCollection]; require( partnerCollectionToNumMinted[partnerCollection] < maxSupplyForCollection, "Max mintable supply reached for partner collection" ); partnerCollectionToNumMinted[partnerCollection]++; uint256 tokenId = numMinted; numMinted++; _mint(to, tokenId); } function ownerMint( address[] calldata recipients, uint256[] calldata quantities ) public onlyOwner { // Note: we are not updating partner collection counts here as this is only for owner minting uint256 totalQuantity = 0; for (uint256 i = 0; i < quantities.length; i++) { totalQuantity += quantities[i]; } require( numMinted + totalQuantity <= MAX_MINTABLE_SUPPLY, "Max mintable supply reached" ); for (uint256 i = 0; i < recipients.length; i++) { address recipient = recipients[i]; for (uint256 j = 0; j < quantities[i]; j++) { uint256 tokenId = numMinted; numMinted++; _mint(recipient, tokenId); } } } function setMinter(address _minter) external onlyOwner { minter = _minter; } function burn(uint256 tokenId) public virtual override { burnedTokenIdToBurner[tokenId] = msg.sender; burnerToBurnedTokenIds[msg.sender].push(tokenId); super.burn(tokenId); } function unlockBoxes(uint256[] calldata tokenIds) public virtual { for (uint256 i = 0; i < tokenIds.length; i++) { uint256 tokenId = tokenIds[i]; burnedTokenIdToBurner[tokenId] = msg.sender; burnerToBurnedTokenIds[msg.sender].push(tokenId); super.burn(tokenId); } } function getBurnedTokenIdsByBurner(address burner) external view returns (uint256[] memory) { return burnerToBurnedTokenIds[burner]; } function setBaseURI(string memory _baseURI) public onlyOwner { baseURI = _baseURI; } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function setPartnerCollectionMaxSupplyOverride( address _partnerCollection, uint256 _maxSupply ) public onlyOwner { partnerCollectionToMaxSupplyOverride[_partnerCollection] = _maxSupply; } 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) returns (bool) { return super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // 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); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "../util/Ownablearama.sol"; import "./IForgottenRunesTricksOrTreats.sol"; abstract contract ForgottenRunesTricksOrTreats is ERC1155Supply, IForgottenRunesTricksOrTreats, Ownablearama { mapping(uint256 => string) public tokenURIs; string public baseURI; //minters mapping mapping(address => bool) public minters; modifier onlyMinterOrOwner() { require( minters[msg.sender] || msg.sender == owner(), "ForgottenRunesTreats: only minter or owner can call this function" ); _; } function mint( address to, uint256 id, uint256 amount, bytes memory data ) public onlyMinterOrOwner { _mint(to, id, amount, data); } // lets us override per token in case we need to function setTokenURI(uint256 _tokenId, string calldata _tokenURI) external onlyOwner { tokenURIs[_tokenId] = _tokenURI; } function setIsMinter(address _minter, bool _isMinter) external onlyOwner { minters[_minter] = _isMinter; } function setURI(string memory _uri) external onlyOwner { super._setURI(_uri); } function uri(uint256 tokenId) public view virtual override returns (string memory) { string memory tokenURI = tokenURIs[tokenId]; return bytes(tokenURI).length > 0 ? tokenURI : string( abi.encodePacked( super.uri(tokenId), Strings.toString(tokenId) ) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be 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), "ERC721: caller is not token owner nor approved"); _burn(tokenId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol) 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 whether 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-_beforeTokenTransfer}. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); if (from == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { _totalSupply[ids[i]] += amounts[i]; } } if (to == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 supply = _totalSupply[id]; require(supply >= amount, "ERC1155: burn amount exceeds totalSupply"); unchecked { _totalSupply[id] = supply - amount; } } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.12; interface IForgottenRunesTricksOrTreats { function mint( address to, uint256 id, uint256 amount, bytes memory data ) external ; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner 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: caller is not token 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) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol) 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: address zero is not a valid owner"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token 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: caller is not token 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(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, 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); _afterTokenTransfer(operator, from, to, ids, amounts, data); _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); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * 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 _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); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` 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 {} /** * @dev Hook that is called after 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 _afterTokenTransfer( 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 // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: 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 Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) 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 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 // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) 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. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) 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 // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@ensdomains/=node_modules/@ensdomains/", "@openzeppelin/=node_modules/@openzeppelin/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "hardhat-deploy/=node_modules/hardhat-deploy/", "hardhat/=node_modules/hardhat/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract ForgottenRunesTricks","name":"_tricks","type":"address"},{"internalType":"contract ForgottenRunesTreats","name":"_treats","type":"address"},{"internalType":"contract NightmareImpTreasureBox","name":"_treasureBox","type":"address"},{"internalType":"contract IPunks","name":"_punks","type":"address"},{"internalType":"contract IDelegationRegistry","name":"_delegationRegistry","type":"address"},{"internalType":"address","name":"_souls","type":"address"},{"internalType":"address","name":"_beasts","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"partnerContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"partnerToken","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"trickTokenId","type":"uint256"}],"name":"TrickMinted","type":"event"},{"inputs":[],"name":"beasts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"boxClaimedStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"delegationRegistry","outputs":[{"internalType":"contract IDelegationRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"earlyMinters","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"forwardERC20s","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"boxIds","type":"uint256[]"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mintTreats","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"partnerContracts","type":"address[]"},{"internalType":"uint256[]","name":"partnerTokenIds","type":"uint256[]"},{"internalType":"bool[]","name":"isBox","type":"bool[]"},{"internalType":"uint256[]","name":"trickTokenIds","type":"uint256[]"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mintTricksAndBoxes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"partnerCollectionToBoxesClaimedCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"partnerCollectionToShapeshiftContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"partnerTokenToClaimsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"punks","outputs":[{"internalType":"contract IPunks","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"partnerContract","type":"address"},{"internalType":"uint256","name":"partnerTokenId","type":"uint256"}],"name":"requireSenderIsTokenOwnerAndAllocationNotClaimed","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDelegationRegistry","name":"_delegationRegistry","type":"address"}],"name":"setDelegationRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"minterAddress","type":"address"},{"internalType":"bool","name":"isMinter","type":"bool"}],"name":"setIsEarlyMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"partnerContract","type":"address"},{"internalType":"address","name":"shapeshiftContract","type":"address"}],"name":"setPartnerCollectionToShapeshiftContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPunks","name":"_punks","type":"address"}],"name":"setPunks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_souls","type":"address"},{"internalType":"address","name":"_beasts","type":"address"}],"name":"setSoulsAndBeasts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startTimestamp","type":"uint256"}],"name":"setStartTimestamp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract NightmareImpTreasureBox","name":"_treasureBox","type":"address"}],"name":"setTreasureBox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ForgottenRunesTreats","name":"_treats","type":"address"}],"name":"setTreats","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ForgottenRunesTricks","name":"_tricks","type":"address"}],"name":"setTricks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"souls","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasureBox","outputs":[{"internalType":"contract NightmareImpTreasureBox","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treats","outputs":[{"internalType":"contract ForgottenRunesTreats","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tricks","outputs":[{"internalType":"contract ForgottenRunesTricks","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
6101406040526000196001553480156200001857600080fd5b5060405162002392380380620023928339810160408190526200003b916200022f565b604080518082018252601081526f2734b3b43a36b0b932a4b6b82237b7b960811b6020808301918252835180850190945260018452603160f81b908401528151902060e08190527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66101008190524660a0529192917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620001218184846040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6080523060c05261012052506200014492506200013e9150503390565b620001c6565b600280546001600160a01b03199081166001600160a01b03998a1617909155600380548216978916979097179096556004805487169588169590951790945560068054861693871693909317909255600580548516918616919091179055600980548416918516919091179055600880549092169216919091179055620002da565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200022c57600080fd5b50565b600080600080600080600060e0888a0312156200024b57600080fd5b8751620002588162000216565b60208901519097506200026b8162000216565b60408901519096506200027e8162000216565b6060890151909550620002918162000216565b6080890151909450620002a48162000216565b60a0890151909350620002b78162000216565b60c0890151909250620002ca8162000216565b8091505092959891949750929550565b60805160a05160c05160e05161010051610120516120686200032a600039600061180f0152600061185e0152600061183901526000611792015260006117bc015260006117e601526120686000f3fe6080604052600436106101e35760003560e01c80639727151a11610102578063dfe0a88911610095578063e8a02a9811610064578063e8a02a98146105a1578063f0e135bf146105e1578063f2fde38b14610611578063f977686a1461063157600080fd5b8063dfe0a88914610513578063e52c6abb14610533578063e6fd48bc14610553578063e7770e0c1461056957600080fd5b8063ad186b85116100d1578063ad186b8514610493578063b0b088e3146104b3578063c44bef75146104d3578063da6da348146104f357600080fd5b80639727151a14610413578063a317ac8914610433578063a4a7af3614610453578063a7a4fa941461047357600080fd5b80636a6440731161017a57806380d175d81161014957806380d175d8146103ad578063853828b6146103cd5780638b7037c4146103d55780638da5cb5b146103f557600080fd5b80636a644073146103225780636c19e78314610358578063715018a61461037857806373aa9e941461038d57600080fd5b80632668380c116101b65780632668380c146102a25780632b2a9757146102c25780632eb246c5146102e2578063530c90fc1461030257600080fd5b8063114ee3c8146101e85780631a491b52146102285780631fbdd72d1461024a578063238ac93314610282575b600080fd5b3480156101f457600080fd5b50610215610203366004611c0b565b600c6020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b50610248610243366004611cb6565b610651565b005b34801561025657600080fd5b5060055461026a906001600160a01b031681565b6040516001600160a01b03909116815260200161021f565b34801561028e57600080fd5b5060075461026a906001600160a01b031681565b3480156102ae57600080fd5b5060045461026a906001600160a01b031681565b3480156102ce57600080fd5b506102486102dd366004611da7565b610b9f565b3480156102ee57600080fd5b5060095461026a906001600160a01b031681565b34801561030e57600080fd5b5061024861031d366004611c0b565b610f41565b34801561032e57600080fd5b5061026a61033d366004611c0b565b600d602052600090815260409020546001600160a01b031681565b34801561036457600080fd5b50610248610373366004611c0b565b610f6b565b34801561038457600080fd5b50610248610f95565b34801561039957600080fd5b506102486103a8366004611c0b565b610f9f565b3480156103b957600080fd5b506102486103c8366004611c0b565b610fc9565b610248610ff3565b3480156103e157600080fd5b506102486103f0366004611dd3565b61101f565b34801561040157600080fd5b506000546001600160a01b031661026a565b34801561041f57600080fd5b5061024861042e366004611da7565b611055565b34801561043f57600080fd5b5060025461026a906001600160a01b031681565b34801561045f57600080fd5b5061024861046e366004611dd3565b6110d8565b34801561047f57600080fd5b5061024861048e366004611e0c565b61110e565b34801561049f57600080fd5b5060035461026a906001600160a01b031681565b3480156104bf57600080fd5b5060085461026a906001600160a01b031681565b3480156104df57600080fd5b506102486104ee366004611ea6565b611556565b3480156104ff57600080fd5b5061024861050e366004611ecd565b611563565b34801561051f57600080fd5b5060065461026a906001600160a01b031681565b34801561053f57600080fd5b5061024861054e366004611c0b565b611596565b34801561055f57600080fd5b5061021560015481565b34801561057557600080fd5b50610215610584366004611da7565b600b60209081526000928352604080842090915290825290205481565b3480156105ad57600080fd5b506105d16105bc366004611c0b565b600e6020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156105ed57600080fd5b506105d16105fc366004611ea6565b600a6020526000908152604090205460ff1681565b34801561061d57600080fd5b5061024861062c366004611c0b565b6115c0565b34801561063d57600080fd5b5061024861064c366004611c0b565b611639565b600154421015806106715750336000908152600e602052604090205460ff165b6106b45760405162461bcd60e51b815260206004820152600f60248201526e139bdd081e595d081cdd185c9d1959608a1b60448201526064015b60405180910390fd5b88871480156106c257508885145b80156106cd57508883145b6107195760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016106ab565b60006108387fe1a6373e29cd5bafb5c6431a15a0970218300732b0c8fea7482715f9731314f4338d8d604051602001610753929190611efb565b604051602081830303815290604052805190602001208c8c60405160200161077c929190611f3d565b604051602081830303815290604052805190602001208b8b6040516020016107a5929190611f66565b604051602081830303815290604052805190602001208a8a6040516020016107ce929190611f3d565b60408051601f198184030181528282528051602091820120908301979097526001600160a01b03909516948101949094526060840192909252608083015260a082015260c081019190915260e0015b60405160208183030381529060405280519060200120611663565b600754604080516020601f87018190048102820181019092528581529293506001600160a01b039091169161088a9184919087908790819084018382808284376000920191909152506116b792505050565b6001600160a01b0316146108da5760405162461bcd60e51b815260206004820152601760248201527629b4b3b730ba3ab932903737ba10313c9039b4b3b732b960491b60448201526064016106ab565b60005b8a811015610b915760008c8c838181106108f9576108f9611f96565b905060200201602081019061090e9190611c0b565b905060008b8b8481811061092457610924611f96565b9050602002013590506109378282610b9f565b6001600160a01b0382166000908152600b60209081526040808320848452909152812080549161096683611fc2565b919050555089898481811061097d5761097d611f96565b90506020020160208101906109929190611fdb565b15610a02576004805460405163ee1fe2ad60e01b815233928101929092526001600160a01b038481166024840152169063ee1fe2ad90604401600060405180830381600087803b1580156109e557600080fd5b505af11580156109f9573d6000803e3d6000fd5b50505050610b7c565b6002546001600160a01b031663731133e9338a8a87818110610a2657610a26611f96565b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602002919091013560248301525060016044820152608060648201526000608482015260a401600060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505050506001600160a01b038281166000908152600d6020526040908190205490516340c10f1960e01b8152336004820152602481018490529116906340c10f1990604401600060405180830381600087803b158015610afd57600080fd5b505af1158015610b11573d6000803e3d6000fd5b5050505080826001600160a01b0316336001600160a01b03167ff9a6046584007d37290cdbd06e52b89fda3a301e3df2ecdc2b678426e3558f548b8b88818110610b5d57610b5d611f96565b90506020020135604051610b7391815260200190565b60405180910390a45b50508080610b8990611fc2565b9150506108dd565b505050505050505050505050565b6006546001600160a01b0390811690831603610d0e57600654604051630b02f02d60e31b8152600481018390526000916001600160a01b031690635817816890602401602060405180830381865afa158015610bff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c239190611ff8565b90506001600160a01b038116331480610cbc5750600554600654604051631574d39f60e31b81523360048201526001600160a01b03848116602483015291821660448201526064810185905291169063aba69cf890608401602060405180830381865afa158015610c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbc9190612015565b610d085760405162461bcd60e51b815260206004820152601860248201527f596f7520646f206e6f74206f776e20746869732070756e6b000000000000000060448201526064016106ab565b50610e69565b6040516331a9108f60e11b8152600481018290526000906001600160a01b03841690636352211e90602401602060405180830381865afa158015610d56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7a9190611ff8565b90506001600160a01b038116331480610e115750600554604051631574d39f60e31b81523360048201526001600160a01b0383811660248301528581166044830152606482018590529091169063aba69cf890608401602060405180830381865afa158015610ded573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e119190612015565b610e675760405162461bcd60e51b815260206004820152602160248201527f596f7520646f206e6f74206f776e207468697320706172746e657220746f6b656044820152603760f91b60648201526084016106ab565b505b6009546001906001600160a01b0390811690841603610e8a57506003610ea4565b6008546001600160a01b0390811690841603610ea45750600a5b6001600160a01b0383166000908152600b602090815260408083208584529091529020548111610f3c5760405162461bcd60e51b815260206004820152603b60248201527f4d617820747269636b206f7220747265617420616c6c6f636174696f6e20616c60448201527f726561647920636c61696d6564206279207468697320746f6b656e000000000060648201526084016106ab565b505050565b610f496116db565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b610f736116db565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b610f9d6116db565b565b610fa76116db565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b610fd16116db565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b610ffb6116db565b60405133904780156108fc02916000818181858888f19350505050610f9d57600080fd5b6110276116db565b600980546001600160a01b039384166001600160a01b03199182161790915560088054929093169116179055565b61105d6116db565b3361106757600080fd5b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044016020604051808303816000875af11580156110b4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190612015565b6110e06116db565b6001600160a01b039182166000908152600d6020526040902080546001600160a01b03191691909216179055565b6001544210158061112e5750336000908152600e602052604090205460ff165b61116c5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081e595d081cdd185c9d1959608a1b60448201526064016106ab565b8483146111cd5760405162461bcd60e51b815260206004820152602960248201527f546f6b656e2069647320616e6420626f7820696473206d7573742062652073616044820152680daca40d8cadccee8d60bb1b60648201526084016106ab565b60006112787f265ba43edf7c44ee75ba83efa1ced681cdcf2afebf6fed722ee45f4351502263338989604051602001611207929190611f3d565b604051602081830303815290604052805190602001208888604051602001611230929190611f3d565b6040516020818303038152906040528051906020012060405160200161081d94939291909384526001600160a01b039290921660208401526040830152606082015260800190565b600754604080516020601f87018190048102820181019092528581529293506001600160a01b03909116916112ca9184919087908790819084018382808284376000920191909152506116b792505050565b6001600160a01b03161461131a5760405162461bcd60e51b815260206004820152601760248201527629b4b3b730ba3ab932903737ba10313c9039b4b3b732b960491b60448201526064016106ab565b60005b8681101561154c57600086868381811061133957611339611f96565b60048054604051634ee8178560e01b81526020939093029490940135908201819052935033926001600160a01b03169150634ee8178590602401602060405180830381865afa158015611390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b49190611ff8565b6001600160a01b0316146114155760405162461bcd60e51b815260206004820152602260248201527f426f78206d7573742068617665206265656e206275726e742062792073656e6460448201526132b960f11b60648201526084016106ab565b6000818152600a602052604090205460ff161561147f5760405162461bcd60e51b815260206004820152602260248201527f547265617420616c726561647920636c61696d656420666f72207468697320626044820152610def60f31b60648201526084016106ab565b6000818152600a60205260409020805460ff191660011790556003546001600160a01b031663731133e9338b8b868181106114bc576114bc611f96565b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602002919091013560248301525060016044820152608060648201526000608482015260a401600060405180830381600087803b15801561152057600080fd5b505af1158015611534573d6000803e3d6000fd5b5050505050808061154490611fc2565b91505061131d565b5050505050505050565b61155e6116db565b600155565b61156b6116db565b6001600160a01b03919091166000908152600e60205260409020805460ff1916911515919091179055565b61159e6116db565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6115c86116db565b6001600160a01b03811661162d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ab565b61163681611735565b50565b6116416116db565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b60006116b1611670611785565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b92915050565b60008060006116c685856118ac565b915091506116d38161191a565b509392505050565b6000546001600160a01b03163314610f9d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106ab565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156117de57507f000000000000000000000000000000000000000000000000000000000000000046145b1561180857507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60008082516041036118e25760208301516040840151606085015160001a6118d687828585611ad0565b94509450505050611913565b825160400361190b5760208301516040840151611900868383611bbd565b935093505050611913565b506000905060025b9250929050565b600081600481111561192e5761192e612032565b036119365750565b600181600481111561194a5761194a612032565b036119975760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016106ab565b60028160048111156119ab576119ab612032565b036119f85760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016106ab565b6003816004811115611a0c57611a0c612032565b03611a645760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016106ab565b6004816004811115611a7857611a78612032565b036116365760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016106ab565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611b075750600090506003611bb4565b8460ff16601b14158015611b1f57508460ff16601c14155b15611b305750600090506004611bb4565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611b84573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611bad57600060019250925050611bb4565b9150600090505b94509492505050565b6000806001600160ff1b03831681611bda60ff86901c601b612048565b9050611be887828885611ad0565b935093505050935093915050565b6001600160a01b038116811461163657600080fd5b600060208284031215611c1d57600080fd5b8135611c2881611bf6565b9392505050565b60008083601f840112611c4157600080fd5b50813567ffffffffffffffff811115611c5957600080fd5b6020830191508360208260051b850101111561191357600080fd5b60008083601f840112611c8657600080fd5b50813567ffffffffffffffff811115611c9e57600080fd5b60208301915083602082850101111561191357600080fd5b60008060008060008060008060008060a08b8d031215611cd557600080fd5b8a3567ffffffffffffffff80821115611ced57600080fd5b611cf98e838f01611c2f565b909c509a5060208d0135915080821115611d1257600080fd5b611d1e8e838f01611c2f565b909a50985060408d0135915080821115611d3757600080fd5b611d438e838f01611c2f565b909850965060608d0135915080821115611d5c57600080fd5b611d688e838f01611c2f565b909650945060808d0135915080821115611d8157600080fd5b50611d8e8d828e01611c74565b915080935050809150509295989b9194979a5092959850565b60008060408385031215611dba57600080fd5b8235611dc581611bf6565b946020939093013593505050565b60008060408385031215611de657600080fd5b8235611df181611bf6565b91506020830135611e0181611bf6565b809150509250929050565b60008060008060008060608789031215611e2557600080fd5b863567ffffffffffffffff80821115611e3d57600080fd5b611e498a838b01611c2f565b90985096506020890135915080821115611e6257600080fd5b611e6e8a838b01611c2f565b90965094506040890135915080821115611e8757600080fd5b50611e9489828a01611c74565b979a9699509497509295939492505050565b600060208284031215611eb857600080fd5b5035919050565b801515811461163657600080fd5b60008060408385031215611ee057600080fd5b8235611eeb81611bf6565b91506020830135611e0181611ebf565b60008184825b85811015611f32578135611f1481611bf6565b6001600160a01b031683526020928301929190910190600101611f01565b509095945050505050565b60006001600160fb1b03831115611f5357600080fd5b8260051b80858437919091019392505050565b60008184825b85811015611f32578135611f7f81611ebf565b151583526020928301929190910190600101611f6c565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611fd457611fd4611fac565b5060010190565b600060208284031215611fed57600080fd5b8135611c2881611ebf565b60006020828403121561200a57600080fd5b8151611c2881611bf6565b60006020828403121561202757600080fd5b8151611c2881611ebf565b634e487b7160e01b600052602160045260246000fd5b808201808211156116b1576116b1611fac56fea164736f6c6343000811000a0000000000000000000000005f48045f3a1a19ab9985418869f77612cfa752d60000000000000000000000007c104b4db94494688027cced1e2ebfb89642c80f00000000000000000000000059775fd5f266c216d7566eb216153ab8863c9c84000000000000000000000000b47e3cd837ddf8e4c57f05d70ab865de6e193bbb00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b000000000000000000000000251b5f14a825c537ff788604ea1b58e49b70726f0000000000000000000000000853d5733825729acdfcb4a79cefbbe0b96b3e91
Deployed Bytecode
0x6080604052600436106101e35760003560e01c80639727151a11610102578063dfe0a88911610095578063e8a02a9811610064578063e8a02a98146105a1578063f0e135bf146105e1578063f2fde38b14610611578063f977686a1461063157600080fd5b8063dfe0a88914610513578063e52c6abb14610533578063e6fd48bc14610553578063e7770e0c1461056957600080fd5b8063ad186b85116100d1578063ad186b8514610493578063b0b088e3146104b3578063c44bef75146104d3578063da6da348146104f357600080fd5b80639727151a14610413578063a317ac8914610433578063a4a7af3614610453578063a7a4fa941461047357600080fd5b80636a6440731161017a57806380d175d81161014957806380d175d8146103ad578063853828b6146103cd5780638b7037c4146103d55780638da5cb5b146103f557600080fd5b80636a644073146103225780636c19e78314610358578063715018a61461037857806373aa9e941461038d57600080fd5b80632668380c116101b65780632668380c146102a25780632b2a9757146102c25780632eb246c5146102e2578063530c90fc1461030257600080fd5b8063114ee3c8146101e85780631a491b52146102285780631fbdd72d1461024a578063238ac93314610282575b600080fd5b3480156101f457600080fd5b50610215610203366004611c0b565b600c6020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561023457600080fd5b50610248610243366004611cb6565b610651565b005b34801561025657600080fd5b5060055461026a906001600160a01b031681565b6040516001600160a01b03909116815260200161021f565b34801561028e57600080fd5b5060075461026a906001600160a01b031681565b3480156102ae57600080fd5b5060045461026a906001600160a01b031681565b3480156102ce57600080fd5b506102486102dd366004611da7565b610b9f565b3480156102ee57600080fd5b5060095461026a906001600160a01b031681565b34801561030e57600080fd5b5061024861031d366004611c0b565b610f41565b34801561032e57600080fd5b5061026a61033d366004611c0b565b600d602052600090815260409020546001600160a01b031681565b34801561036457600080fd5b50610248610373366004611c0b565b610f6b565b34801561038457600080fd5b50610248610f95565b34801561039957600080fd5b506102486103a8366004611c0b565b610f9f565b3480156103b957600080fd5b506102486103c8366004611c0b565b610fc9565b610248610ff3565b3480156103e157600080fd5b506102486103f0366004611dd3565b61101f565b34801561040157600080fd5b506000546001600160a01b031661026a565b34801561041f57600080fd5b5061024861042e366004611da7565b611055565b34801561043f57600080fd5b5060025461026a906001600160a01b031681565b34801561045f57600080fd5b5061024861046e366004611dd3565b6110d8565b34801561047f57600080fd5b5061024861048e366004611e0c565b61110e565b34801561049f57600080fd5b5060035461026a906001600160a01b031681565b3480156104bf57600080fd5b5060085461026a906001600160a01b031681565b3480156104df57600080fd5b506102486104ee366004611ea6565b611556565b3480156104ff57600080fd5b5061024861050e366004611ecd565b611563565b34801561051f57600080fd5b5060065461026a906001600160a01b031681565b34801561053f57600080fd5b5061024861054e366004611c0b565b611596565b34801561055f57600080fd5b5061021560015481565b34801561057557600080fd5b50610215610584366004611da7565b600b60209081526000928352604080842090915290825290205481565b3480156105ad57600080fd5b506105d16105bc366004611c0b565b600e6020526000908152604090205460ff1681565b604051901515815260200161021f565b3480156105ed57600080fd5b506105d16105fc366004611ea6565b600a6020526000908152604090205460ff1681565b34801561061d57600080fd5b5061024861062c366004611c0b565b6115c0565b34801561063d57600080fd5b5061024861064c366004611c0b565b611639565b600154421015806106715750336000908152600e602052604090205460ff165b6106b45760405162461bcd60e51b815260206004820152600f60248201526e139bdd081e595d081cdd185c9d1959608a1b60448201526064015b60405180910390fd5b88871480156106c257508885145b80156106cd57508883145b6107195760405162461bcd60e51b815260206004820152601a60248201527f417272617973206d7573742062652073616d65206c656e67746800000000000060448201526064016106ab565b60006108387fe1a6373e29cd5bafb5c6431a15a0970218300732b0c8fea7482715f9731314f4338d8d604051602001610753929190611efb565b604051602081830303815290604052805190602001208c8c60405160200161077c929190611f3d565b604051602081830303815290604052805190602001208b8b6040516020016107a5929190611f66565b604051602081830303815290604052805190602001208a8a6040516020016107ce929190611f3d565b60408051601f198184030181528282528051602091820120908301979097526001600160a01b03909516948101949094526060840192909252608083015260a082015260c081019190915260e0015b60405160208183030381529060405280519060200120611663565b600754604080516020601f87018190048102820181019092528581529293506001600160a01b039091169161088a9184919087908790819084018382808284376000920191909152506116b792505050565b6001600160a01b0316146108da5760405162461bcd60e51b815260206004820152601760248201527629b4b3b730ba3ab932903737ba10313c9039b4b3b732b960491b60448201526064016106ab565b60005b8a811015610b915760008c8c838181106108f9576108f9611f96565b905060200201602081019061090e9190611c0b565b905060008b8b8481811061092457610924611f96565b9050602002013590506109378282610b9f565b6001600160a01b0382166000908152600b60209081526040808320848452909152812080549161096683611fc2565b919050555089898481811061097d5761097d611f96565b90506020020160208101906109929190611fdb565b15610a02576004805460405163ee1fe2ad60e01b815233928101929092526001600160a01b038481166024840152169063ee1fe2ad90604401600060405180830381600087803b1580156109e557600080fd5b505af11580156109f9573d6000803e3d6000fd5b50505050610b7c565b6002546001600160a01b031663731133e9338a8a87818110610a2657610a26611f96565b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602002919091013560248301525060016044820152608060648201526000608482015260a401600060405180830381600087803b158015610a8a57600080fd5b505af1158015610a9e573d6000803e3d6000fd5b505050506001600160a01b038281166000908152600d6020526040908190205490516340c10f1960e01b8152336004820152602481018490529116906340c10f1990604401600060405180830381600087803b158015610afd57600080fd5b505af1158015610b11573d6000803e3d6000fd5b5050505080826001600160a01b0316336001600160a01b03167ff9a6046584007d37290cdbd06e52b89fda3a301e3df2ecdc2b678426e3558f548b8b88818110610b5d57610b5d611f96565b90506020020135604051610b7391815260200190565b60405180910390a45b50508080610b8990611fc2565b9150506108dd565b505050505050505050505050565b6006546001600160a01b0390811690831603610d0e57600654604051630b02f02d60e31b8152600481018390526000916001600160a01b031690635817816890602401602060405180830381865afa158015610bff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c239190611ff8565b90506001600160a01b038116331480610cbc5750600554600654604051631574d39f60e31b81523360048201526001600160a01b03848116602483015291821660448201526064810185905291169063aba69cf890608401602060405180830381865afa158015610c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cbc9190612015565b610d085760405162461bcd60e51b815260206004820152601860248201527f596f7520646f206e6f74206f776e20746869732070756e6b000000000000000060448201526064016106ab565b50610e69565b6040516331a9108f60e11b8152600481018290526000906001600160a01b03841690636352211e90602401602060405180830381865afa158015610d56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7a9190611ff8565b90506001600160a01b038116331480610e115750600554604051631574d39f60e31b81523360048201526001600160a01b0383811660248301528581166044830152606482018590529091169063aba69cf890608401602060405180830381865afa158015610ded573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e119190612015565b610e675760405162461bcd60e51b815260206004820152602160248201527f596f7520646f206e6f74206f776e207468697320706172746e657220746f6b656044820152603760f91b60648201526084016106ab565b505b6009546001906001600160a01b0390811690841603610e8a57506003610ea4565b6008546001600160a01b0390811690841603610ea45750600a5b6001600160a01b0383166000908152600b602090815260408083208584529091529020548111610f3c5760405162461bcd60e51b815260206004820152603b60248201527f4d617820747269636b206f7220747265617420616c6c6f636174696f6e20616c60448201527f726561647920636c61696d6564206279207468697320746f6b656e000000000060648201526084016106ab565b505050565b610f496116db565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b610f736116db565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b610f9d6116db565b565b610fa76116db565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b610fd16116db565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b610ffb6116db565b60405133904780156108fc02916000818181858888f19350505050610f9d57600080fd5b6110276116db565b600980546001600160a01b039384166001600160a01b03199182161790915560088054929093169116179055565b61105d6116db565b3361106757600080fd5b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044016020604051808303816000875af11580156110b4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3c9190612015565b6110e06116db565b6001600160a01b039182166000908152600d6020526040902080546001600160a01b03191691909216179055565b6001544210158061112e5750336000908152600e602052604090205460ff165b61116c5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081e595d081cdd185c9d1959608a1b60448201526064016106ab565b8483146111cd5760405162461bcd60e51b815260206004820152602960248201527f546f6b656e2069647320616e6420626f7820696473206d7573742062652073616044820152680daca40d8cadccee8d60bb1b60648201526084016106ab565b60006112787f265ba43edf7c44ee75ba83efa1ced681cdcf2afebf6fed722ee45f4351502263338989604051602001611207929190611f3d565b604051602081830303815290604052805190602001208888604051602001611230929190611f3d565b6040516020818303038152906040528051906020012060405160200161081d94939291909384526001600160a01b039290921660208401526040830152606082015260800190565b600754604080516020601f87018190048102820181019092528581529293506001600160a01b03909116916112ca9184919087908790819084018382808284376000920191909152506116b792505050565b6001600160a01b03161461131a5760405162461bcd60e51b815260206004820152601760248201527629b4b3b730ba3ab932903737ba10313c9039b4b3b732b960491b60448201526064016106ab565b60005b8681101561154c57600086868381811061133957611339611f96565b60048054604051634ee8178560e01b81526020939093029490940135908201819052935033926001600160a01b03169150634ee8178590602401602060405180830381865afa158015611390573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b49190611ff8565b6001600160a01b0316146114155760405162461bcd60e51b815260206004820152602260248201527f426f78206d7573742068617665206265656e206275726e742062792073656e6460448201526132b960f11b60648201526084016106ab565b6000818152600a602052604090205460ff161561147f5760405162461bcd60e51b815260206004820152602260248201527f547265617420616c726561647920636c61696d656420666f72207468697320626044820152610def60f31b60648201526084016106ab565b6000818152600a60205260409020805460ff191660011790556003546001600160a01b031663731133e9338b8b868181106114bc576114bc611f96565b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602002919091013560248301525060016044820152608060648201526000608482015260a401600060405180830381600087803b15801561152057600080fd5b505af1158015611534573d6000803e3d6000fd5b5050505050808061154490611fc2565b91505061131d565b5050505050505050565b61155e6116db565b600155565b61156b6116db565b6001600160a01b03919091166000908152600e60205260409020805460ff1916911515919091179055565b61159e6116db565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6115c86116db565b6001600160a01b03811661162d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ab565b61163681611735565b50565b6116416116db565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b60006116b1611670611785565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b92915050565b60008060006116c685856118ac565b915091506116d38161191a565b509392505050565b6000546001600160a01b03163314610f9d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106ab565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000306001600160a01b037f000000000000000000000000d52c79d897a24c275729112c3c5ea813b5703f88161480156117de57507f000000000000000000000000000000000000000000000000000000000000000146145b1561180857507f9649a61c5e054e602e7581379ae0d1dcb4ef13dc8a1ad5e7310082bbb9f004a390565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527fe297dc76640cef989985c42b05bae92d9c49be4f187fecf912f73573f397d904828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60008082516041036118e25760208301516040840151606085015160001a6118d687828585611ad0565b94509450505050611913565b825160400361190b5760208301516040840151611900868383611bbd565b935093505050611913565b506000905060025b9250929050565b600081600481111561192e5761192e612032565b036119365750565b600181600481111561194a5761194a612032565b036119975760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016106ab565b60028160048111156119ab576119ab612032565b036119f85760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016106ab565b6003816004811115611a0c57611a0c612032565b03611a645760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016106ab565b6004816004811115611a7857611a78612032565b036116365760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016106ab565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611b075750600090506003611bb4565b8460ff16601b14158015611b1f57508460ff16601c14155b15611b305750600090506004611bb4565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611b84573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611bad57600060019250925050611bb4565b9150600090505b94509492505050565b6000806001600160ff1b03831681611bda60ff86901c601b612048565b9050611be887828885611ad0565b935093505050935093915050565b6001600160a01b038116811461163657600080fd5b600060208284031215611c1d57600080fd5b8135611c2881611bf6565b9392505050565b60008083601f840112611c4157600080fd5b50813567ffffffffffffffff811115611c5957600080fd5b6020830191508360208260051b850101111561191357600080fd5b60008083601f840112611c8657600080fd5b50813567ffffffffffffffff811115611c9e57600080fd5b60208301915083602082850101111561191357600080fd5b60008060008060008060008060008060a08b8d031215611cd557600080fd5b8a3567ffffffffffffffff80821115611ced57600080fd5b611cf98e838f01611c2f565b909c509a5060208d0135915080821115611d1257600080fd5b611d1e8e838f01611c2f565b909a50985060408d0135915080821115611d3757600080fd5b611d438e838f01611c2f565b909850965060608d0135915080821115611d5c57600080fd5b611d688e838f01611c2f565b909650945060808d0135915080821115611d8157600080fd5b50611d8e8d828e01611c74565b915080935050809150509295989b9194979a5092959850565b60008060408385031215611dba57600080fd5b8235611dc581611bf6565b946020939093013593505050565b60008060408385031215611de657600080fd5b8235611df181611bf6565b91506020830135611e0181611bf6565b809150509250929050565b60008060008060008060608789031215611e2557600080fd5b863567ffffffffffffffff80821115611e3d57600080fd5b611e498a838b01611c2f565b90985096506020890135915080821115611e6257600080fd5b611e6e8a838b01611c2f565b90965094506040890135915080821115611e8757600080fd5b50611e9489828a01611c74565b979a9699509497509295939492505050565b600060208284031215611eb857600080fd5b5035919050565b801515811461163657600080fd5b60008060408385031215611ee057600080fd5b8235611eeb81611bf6565b91506020830135611e0181611ebf565b60008184825b85811015611f32578135611f1481611bf6565b6001600160a01b031683526020928301929190910190600101611f01565b509095945050505050565b60006001600160fb1b03831115611f5357600080fd5b8260051b80858437919091019392505050565b60008184825b85811015611f32578135611f7f81611ebf565b151583526020928301929190910190600101611f6c565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611fd457611fd4611fac565b5060010190565b600060208284031215611fed57600080fd5b8135611c2881611ebf565b60006020828403121561200a57600080fd5b8151611c2881611bf6565b60006020828403121561202757600080fd5b8151611c2881611ebf565b634e487b7160e01b600052602160045260246000fd5b808201808211156116b1576116b1611fac56fea164736f6c6343000811000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000005f48045f3a1a19ab9985418869f77612cfa752d60000000000000000000000007c104b4db94494688027cced1e2ebfb89642c80f00000000000000000000000059775fd5f266c216d7566eb216153ab8863c9c84000000000000000000000000b47e3cd837ddf8e4c57f05d70ab865de6e193bbb00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b000000000000000000000000251b5f14a825c537ff788604ea1b58e49b70726f0000000000000000000000000853d5733825729acdfcb4a79cefbbe0b96b3e91
-----Decoded View---------------
Arg [0] : _tricks (address): 0x5F48045f3A1a19Ab9985418869f77612CFA752d6
Arg [1] : _treats (address): 0x7C104b4db94494688027CcED1E2EBFb89642C80F
Arg [2] : _treasureBox (address): 0x59775fD5F266C216D7566eB216153aB8863C9c84
Arg [3] : _punks (address): 0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB
Arg [4] : _delegationRegistry (address): 0x00000000000076A84feF008CDAbe6409d2FE638B
Arg [5] : _souls (address): 0x251b5F14A825C537ff788604eA1b58e49b70726f
Arg [6] : _beasts (address): 0x0853D5733825729ACdfCB4A79CEFbBe0B96B3e91
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000005f48045f3a1a19ab9985418869f77612cfa752d6
Arg [1] : 0000000000000000000000007c104b4db94494688027cced1e2ebfb89642c80f
Arg [2] : 00000000000000000000000059775fd5f266c216d7566eb216153ab8863c9c84
Arg [3] : 000000000000000000000000b47e3cd837ddf8e4c57f05d70ab865de6e193bbb
Arg [4] : 00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b
Arg [5] : 000000000000000000000000251b5f14a825c537ff788604ea1b58e49b70726f
Arg [6] : 0000000000000000000000000853d5733825729acdfcb4a79cefbbe0b96b3e91
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.