Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 15402660 | 784 days ago | IN | 0 ETH | 0.01989508 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
MeowMeowUpgradeable
Compiler Version
v0.8.7+commit.e28d00a7
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.4; import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721PausableUpgradeable.sol"; import "./ERC5058Upgradeable/ERC5058Upgradeable.sol"; import "./ERC721VATUpgradeable/ERC721VATUpgradeable.sol"; import "./extensions/ERC721MultiURIUpgradeable.sol"; import "./extensions/TokenWithdrawUpgradeable.sol"; import "./ERC721AUpgradeable/ERC721AUpgradeable.sol"; contract MeowMeowUpgradeable is Initializable, AccessControlEnumerableUpgradeable, ReentrancyGuardUpgradeable, ERC721EnumerableUpgradeable, ERC721PausableUpgradeable, IERC721ReceiverUpgradeable, ERC5058Upgradeable, ERC721VATUpgradeable, ERC721MultiURIUpgradeable, TokenWithdrawUpgradeable, ERC721AUpgradeable { using CountersUpgradeable for CountersUpgradeable.Counter; using SafeERC20Upgradeable for IERC20Upgradeable; bytes32 public constant MARKET_ROLE = keccak256("MARKET_ROLE"); bytes32 public constant VAT_ADMIN_ROLE = keccak256("VAT_ADMIN_ROLE"); uint256 public constant MaxAvailable = 10000; bool public constant ChromeExtension = true; CountersUpgradeable.Counter private _tokenIdTracker; address payable private _devWallet; bytes32 private _wlHash; bool public openMint; IERC20Upgradeable public rewardToken; address public tradeRewardWallet; uint256 public tradeRewardPerETH; uint256 public freeMintMaxNum; uint256 public currentFreeMintNum; uint256 public freeMintStartAfter; uint256 public freeMintNumPerAddress; uint256 public freeMintReward; uint256 public publicSaleStartAfter; uint256 public publicSaleNumPerAddress; uint256 public publicSalePrice; uint256 public publicSaleReward; uint256 public wlMintStartAfter; uint256 public wlMintNumPerAddress; uint256 public wlMintPrice; uint256 public wlMintReward; mapping(address => uint256) public wlMinted; mapping(address => uint256) public freeMinted; uint256 public startTokenId; /* function initialize() public initializer { OwnableUpgradeable.__Ownable_init(); ReentrancyGuardUpgradeable.__ReentrancyGuard_init(); ERC721PausableUpgradeable.__ERC721Pausable_init(); ERC721Upgradeable.__ERC721_init("MeowMeow", "MeowMeow"); ERC721MultiURIUpgradeable.__ERC721MultiURI_init( "", "https://ipfs.io/ipfs/QmNsvbhQHCWYpPxJxeG7qkmFEpS8d9gmPFrdRLXE7reKaP" ); __MeowMeow_init_unchained(); } function __MeowMeow_init_unchained() internal onlyInitializing { rewardToken = IERC20Upgradeable(0x84a32718E09fD6C0045070Fe7921153A290D45C2); tradeRewardWallet = 0x99999ca5293f20Bf666bDf317316eB83a4863A81; tradeRewardPerETH = 2000000; _devWallet = payable(0x00000078114eA16C13D81b6b1e96c607B3831829); openMint = true; freeMintMaxNum = 1; freeMintStartAfter = 1659952800; freeMintNumPerAddress = 1; freeMintReward = 5000 ether; publicSaleStartAfter = 1660305600; publicSaleNumPerAddress = 5; publicSalePrice = 0.0069 ether; publicSaleReward = 15000 ether; wlMintStartAfter = 1660305600; wlMintNumPerAddress = 1; wlMintReward = 10000 ether; _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); // seaport market _grantRole(MARKET_ROLE, 0x00000000006c3852cbEf3e08E8dF289169EdE581); } */ function setRewardToken(address token) external onlyOwner { rewardToken = IERC20Upgradeable(token); } function setTradeRewardPerETH(uint256 reward) external onlyOwner { tradeRewardPerETH = reward; } function setDevWallet(address payable newWallet) external onlyOwner { _devWallet = newWallet; } function setWLHash(bytes32 hash) external onlyOwner { _wlHash = hash; } function setFreeMintMaxNum(uint256 num) external onlyOwner { freeMintMaxNum = num; } function setFreeMint( uint256 start, uint256 num, uint256 reward ) external onlyOwner { freeMintStartAfter = start; freeMintNumPerAddress = num; freeMintReward = reward; } function setPublicSale( uint256 start, uint256 num, uint256 price, uint256 reward ) external onlyOwner { publicSaleStartAfter = start; publicSaleNumPerAddress = num; publicSalePrice = price; publicSaleReward = reward; } function setWLMint( uint256 start, uint256 num, uint256 price, uint256 reward ) external onlyOwner { wlMintStartAfter = start; wlMintNumPerAddress = num; wlMintPrice = price; wlMintReward = reward; } function setOpenMint(bool open) external onlyOwner { openMint = open; } function freeMint(uint256 num) external whenNotPaused { require(openMint, "mint ended"); require(tx.origin == msg.sender, "only EOA"); require(currentFreeMintNum + num <= freeMintMaxNum, "insufficient free remaining"); require(totalSupply() + num <= MaxAvailable, "mint ended"); require( freeMintNumPerAddress == 0 || freeMinted[msg.sender] + num <= freeMintNumPerAddress, "already free minted" ); require(block.timestamp >= freeMintStartAfter && freeMintStartAfter > 0, "not start yet"); freeMinted[msg.sender] += num; currentFreeMintNum += num; _rewardToken(num, freeMintReward * num); } function publicSale(uint256 num) external payable whenNotPaused nonReentrant { require(openMint, "mint ended"); require(tx.origin == msg.sender, "only EOA"); require(totalSupply() + num <= MaxAvailable, "mint ended"); require(block.timestamp >= publicSaleStartAfter && publicSaleStartAfter > 0, "not start yet"); require(publicSaleNumPerAddress == 0 || num <= publicSaleNumPerAddress, "invalid mint num"); require(msg.value == num * publicSalePrice, "insufficient funds"); if (publicSalePrice > 0) { AddressUpgradeable.sendValue(_devWallet, msg.value); } _rewardToken(num, publicSaleReward * num); } function whitelistMint(uint256 num, bytes32[] calldata proof) external payable whenNotPaused nonReentrant { require(openMint, "mint ended"); require(tx.origin == msg.sender, "only EOA"); require(totalSupply() + num <= MaxAvailable, "insufficient remaining"); require( MerkleProofUpgradeable.verify(proof, _wlHash, keccak256(abi.encodePacked(msg.sender))), "invalid proof" ); require(wlMintNumPerAddress == 0 || wlMinted[msg.sender] + num <= wlMintNumPerAddress, "already wl minted"); require(block.timestamp >= wlMintStartAfter && wlMintStartAfter > 0, "not start yet"); require(msg.value == num * wlMintPrice, "insufficient funds"); if (wlMintPrice > 0) { AddressUpgradeable.sendValue(_devWallet, msg.value); } else { require(currentFreeMintNum + num <= freeMintMaxNum, "insufficient free remaining"); currentFreeMintNum += num; } wlMinted[msg.sender] += num; _rewardToken(num, wlMintReward * num); } function increaseTokenVAT(uint256 tokenId, uint256 vat) external onlyRole(VAT_ADMIN_ROLE) { _increaseTokenVAT(tokenId, vat); } function _increaseTokenVAT(uint256 tokenId, uint256 vat) internal virtual override { super._increaseTokenVAT(tokenId, vat); uint256 tradeReward = tradeRewardPerETH * vat; if (rewardToken.allowance(tradeRewardWallet, address(this)) >= tradeReward) { rewardToken.transferFrom(tradeRewardWallet, currentTradeInfo.seller, tradeReward / 2); rewardToken.transferFrom(tradeRewardWallet, currentTradeInfo.buyer, tradeReward / 2); } } function exists(uint256 tokenId) external view returns (bool) { return _exists(tokenId); } function tokenURI(uint256 tokenId) public view virtual override(ERC721Upgradeable, ERC721AUpgradeable, ERC721MultiURIUpgradeable) returns (string memory) { return super.tokenURI(tokenId); } function burn(uint256 tokenId) external { _burn(tokenId); } function _baseURI() internal view override(ERC721Upgradeable, ERC721AUpgradeable, ERC721MultiURIUpgradeable) returns (string memory) { return super._baseURI(); } function _burn(uint256 tokenId) internal virtual override( ERC721Upgradeable, ERC721AUpgradeable, ERC5058Upgradeable, ERC721VATUpgradeable, ERC721MultiURIUpgradeable ) { require(!openMint, "Not allow burn during minting period"); if (tokenId < startTokenId) { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not owner nor approved"); ERC721Upgradeable._burn(tokenId); } else { ERC721AUpgradeable._burn(tokenId); } } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override( ERC721Upgradeable, ERC721AUpgradeable, ERC721EnumerableUpgradeable, ERC721PausableUpgradeable, ERC5058Upgradeable ) { super._beforeTokenTransfer(from, to, tokenId); } function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override(ERC721Upgradeable, ERC721AUpgradeable) { super._afterTokenTransfer(from, to, tokenId); _tokenSecondaryMarketTransaction(from, to, tokenId); } function _rewardToken(uint256 num, uint256 reward) internal { _mint(msg.sender, num); if (reward > 0 && rewardToken.allowance(tradeRewardWallet, address(this)) >= reward) { rewardToken.transferFrom(tradeRewardWallet, msg.sender, reward); } } function supportsInterface(bytes4 interfaceId) public view virtual override( AccessControlEnumerableUpgradeable, ERC721Upgradeable, ERC721AUpgradeable, ERC721EnumerableUpgradeable, ERC5058Upgradeable ) returns (bool) { return super.supportsInterface(interfaceId); } function onERC721Received( address, /*operator*/ address, /*from*/ uint256, /*tokenId*/ bytes calldata /*data*/ ) public virtual override returns (bytes4) { return this.onERC721Received.selector; } function pause() public onlyOwner { PausableUpgradeable._pause(); } function unpause() public onlyOwner { PausableUpgradeable._unpause(); } receive() external payable {} function ERC721A_init() external onlyOwner { startTokenId = ERC721EnumerableUpgradeable.totalSupply() + 1; ERC721AStorage.layout()._currentIndex = startTokenId; } function setCurrentIndex(uint256 tokenId) external onlyOwner { ERC721AStorage.layout()._currentIndex = tokenId; } function _startTokenId() internal view virtual override returns (uint256) { return startTokenId; } function _exists(uint256 tokenId) internal view virtual override(ERC721Upgradeable, ERC721AUpgradeable) returns (bool) { if (tokenId < startTokenId) { return ERC721Upgradeable._exists(tokenId); } return ERC721AUpgradeable._exists(tokenId); } function _mint(address to, uint256 quantity) internal virtual override(ERC721Upgradeable, ERC721AUpgradeable) { ERC721AUpgradeable._mint(to, quantity); } function _safeMint(address to, uint256 quantity) internal virtual override(ERC721Upgradeable, ERC721AUpgradeable) { ERC721AUpgradeable._safeMint(to, quantity); } function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual override(ERC721Upgradeable, ERC721AUpgradeable) { ERC721AUpgradeable._safeMint(to, quantity, _data); } function name() public view virtual override(ERC721Upgradeable, ERC721AUpgradeable) returns (string memory) { return ERC721Upgradeable.name(); } function symbol() public view virtual override(ERC721Upgradeable, ERC721AUpgradeable) returns (string memory) { return ERC721Upgradeable.symbol(); } function totalSupply() public view virtual override(ERC721EnumerableUpgradeable, ERC721AUpgradeable) returns (uint256) { return ERC721AUpgradeable.totalSupply() + _startTokenId(); } function balanceOf(address owner) public view virtual override(ERC721Upgradeable, ERC721AUpgradeable) returns (uint256) { return ERC721AUpgradeable.balanceOf(owner) + ERC721Upgradeable.balanceOf(owner); } function ownerOf(uint256 tokenId) public view virtual override(ERC721Upgradeable, ERC721AUpgradeable) returns (address) { if (tokenId < startTokenId) { return ERC721Upgradeable.ownerOf(tokenId); } return ERC721AUpgradeable.ownerOf(tokenId); } function approve(address to, uint256 tokenId) public virtual override(ERC721Upgradeable, ERC721AUpgradeable) { if (tokenId < startTokenId) { ERC721Upgradeable.approve(to, tokenId); } else { ERC721AUpgradeable.approve(to, tokenId); } } function getApproved(uint256 tokenId) public view virtual override(ERC721Upgradeable, ERC721AUpgradeable) returns (address) { if (tokenId < startTokenId) { return ERC721Upgradeable.getApproved(tokenId); } return ERC721AUpgradeable.getApproved(tokenId); } function setApprovalForAll(address operator, bool approved) public virtual override(ERC721Upgradeable, ERC721AUpgradeable) { ERC721Upgradeable.setApprovalForAll(operator, approved); } function isApprovedForAll(address owner, address operator) public view virtual override(ERC721Upgradeable, ERC721AUpgradeable) returns (bool) { return ERC721Upgradeable.isApprovedForAll(owner, operator); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) public virtual override(ERC721Upgradeable, ERC721AUpgradeable) { if (tokenId < startTokenId) { ERC721Upgradeable.safeTransferFrom(from, to, tokenId, data); } else { ERC721AUpgradeable.safeTransferFrom(from, to, tokenId, data); } } function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override(ERC721Upgradeable, ERC721AUpgradeable) { if (tokenId < startTokenId) { ERC721Upgradeable.safeTransferFrom(from, to, tokenId, ""); } else { ERC721AUpgradeable.safeTransferFrom(from, to, tokenId, ""); } } function transferFrom( address from, address to, uint256 tokenId ) public virtual override(ERC721Upgradeable, ERC721AUpgradeable) { if (tokenId < startTokenId) { ERC721Upgradeable.transferFrom(from, to, tokenId); } else { ERC721AUpgradeable.transferFrom(from, to, tokenId); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal onlyInitializing { } function __AccessControlEnumerable_init_unchained() internal onlyInitializing { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library CountersUpgradeable { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. */ library MerkleProofUpgradeable { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`, * consuming from one or the other at each step according to the instructions given by * `proofFlags`. * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof} * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "./IERC721EnumerableUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable { function __ERC721Enumerable_init() internal onlyInitializing { } function __ERC721Enumerable_init_unchained() internal onlyInitializing { } // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721Upgradeable.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721EnumerableUpgradeable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev 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 = ERC721Upgradeable.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[46] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "../../../security/PausableUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev ERC721 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC721PausableUpgradeable is Initializable, ERC721Upgradeable, PausableUpgradeable { function __ERC721Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __ERC721Pausable_init_unchained() internal onlyInitializing { } /** * @dev See {ERC721-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); require(!paused(), "ERC721Pausable: token transfer while paused"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "./IERC5058Upgradeable.sol"; /** * @dev Implementation ERC721 Lockable Token */ abstract contract ERC5058Upgradeable is Initializable, ERC721Upgradeable, IERC5058Upgradeable { // Mapping from token ID to unlock time mapping(uint256 => uint256) public lockedTokens; // Mapping from token ID to lock approved address mapping(uint256 => address) private _lockApprovals; // Mapping from owner to lock operator approvals mapping(address => mapping(address => bool)) private _lockOperatorApprovals; function __ERC5058_init() internal onlyInitializing {} function __ERC5058_init_unchained() internal onlyInitializing {} /** * @dev See {IERC5058-lockApprove}. */ function lockApprove(address to, uint256 tokenId) public virtual override { require(!isLocked(tokenId), "ERC5058: token is locked"); address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC5058: lock approval to current owner"); require( _msgSender() == owner || isLockApprovedForAll(owner, _msgSender()), "ERC5058: lock approve caller is not owner nor approved for all" ); _lockApprove(owner, to, tokenId); } /** * @dev See {IERC5058-getLockApproved}. */ function getLockApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC5058: lock approved query for nonexistent token"); return _lockApprovals[tokenId]; } /** * @dev See {IERC5058-lockerOf}. */ function lockerOf(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC5058: locker query for nonexistent token"); require(isLocked(tokenId), "ERC5058: locker query for non-locked token"); return _lockApprovals[tokenId]; } /** * @dev See {IERC5058-setLockApprovalForAll}. */ function setLockApprovalForAll(address operator, bool approved) public virtual override { _setLockApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC5058-isLockApprovedForAll}. */ function isLockApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _lockOperatorApprovals[owner][operator]; } /** * @dev See {IERC5058-isLocked}. */ function isLocked(uint256 tokenId) public view virtual override returns (bool) { return lockedTokens[tokenId] > block.timestamp; } /** * @dev See {IERC5058-lockExpiredTime}. */ function lockExpiredTime(uint256 tokenId) public view virtual override returns (uint256) { return lockedTokens[tokenId]; } /** * @dev See {IERC5058-lock}. */ function lock(uint256 tokenId, uint256 expired) public virtual override { //solhint-disable-next-line max-line-length require(_isLockApprovedOrOwner(_msgSender(), tokenId), "ERC5058: lock caller is not owner nor approved"); require(expired > block.timestamp, "ERC5058: expired time must be greater than current block timestamp"); require(!isLocked(tokenId), "ERC5058: token is locked"); _lock(_msgSender(), tokenId, expired); } /** * @dev See {IERC5058-unlock}. */ function unlock(uint256 tokenId) public virtual override { require(lockerOf(tokenId) == _msgSender(), "ERC5058: unlock caller is not lock operator"); address from = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenLock(_msgSender(), from, tokenId, 0); delete lockedTokens[tokenId]; emit Unlocked(_msgSender(), from, tokenId); _afterTokenLock(_msgSender(), from, tokenId, 0); } /** * @dev Locks `tokenId` from `from` until `expired`. * * Requirements: * * - `tokenId` token must be owned by `from`. * * Emits a {Locked} event. */ function _lock( address operator, uint256 tokenId, uint256 expired ) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenLock(operator, owner, tokenId, expired); lockedTokens[tokenId] = expired; _lockApprovals[tokenId] = _msgSender(); emit Locked(operator, owner, tokenId, expired); _afterTokenLock(operator, owner, tokenId, expired); } /** * @dev Safely mints `tokenId` and transfers it to `to`, but the `tokenId` is locked and cannot be transferred. * * Requirements: * * - `tokenId` must not exist. * * Emits {Locked} and {Transfer} event. */ function _safeLockMint( address to, uint256 tokenId, uint256 expired, bytes memory _data ) internal virtual { require(expired > block.timestamp, "ERC5058: lock mint for invalid lock block timestamp"); _safeMint(to, tokenId, _data); _lock(address(0), tokenId, expired); } /** * @dev See {ERC721-_burn}. This override additionally clears the lock approvals for the token. */ function _burn(uint256 tokenId) internal virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenLock(_msgSender(), owner, tokenId, 0); // clear lock approvals delete lockedTokens[tokenId]; delete _lockApprovals[tokenId]; _afterTokenLock(_msgSender(), owner, tokenId, 0); super._burn(tokenId); } /** * @dev Approve `to` to lock operate on `tokenId` * * Emits a {LockApproval} event. */ function _lockApprove( address owner, address to, uint256 tokenId ) internal virtual { _lockApprovals[tokenId] = to; emit LockApproval(owner, to, tokenId); } /** * @dev Approve `operator` to lock operate on all of `owner` tokens * * Emits a {LockApprovalForAll} event. */ function _setLockApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC5058: lock approve to caller"); _lockOperatorApprovals[owner][operator] = approved; emit LockApprovalForAll(owner, operator, approved); } /** * @dev Returns whether `spender` is allowed to lock `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isLockApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC5058: lock operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || isLockApprovedForAll(owner, spender) || getLockApproved(tokenId) == spender); } /** * @dev See {ERC721-_beforeTokenTransfer}. * * Requirements: * * - the `tokenId` must not be locked. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); require(!isLocked(tokenId), "ERC5058: token transfer while locked"); } /** * @dev Hook that is called before any token lock/unlock. * * Calling conditions: * * - `owner` is non-zero. * - When `expired` is zero, `tokenId` will be unlock for `from`. * - When `expired` is non-zero, ``from``'s `tokenId` will be locked. * */ function _beforeTokenLock( address operator, address owner, uint256 tokenId, uint256 expired ) internal virtual {} /** * @dev Hook that is called after any lock/unlock of tokens. * * Calling conditions: * * - `owner` is non-zero. * - When `expired` is zero, `tokenId` will be unlock for `from`. * - When `expired` is non-zero, ``from``'s `tokenId` will be locked. * */ function _afterTokenLock( address operator, address owner, uint256 tokenId, uint256 expired ) internal virtual {} /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC5058Upgradeable).interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; abstract contract ERC721VATUpgradeable is Initializable, ERC721Upgradeable { event IncreaseVAT(address market, uint256 tokenId, uint256 vat); event DecreaseVAT(address owner, uint256 tokenId, uint256 vat); event MarketTransaction(address market, address from, address to, uint256 tokenId); struct TradeInfo { address seller; address buyer; uint256 tokenId; bool used; } struct VATInfo { uint256 balance; uint256 count; } TradeInfo public currentTradeInfo; uint256 public totalVAT; uint256 public totalTransactions; // Mapping from token id to token VAT balance mapping(uint256 => VATInfo) public tokensVAT; function __ERC721VAT_init() internal onlyInitializing {} function __ERC721VAT_init_unchained() internal onlyInitializing {} // called by VATReceiver function _increaseTokenVAT(uint256 tokenId, uint256 vat) internal virtual { totalVAT += vat; currentTradeInfo.used = true; VATInfo storage info = tokensVAT[tokenId]; info.balance += vat; info.count++; emit IncreaseVAT(msg.sender, tokenId, vat); } function _burn(uint256 tokenId) internal virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); VATInfo storage info = tokensVAT[tokenId]; AddressUpgradeable.sendValue(payable(owner), info.balance); totalVAT -= info.balance; delete tokensVAT[tokenId]; emit DecreaseVAT(owner, tokenId, info.balance); super._burn(tokenId); } function _tokenSecondaryMarketTransaction( address from, address to, uint256 tokenId ) internal virtual { currentTradeInfo.seller = from; currentTradeInfo.buyer = to; currentTradeInfo.tokenId = tokenId; currentTradeInfo.used = false; totalTransactions++; emit MarketTransaction(msg.sender, from, to, tokenId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; abstract contract ERC721MultiURIUpgradeable is Initializable, OwnableUpgradeable, ERC721Upgradeable { using StringsUpgradeable for uint256; string public baseTokenURI; string public bundleTokenURI; string private _mysteryBoxURI; struct MultiURI { // 0: baseTokenURI // 1: bundleTokenURI // 2: uris[0] // 3: uris[1] // 4: uris[2] uint8 displayId; string[3] uris; } mapping(uint256 => MultiURI) private _tokenURIs; function __ERC721MultiURI_init(string memory _baseTokenURI, string memory _boxURI) internal onlyInitializing { __ERC721MultiURI_init_unchained(_baseTokenURI, _boxURI); } function __ERC721MultiURI_init_unchained(string memory _baseTokenURI, string memory _boxURI) internal onlyInitializing { baseTokenURI = _baseTokenURI; _mysteryBoxURI = _boxURI; } function setBaseTokenURI(string memory _baseTokenURI) public onlyOwner { baseTokenURI = _baseTokenURI; } function setBundleTokenURI(string memory _bundleTokenURI) public onlyOwner { bundleTokenURI = _bundleTokenURI; } function setMysteryBoxURI(string memory _uri) public onlyOwner { _mysteryBoxURI = _uri; } function setTokenURI( uint256 tokenId, uint256 pos, string memory uri ) public virtual { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721MultiURI: caller is not owner nor approved"); require(pos < 3, "ERC721MultiURI: uri pos out of index"); _tokenURIs[tokenId].uris[pos] = uri; } function setDisplayTokenURI(uint256 tokenId, uint8 displayId) public virtual { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721MultiURI: caller is not owner nor approved"); require(displayId < 5, "ERC721MultiURI: display id out of index"); string memory uri = displayURI(tokenId, displayId); require(bytes(uri).length > 0, "ERC721MultiURI: empty uri"); _tokenURIs[tokenId].displayId = displayId; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721MultiURI: URI query for nonexistent token"); uint8 displayId = _tokenURIs[tokenId].displayId; string memory uri = displayURI(tokenId, displayId); if (bytes(uri).length > 0) { return uri; } return super.tokenURI(tokenId); } function displayURI(uint256 tokenId, uint8 displayId) public view virtual returns (string memory) { if (displayId == 0) { string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : _mysteryBoxURI; } if (displayId == 1) { if (bytes(bundleTokenURI).length > 0) { return string(abi.encodePacked(bundleTokenURI, tokenId.toString())); } } else { string memory uri = _tokenURIs[tokenId].uris[displayId - 2]; if (bytes(uri).length > 0) { return uri; } } return ""; } function _baseURI() internal view virtual override returns (string memory) { return baseTokenURI; } function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); delete _tokenURIs[tokenId]; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; abstract contract TokenWithdrawUpgradeable is Initializable, OwnableUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; function __TokenWithdraw_init() internal onlyInitializing {} function __TokenWithdraw_init_unchained() internal onlyInitializing {} function withdraw(address payable to, uint256 amount) external onlyOwner { AddressUpgradeable.sendValue(to, amount); } function withdrawERC20( address token, address to, uint256 amount ) external onlyOwner { IERC20Upgradeable(token).safeTransfer(to, amount); } function withdrawERC721( address token, address to, uint256 tokenId ) external onlyOwner { IERC721Upgradeable(token).safeTransferFrom(address(this), to, tokenId); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; import "./IERC721AUpgradeable.sol"; import { ERC721AStorage } from "./ERC721AStorage.sol"; import "erc721a-upgradeable/contracts/ERC721A__Initializable.sol"; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721ReceiverUpgradeable { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721AUpgradeable is ERC721A__Initializable, IERC721AUpgradeable { using ERC721AStorage for ERC721AStorage.Layout; // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // CONSTRUCTOR // ============================================================= function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializingERC721A { __ERC721A_init_unchained(name_, symbol_); } function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializingERC721A { ERC721AStorage.layout()._name = name_; ERC721AStorage.layout()._symbol = symbol_; ERC721AStorage.layout()._currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return ERC721AStorage.layout()._currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return ERC721AStorage.layout()._currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return ERC721AStorage.layout()._burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return ERC721AStorage.layout()._packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(ERC721AStorage.layout()._packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = ERC721AStorage.layout()._packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); ERC721AStorage.layout()._packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return ERC721AStorage.layout()._name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return ERC721AStorage.layout()._symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ""; } /** * @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, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(ERC721AStorage.layout()._packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (ERC721AStorage.layout()._packedOwnerships[index] == 0) { ERC721AStorage.layout()._packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < ERC721AStorage.layout()._currentIndex) { uint256 packed = ERC721AStorage.layout()._packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = ERC721AStorage.layout()._packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @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) public virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } ERC721AStorage.layout()._tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return ERC721AStorage.layout()._tokenApprovals[tokenId].value; } /** * @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) public virtual override { if (operator == _msgSenderERC721A()) revert ApproveToCaller(); ERC721AStorage.layout()._operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return ERC721AStorage.layout()._operatorApprovals[owner][operator]; } /** * @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. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < ERC721AStorage.layout()._currentIndex && // If within bounds, ERC721AStorage.layout()._packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { ERC721AStorage.TokenApprovalRef storage tokenApproval = ERC721AStorage.layout()._tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) public virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --ERC721AStorage.layout()._packedAddressData[from]; // Updates: `balance -= 1`. ++ERC721AStorage.layout()._packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != ERC721AStorage.layout()._currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); _afterTokenTransfer(from, to, tokenId); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @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 memory _data ) public virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * 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, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (bytes4 retval) { return retval == ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = ERC721AStorage.layout()._currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); ERC721AStorage.layout()._currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = ERC721AStorage.layout()._currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. ERC721AStorage.layout()._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); ERC721AStorage.layout()._currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = ERC721AStorage.layout()._currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (ERC721AStorage.layout()._currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ""); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. ERC721AStorage.layout()._packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. ERC721AStorage.layout()._packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != ERC721AStorage.layout()._currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { ERC721AStorage.layout()._burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = ERC721AStorage.layout()._packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); ERC721AStorage.layout()._packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * 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, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), // but we allocate 0x80 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 32-byte word to store the length, // and 3 32-byte words to store a maximum of 78 digits. Total: 0x20 + 3 * 0x20 = 0x80. str := add(mload(0x40), 0x80) // Update the free memory pointer to allocate. mstore(0x40, str) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. * ==== */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { 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 v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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 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/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _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 = ERC721Upgradeable.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 = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _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 = ERC721Upgradeable.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(ERC721Upgradeable.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(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * 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 {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[44] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: 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 IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: CC0-1.0 pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; /** * @dev ERC-721 Non-Fungible Token Standard, optional lockable extension * ERC721 Token that can be locked for a certain period and cannot be transferred. * This is designed for a non-escrow staking contract that comes later to lock a user's NFT * while still letting them keep it in their wallet. * This extension can ensure the security of user tokens during the staking period. * If the nft lending protocol is compatible with this extension, the trouble caused by the NFT * airdrop can be avoided, because the airdrop is still in the user's wallet */ interface IERC5058Upgradeable is IERC721Upgradeable { /** * @dev Emitted when `tokenId` token is locked by `operator` from `owner`. */ event Locked(address indexed operator, address indexed owner, uint256 indexed tokenId, uint256 expired); /** * @dev Emitted when `tokenId` token is unlocked by `operator` from `owner`. */ event Unlocked(address indexed operator, address indexed owner, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to lock the `tokenId` token. */ event LockApproval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to lock all of its tokens. */ event LockApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the locker who is locking the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function lockerOf(uint256 tokenId) external view returns (address locker); /** * @dev Lock `tokenId` token until the block timestamp is greater than `expired` to be unlocked. * * Requirements: * * - `tokenId` token must be owned by `owner`. * - `expired` must be greater than block.timestamp * - If the caller is not `from`, it must be approved to lock this token * by either {lockApprove} or {setLockApprovalForAll}. * * Emits a {Locked} event. */ function lock(uint256 tokenId, uint256 expired) external; /** * @dev Unlock `tokenId` token. * * Requirements: * * - `tokenId` token must be owned by `from`. * - the caller must be the operator who locks the token by {lock} * * Emits a {Unlocked} event. */ function unlock(uint256 tokenId) external; /** * @dev Gives permission to `to` to lock `tokenId` token. * * Requirements: * * - The caller must own the token or be an approved lock operator. * - `tokenId` must exist. * * Emits an {LockApproval} event. */ function lockApprove(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an lock operator for the caller. * Operators can call {lock} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {LockApprovalForAll} event. */ function setLockApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account lock approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getLockApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to lock all of the assets of `owner`. * * See {setLockApprovalForAll} */ function isLockApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Returns if the `tokenId` token is locked. */ function isLocked(uint256 tokenId) external view returns (bool); /** * @dev Returns the `tokenId` token lock expired time. */ function lockExpiredTime(uint256 tokenId) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _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); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/draft-IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20Upgradeable token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20PermitUpgradeable token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20Upgradeable token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @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 // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20PermitUpgradeable { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol"; /** * @dev Interface of ERC721A. */ interface IERC721AUpgradeable is IERC721Upgradeable { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * The caller cannot approve to their own address. */ error ApproveToCaller(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC721Metadata // ============================================================= /** * @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); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; library ERC721AStorage { // Reference type for token approval. struct TokenApprovalRef { address value; } struct Layout { // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 _currentIndex; // The number of tokens burned. uint256 _burnCounter; // Token name string _name; // Token symbol string _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => ERC721AStorage.TokenApprovalRef) _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) _operatorApprovals; } bytes32 internal constant STORAGE_SLOT = keccak256("ERC721A.contracts.storage.ERC721A30"); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable diamond facet contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ import {ERC721A__InitializableStorage} from './ERC721A__InitializableStorage.sol'; abstract contract ERC721A__Initializable { using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializerERC721A() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require( ERC721A__InitializableStorage.layout()._initializing ? _isConstructor() : !ERC721A__InitializableStorage.layout()._initialized, 'ERC721A__Initializable: contract is already initialized' ); bool isTopLevelCall = !ERC721A__InitializableStorage.layout()._initializing; if (isTopLevelCall) { ERC721A__InitializableStorage.layout()._initializing = true; ERC721A__InitializableStorage.layout()._initialized = true; } _; if (isTopLevelCall) { ERC721A__InitializableStorage.layout()._initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializingERC721A() { require( ERC721A__InitializableStorage.layout()._initializing, 'ERC721A__Initializable: contract is not initializing' ); _; } /// @dev Returns true if and only if the function is running in the constructor function _isConstructor() private view returns (bool) { // extcodesize checks the size of the code stored in an address, and // address returns the current address. Since the code is still not // deployed when running a constructor, any checks on its code size will // yield zero, making it an effective way to detect if a contract is // under construction or not. address self = address(this); uint256 cs; assembly { cs := extcodesize(self) } return cs == 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base storage for the initialization function for upgradeable diamond facet contracts **/ library ERC721A__InitializableStorage { struct Layout { /* * Indicates that the contract has been initialized. */ bool _initialized; /* * Indicates that the contract is in the process of being initialized. */ bool _initializing; } bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.initializable.facet'); function layout() internal pure returns (Layout storage l) { bytes32 slot = STORAGE_SLOT; assembly { l.slot := slot } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vat","type":"uint256"}],"name":"DecreaseVAT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"market","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vat","type":"uint256"}],"name":"IncreaseVAT","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"LockApproval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"LockApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expired","type":"uint256"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"market","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"MarketTransaction","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Unlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ChromeExtension","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ERC721A_init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"MARKET_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MaxAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VAT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bundleTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentFreeMintNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentTradeInfo","outputs":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"buyer","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"used","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint8","name":"displayId","type":"uint8"}],"name":"displayURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"freeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"freeMintMaxNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freeMintNumPerAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freeMintReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freeMintStartAfter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"freeMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getLockApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"vat","type":"uint256"}],"name":"increaseTokenVAT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isLockApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"expired","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"lockApprove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"lockExpiredTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockedTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"lockerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"openMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"publicSale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicSaleNumPerAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSalePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleStartAfter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseTokenURI","type":"string"}],"name":"setBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_bundleTokenURI","type":"string"}],"name":"setBundleTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"setCurrentIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"newWallet","type":"address"}],"name":"setDevWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint8","name":"displayId","type":"uint8"}],"name":"setDisplayTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"num","type":"uint256"},{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"setFreeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"setFreeMintMaxNum","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setLockApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setMysteryBoxURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"open","type":"bool"}],"name":"setOpenMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"num","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"setPublicSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"setRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"pos","type":"uint256"},{"internalType":"string","name":"uri","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"setTradeRewardPerETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"}],"name":"setWLHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"num","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"reward","type":"uint256"}],"name":"setWLMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokensVAT","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTransactions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalVAT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradeRewardPerETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradeRewardWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"whitelistMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"wlMintNumPerAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wlMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wlMintReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wlMintStartAfter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wlMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405234801561001057600080fd5b50615b3480620000216000396000f3fe6080604052600436106105425760003560e01c806371cc4089116102bd578063b883123c11610180578063d547cfb7116100e7578063ec0319c0116100a0578063f4bbcb291161007a578063f4bbcb291461112c578063f6aacfb11461114c578063f7c618c11461117c578063f97ec2c6146111a257600080fd5b8063ec0319c0146110d7578063f2fde38b146110ec578063f3fef3a31461110c57600080fd5b8063d547cfb714610ff3578063dcec329414611008578063e2af30f414611036578063e4bc352214611056578063e6798baa146110a0578063e985e9c5146110b757600080fd5b8063ca15c87311610139578063ca15c87314610f5b578063d146f72314610f7b578063d1a922b414610f92578063d2cab05614610fa9578063d463a0b714610fbc578063d547741f14610fd357600080fd5b8063b883123c14610ea9578063b88d4fde14610ec9578063b9a6003814610ee9578063bce6d67214610f00578063c6fb82d514610f1b578063c87b56dd14610f3b57600080fd5b806395d89b4111610224578063a22cb465116101dd578063a22cb46514610deb578063a45c322f14610e0b578063a9a9066114610e2b578063b009de2b14610e4b578063b287c8ed14610e62578063b60b711c14610e7557600080fd5b806395d89b4114610d535780639619680114610d685780639aa183a014610d895780639b6860c814610d9f5780639bc89e5b14610db6578063a217fddf14610dd657600080fd5b80638456cb59116102765780638456cb5914610c765780638aee812714610c8b5780638da5cb5b14610cab5780639010d07c14610cc957806391c79cd714610ce957806391d1485414610d3357600080fd5b806371cc408914610bbc578063777554c514610bdc5780637849267514610bfc57806378a9238014610c11578063799795e314610c3f5780637c928fe914610c5657600080fd5b806336568abe116104055780634f6ccce71161036c57806364a8e8ba1161032557806364a8e8ba14610b1957806365bd689414610b3957806369fabf1a14610b5057806370a0823114610b7057806370fbee6014610b90578063715018a614610ba757600080fd5b80634f6ccce714610a6957806353bb0ab314610a895780635c975abb14610aa9578063613b04a214610ac25780636198e33914610ad95780636352211e14610af957600080fd5b80634025feb2116103be5780634025feb2146109a957806342842e0e146109c957806342966c68146109e957806344004cc114610a095780634ce17b8614610a295780634f558e7914610a4957600080fd5b806336568abe14610898578063389fcf06146108b857806338b4f04f146108e65780633a879f71146108fd5780633e27ec9b146109605780633f4ba83a1461099457600080fd5b80631ddae4f9116104a9578063248a9ca311610462578063248a9ca3146107da57806327f0f3ee1461080a5780632c4e9fc6146108215780632f2ff15d146108385780632f745c591461085857806330176e131461087857600080fd5b80631ddae4f91461071e5780631ef208951461074c5780631f53ac0214610763578063210ef7ed14610783578063231d5ca5146107a357806323b872dd146107ba57600080fd5b806311f3043d116104fb57806311f3043d1461063f578063121cba19146106645780631338736f14610684578063150b7a02146106a4578063179a9c0f146106e957806318160ddd1461070957600080fd5b806301ffc9a71461054e57806306fdde03146105835780630800ef41146105a5578063081812fc146105c7578063095ea7b3146105ff5780631056642a1461061f57600080fd5b3661054957005b600080fd5b34801561055a57600080fd5b5061056e6105693660046153a5565b6111b7565b60405190151581526020015b60405180910390f35b34801561058f57600080fd5b506105986111c8565b60405161057a9190615795565b3480156105b157600080fd5b506105c56105c0366004615345565b6111d7565b005b3480156105d357600080fd5b506105e76105e2366004615345565b6111e5565b6040516001600160a01b03909116815260200161057a565b34801561060b57600080fd5b506105c561061a366004615198565b611204565b34801561062b57600080fd5b506105c561063a366004615345565b611227565b34801561064b57600080fd5b506106566101fc5481565b60405190815260200161057a565b34801561067057600080fd5b506105e761067f366004615345565b611235565b34801561069057600080fd5b506105c561069f366004615383565b611333565b3480156106b057600080fd5b506106d06106bf36600461523e565b630a85bd0160e11b95945050505050565b6040516001600160e01b0319909116815260200161057a565b3480156106f557600080fd5b506105c5610704366004615198565b611485565b34801561071557600080fd5b506106566115fc565b34801561072a57600080fd5b50610656610739366004615345565b60009081526101f5602052604090205490565b34801561075857600080fd5b5061065661020d5481565b34801561076f57600080fd5b506105c561077e36600461517b565b61161a565b34801561078f57600080fd5b506105c561079e366004615383565b611645565b3480156107af57600080fd5b5061065661020c5481565b3480156107c657600080fd5b506105c56107d53660046151fd565b611679565b3480156107e657600080fd5b506106566107f5366004615345565b60009081526097602052604090206001015490565b34801561081657600080fd5b5061065661020e5481565b34801561082d57600080fd5b506106566102145481565b34801561084457600080fd5b506105c561085336600461535e565b61169a565b34801561086457600080fd5b50610656610873366004615198565b6116bf565b34801561088457600080fd5b506105c56108933660046153df565b611756565b3480156108a457600080fd5b506105c56108b336600461535e565b611772565b3480156108c457600080fd5b506106566108d336600461517b565b6102176020526000908152604090205481565b3480156108f257600080fd5b5061065661020f5481565b34801561090957600080fd5b506101f8546101f9546101fa546101fb54610933936001600160a01b039081169316919060ff1684565b604080516001600160a01b039586168152949093166020850152918301521515606082015260800161057a565b34801561096c57600080fd5b506106567f395f08be531c0d7403cba7c5ffd2b57329184452bcebcd6a48299ebbbf39db6f81565b3480156109a057600080fd5b506105c56117ec565b3480156109b557600080fd5b506105c56109c43660046151fd565b6117fe565b3480156109d557600080fd5b506105c56109e43660046151fd565b61186d565b3480156109f557600080fd5b506105c5610a04366004615345565b6118ae565b348015610a1557600080fd5b506105c5610a243660046151fd565b6118ba565b348015610a3557600080fd5b506105e7610a44366004615345565b6118d6565b348015610a5557600080fd5b5061056e610a64366004615345565b611948565b348015610a7557600080fd5b50610656610a84366004615345565b611953565b348015610a9557600080fd5b506105c5610aa43660046154ac565b6119e8565b348015610ab557600080fd5b506101915460ff1661056e565b348015610ace57600080fd5b5061065661020b5481565b348015610ae557600080fd5b506105c5610af4366004615345565b611aa9565b348015610b0557600080fd5b506105e7610b14366004615345565b611b80565b348015610b2557600080fd5b506105c5610b343660046153df565b611b9f565b348015610b4557600080fd5b506106566102095481565b348015610b5c57600080fd5b506105c5610b6b3660046153df565b611bbb565b348015610b7c57600080fd5b50610656610b8b36600461517b565b611bd7565b348015610b9c57600080fd5b5061065661020a5481565b348015610bb357600080fd5b506105c5611bf5565b348015610bc857600080fd5b506105c5610bd7366004615528565b611c07565b348015610be857600080fd5b506105c5610bf7366004615345565b611c27565b348015610c0857600080fd5b506105c5611c3c565b348015610c1d57600080fd5b50610656610c2c36600461517b565b6102166020526000908152604090205481565b348015610c4b57600080fd5b506106566102115481565b348015610c6257600080fd5b506105c5610c71366004615345565b611c64565b348015610c8257600080fd5b506105c5611e3e565b348015610c9757600080fd5b506105c5610ca636600461517b565b611e4e565b348015610cb757600080fd5b506033546001600160a01b03166105e7565b348015610cd557600080fd5b506105e7610ce4366004615383565b611e7f565b348015610cf557600080fd5b5061056e610d043660046151c4565b6001600160a01b0391821660009081526101f76020908152604080832093909416825291909152205460ff1690565b348015610d3f57600080fd5b5061056e610d4e36600461535e565b611e9e565b348015610d5f57600080fd5b50610598611ec9565b348015610d7457600080fd5b50610207546105e7906001600160a01b031681565b348015610d9557600080fd5b5061065661271081565b348015610dab57600080fd5b506106566102105481565b348015610dc257600080fd5b506105c5610dd1366004615345565b611ed3565b348015610de257600080fd5b50610656600081565b348015610df757600080fd5b506105c5610e063660046152dd565b611ee1565b348015610e1757600080fd5b506105c5610e263660046154fc565b611eeb565b348015610e3757600080fd5b506105c5610e46366004615528565b611f04565b348015610e5757600080fd5b506106566102155481565b6105c5610e70366004615345565b611f24565b348015610e8157600080fd5b506106567fc0f1d8144debc243d1891289d78c45e23543cbcf448281d467d3fce010f9750e81565b348015610eb557600080fd5b506105c5610ec436600461555a565b61210a565b348015610ed557600080fd5b506105c5610ee436600461523e565b612217565b348015610ef557600080fd5b506106566101fd5481565b348015610f0c57600080fd5b506102065461056e9060ff1681565b348015610f2757600080fd5b50610598610f3636600461555a565b6122b2565b348015610f4757600080fd5b50610598610f56366004615345565b6124d6565b348015610f6757600080fd5b50610656610f76366004615345565b6124e1565b348015610f8757600080fd5b506106566102125481565b348015610f9e57600080fd5b506106566102135481565b6105c5610fb736600461542d565b6124f8565b348015610fc857600080fd5b506106566102085481565b348015610fdf57600080fd5b506105c5610fee36600461535e565b61287d565b348015610fff57600080fd5b506105986128a2565b34801561101457600080fd5b50610656611023366004615345565b6101f56020526000908152604090205481565b34801561104257600080fd5b506105c561105136600461530b565b612931565b34801561106257600080fd5b5061108b611071366004615345565b6101fe602052600090815260409020805460019091015482565b6040805192835260208301919091520161057a565b3480156110ac57600080fd5b506106566102185481565b3480156110c357600080fd5b5061056e6110d23660046151c4565b61294d565b3480156110e357600080fd5b5061059861297e565b3480156110f857600080fd5b506105c561110736600461517b565b61298c565b34801561111857600080fd5b506105c5611127366004615198565b612a02565b34801561113857600080fd5b506105c56111473660046152dd565b612a14565b34801561115857600080fd5b5061056e611167366004615345565b60009081526101f56020526040902054421090565b34801561118857600080fd5b50610206546105e79061010090046001600160a01b031681565b3480156111ae57600080fd5b5061056e600181565b60006111c282612a1f565b92915050565b60606111d2612a6d565b905090565b6111df612b00565b61020555565b6000610218548210156111fb576111c282612b5a565b6111c282612b82565b6102185481101561121d576112198282612bcf565b5050565b6112198282612ce0565b61122f612b00565b61020955565b600061124082612d8e565b6112a55760405162461bcd60e51b815260206004820152602b60248201527f455243353035383a206c6f636b657220717565727920666f72206e6f6e65786960448201526a39ba32b73a103a37b5b2b760a91b60648201526084015b60405180910390fd5b60008281526101f5602052604090205442106113165760405162461bcd60e51b815260206004820152602a60248201527f455243353035383a206c6f636b657220717565727920666f72206e6f6e2d6c6f60448201526931b5b2b2103a37b5b2b760b11b606482015260840161129c565b5060009081526101f660205260409020546001600160a01b031690565b61133d3383612dc4565b6113a05760405162461bcd60e51b815260206004820152602e60248201527f455243353035383a206c6f636b2063616c6c6572206973206e6f74206f776e6560448201526d1c881b9bdc88185c1c1c9bdd995960921b606482015260840161129c565b4281116114205760405162461bcd60e51b815260206004820152604260248201527f455243353035383a20657870697265642074696d65206d75737420626520677260448201527f6561746572207468616e2063757272656e7420626c6f636b2074696d6573746160648201526106d760f41b608482015260a40161129c565b60008281526101f5602052604090205442101561147a5760405162461bcd60e51b8152602060048201526018602482015277115490cd4c0d4e0e881d1bdad95b881a5cc81b1bd8dad95960421b604482015260640161129c565b611219338383612eb5565b60008181526101f560205260409020544210156114df5760405162461bcd60e51b8152602060048201526018602482015277115490cd4c0d4e0e881d1bdad95b881a5cc81b1bd8dad95960421b604482015260640161129c565b60006114ea82612f38565b9050806001600160a01b0316836001600160a01b0316141561155e5760405162461bcd60e51b815260206004820152602760248201527f455243353035383a206c6f636b20617070726f76616c20746f2063757272656e6044820152663a1037bbb732b960c91b606482015260840161129c565b336001600160a01b038216148061157a575061157a8133610d04565b6115ec5760405162461bcd60e51b815260206004820152603e60248201527f455243353035383a206c6f636b20617070726f76652063616c6c65722069732060448201527f6e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161129c565b6115f7818484612f99565b505050565b60006116086102185490565b611610612ff6565b6111d29190615905565b611622612b00565b61020480546001600160a01b0319166001600160a01b0392909216919091179055565b7fc0f1d8144debc243d1891289d78c45e23543cbcf448281d467d3fce010f9750e61166f8161301e565b6115f78383613028565b6102185481101561168f576115f783838361321e565b6115f7838383613250565b6000828152609760205260409020600101546116b58161301e565b6115f78383613438565b60006116ca8361345a565b821061172c5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161129c565b506001600160a01b0391909116600090815261015f60209081526040808320938352929052205490565b61175e612b00565b8051611219906101ff906020840190615055565b6001600160a01b03811633146117e25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161129c565b61121982826134e1565b6117f4612b00565b6117fc613503565b565b611806612b00565b604051632142170760e11b81526001600160a01b038416906342842e0e9061183690309086908690600401615734565b600060405180830381600087803b15801561185057600080fd5b505af1158015611864573d6000803e3d6000fd5b50505050505050565b61021854811015611893576115f783838360405180602001604052806000815250613556565b6115f783838360405180602001604052806000815250613587565b6118b7816135cb565b50565b6118c2612b00565b6115f76001600160a01b03841683836136ae565b60006118e182612d8e565b6113165760405162461bcd60e51b815260206004820152603260248201527f455243353035383a206c6f636b20617070726f76656420717565727920666f72604482015271103737b732bc34b9ba32b73a103a37b5b2b760711b606482015260840161129c565b60006111c282612d8e565b600061195f6101615490565b82106119c25760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161129c565b61016182815481106119d6576119d6615a79565b90600052602060002001549050919050565b6119f23384613700565b611a0e5760405162461bcd60e51b815260040161129c906157a8565b60038210611a6a5760405162461bcd60e51b8152602060048201526024808201527f4552433732314d756c74695552493a2075726920706f73206f7574206f6620696044820152630dcc8caf60e31b606482015260840161129c565b60008381526102026020526040902081906001018360038110611a8f57611a8f615a79565b019080519060200190611aa3929190615055565b50505050565b33611ab382611235565b6001600160a01b031614611b1d5760405162461bcd60e51b815260206004820152602b60248201527f455243353035383a20756e6c6f636b2063616c6c6572206973206e6f74206c6f60448201526a31b59037b832b930ba37b960a91b606482015260840161129c565b6000611b2882612f38565b905060008281526101f56020526040812055816001600160a01b038216336001600160a01b03167fe6e0ef9cd056ca98561ca60e347ada61e1ede2f1142a078951b7a52e1e508e6060405160405180910390a4611219565b600061021854821015611b96576111c282612f38565b6111c28261374c565b611ba7612b00565b805161121990610200906020840190615055565b611bc3612b00565b805161121990610201906020840190615055565b6000611be28261345a565b611beb83613757565b6111c29190615905565b611bfd612b00565b6117fc60006137c0565b611c0f612b00565b61020e9390935561020f919091556102105561021155565b611c2f612b00565b80611c38613812565b5550565b611c44612b00565b61016154611c53906001615905565b610218819055611c61613812565b55565b611c6c613836565b6102065460ff16611c8f5760405162461bcd60e51b815260040161129c9061584a565b323314611cae5760405162461bcd60e51b815260040161129c90615895565b610209548161020a54611cc19190615905565b1115611d0f5760405162461bcd60e51b815260206004820152601b60248201527f696e73756666696369656e7420667265652072656d61696e696e670000000000604482015260640161129c565b61271081611d1b6115fc565b611d259190615905565b1115611d435760405162461bcd60e51b815260040161129c9061584a565b61020c541580611d71575061020c543360009081526102176020526040902054611d6e908390615905565b11155b611db35760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e48199c9959481b5a5b9d1959606a1b604482015260640161129c565b61020b544210158015611dc95750600061020b54115b611de55760405162461bcd60e51b815260040161129c9061586e565b336000908152610217602052604081208054839290611e05908490615905565b925050819055508061020a6000828254611e1f9190615905565b925050819055506118b7818261020d54611e399190615931565b61387d565b611e46612b00565b6117fc6139ba565b611e56612b00565b61020680546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600082815260c960205260408120611e9790836139f8565b9392505050565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606111d2613a04565b611edb612b00565b61020855565b6112198282613a14565b611ef3612b00565b61020b9290925561020c5561020d55565b611f0c612b00565b61021293909355610213919091556102145561021555565b611f2c613836565b600260fb541415611f7f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161129c565b600260fb556102065460ff16611fa75760405162461bcd60e51b815260040161129c9061584a565b323314611fc65760405162461bcd60e51b815260040161129c90615895565b61271081611fd26115fc565b611fdc9190615905565b1115611ffa5760405162461bcd60e51b815260040161129c9061584a565b61020e5442101580156120105750600061020e54115b61202c5760405162461bcd60e51b815260040161129c9061586e565b61020f54158061203f575061020f548111155b61207e5760405162461bcd60e51b815260206004820152601060248201526f696e76616c6964206d696e74206e756d60801b604482015260640161129c565b6102105461208c9082615931565b34146120cf5760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b604482015260640161129c565b61021054156120ef57610204546120ef906001600160a01b031634613a1f565b612102818261021154611e399190615931565b50600160fb55565b612115335b83613700565b6121315760405162461bcd60e51b815260040161129c906157a8565b60058160ff16106121945760405162461bcd60e51b815260206004820152602760248201527f4552433732314d756c74695552493a20646973706c6179206964206f7574206f6044820152660cc40d2dcc8caf60cb1b606482015260840161129c565b60006121a083836122b2565b905060008151116121f35760405162461bcd60e51b815260206004820152601960248201527f4552433732314d756c74695552493a20656d7074792075726900000000000000604482015260640161129c565b5060009182526102026020526040909120805460ff191660ff909216919091179055565b610218548310156122695761226485858585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061355692505050565b6122ab565b6122ab85858585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061358792505050565b5050505050565b606060ff82166123955760006122c6613b38565b905060008151116123625761020180546122df906159cd565b80601f016020809104026020016040519081016040528092919081815260200182805461230b906159cd565b80156123585780601f1061232d57610100808354040283529160200191612358565b820191906000526020600020905b81548152906001019060200180831161233b57829003601f168201915b505050505061238d565b8061236c85613b4f565b60405160200161237d9291906155e9565b6040516020818303038152906040525b9150506111c2565b8160ff16600114156123f157600061020080546123b1906159cd565b905011156123ec576102006123c584613b4f565b6040516020016123d6929190615618565b60405160208183030381529060405290506111c2565b6124c0565b60008381526102026020526040812060010161240e600285615967565b60ff166003811061242157612421615a79565b01805461242d906159cd565b80601f0160208091040260200160405190810160405280929190818152602001828054612459906159cd565b80156124a65780601f1061247b576101008083540402835291602001916124a6565b820191906000526020600020905b81548152906001019060200180831161248957829003601f168201915b505050505090506000815111156124be5790506111c2565b505b5060408051602081019091526000815292915050565b60606111c282613c4d565b600081815260c9602052604081206111c290613cd1565b612500613836565b600260fb5414156125535760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161129c565b600260fb556102065460ff1661257b5760405162461bcd60e51b815260040161129c9061584a565b32331461259a5760405162461bcd60e51b815260040161129c90615895565b612710836125a66115fc565b6125b09190615905565b11156125f75760405162461bcd60e51b8152602060048201526016602482015275696e73756666696369656e742072656d61696e696e6760501b604482015260640161129c565b61266d82828080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050610205546040516bffffffffffffffffffffffff193360601b166020820152909250603401905060405160208183030381529060405280519060200120613cdb565b6126a95760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b210383937b7b360991b604482015260640161129c565b6102135415806126d757506102135433600090815261021660205260409020546126d4908590615905565b11155b6127175760405162461bcd60e51b8152602060048201526011602482015270185b1c9958591e481ddb081b5a5b9d1959607a1b604482015260640161129c565b61021254421015801561272d5750600061021254115b6127495760405162461bcd60e51b815260040161129c9061586e565b610214546127579084615931565b341461279a5760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b604482015260640161129c565b61021454156127bf57610204546127ba906001600160a01b031634613a1f565b612839565b610209548361020a546127d29190615905565b11156128205760405162461bcd60e51b815260206004820152601b60248201527f696e73756666696369656e7420667265652072656d61696e696e670000000000604482015260640161129c565b8261020a60008282546128339190615905565b90915550505b336000908152610216602052604081208054859290612859908490615905565b92505081905550612873838461021554611e399190615931565b5050600160fb5550565b6000828152609760205260409020600101546128988161301e565b6115f783836134e1565b6101ff80546128b0906159cd565b80601f01602080910402602001604051908101604052809291908181526020018280546128dc906159cd565b80156129295780601f106128fe57610100808354040283529160200191612929565b820191906000526020600020905b81548152906001019060200180831161290c57829003601f168201915b505050505081565b612939612b00565b610206805460ff1916911515919091179055565b6001600160a01b0380831660009081526101326020908152604080832093851683529290529081205460ff16611e97565b61020080546128b0906159cd565b612994612b00565b6001600160a01b0381166129f95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161129c565b6118b7816137c0565b612a0a612b00565b6112198282613a1f565b611219338383613cf1565b60006301ffc9a760e01b6001600160e01b031983161480612a5057506380ac58cd60e01b6001600160e01b03198316145b806111c25750506001600160e01b031916635b5e139f60e01b1490565b606061012d8054612a7d906159cd565b80601f0160208091040260200160405190810160405280929190818152602001828054612aa9906159cd565b8015612af65780601f10612acb57610100808354040283529160200191612af6565b820191906000526020600020905b815481529060010190602001808311612ad957829003601f168201915b5050505050905090565b6033546001600160a01b031633146117fc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161129c565b6000612b6582613dc2565b50600090815261013160205260409020546001600160a01b031690565b6000612b8d82612d8e565b612baa576040516333d1c03960e21b815260040160405180910390fd5b612bb2613812565b60009283526006016020525060409020546001600160a01b031690565b6000612bda82612f38565b9050806001600160a01b0316836001600160a01b03161415612c485760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161129c565b336001600160a01b0382161480612c645750612c64813361294d565b612cd65760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161129c565b6115f78383613e12565b6000612ceb82611b80565b9050336001600160a01b03821614612d2457612d07813361294d565b612d24576040516367d9dca160e11b815260040160405180910390fd5b82612d2d613812565b6000848152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551849286811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a4505050565b600061021854821015612dbb57600082815261012f60205260409020546001600160a01b031615156111c2565b6111c282613e81565b6000612dcf82612d8e565b612e365760405162461bcd60e51b815260206004820152603260248201527f455243353035383a206c6f636b206f70657261746f7220717565727920666f72604482015271103737b732bc34b9ba32b73a103a37b5b2b760711b606482015260840161129c565b6000612e4183612f38565b9050806001600160a01b0316846001600160a01b03161480612e8957506001600160a01b0380821660009081526101f7602090815260408083209388168352929052205460ff165b80612ead5750836001600160a01b0316612ea2846118d6565b6001600160a01b0316145b949350505050565b6000612ec083612f38565b60008481526101f5602090815260408083208690556101f682529182902080546001600160a01b031916331790558151858152915192935085926001600160a01b0380861693908916927f967ad762aa9070ada8db64577288e214771e89667066ae38e8750cb8a86c542992918290030190a4611aa3565b600081815261012f60205260408120546001600160a01b0316806111c25760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161129c565b60008181526101f6602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fbd5378dc6d0395c338ca88b324966808490d6a9983bbc7a0f7a8429a44a3176291a4505050565b60006130026102185490565b61300a613812565b60010154613016613812565b540303919050565b6118b78133613ed2565b6130328282613f36565b600081610208546130439190615931565b6102065461020754604051636eb1769f60e11b81526001600160a01b0391821660048201523060248201529293508392610100909204169063dd62ed3e9060440160206040518083038186803b15801561309c57600080fd5b505afa1580156130b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d49190615414565b106115f75761020654610207546101f8546001600160a01b036101009093048316926323b872dd928116911661310b60028661591d565b6040518463ffffffff1660e01b815260040161312993929190615734565b602060405180830381600087803b15801561314357600080fd5b505af1158015613157573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061317b9190615328565b5061020654610207546101f9546001600160a01b036101009093048316926323b872dd92811691166131ae60028661591d565b6040518463ffffffff1660e01b81526004016131cc93929190615734565b602060405180830381600087803b1580156131e657600080fd5b505af11580156131fa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa39190615328565b613229335b82613700565b6132455760405162461bcd60e51b815260040161129c906158b7565b6115f7838383613fe2565b600061325b82614175565b9050836001600160a01b0316816001600160a01b03161461328e5760405162a1148160e81b815260040160405180910390fd5b60008061329a8461420c565b915091506132bf81876132aa3390565b6001600160a01b039081169116811491141790565b6132ea576132cd863361294d565b6132ea57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661331157604051633a954ecd60e21b815260040160405180910390fd5b801561331c57600082555b613324613812565b6001600160a01b0387166000908152600591909101602052604090208054600019019055613350613812565b6001600160a01b03861660008181526005929092016020526040909120805460010190554260a01b17600160e11b17613387613812565b60008681526004919091016020526040902055600160e11b83166133f657600184016133b1613812565b600082815260049190910160205260409020546133f4576133d0613812565b5481146133f457836133e0613812565b600083815260049190910160205260409020555b505b83856001600160a01b0316876001600160a01b0316600080516020615adf83398151915260405160405180910390a4613430868686614234565b505050505050565b613442828261423f565b600082815260c9602052604090206115f790826142c5565b60006001600160a01b0382166134c45760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161129c565b506001600160a01b03166000908152610130602052604090205490565b6134eb82826142da565b600082815260c9602052604090206115f79082614341565b61350b614356565b610191805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61355f3361210f565b61357b5760405162461bcd60e51b815260040161129c906158b7565b611aa3848484846143a0565b613592848484611679565b6001600160a01b0383163b15611aa3576135ae848484846143d3565b611aa3576040516368d2bf6b60e11b815260040160405180910390fd5b6102065460ff161561362b5760405162461bcd60e51b8152602060048201526024808201527f4e6f7420616c6c6f77206275726e20647572696e67206d696e74696e672070656044820152631c9a5bd960e21b606482015260840161129c565b610218548110156136a55761363f33613223565b61369c5760405162461bcd60e51b815260206004820152602860248201527f4552433732313a2063616c6c6572206973206e6f74206f776e6572206e6f7220604482015267185c1c1c9bdd995960c21b606482015260840161129c565b6118b7816144ca565b6118b78161455d565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526115f7908490614568565b60008061370c83612f38565b9050806001600160a01b0316846001600160a01b031614806137335750613733818561294d565b80612ead5750836001600160a01b0316612ea2846111e5565b60006111c282614175565b60006001600160a01b038216613780576040516323d3ad8160e21b815260040160405180910390fd5b67ffffffffffffffff613791613812565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b7f49d68f8497c9113bb90cd0201cf1335d00c5c438f6870a7e93e597c5d83821e390565b6101915460ff16156117fc5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161129c565b613887338361463a565b60008111801561392457506102065461020754604051636eb1769f60e11b81526001600160a01b039182166004820152306024820152839261010090049091169063dd62ed3e9060440160206040518083038186803b1580156138e957600080fd5b505afa1580156138fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139219190615414565b10155b156112195761020654610207546040516323b872dd60e01b81526001600160a01b036101009093048316926323b872dd926139689291169033908690600401615734565b602060405180830381600087803b15801561398257600080fd5b505af1158015613996573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f79190615328565b6139c2613836565b610191805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135393390565b6000611e978383614644565b606061012e8054612a7d906159cd565b61121933838361466e565b80471015613a6f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161129c565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613abc576040519150601f19603f3d011682016040523d82523d6000602084013e613ac1565b606091505b50509050806115f75760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161129c565b60606111d260408051602081019091526000815290565b606081613b735750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613b9d5780613b8781615a08565b9150613b969050600a8361591d565b9150613b77565b60008167ffffffffffffffff811115613bb857613bb8615a8f565b6040519080825280601f01601f191660200182016040528015613be2576020820181803683370190505b5090505b8415612ead57613bf7600183615950565b9150613c04600a86615a23565b613c0f906030615905565b60f81b818381518110613c2457613c24615a79565b60200101906001600160f81b031916908160001a905350613c46600a8661591d565b9450613be6565b6060613c5882612d8e565b613c7557604051630a14c4b560e41b815260040160405180910390fd5b6000613c7f613b38565b9050805160001415613ca05760405180602001604052806000815250611e97565b80613caa84614736565b604051602001613cbb9291906155e9565b6040516020818303038152906040529392505050565b60006111c2825490565b600082613ce88584614778565b14949350505050565b816001600160a01b0316836001600160a01b03161415613d535760405162461bcd60e51b815260206004820152601f60248201527f455243353035383a206c6f636b20617070726f766520746f2063616c6c657200604482015260640161129c565b6001600160a01b0383811660008181526101f76020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527fbb3b2937fc41058c97e1ad0d0bbac3c664894dd823924eb7717d814fe700f03491015b60405180910390a3505050565b613dcb81612d8e565b6118b75760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161129c565b60008181526101316020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613e4882612f38565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600081613e8e6102185490565b11158015613ea35750613e9f613812565b5482105b80156111c25750600160e01b613eb7613812565b60008481526004919091016020526040902054161592915050565b613edc8282611e9e565b61121957613ef4816001600160a01b031660146147c5565b613eff8360206147c5565b604051602001613f109291906156bf565b60408051601f198184030181529082905262461bcd60e51b825261129c91600401615795565b806101fc6000828254613f499190615905565b90915550506101fb805460ff1916600117905560008281526101fe60205260408120805490918391839190613f7f908490615905565b9091555050600181018054906000613f9683615a08565b909155505060408051338152602081018590529081018390527f7bb4b3f96a37d77ea59743ca80a069ed87950496bd9e9ff983f2a7739466dfc9906060015b60405180910390a1505050565b826001600160a01b0316613ff582612f38565b6001600160a01b0316146140595760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161129c565b6001600160a01b0382166140bb5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161129c565b6140c6600082613e12565b6001600160a01b0383166000908152610130602052604081208054600192906140f0908490615950565b90915550506001600160a01b03821660009081526101306020526040812080546001929061411f908490615905565b9091555050600081815261012f602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615adf83398151915291a46115f7838383614234565b600081806141836102185490565b116141f357614190613812565b548110156141f35760006141a2613812565b600083815260049190910160205260409020549050600160e01b81166141f1575b80611e97576141d0613812565b600019909201600081815260049390930160205260409092205490506141c3565b505b604051636f96cda160e11b815260040160405180910390fd5b6000806000614219613812565b60009485526006016020525050604090912080549092909150565b6115f7838383614961565b6142498282611e9e565b6112195760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556142813390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611e97836001600160a01b038416614a0b565b6142e48282611e9e565b156112195760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611e97836001600160a01b038416614a5a565b6101915460ff166117fc5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161129c565b6143ab848484613fe2565b6143b784848484614b4d565b611aa35760405162461bcd60e51b815260040161129c906157f8565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290614408903390899088908890600401615758565b602060405180830381600087803b15801561442257600080fd5b505af1925050508015614452575060408051601f3d908101601f1916820190925261444f918101906153c2565b60015b6144ad573d808015614480576040519150601f19603f3d011682016040523d82523d6000602084013e614485565b606091505b5080516144a5576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60006144d582612f38565b90506144e2600083613e12565b6001600160a01b03811660009081526101306020526040812080546001929061450c908490615950565b9091555050600082815261012f602052604080822080546001600160a01b0319169055518391906001600160a01b03841690600080516020615adf833981519152908390a461121981600084614234565b6118b7816000614c35565b60006145bd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614d9d9092919063ffffffff16565b8051909150156115f757808060200190518101906145db9190615328565b6115f75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161129c565b6112198282614dac565b600082600001828154811061465b5761465b615a79565b9060005260206000200154905092915050565b816001600160a01b0316836001600160a01b031614156146d05760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161129c565b6001600160a01b0383811660008181526101326020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101613db5565b604080516080019081905280825b600183039250600a81066030018353600a90048061476157614766565b614744565b50819003601f19909101908152919050565b600081815b84518110156147bd576147a98286838151811061479c5761479c615a79565b6020026020010151614ebc565b9150806147b581615a08565b91505061477d565b509392505050565b606060006147d4836002615931565b6147df906002615905565b67ffffffffffffffff8111156147f7576147f7615a8f565b6040519080825280601f01601f191660200182016040528015614821576020820181803683370190505b509050600360fc1b8160008151811061483c5761483c615a79565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061486b5761486b615a79565b60200101906001600160f81b031916908160001a905350600061488f846002615931565b61489a906001615905565b90505b6001811115614912576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106148ce576148ce615a79565b1a60f81b8282815181106148e4576148e4615a79565b60200101906001600160f81b031916908160001a90535060049490941c9361490b816159b6565b905061489d565b508315611e975760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161129c565b6101f880546001600160a01b038086166001600160a01b0319928316179092556101f98054928516929091169190911790556101fa8190556101fb805460ff191690556101fd80549060006149b583615a08565b9091555050604080513381526001600160a01b038086166020830152841691810191909152606081018290527f45662a318b67ba901b3a9144d7f57390d3cc4dedd5b7a8819df7e969a71e8f3b90608001613fd5565b6000818152600183016020526040812054614a52575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556111c2565b5060006111c2565b60008181526001830160205260408120548015614b43576000614a7e600183615950565b8554909150600090614a9290600190615950565b9050818114614af7576000866000018281548110614ab257614ab2615a79565b9060005260206000200154905080876000018481548110614ad557614ad5615a79565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614b0857614b08615a63565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506111c2565b60009150506111c2565b60006001600160a01b0384163b15614c2d57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614b91903390899088908890600401615758565b602060405180830381600087803b158015614bab57600080fd5b505af1925050508015614bdb575060408051601f3d908101601f19168201909252614bd8918101906153c2565b60015b6144ad573d808015614c09576040519150601f19603f3d011682016040523d82523d6000602084013e614c0e565b606091505b5080516144a55760405162461bcd60e51b815260040161129c906157f8565b506001612ead565b6000614c4083614175565b905080600080614c4f8661420c565b915091508415614c8f57614c648184336132aa565b614c8f57614c72833361294d565b614c8f57604051632ce44b5f60e11b815260040160405180910390fd5b8015614c9a57600082555b6fffffffffffffffffffffffffffffffff614cb3613812565b6001600160a01b038516600081815260059290920160205260409091208054929092019091554260a01b17600360e01b17614cec613812565b60008881526004919091016020526040902055600160e11b8416614d5b5760018601614d16613812565b60008281526004919091016020526040902054614d5957614d35613812565b548114614d595784614d45613812565b600083815260049190910160205260409020555b505b60405186906000906001600160a01b03861690600080516020615adf833981519152908390a4614d89613812565b600190810180549091019055505050505050565b6060612ead8484600085614eeb565b6000614db6613812565b54905081614dd75760405163b562e8dd60e01b815260040160405180910390fd5b680100000000000000018202614deb613812565b6001600160a01b038516600081815260059290920160205260409091208054929092019091554260a01b6001841460e11b1717614e26613812565b600083815260049190910160205260408120919091556001600160a01b038416908383019083908390600080516020615adf8339815191528180a4600183015b818114614e8c5780836000600080516020615adf833981519152600080a4600101614e66565b5081614eaa57604051622e076360e81b815260040160405180910390fd5b80614eb3613812565b55506115f79050565b6000818310614ed8576000828152602084905260409020611e97565b6000838152602083905260409020611e97565b606082471015614f4c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161129c565b6001600160a01b0385163b614fa35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161129c565b600080866001600160a01b03168587604051614fbf91906155cd565b60006040518083038185875af1925050503d8060008114614ffc576040519150601f19603f3d011682016040523d82523d6000602084013e615001565b606091505b509150915061501182828661501c565b979650505050505050565b6060831561502b575081611e97565b82511561503b5782518084602001fd5b8160405162461bcd60e51b815260040161129c9190615795565b828054615061906159cd565b90600052602060002090601f01602090048101928261508357600085556150c9565b82601f1061509c57805160ff19168380011785556150c9565b828001600101855582156150c9579182015b828111156150c95782518255916020019190600101906150ae565b506150d59291506150d9565b5090565b5b808211156150d557600081556001016150da565b600082601f8301126150ff57600080fd5b813567ffffffffffffffff8082111561511a5761511a615a8f565b604051601f8301601f19908116603f0116810190828211818310171561514257615142615a8f565b8160405283815286602085880101111561515b57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60006020828403121561518d57600080fd5b8135611e9781615aa5565b600080604083850312156151ab57600080fd5b82356151b681615aa5565b946020939093013593505050565b600080604083850312156151d757600080fd5b82356151e281615aa5565b915060208301356151f281615aa5565b809150509250929050565b60008060006060848603121561521257600080fd5b833561521d81615aa5565b9250602084013561522d81615aa5565b929592945050506040919091013590565b60008060008060006080868803121561525657600080fd5b853561526181615aa5565b9450602086013561527181615aa5565b935060408601359250606086013567ffffffffffffffff8082111561529557600080fd5b818801915088601f8301126152a957600080fd5b8135818111156152b857600080fd5b8960208285010111156152ca57600080fd5b9699959850939650602001949392505050565b600080604083850312156152f057600080fd5b82356152fb81615aa5565b915060208301356151f281615aba565b60006020828403121561531d57600080fd5b8135611e9781615aba565b60006020828403121561533a57600080fd5b8151611e9781615aba565b60006020828403121561535757600080fd5b5035919050565b6000806040838503121561537157600080fd5b8235915060208301356151f281615aa5565b6000806040838503121561539657600080fd5b50508035926020909101359150565b6000602082840312156153b757600080fd5b8135611e9781615ac8565b6000602082840312156153d457600080fd5b8151611e9781615ac8565b6000602082840312156153f157600080fd5b813567ffffffffffffffff81111561540857600080fd5b612ead848285016150ee565b60006020828403121561542657600080fd5b5051919050565b60008060006040848603121561544257600080fd5b83359250602084013567ffffffffffffffff8082111561546157600080fd5b818601915086601f83011261547557600080fd5b81358181111561548457600080fd5b8760208260051b850101111561549957600080fd5b6020830194508093505050509250925092565b6000806000606084860312156154c157600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156154e657600080fd5b6154f2868287016150ee565b9150509250925092565b60008060006060848603121561551157600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561553e57600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561556d57600080fd5b82359150602083013560ff811681146151f257600080fd5b6000815180845261559d81602086016020860161598a565b601f01601f19169290920160200192915050565b600081516155c381856020860161598a565b9290920192915050565b600082516155df81846020870161598a565b9190910192915050565b600083516155fb81846020880161598a565b83519083019061560f81836020880161598a565b01949350505050565b600080845481600182811c91508083168061563457607f831692505b602080841082141561565457634e487b7160e01b86526022600452602486fd5b8180156156685760018114615679576156a6565b60ff198616895284890196506156a6565b60008b81526020902060005b8681101561569e5781548b820152908501908301615685565b505084890196505b5050505050506156b681856155b1565b95945050505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516156f781601785016020880161598a565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161572881602884016020880161598a565b01602801949350505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061578b90830184615585565b9695505050505050565b602081526000611e976020830184615585565b60208082526030908201527f4552433732314d756c74695552493a2063616c6c6572206973206e6f74206f7760408201526f1b995c881b9bdc88185c1c1c9bdd995960821b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252600a90820152691b5a5b9d08195b99195960b21b604082015260600190565b6020808252600d908201526c1b9bdd081cdd185c9d081e595d609a1b604082015260600190565b6020808252600890820152676f6e6c7920454f4160c01b604082015260600190565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6000821982111561591857615918615a37565b500190565b60008261592c5761592c615a4d565b500490565b600081600019048311821515161561594b5761594b615a37565b500290565b60008282101561596257615962615a37565b500390565b600060ff821660ff84168082101561598157615981615a37565b90039392505050565b60005b838110156159a557818101518382015260200161598d565b83811115611aa35750506000910152565b6000816159c5576159c5615a37565b506000190190565b600181811c908216806159e157607f821691505b60208210811415615a0257634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415615a1c57615a1c615a37565b5060010190565b600082615a3257615a32615a4d565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146118b757600080fd5b80151581146118b757600080fd5b6001600160e01b0319811681146118b757600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220fbc53cbe91d1b37f12a3fda7ad3dc57d605af67078c27172ec94ab63cc05c61564736f6c63430008070033
Deployed Bytecode
0x6080604052600436106105425760003560e01c806371cc4089116102bd578063b883123c11610180578063d547cfb7116100e7578063ec0319c0116100a0578063f4bbcb291161007a578063f4bbcb291461112c578063f6aacfb11461114c578063f7c618c11461117c578063f97ec2c6146111a257600080fd5b8063ec0319c0146110d7578063f2fde38b146110ec578063f3fef3a31461110c57600080fd5b8063d547cfb714610ff3578063dcec329414611008578063e2af30f414611036578063e4bc352214611056578063e6798baa146110a0578063e985e9c5146110b757600080fd5b8063ca15c87311610139578063ca15c87314610f5b578063d146f72314610f7b578063d1a922b414610f92578063d2cab05614610fa9578063d463a0b714610fbc578063d547741f14610fd357600080fd5b8063b883123c14610ea9578063b88d4fde14610ec9578063b9a6003814610ee9578063bce6d67214610f00578063c6fb82d514610f1b578063c87b56dd14610f3b57600080fd5b806395d89b4111610224578063a22cb465116101dd578063a22cb46514610deb578063a45c322f14610e0b578063a9a9066114610e2b578063b009de2b14610e4b578063b287c8ed14610e62578063b60b711c14610e7557600080fd5b806395d89b4114610d535780639619680114610d685780639aa183a014610d895780639b6860c814610d9f5780639bc89e5b14610db6578063a217fddf14610dd657600080fd5b80638456cb59116102765780638456cb5914610c765780638aee812714610c8b5780638da5cb5b14610cab5780639010d07c14610cc957806391c79cd714610ce957806391d1485414610d3357600080fd5b806371cc408914610bbc578063777554c514610bdc5780637849267514610bfc57806378a9238014610c11578063799795e314610c3f5780637c928fe914610c5657600080fd5b806336568abe116104055780634f6ccce71161036c57806364a8e8ba1161032557806364a8e8ba14610b1957806365bd689414610b3957806369fabf1a14610b5057806370a0823114610b7057806370fbee6014610b90578063715018a614610ba757600080fd5b80634f6ccce714610a6957806353bb0ab314610a895780635c975abb14610aa9578063613b04a214610ac25780636198e33914610ad95780636352211e14610af957600080fd5b80634025feb2116103be5780634025feb2146109a957806342842e0e146109c957806342966c68146109e957806344004cc114610a095780634ce17b8614610a295780634f558e7914610a4957600080fd5b806336568abe14610898578063389fcf06146108b857806338b4f04f146108e65780633a879f71146108fd5780633e27ec9b146109605780633f4ba83a1461099457600080fd5b80631ddae4f9116104a9578063248a9ca311610462578063248a9ca3146107da57806327f0f3ee1461080a5780632c4e9fc6146108215780632f2ff15d146108385780632f745c591461085857806330176e131461087857600080fd5b80631ddae4f91461071e5780631ef208951461074c5780631f53ac0214610763578063210ef7ed14610783578063231d5ca5146107a357806323b872dd146107ba57600080fd5b806311f3043d116104fb57806311f3043d1461063f578063121cba19146106645780631338736f14610684578063150b7a02146106a4578063179a9c0f146106e957806318160ddd1461070957600080fd5b806301ffc9a71461054e57806306fdde03146105835780630800ef41146105a5578063081812fc146105c7578063095ea7b3146105ff5780631056642a1461061f57600080fd5b3661054957005b600080fd5b34801561055a57600080fd5b5061056e6105693660046153a5565b6111b7565b60405190151581526020015b60405180910390f35b34801561058f57600080fd5b506105986111c8565b60405161057a9190615795565b3480156105b157600080fd5b506105c56105c0366004615345565b6111d7565b005b3480156105d357600080fd5b506105e76105e2366004615345565b6111e5565b6040516001600160a01b03909116815260200161057a565b34801561060b57600080fd5b506105c561061a366004615198565b611204565b34801561062b57600080fd5b506105c561063a366004615345565b611227565b34801561064b57600080fd5b506106566101fc5481565b60405190815260200161057a565b34801561067057600080fd5b506105e761067f366004615345565b611235565b34801561069057600080fd5b506105c561069f366004615383565b611333565b3480156106b057600080fd5b506106d06106bf36600461523e565b630a85bd0160e11b95945050505050565b6040516001600160e01b0319909116815260200161057a565b3480156106f557600080fd5b506105c5610704366004615198565b611485565b34801561071557600080fd5b506106566115fc565b34801561072a57600080fd5b50610656610739366004615345565b60009081526101f5602052604090205490565b34801561075857600080fd5b5061065661020d5481565b34801561076f57600080fd5b506105c561077e36600461517b565b61161a565b34801561078f57600080fd5b506105c561079e366004615383565b611645565b3480156107af57600080fd5b5061065661020c5481565b3480156107c657600080fd5b506105c56107d53660046151fd565b611679565b3480156107e657600080fd5b506106566107f5366004615345565b60009081526097602052604090206001015490565b34801561081657600080fd5b5061065661020e5481565b34801561082d57600080fd5b506106566102145481565b34801561084457600080fd5b506105c561085336600461535e565b61169a565b34801561086457600080fd5b50610656610873366004615198565b6116bf565b34801561088457600080fd5b506105c56108933660046153df565b611756565b3480156108a457600080fd5b506105c56108b336600461535e565b611772565b3480156108c457600080fd5b506106566108d336600461517b565b6102176020526000908152604090205481565b3480156108f257600080fd5b5061065661020f5481565b34801561090957600080fd5b506101f8546101f9546101fa546101fb54610933936001600160a01b039081169316919060ff1684565b604080516001600160a01b039586168152949093166020850152918301521515606082015260800161057a565b34801561096c57600080fd5b506106567f395f08be531c0d7403cba7c5ffd2b57329184452bcebcd6a48299ebbbf39db6f81565b3480156109a057600080fd5b506105c56117ec565b3480156109b557600080fd5b506105c56109c43660046151fd565b6117fe565b3480156109d557600080fd5b506105c56109e43660046151fd565b61186d565b3480156109f557600080fd5b506105c5610a04366004615345565b6118ae565b348015610a1557600080fd5b506105c5610a243660046151fd565b6118ba565b348015610a3557600080fd5b506105e7610a44366004615345565b6118d6565b348015610a5557600080fd5b5061056e610a64366004615345565b611948565b348015610a7557600080fd5b50610656610a84366004615345565b611953565b348015610a9557600080fd5b506105c5610aa43660046154ac565b6119e8565b348015610ab557600080fd5b506101915460ff1661056e565b348015610ace57600080fd5b5061065661020b5481565b348015610ae557600080fd5b506105c5610af4366004615345565b611aa9565b348015610b0557600080fd5b506105e7610b14366004615345565b611b80565b348015610b2557600080fd5b506105c5610b343660046153df565b611b9f565b348015610b4557600080fd5b506106566102095481565b348015610b5c57600080fd5b506105c5610b6b3660046153df565b611bbb565b348015610b7c57600080fd5b50610656610b8b36600461517b565b611bd7565b348015610b9c57600080fd5b5061065661020a5481565b348015610bb357600080fd5b506105c5611bf5565b348015610bc857600080fd5b506105c5610bd7366004615528565b611c07565b348015610be857600080fd5b506105c5610bf7366004615345565b611c27565b348015610c0857600080fd5b506105c5611c3c565b348015610c1d57600080fd5b50610656610c2c36600461517b565b6102166020526000908152604090205481565b348015610c4b57600080fd5b506106566102115481565b348015610c6257600080fd5b506105c5610c71366004615345565b611c64565b348015610c8257600080fd5b506105c5611e3e565b348015610c9757600080fd5b506105c5610ca636600461517b565b611e4e565b348015610cb757600080fd5b506033546001600160a01b03166105e7565b348015610cd557600080fd5b506105e7610ce4366004615383565b611e7f565b348015610cf557600080fd5b5061056e610d043660046151c4565b6001600160a01b0391821660009081526101f76020908152604080832093909416825291909152205460ff1690565b348015610d3f57600080fd5b5061056e610d4e36600461535e565b611e9e565b348015610d5f57600080fd5b50610598611ec9565b348015610d7457600080fd5b50610207546105e7906001600160a01b031681565b348015610d9557600080fd5b5061065661271081565b348015610dab57600080fd5b506106566102105481565b348015610dc257600080fd5b506105c5610dd1366004615345565b611ed3565b348015610de257600080fd5b50610656600081565b348015610df757600080fd5b506105c5610e063660046152dd565b611ee1565b348015610e1757600080fd5b506105c5610e263660046154fc565b611eeb565b348015610e3757600080fd5b506105c5610e46366004615528565b611f04565b348015610e5757600080fd5b506106566102155481565b6105c5610e70366004615345565b611f24565b348015610e8157600080fd5b506106567fc0f1d8144debc243d1891289d78c45e23543cbcf448281d467d3fce010f9750e81565b348015610eb557600080fd5b506105c5610ec436600461555a565b61210a565b348015610ed557600080fd5b506105c5610ee436600461523e565b612217565b348015610ef557600080fd5b506106566101fd5481565b348015610f0c57600080fd5b506102065461056e9060ff1681565b348015610f2757600080fd5b50610598610f3636600461555a565b6122b2565b348015610f4757600080fd5b50610598610f56366004615345565b6124d6565b348015610f6757600080fd5b50610656610f76366004615345565b6124e1565b348015610f8757600080fd5b506106566102125481565b348015610f9e57600080fd5b506106566102135481565b6105c5610fb736600461542d565b6124f8565b348015610fc857600080fd5b506106566102085481565b348015610fdf57600080fd5b506105c5610fee36600461535e565b61287d565b348015610fff57600080fd5b506105986128a2565b34801561101457600080fd5b50610656611023366004615345565b6101f56020526000908152604090205481565b34801561104257600080fd5b506105c561105136600461530b565b612931565b34801561106257600080fd5b5061108b611071366004615345565b6101fe602052600090815260409020805460019091015482565b6040805192835260208301919091520161057a565b3480156110ac57600080fd5b506106566102185481565b3480156110c357600080fd5b5061056e6110d23660046151c4565b61294d565b3480156110e357600080fd5b5061059861297e565b3480156110f857600080fd5b506105c561110736600461517b565b61298c565b34801561111857600080fd5b506105c5611127366004615198565b612a02565b34801561113857600080fd5b506105c56111473660046152dd565b612a14565b34801561115857600080fd5b5061056e611167366004615345565b60009081526101f56020526040902054421090565b34801561118857600080fd5b50610206546105e79061010090046001600160a01b031681565b3480156111ae57600080fd5b5061056e600181565b60006111c282612a1f565b92915050565b60606111d2612a6d565b905090565b6111df612b00565b61020555565b6000610218548210156111fb576111c282612b5a565b6111c282612b82565b6102185481101561121d576112198282612bcf565b5050565b6112198282612ce0565b61122f612b00565b61020955565b600061124082612d8e565b6112a55760405162461bcd60e51b815260206004820152602b60248201527f455243353035383a206c6f636b657220717565727920666f72206e6f6e65786960448201526a39ba32b73a103a37b5b2b760a91b60648201526084015b60405180910390fd5b60008281526101f5602052604090205442106113165760405162461bcd60e51b815260206004820152602a60248201527f455243353035383a206c6f636b657220717565727920666f72206e6f6e2d6c6f60448201526931b5b2b2103a37b5b2b760b11b606482015260840161129c565b5060009081526101f660205260409020546001600160a01b031690565b61133d3383612dc4565b6113a05760405162461bcd60e51b815260206004820152602e60248201527f455243353035383a206c6f636b2063616c6c6572206973206e6f74206f776e6560448201526d1c881b9bdc88185c1c1c9bdd995960921b606482015260840161129c565b4281116114205760405162461bcd60e51b815260206004820152604260248201527f455243353035383a20657870697265642074696d65206d75737420626520677260448201527f6561746572207468616e2063757272656e7420626c6f636b2074696d6573746160648201526106d760f41b608482015260a40161129c565b60008281526101f5602052604090205442101561147a5760405162461bcd60e51b8152602060048201526018602482015277115490cd4c0d4e0e881d1bdad95b881a5cc81b1bd8dad95960421b604482015260640161129c565b611219338383612eb5565b60008181526101f560205260409020544210156114df5760405162461bcd60e51b8152602060048201526018602482015277115490cd4c0d4e0e881d1bdad95b881a5cc81b1bd8dad95960421b604482015260640161129c565b60006114ea82612f38565b9050806001600160a01b0316836001600160a01b0316141561155e5760405162461bcd60e51b815260206004820152602760248201527f455243353035383a206c6f636b20617070726f76616c20746f2063757272656e6044820152663a1037bbb732b960c91b606482015260840161129c565b336001600160a01b038216148061157a575061157a8133610d04565b6115ec5760405162461bcd60e51b815260206004820152603e60248201527f455243353035383a206c6f636b20617070726f76652063616c6c65722069732060448201527f6e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161129c565b6115f7818484612f99565b505050565b60006116086102185490565b611610612ff6565b6111d29190615905565b611622612b00565b61020480546001600160a01b0319166001600160a01b0392909216919091179055565b7fc0f1d8144debc243d1891289d78c45e23543cbcf448281d467d3fce010f9750e61166f8161301e565b6115f78383613028565b6102185481101561168f576115f783838361321e565b6115f7838383613250565b6000828152609760205260409020600101546116b58161301e565b6115f78383613438565b60006116ca8361345a565b821061172c5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b606482015260840161129c565b506001600160a01b0391909116600090815261015f60209081526040808320938352929052205490565b61175e612b00565b8051611219906101ff906020840190615055565b6001600160a01b03811633146117e25760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161129c565b61121982826134e1565b6117f4612b00565b6117fc613503565b565b611806612b00565b604051632142170760e11b81526001600160a01b038416906342842e0e9061183690309086908690600401615734565b600060405180830381600087803b15801561185057600080fd5b505af1158015611864573d6000803e3d6000fd5b50505050505050565b61021854811015611893576115f783838360405180602001604052806000815250613556565b6115f783838360405180602001604052806000815250613587565b6118b7816135cb565b50565b6118c2612b00565b6115f76001600160a01b03841683836136ae565b60006118e182612d8e565b6113165760405162461bcd60e51b815260206004820152603260248201527f455243353035383a206c6f636b20617070726f76656420717565727920666f72604482015271103737b732bc34b9ba32b73a103a37b5b2b760711b606482015260840161129c565b60006111c282612d8e565b600061195f6101615490565b82106119c25760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b606482015260840161129c565b61016182815481106119d6576119d6615a79565b90600052602060002001549050919050565b6119f23384613700565b611a0e5760405162461bcd60e51b815260040161129c906157a8565b60038210611a6a5760405162461bcd60e51b8152602060048201526024808201527f4552433732314d756c74695552493a2075726920706f73206f7574206f6620696044820152630dcc8caf60e31b606482015260840161129c565b60008381526102026020526040902081906001018360038110611a8f57611a8f615a79565b019080519060200190611aa3929190615055565b50505050565b33611ab382611235565b6001600160a01b031614611b1d5760405162461bcd60e51b815260206004820152602b60248201527f455243353035383a20756e6c6f636b2063616c6c6572206973206e6f74206c6f60448201526a31b59037b832b930ba37b960a91b606482015260840161129c565b6000611b2882612f38565b905060008281526101f56020526040812055816001600160a01b038216336001600160a01b03167fe6e0ef9cd056ca98561ca60e347ada61e1ede2f1142a078951b7a52e1e508e6060405160405180910390a4611219565b600061021854821015611b96576111c282612f38565b6111c28261374c565b611ba7612b00565b805161121990610200906020840190615055565b611bc3612b00565b805161121990610201906020840190615055565b6000611be28261345a565b611beb83613757565b6111c29190615905565b611bfd612b00565b6117fc60006137c0565b611c0f612b00565b61020e9390935561020f919091556102105561021155565b611c2f612b00565b80611c38613812565b5550565b611c44612b00565b61016154611c53906001615905565b610218819055611c61613812565b55565b611c6c613836565b6102065460ff16611c8f5760405162461bcd60e51b815260040161129c9061584a565b323314611cae5760405162461bcd60e51b815260040161129c90615895565b610209548161020a54611cc19190615905565b1115611d0f5760405162461bcd60e51b815260206004820152601b60248201527f696e73756666696369656e7420667265652072656d61696e696e670000000000604482015260640161129c565b61271081611d1b6115fc565b611d259190615905565b1115611d435760405162461bcd60e51b815260040161129c9061584a565b61020c541580611d71575061020c543360009081526102176020526040902054611d6e908390615905565b11155b611db35760405162461bcd60e51b8152602060048201526013602482015272185b1c9958591e48199c9959481b5a5b9d1959606a1b604482015260640161129c565b61020b544210158015611dc95750600061020b54115b611de55760405162461bcd60e51b815260040161129c9061586e565b336000908152610217602052604081208054839290611e05908490615905565b925050819055508061020a6000828254611e1f9190615905565b925050819055506118b7818261020d54611e399190615931565b61387d565b611e46612b00565b6117fc6139ba565b611e56612b00565b61020680546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600082815260c960205260408120611e9790836139f8565b9392505050565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b60606111d2613a04565b611edb612b00565b61020855565b6112198282613a14565b611ef3612b00565b61020b9290925561020c5561020d55565b611f0c612b00565b61021293909355610213919091556102145561021555565b611f2c613836565b600260fb541415611f7f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161129c565b600260fb556102065460ff16611fa75760405162461bcd60e51b815260040161129c9061584a565b323314611fc65760405162461bcd60e51b815260040161129c90615895565b61271081611fd26115fc565b611fdc9190615905565b1115611ffa5760405162461bcd60e51b815260040161129c9061584a565b61020e5442101580156120105750600061020e54115b61202c5760405162461bcd60e51b815260040161129c9061586e565b61020f54158061203f575061020f548111155b61207e5760405162461bcd60e51b815260206004820152601060248201526f696e76616c6964206d696e74206e756d60801b604482015260640161129c565b6102105461208c9082615931565b34146120cf5760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b604482015260640161129c565b61021054156120ef57610204546120ef906001600160a01b031634613a1f565b612102818261021154611e399190615931565b50600160fb55565b612115335b83613700565b6121315760405162461bcd60e51b815260040161129c906157a8565b60058160ff16106121945760405162461bcd60e51b815260206004820152602760248201527f4552433732314d756c74695552493a20646973706c6179206964206f7574206f6044820152660cc40d2dcc8caf60cb1b606482015260840161129c565b60006121a083836122b2565b905060008151116121f35760405162461bcd60e51b815260206004820152601960248201527f4552433732314d756c74695552493a20656d7074792075726900000000000000604482015260640161129c565b5060009182526102026020526040909120805460ff191660ff909216919091179055565b610218548310156122695761226485858585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061355692505050565b6122ab565b6122ab85858585858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061358792505050565b5050505050565b606060ff82166123955760006122c6613b38565b905060008151116123625761020180546122df906159cd565b80601f016020809104026020016040519081016040528092919081815260200182805461230b906159cd565b80156123585780601f1061232d57610100808354040283529160200191612358565b820191906000526020600020905b81548152906001019060200180831161233b57829003601f168201915b505050505061238d565b8061236c85613b4f565b60405160200161237d9291906155e9565b6040516020818303038152906040525b9150506111c2565b8160ff16600114156123f157600061020080546123b1906159cd565b905011156123ec576102006123c584613b4f565b6040516020016123d6929190615618565b60405160208183030381529060405290506111c2565b6124c0565b60008381526102026020526040812060010161240e600285615967565b60ff166003811061242157612421615a79565b01805461242d906159cd565b80601f0160208091040260200160405190810160405280929190818152602001828054612459906159cd565b80156124a65780601f1061247b576101008083540402835291602001916124a6565b820191906000526020600020905b81548152906001019060200180831161248957829003601f168201915b505050505090506000815111156124be5790506111c2565b505b5060408051602081019091526000815292915050565b60606111c282613c4d565b600081815260c9602052604081206111c290613cd1565b612500613836565b600260fb5414156125535760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161129c565b600260fb556102065460ff1661257b5760405162461bcd60e51b815260040161129c9061584a565b32331461259a5760405162461bcd60e51b815260040161129c90615895565b612710836125a66115fc565b6125b09190615905565b11156125f75760405162461bcd60e51b8152602060048201526016602482015275696e73756666696369656e742072656d61696e696e6760501b604482015260640161129c565b61266d82828080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050610205546040516bffffffffffffffffffffffff193360601b166020820152909250603401905060405160208183030381529060405280519060200120613cdb565b6126a95760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b210383937b7b360991b604482015260640161129c565b6102135415806126d757506102135433600090815261021660205260409020546126d4908590615905565b11155b6127175760405162461bcd60e51b8152602060048201526011602482015270185b1c9958591e481ddb081b5a5b9d1959607a1b604482015260640161129c565b61021254421015801561272d5750600061021254115b6127495760405162461bcd60e51b815260040161129c9061586e565b610214546127579084615931565b341461279a5760405162461bcd60e51b8152602060048201526012602482015271696e73756666696369656e742066756e647360701b604482015260640161129c565b61021454156127bf57610204546127ba906001600160a01b031634613a1f565b612839565b610209548361020a546127d29190615905565b11156128205760405162461bcd60e51b815260206004820152601b60248201527f696e73756666696369656e7420667265652072656d61696e696e670000000000604482015260640161129c565b8261020a60008282546128339190615905565b90915550505b336000908152610216602052604081208054859290612859908490615905565b92505081905550612873838461021554611e399190615931565b5050600160fb5550565b6000828152609760205260409020600101546128988161301e565b6115f783836134e1565b6101ff80546128b0906159cd565b80601f01602080910402602001604051908101604052809291908181526020018280546128dc906159cd565b80156129295780601f106128fe57610100808354040283529160200191612929565b820191906000526020600020905b81548152906001019060200180831161290c57829003601f168201915b505050505081565b612939612b00565b610206805460ff1916911515919091179055565b6001600160a01b0380831660009081526101326020908152604080832093851683529290529081205460ff16611e97565b61020080546128b0906159cd565b612994612b00565b6001600160a01b0381166129f95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161129c565b6118b7816137c0565b612a0a612b00565b6112198282613a1f565b611219338383613cf1565b60006301ffc9a760e01b6001600160e01b031983161480612a5057506380ac58cd60e01b6001600160e01b03198316145b806111c25750506001600160e01b031916635b5e139f60e01b1490565b606061012d8054612a7d906159cd565b80601f0160208091040260200160405190810160405280929190818152602001828054612aa9906159cd565b8015612af65780601f10612acb57610100808354040283529160200191612af6565b820191906000526020600020905b815481529060010190602001808311612ad957829003601f168201915b5050505050905090565b6033546001600160a01b031633146117fc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161129c565b6000612b6582613dc2565b50600090815261013160205260409020546001600160a01b031690565b6000612b8d82612d8e565b612baa576040516333d1c03960e21b815260040160405180910390fd5b612bb2613812565b60009283526006016020525060409020546001600160a01b031690565b6000612bda82612f38565b9050806001600160a01b0316836001600160a01b03161415612c485760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161129c565b336001600160a01b0382161480612c645750612c64813361294d565b612cd65760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161129c565b6115f78383613e12565b6000612ceb82611b80565b9050336001600160a01b03821614612d2457612d07813361294d565b612d24576040516367d9dca160e11b815260040160405180910390fd5b82612d2d613812565b6000848152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551849286811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a4505050565b600061021854821015612dbb57600082815261012f60205260409020546001600160a01b031615156111c2565b6111c282613e81565b6000612dcf82612d8e565b612e365760405162461bcd60e51b815260206004820152603260248201527f455243353035383a206c6f636b206f70657261746f7220717565727920666f72604482015271103737b732bc34b9ba32b73a103a37b5b2b760711b606482015260840161129c565b6000612e4183612f38565b9050806001600160a01b0316846001600160a01b03161480612e8957506001600160a01b0380821660009081526101f7602090815260408083209388168352929052205460ff165b80612ead5750836001600160a01b0316612ea2846118d6565b6001600160a01b0316145b949350505050565b6000612ec083612f38565b60008481526101f5602090815260408083208690556101f682529182902080546001600160a01b031916331790558151858152915192935085926001600160a01b0380861693908916927f967ad762aa9070ada8db64577288e214771e89667066ae38e8750cb8a86c542992918290030190a4611aa3565b600081815261012f60205260408120546001600160a01b0316806111c25760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161129c565b60008181526101f6602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fbd5378dc6d0395c338ca88b324966808490d6a9983bbc7a0f7a8429a44a3176291a4505050565b60006130026102185490565b61300a613812565b60010154613016613812565b540303919050565b6118b78133613ed2565b6130328282613f36565b600081610208546130439190615931565b6102065461020754604051636eb1769f60e11b81526001600160a01b0391821660048201523060248201529293508392610100909204169063dd62ed3e9060440160206040518083038186803b15801561309c57600080fd5b505afa1580156130b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d49190615414565b106115f75761020654610207546101f8546001600160a01b036101009093048316926323b872dd928116911661310b60028661591d565b6040518463ffffffff1660e01b815260040161312993929190615734565b602060405180830381600087803b15801561314357600080fd5b505af1158015613157573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061317b9190615328565b5061020654610207546101f9546001600160a01b036101009093048316926323b872dd92811691166131ae60028661591d565b6040518463ffffffff1660e01b81526004016131cc93929190615734565b602060405180830381600087803b1580156131e657600080fd5b505af11580156131fa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa39190615328565b613229335b82613700565b6132455760405162461bcd60e51b815260040161129c906158b7565b6115f7838383613fe2565b600061325b82614175565b9050836001600160a01b0316816001600160a01b03161461328e5760405162a1148160e81b815260040160405180910390fd5b60008061329a8461420c565b915091506132bf81876132aa3390565b6001600160a01b039081169116811491141790565b6132ea576132cd863361294d565b6132ea57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661331157604051633a954ecd60e21b815260040160405180910390fd5b801561331c57600082555b613324613812565b6001600160a01b0387166000908152600591909101602052604090208054600019019055613350613812565b6001600160a01b03861660008181526005929092016020526040909120805460010190554260a01b17600160e11b17613387613812565b60008681526004919091016020526040902055600160e11b83166133f657600184016133b1613812565b600082815260049190910160205260409020546133f4576133d0613812565b5481146133f457836133e0613812565b600083815260049190910160205260409020555b505b83856001600160a01b0316876001600160a01b0316600080516020615adf83398151915260405160405180910390a4613430868686614234565b505050505050565b613442828261423f565b600082815260c9602052604090206115f790826142c5565b60006001600160a01b0382166134c45760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161129c565b506001600160a01b03166000908152610130602052604090205490565b6134eb82826142da565b600082815260c9602052604090206115f79082614341565b61350b614356565b610191805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b61355f3361210f565b61357b5760405162461bcd60e51b815260040161129c906158b7565b611aa3848484846143a0565b613592848484611679565b6001600160a01b0383163b15611aa3576135ae848484846143d3565b611aa3576040516368d2bf6b60e11b815260040160405180910390fd5b6102065460ff161561362b5760405162461bcd60e51b8152602060048201526024808201527f4e6f7420616c6c6f77206275726e20647572696e67206d696e74696e672070656044820152631c9a5bd960e21b606482015260840161129c565b610218548110156136a55761363f33613223565b61369c5760405162461bcd60e51b815260206004820152602860248201527f4552433732313a2063616c6c6572206973206e6f74206f776e6572206e6f7220604482015267185c1c1c9bdd995960c21b606482015260840161129c565b6118b7816144ca565b6118b78161455d565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526115f7908490614568565b60008061370c83612f38565b9050806001600160a01b0316846001600160a01b031614806137335750613733818561294d565b80612ead5750836001600160a01b0316612ea2846111e5565b60006111c282614175565b60006001600160a01b038216613780576040516323d3ad8160e21b815260040160405180910390fd5b67ffffffffffffffff613791613812565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b7f49d68f8497c9113bb90cd0201cf1335d00c5c438f6870a7e93e597c5d83821e390565b6101915460ff16156117fc5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161129c565b613887338361463a565b60008111801561392457506102065461020754604051636eb1769f60e11b81526001600160a01b039182166004820152306024820152839261010090049091169063dd62ed3e9060440160206040518083038186803b1580156138e957600080fd5b505afa1580156138fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139219190615414565b10155b156112195761020654610207546040516323b872dd60e01b81526001600160a01b036101009093048316926323b872dd926139689291169033908690600401615734565b602060405180830381600087803b15801561398257600080fd5b505af1158015613996573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f79190615328565b6139c2613836565b610191805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135393390565b6000611e978383614644565b606061012e8054612a7d906159cd565b61121933838361466e565b80471015613a6f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161129c565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613abc576040519150601f19603f3d011682016040523d82523d6000602084013e613ac1565b606091505b50509050806115f75760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161129c565b60606111d260408051602081019091526000815290565b606081613b735750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613b9d5780613b8781615a08565b9150613b969050600a8361591d565b9150613b77565b60008167ffffffffffffffff811115613bb857613bb8615a8f565b6040519080825280601f01601f191660200182016040528015613be2576020820181803683370190505b5090505b8415612ead57613bf7600183615950565b9150613c04600a86615a23565b613c0f906030615905565b60f81b818381518110613c2457613c24615a79565b60200101906001600160f81b031916908160001a905350613c46600a8661591d565b9450613be6565b6060613c5882612d8e565b613c7557604051630a14c4b560e41b815260040160405180910390fd5b6000613c7f613b38565b9050805160001415613ca05760405180602001604052806000815250611e97565b80613caa84614736565b604051602001613cbb9291906155e9565b6040516020818303038152906040529392505050565b60006111c2825490565b600082613ce88584614778565b14949350505050565b816001600160a01b0316836001600160a01b03161415613d535760405162461bcd60e51b815260206004820152601f60248201527f455243353035383a206c6f636b20617070726f766520746f2063616c6c657200604482015260640161129c565b6001600160a01b0383811660008181526101f76020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527fbb3b2937fc41058c97e1ad0d0bbac3c664894dd823924eb7717d814fe700f03491015b60405180910390a3505050565b613dcb81612d8e565b6118b75760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604482015260640161129c565b60008181526101316020526040902080546001600160a01b0319166001600160a01b0384169081179091558190613e4882612f38565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600081613e8e6102185490565b11158015613ea35750613e9f613812565b5482105b80156111c25750600160e01b613eb7613812565b60008481526004919091016020526040902054161592915050565b613edc8282611e9e565b61121957613ef4816001600160a01b031660146147c5565b613eff8360206147c5565b604051602001613f109291906156bf565b60408051601f198184030181529082905262461bcd60e51b825261129c91600401615795565b806101fc6000828254613f499190615905565b90915550506101fb805460ff1916600117905560008281526101fe60205260408120805490918391839190613f7f908490615905565b9091555050600181018054906000613f9683615a08565b909155505060408051338152602081018590529081018390527f7bb4b3f96a37d77ea59743ca80a069ed87950496bd9e9ff983f2a7739466dfc9906060015b60405180910390a1505050565b826001600160a01b0316613ff582612f38565b6001600160a01b0316146140595760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161129c565b6001600160a01b0382166140bb5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161129c565b6140c6600082613e12565b6001600160a01b0383166000908152610130602052604081208054600192906140f0908490615950565b90915550506001600160a01b03821660009081526101306020526040812080546001929061411f908490615905565b9091555050600081815261012f602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615adf83398151915291a46115f7838383614234565b600081806141836102185490565b116141f357614190613812565b548110156141f35760006141a2613812565b600083815260049190910160205260409020549050600160e01b81166141f1575b80611e97576141d0613812565b600019909201600081815260049390930160205260409092205490506141c3565b505b604051636f96cda160e11b815260040160405180910390fd5b6000806000614219613812565b60009485526006016020525050604090912080549092909150565b6115f7838383614961565b6142498282611e9e565b6112195760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556142813390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000611e97836001600160a01b038416614a0b565b6142e48282611e9e565b156112195760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000611e97836001600160a01b038416614a5a565b6101915460ff166117fc5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161129c565b6143ab848484613fe2565b6143b784848484614b4d565b611aa35760405162461bcd60e51b815260040161129c906157f8565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290614408903390899088908890600401615758565b602060405180830381600087803b15801561442257600080fd5b505af1925050508015614452575060408051601f3d908101601f1916820190925261444f918101906153c2565b60015b6144ad573d808015614480576040519150601f19603f3d011682016040523d82523d6000602084013e614485565b606091505b5080516144a5576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b60006144d582612f38565b90506144e2600083613e12565b6001600160a01b03811660009081526101306020526040812080546001929061450c908490615950565b9091555050600082815261012f602052604080822080546001600160a01b0319169055518391906001600160a01b03841690600080516020615adf833981519152908390a461121981600084614234565b6118b7816000614c35565b60006145bd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614d9d9092919063ffffffff16565b8051909150156115f757808060200190518101906145db9190615328565b6115f75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161129c565b6112198282614dac565b600082600001828154811061465b5761465b615a79565b9060005260206000200154905092915050565b816001600160a01b0316836001600160a01b031614156146d05760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015260640161129c565b6001600160a01b0383811660008181526101326020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319101613db5565b604080516080019081905280825b600183039250600a81066030018353600a90048061476157614766565b614744565b50819003601f19909101908152919050565b600081815b84518110156147bd576147a98286838151811061479c5761479c615a79565b6020026020010151614ebc565b9150806147b581615a08565b91505061477d565b509392505050565b606060006147d4836002615931565b6147df906002615905565b67ffffffffffffffff8111156147f7576147f7615a8f565b6040519080825280601f01601f191660200182016040528015614821576020820181803683370190505b509050600360fc1b8160008151811061483c5761483c615a79565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061486b5761486b615a79565b60200101906001600160f81b031916908160001a905350600061488f846002615931565b61489a906001615905565b90505b6001811115614912576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106148ce576148ce615a79565b1a60f81b8282815181106148e4576148e4615a79565b60200101906001600160f81b031916908160001a90535060049490941c9361490b816159b6565b905061489d565b508315611e975760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161129c565b6101f880546001600160a01b038086166001600160a01b0319928316179092556101f98054928516929091169190911790556101fa8190556101fb805460ff191690556101fd80549060006149b583615a08565b9091555050604080513381526001600160a01b038086166020830152841691810191909152606081018290527f45662a318b67ba901b3a9144d7f57390d3cc4dedd5b7a8819df7e969a71e8f3b90608001613fd5565b6000818152600183016020526040812054614a52575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556111c2565b5060006111c2565b60008181526001830160205260408120548015614b43576000614a7e600183615950565b8554909150600090614a9290600190615950565b9050818114614af7576000866000018281548110614ab257614ab2615a79565b9060005260206000200154905080876000018481548110614ad557614ad5615a79565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614b0857614b08615a63565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506111c2565b60009150506111c2565b60006001600160a01b0384163b15614c2d57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614b91903390899088908890600401615758565b602060405180830381600087803b158015614bab57600080fd5b505af1925050508015614bdb575060408051601f3d908101601f19168201909252614bd8918101906153c2565b60015b6144ad573d808015614c09576040519150601f19603f3d011682016040523d82523d6000602084013e614c0e565b606091505b5080516144a55760405162461bcd60e51b815260040161129c906157f8565b506001612ead565b6000614c4083614175565b905080600080614c4f8661420c565b915091508415614c8f57614c648184336132aa565b614c8f57614c72833361294d565b614c8f57604051632ce44b5f60e11b815260040160405180910390fd5b8015614c9a57600082555b6fffffffffffffffffffffffffffffffff614cb3613812565b6001600160a01b038516600081815260059290920160205260409091208054929092019091554260a01b17600360e01b17614cec613812565b60008881526004919091016020526040902055600160e11b8416614d5b5760018601614d16613812565b60008281526004919091016020526040902054614d5957614d35613812565b548114614d595784614d45613812565b600083815260049190910160205260409020555b505b60405186906000906001600160a01b03861690600080516020615adf833981519152908390a4614d89613812565b600190810180549091019055505050505050565b6060612ead8484600085614eeb565b6000614db6613812565b54905081614dd75760405163b562e8dd60e01b815260040160405180910390fd5b680100000000000000018202614deb613812565b6001600160a01b038516600081815260059290920160205260409091208054929092019091554260a01b6001841460e11b1717614e26613812565b600083815260049190910160205260408120919091556001600160a01b038416908383019083908390600080516020615adf8339815191528180a4600183015b818114614e8c5780836000600080516020615adf833981519152600080a4600101614e66565b5081614eaa57604051622e076360e81b815260040160405180910390fd5b80614eb3613812565b55506115f79050565b6000818310614ed8576000828152602084905260409020611e97565b6000838152602083905260409020611e97565b606082471015614f4c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161129c565b6001600160a01b0385163b614fa35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161129c565b600080866001600160a01b03168587604051614fbf91906155cd565b60006040518083038185875af1925050503d8060008114614ffc576040519150601f19603f3d011682016040523d82523d6000602084013e615001565b606091505b509150915061501182828661501c565b979650505050505050565b6060831561502b575081611e97565b82511561503b5782518084602001fd5b8160405162461bcd60e51b815260040161129c9190615795565b828054615061906159cd565b90600052602060002090601f01602090048101928261508357600085556150c9565b82601f1061509c57805160ff19168380011785556150c9565b828001600101855582156150c9579182015b828111156150c95782518255916020019190600101906150ae565b506150d59291506150d9565b5090565b5b808211156150d557600081556001016150da565b600082601f8301126150ff57600080fd5b813567ffffffffffffffff8082111561511a5761511a615a8f565b604051601f8301601f19908116603f0116810190828211818310171561514257615142615a8f565b8160405283815286602085880101111561515b57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60006020828403121561518d57600080fd5b8135611e9781615aa5565b600080604083850312156151ab57600080fd5b82356151b681615aa5565b946020939093013593505050565b600080604083850312156151d757600080fd5b82356151e281615aa5565b915060208301356151f281615aa5565b809150509250929050565b60008060006060848603121561521257600080fd5b833561521d81615aa5565b9250602084013561522d81615aa5565b929592945050506040919091013590565b60008060008060006080868803121561525657600080fd5b853561526181615aa5565b9450602086013561527181615aa5565b935060408601359250606086013567ffffffffffffffff8082111561529557600080fd5b818801915088601f8301126152a957600080fd5b8135818111156152b857600080fd5b8960208285010111156152ca57600080fd5b9699959850939650602001949392505050565b600080604083850312156152f057600080fd5b82356152fb81615aa5565b915060208301356151f281615aba565b60006020828403121561531d57600080fd5b8135611e9781615aba565b60006020828403121561533a57600080fd5b8151611e9781615aba565b60006020828403121561535757600080fd5b5035919050565b6000806040838503121561537157600080fd5b8235915060208301356151f281615aa5565b6000806040838503121561539657600080fd5b50508035926020909101359150565b6000602082840312156153b757600080fd5b8135611e9781615ac8565b6000602082840312156153d457600080fd5b8151611e9781615ac8565b6000602082840312156153f157600080fd5b813567ffffffffffffffff81111561540857600080fd5b612ead848285016150ee565b60006020828403121561542657600080fd5b5051919050565b60008060006040848603121561544257600080fd5b83359250602084013567ffffffffffffffff8082111561546157600080fd5b818601915086601f83011261547557600080fd5b81358181111561548457600080fd5b8760208260051b850101111561549957600080fd5b6020830194508093505050509250925092565b6000806000606084860312156154c157600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156154e657600080fd5b6154f2868287016150ee565b9150509250925092565b60008060006060848603121561551157600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561553e57600080fd5b5050823594602084013594506040840135936060013592509050565b6000806040838503121561556d57600080fd5b82359150602083013560ff811681146151f257600080fd5b6000815180845261559d81602086016020860161598a565b601f01601f19169290920160200192915050565b600081516155c381856020860161598a565b9290920192915050565b600082516155df81846020870161598a565b9190910192915050565b600083516155fb81846020880161598a565b83519083019061560f81836020880161598a565b01949350505050565b600080845481600182811c91508083168061563457607f831692505b602080841082141561565457634e487b7160e01b86526022600452602486fd5b8180156156685760018114615679576156a6565b60ff198616895284890196506156a6565b60008b81526020902060005b8681101561569e5781548b820152908501908301615685565b505084890196505b5050505050506156b681856155b1565b95945050505050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516156f781601785016020880161598a565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161572881602884016020880161598a565b01602801949350505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061578b90830184615585565b9695505050505050565b602081526000611e976020830184615585565b60208082526030908201527f4552433732314d756c74695552493a2063616c6c6572206973206e6f74206f7760408201526f1b995c881b9bdc88185c1c1c9bdd995960821b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252600a90820152691b5a5b9d08195b99195960b21b604082015260600190565b6020808252600d908201526c1b9bdd081cdd185c9d081e595d609a1b604082015260600190565b6020808252600890820152676f6e6c7920454f4160c01b604082015260600190565b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b6000821982111561591857615918615a37565b500190565b60008261592c5761592c615a4d565b500490565b600081600019048311821515161561594b5761594b615a37565b500290565b60008282101561596257615962615a37565b500390565b600060ff821660ff84168082101561598157615981615a37565b90039392505050565b60005b838110156159a557818101518382015260200161598d565b83811115611aa35750506000910152565b6000816159c5576159c5615a37565b506000190190565b600181811c908216806159e157607f821691505b60208210811415615a0257634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415615a1c57615a1c615a37565b5060010190565b600082615a3257615a32615a4d565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146118b757600080fd5b80151581146118b757600080fd5b6001600160e01b0319811681146118b757600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220fbc53cbe91d1b37f12a3fda7ad3dc57d605af67078c27172ec94ab63cc05c61564736f6c63430008070033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 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.