ERC-721
Overview
Max Total Supply
3,711 3FACE
Holders
879
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
0 3FACELoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
THREEFACE
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; import './3FACEBase.sol'; import './3FACESplits.sol'; /** * @title THREEFACE * ▄▄▀▀▀▀█ * ▄▄▄▄▄▄ ▄▄▄▄▄▄▄▀▀ ▐▌ * ▄▄▄▄▓▀▀ █ ▄▀ ▄█▌ * ▄▀ ▄▄▀ █ ▄▄▄████ * ▓ ▄██████▀ █ ▄▄██████▀▀ ▄▄█▀▀▀▀▀▓ * ▄▄▄▄▄▄▄▄▄▄▄▄▄ ▓ ▓██ ▐▌ ███▀▀ ▄▄▀▀▀▀ ██ * ▄▄▀▀▀▀ █ ▐▌ ██▌ ▐ ██ ▄▀ ▄█ * ▐▀ ██ ▐▌ ██▌ █ ██ ▓ ▄▄▄█████▀▀▀▀ * ▐ ▄▄▄█████ ██ ▐ ██▌ ▐▌ ▐█▌ █ ▐██ * ▐▌ █████▀▀▀▀▀▀▀▀▌ ██ ▓ ██▌ ▐ ██ ▐▌ ▓█▌ * ▌ ▓█▌ ▌ ██ ▐▌ ▐██ █ ██ ▐▌ ██ * ▀▀▀▀ ▌ ▐██ ▐▌ ▐█▀ ▄▄▄▄ ▌ ▐█▌ ▐▌ ▐█▌ ▄▄▓▀▀▀▄ * ▐▌ ▐██ ▐ ▀▀▀▀▀ ▌ ▐▌ ▓█ ▐ ▀▀▀ ▄▌ * ▄▀ ▄█▌ █ ▄▄▄█ ▐ █▌ █ ▄▄▄▄▄▄▄████ * ▄▀ ▀▄ ▄▄▀▀ ▄██ ▌ ███▀▀▀ ▄▄▀▀▀▀▀▀▀▄ █ █▌ █ ██▀▀▀▀▀▀▀ * ▐ ▀███ ▌ ██ ▐▌ ▄▄▄ ▐ ▐ ▐█ ▐ ▐█▌ * █ ▄▄▄██ ██ ▌ ▐██ █ ██ █ ▐ ▌ ██ █ ▐█ ▄▄▀▀▀▀▀█ * ▀▀▀███▀▀ █▌ ▐██ ▌ ██▌ ▌ ▀▀▀▀▀ ▐▌ ▐▌ █▌ ▐▌ ▀▀▀▀▀▀ ▄██ * ▄▄▄ █ ██ ▓ ██ ▐▌ ▄█████▄ ▐ ▐ █▌ ▓ ▄████▀ * █ ▐ ▄▄▀▀ ██ ▐▌ ▐█▌ ▌ ▐█▌ ▐█ █ ▐ ▓▌ ▀▀████▄▄▄▄▄███▀ * ▐ ▀▀▀▀▀▀ ██ █ ██ █▄██ ██▌ ▐ ▐▌ ▀▀▀▀▀▀▀ * ▐ ▄▄▄███▀ ▓ ██ ▐ █ ▄▄▄▄▄▄▄▄▄ * ▀▄▄▄▄▄██████▀▀▀ ▄▀ ▐█▌ ▀▄ ▀▀▀▀▀▀ █▄ * ▄█ ▄██ ▀████▄▄▄▄▄▄▄▄▄▄▄▄▄██ * ▄▀▀▀▀▀▀ ▄███▀ ▀▀▀▀▀▀▀▀ * ▄▓▀ ▄███▀ * ▌▄▄▄██████▀▀▀ */ contract THREEFACE is THREEFACESplits, THREEFACEBase { constructor() THREEFACEBase( 'THREEFACE', '3FACE', 'https://3face.mypinata.cloud/ipfs/', addresses, splits, 0.2 ether, 0.1 ether, 0.5 ether, 0.003 ether ) { // Implementation version: V1 uint256[] memory natures = new uint256[](4); natures[0] = 100; natures[1] = 101; natures[2] = 102; natures[3] = 103; string[] memory natureFragments = new string[](4); natureFragments[0] = 'Qma8y8nhUJNymNd8b2w778cgGFdpsJWm6du75DSxc536BG'; // Change natureFragments[1] = 'QmT89zqM4SzCuow6LaZXSfs8PXMHAE88FJL2KjXQgfbDc4'; // Structure natureFragments[2] = 'QmTLpKhNduGRdDFhAZQJM6dP16SYabmib4YSN4tBoEuBEo'; // Belonging natureFragments[3] = 'QmUgGcKnGTYXEhoJx6pjTNQUDhbzQmoj1VB9fXPg7Ty5R9'; // Transcendence _setNatureFragments(natures, natureFragments); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; // NFTC Open Source Contracts See: https://github.com/NFTCulture/nftc-open-contracts import '@nftculture/nftc-open-contracts/contracts/security/GuardedAgainstContracts.sol'; import '@nftculture/nftc-open-contracts/contracts/financial/LockedPaymentSplitter.sol'; import '@nftculture/nftc-open-contracts/contracts/utility/AuxHelper32.sol'; import './AuxHelperFourInto256.sol'; import './DigiSigHelper.sol'; // NFTC Prerelease Contracts import '@nftculture/nftc-contract-library/contracts/token/phased/PhasedMintThree.sol'; import '@nftculture/nftc-contract-library/contracts/whitelisting/MerkleLeaves.sol'; // NFTC Prerelease Libraries import {MerkleClaimList} from '@nftculture/nftc-contract-library/contracts/whitelisting/MerkleClaimList.sol'; // ERC721A from Chiru Labs import 'erc721a/contracts/extensions/ERC721ABurnable.sol'; import 'erc721a/contracts/extensions/ERC721AQueryable.sol'; // OZ Libraries import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; // Error Codes error ExceedsMaxSupply(); error ExceedsReserveBatchSize(); error ProofInvalidPresale(); error ExceedsPresaleBatchSize(); error InvalidPresalePayment(); error ExceedsPresalePurchaseLimit(); error ExceedsPresaleSupply(); error ExceedsPublicMintBatchSize(); error InvalidPublicMintPayment(); error BindingNotAllowed(); error InvalidSelectedNature(); error InvalidRemoteMinter(); /** * @title THREEFACEBase * @author @NiftyMike | @NFTCulture * @dev ERC721a Burnable, Queryable with @NFTCulture standardized components. * * Three phase mint: * Phase One - Indexed Allowlist * Phase Two - Indexed Allowlist * Phase Three - Public * * Contract features a concept called "Binding" where the user can trigger a new * generative artwork to take the place of a token's current artwork. */ abstract contract THREEFACEBase is ERC721ABurnable, ERC721AQueryable, Ownable, ReentrancyGuard, LockedPaymentSplitter, PhasedMintThree, MerkleLeaves, AuxHelperFourInto256, AuxHelper32, DigiSigHelper { using Strings for uint256; using BooleanPacking for uint256; using MerkleClaimList for MerkleClaimList.Root; uint256 private constant MAX_NFTS_FOR_PRESALE_1 = 1896; uint256 private constant MAX_NFTS_FOR_SALE = 4096; uint256 private constant MAX_RESERVE_BATCH_SIZE = 32; uint256 private constant MAX_MINT_BATCH_SIZE = 10; uint256 public constant NATURE_BASE_VAL = 100; uint256 public constant NATURE_MIN = 0; uint256 public constant NATURE_MAX = 3; // Control flags for the token binding process. uint256 private constant BINDING_ALLOWED = 5; uint256 private constant REFUNDING_ENABLED = 6; uint256 internal _bindingControlFlags; uint256 public bindingRefundAmount; string public baseURI; MerkleClaimList.Root private _phaseOneRoot; MerkleClaimList.Root private _phaseTwoRoot; // Nature URI fragments. NatureID -> NatureURI mapping. mapping(uint256 => string) internal _natureUriFragments; // User URI fragments. TokenID -> UserURI mapping. // Each IPFS Hash costs about 85k gas to store. // There are optimizations for this, but they reduce // user-friendliness and forward compatiblity. mapping(uint256 => string) internal _userUriFragments; struct TokenBindingData { uint64 tokenId; uint64 generation; uint64 isBoundToUser; uint64 reserved; } mapping(uint256 => TokenBindingData) internal _tokenBindingMap; // Use the event log for persistence of previous URI fragments. // This saves about 60k gas vs. saving them in the contract. event ReleaseURIFragment(uint256 tokenId, uint256 generation, string previousUriFragment); // Use the event log for tracking when tokens have been refunded. event TokenBindingRefunded(uint256 tokenId); address private _threefaceSigner; address private _remoteMinter; modifier canBind() { if (!_bindingControlFlags.getBoolean(BINDING_ALLOWED)) revert BindingNotAllowed(); _; } constructor( string memory __name, string memory __symbol, string memory __baseURI, address[] memory __addresses, uint256[] memory __splits, uint256 __phaseOnePricePerNft, uint256 __phaseTwoPricePerNft, uint256 __phaseThreePricePerNft, uint256 __bindingRefundAmount ) ERC721A(__name, __symbol) SlimPaymentSplitter(__addresses, __splits) PhasedMintThree(__phaseOnePricePerNft, __phaseTwoPricePerNft, __phaseThreePricePerNft) { baseURI = __baseURI; _threefaceSigner = msg.sender; _remoteMinter = 0xdAb1a1854214684acE522439684a145E62505233; bindingRefundAmount = __bindingRefundAmount; } function maxPresaleOne() external pure returns (uint256) { return MAX_NFTS_FOR_PRESALE_1; } function maxSupply() external pure returns (uint256) { return MAX_NFTS_FOR_SALE; } function phaseOneBatchSize() external pure returns (uint256) { return MAX_MINT_BATCH_SIZE; } function phaseTwoBatchSize() external pure returns (uint256) { return MAX_MINT_BATCH_SIZE; } function publicMintBatchSize() external pure returns (uint256) { return MAX_MINT_BATCH_SIZE; } function isOpenEdition() external pure returns (bool) { // Front end minting websites should treat this mint as an open edition, even though there is a hard cap. return false; } function isBindingAllowed() external view returns (bool) { return _isBindingAllowed(); } function isRefundingEnabled() external view returns (bool) { return _isRefundingEnabled(); } function setBindingState( bool __bindingAllowed, bool __refundingEnabled, uint256 __bindingRefundAmount ) external onlyOwner { uint256 tempControlFlags = _bindingControlFlags; tempControlFlags = tempControlFlags.setBoolean(BINDING_ALLOWED, __bindingAllowed); tempControlFlags = tempControlFlags.setBoolean(REFUNDING_ENABLED, __refundingEnabled); _bindingControlFlags = tempControlFlags; if (__bindingRefundAmount > 0) { bindingRefundAmount = __bindingRefundAmount; } } function setBaseURI(string memory __baseUri) external onlyOwner { baseURI = __baseUri; } function setThreefaceSigner(address __newSigner) external onlyOwner { _threefaceSigner = __newSigner; } function setRemoteMinter(address __newMinter) external onlyOwner { _remoteMinter = __newMinter; } function setNatureFragments(uint256[] memory __natureIds, string[] memory __natureUris) external onlyOwner { _setNatureFragments(__natureIds, __natureUris); } /** * @dev This is just here in case of emergency */ function restoreUserFragment( uint256 tokenId, uint256 boundGenerationOverride, string calldata userUri, bool flush ) external onlyOwner { if (flush) { // Something bad must have happened, cause we are deliberately // wiping the bound state and generation here. delete _tokenBindingMap[tokenId]; } // Do the normal workflow. _setBindToUser(tokenId, _tokenBindingMap[tokenId], userUri); if (flush) { _tokenBindingMap[tokenId].generation = uint64(boundGenerationOverride); } } /** * @dev This is just here in case of emergency */ function restoreToBlank(uint256 tokenId, uint256 selectedNature) external onlyOwner { // Reset the fragment for this token. delete _tokenBindingMap[tokenId]; // Make sure the ownership info is initialized. _initializeOwnershipAt(tokenId); // Override set the nature back to expected value. _setNature(tokenId, uint24(selectedNature)); } function setMerkleRoots(bytes32 __phaseOneRoot, bytes32 __phaseTwoRoot) external onlyOwner { _setMerkleRoots(__phaseOneRoot, __phaseTwoRoot); } function _setMerkleRoots(bytes32 __phaseOneRoot, bytes32 __phaseTwoRoot) internal { if (__phaseOneRoot != 0) { _phaseOneRoot._setRoot(__phaseOneRoot); } if (__phaseTwoRoot != 0) { _phaseTwoRoot._setRoot(__phaseTwoRoot); } } function auxMintValues(address wallet) external view returns (uint32 presalePhaseOnePurchases, uint32 presalePhaseTwoPurchases) { // Unpack single value from _getAux() to determine presalePhaseOnePurchases and presalePhaseTwoPurchases return _unpack32(_getAux(wallet)); } function checkProofPhaseOne( bytes32[] calldata proof, address wallet, uint256 index ) external view returns (bool) { return _phaseOneRoot._checkLeaf(proof, _generateIndexedLeaf(wallet, index)); } function getNextProofIndexPhaseOne(address wallet) external view returns (uint256) { (uint32 phaseOnePurchases, ) = _unpack32(_getAux(wallet)); return phaseOnePurchases; } function checkProofPhaseTwo( bytes32[] calldata proof, address wallet, uint256 index ) external view returns (bool) { return _phaseTwoRoot._checkLeaf(proof, _generateIndexedLeaf(wallet, index)); } function getNextProofIndexPhaseTwo(address wallet) external view returns (uint256) { (, uint32 phaseTwoPurchases) = _unpack32(_getAux(wallet)); return phaseTwoPurchases; } function getPresalePhaseOneTokensPurchased(address wallet) external view returns (uint32) { (uint32 phaseOnePurchases, ) = _unpack32(_getAux(wallet)); return phaseOnePurchases; } function getPresalePhaseTwoTokensPurchased(address wallet) external view returns (uint32) { (, uint32 phaseTwoPurchases) = _unpack32(_getAux(wallet)); return phaseTwoPurchases; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), 'No token'); string memory base = _baseURI(); require(bytes(base).length > 0, 'Base unset'); uint256 nature = _getNature(tokenId); if (!_isBoundToUser(tokenId)) { // Build uri for "blank" 3face. return string(abi.encodePacked(base, _natureUriFragments[nature], _tokenFilename(tokenId))); } else { // Note: these are direct IPFS links, and do not need the token id appended. return string(abi.encodePacked(base, _userUriFragments[tokenId])); } } function getNature(uint256 tokenId) external view returns (uint256) { return _getNature(tokenId); } function getBindingInfo(uint256 tokenId) external view returns (TokenBindingData memory) { return _tokenBindingMap[tokenId]; } function getBindingInfo_CurrentFragment(uint256 tokenId) external view returns (string memory) { return _userUriFragments[tokenId]; } function getBindingInfo_Generation(uint256 tokenId) external view returns (uint256) { return _tokenBindingMap[tokenId].generation; } function getBindingInfo_IsBoundToUser(uint256 tokenId) external view returns (bool) { return _tokenBindingMap[tokenId].isBoundToUser == 1; } function getBindingInfo_Status(uint256 tokenId, string calldata uriFragment) external view returns (uint256) { bytes32 theUriFragmentHash = keccak256(abi.encodePacked(uriFragment)); if (keccak256(abi.encodePacked(_userUriFragments[tokenId])) == theUriFragmentHash) return 1; return 0; } function exists(uint256 tokenId) external view returns (bool) { return _exists(tokenId); } /** * @notice Owner: reserve tokens for team. * * NOTE: All tokens in a given transaction will be forced to have the same nature. * * @param friends addresses to send tokens to. * @param count the number of tokens to mint. * @param selectedNature the nature of the tokens. */ function reserveTokens( address[] memory friends, uint256 count, uint256 selectedNature ) external payable onlyOwner { if (0 >= count || count > MAX_RESERVE_BATCH_SIZE) revert ExceedsReserveBatchSize(); uint256 totalMinted = _totalMinted(); // track locally to save gas. uint256 idx; for (idx = 0; idx < friends.length; idx++) { _internalMintTokens(friends[idx], totalMinted, count, selectedNature); totalMinted += count; } } /** * @notice Owner: reserve sets for team. * * @param friends addresses to send tokens to. * @param sets the number of sets to mint. */ function reserveSets(address[] memory friends, uint256 sets) external payable onlyOwner { if (0 >= sets || sets > MAX_RESERVE_BATCH_SIZE) revert ExceedsReserveBatchSize(); uint256 totalMinted = _totalMinted(); // track locally to save gas. uint256 idx; for (idx = 0; idx < friends.length; idx++) { totalMinted = _internalMintSet(friends[idx], totalMinted, sets); } } /** * @notice Presale tokens Phase 1 - purchase bound by terms & conditions of project. * * @param proof merkle proof for presale. * @param count the number of tokens to mint. * @param selectedNature the nature of the token you would like to mint. */ function presalePhaseOneTokens( bytes32[] calldata proof, uint256 count, uint256 selectedNature ) external payable nonReentrant isPhaseOne { if (0 >= count || count > MAX_MINT_BATCH_SIZE) revert ExceedsPresaleBatchSize(); if (msg.value != phaseOnePricePerNft * count) revert InvalidPresalePayment(); (uint32 presalePhase1Purchases, uint32 otherPhase) = _unpack32(_getAux(msg.sender)); uint256 newBalance = presalePhase1Purchases + count; _setAux(msg.sender, _pack32(uint16(newBalance), otherPhase)); _proofMintTokensPhaseOne(msg.sender, proof, newBalance, count, selectedNature); } /** * @notice Presale tokens Phase 2 - purchase bound by terms & conditions of project. * * @param proof merkle proof for presale. * @param count the number of tokens to mint. * @param selectedNature the nature of the token you would like to mint. */ function presalePhaseTwoTokens( bytes32[] calldata proof, uint256 count, uint256 selectedNature ) external payable nonReentrant isPhaseTwo { if (0 >= count || count > MAX_MINT_BATCH_SIZE) revert ExceedsPresaleBatchSize(); if (msg.value != phaseTwoPricePerNft * count) revert InvalidPresalePayment(); (uint32 otherPhase, uint32 presalePhase2Purchases) = _unpack32(_getAux(msg.sender)); uint256 newBalance = presalePhase2Purchases + count; _setAux(msg.sender, _pack32(otherPhase, uint16(newBalance))); _proofMintTokensPhaseTwo(msg.sender, proof, newBalance, count, selectedNature); } /** * @notice Mint tokens - purchase bound by terms & conditions of project. * IMPORTANT: All tokens minted will have the same nature selection. * * @param count the number of tokens to mint. * @param selectedNature the nature of the token you would like to mint. */ function mintTokens(uint256 count, uint256 selectedNature) external payable nonReentrant isPublicMinting { if (0 >= count || count > MAX_MINT_BATCH_SIZE) revert ExceedsPublicMintBatchSize(); if (msg.value != publicMintPricePerNft * count) revert InvalidPublicMintPayment(); _internalMintTokens(msg.sender, _totalMinted(), count, selectedNature); } /** * @notice Same as mintTokens(), but with a to: for fiat purchasing. * * @param count the number of tokens to mint. * @param selectedNature the nature of the token you would like to mint. * @param to address where the new token should be sent. */ function mintTokensTo( uint256 count, uint256 selectedNature, address to ) external payable nonReentrant isPublicMinting { if (0 >= count || count > MAX_MINT_BATCH_SIZE) revert ExceedsPublicMintBatchSize(); if (msg.value != publicMintPricePerNft * count) revert InvalidPublicMintPayment(); if (msg.sender != _remoteMinter && _remoteMinter != 0x0000000000000000000000000000000000000000) revert InvalidRemoteMinter(); _internalMintTokens(to, _totalMinted(), count, selectedNature); } /** * @notice Mint function that will mint a single set of tokens, 1 per nature. * * @param sets the number of sets to mint */ function mintSet(uint256 sets) external payable nonReentrant isPublicMinting { if (0 >= sets || sets > 5) revert ExceedsPublicMintBatchSize(); if (msg.value != publicMintPricePerNft * (4 * sets)) revert InvalidPublicMintPayment(); _internalMintSet(msg.sender, _totalMinted(), sets); } /** * @notice Bind a Token to a User URI Fragment. * * This method will convert the token from being a "blank" token with a default * piece of artwork to a token with a generative artwork. * * The initial call to bind a token will have gas refunded according to a committed * amount by the project. * * @param tokenId the token to bind * @param userUri the URI fragment for the token * @param threefaceSignature an approved signature for the request */ function bindToUser( uint256 tokenId, string calldata userUri, bytes calldata threefaceSignature ) external { _bindToUser(tokenId, userUri, threefaceSignature); } function _baseURI() internal view virtual override returns (string memory) { return baseURI; } function _tokenFilename(uint256 tokenId) internal pure virtual returns (string memory) { // Special: Append the slash, so it looks like '/0' return string(abi.encodePacked('/', tokenId.toString())); } function _internalMintSet( address minter, uint256 totalMinted, uint256 sets ) internal returns (uint256) { _internalMintTokens(minter, totalMinted, sets, NATURE_BASE_VAL); totalMinted += sets; _internalMintTokens(minter, totalMinted, sets, NATURE_BASE_VAL + 1); totalMinted += sets; _internalMintTokens(minter, totalMinted, sets, NATURE_BASE_VAL + 2); totalMinted += sets; _internalMintTokens(minter, totalMinted, sets, NATURE_BASE_VAL + 3); totalMinted += sets; return totalMinted; } function _internalMintTokens( address minter, uint256 totalMinted, uint256 count, uint256 selectedNature ) internal { if (totalMinted + count > MAX_NFTS_FOR_SALE) revert ExceedsMaxSupply(); if (selectedNature < NATURE_BASE_VAL + NATURE_MIN || selectedNature > NATURE_BASE_VAL + NATURE_MAX) revert InvalidSelectedNature(); uint24 selectedNatureAs24 = uint24(selectedNature); uint256 nextToken = _nextTokenId(); _safeMint(minter, count); _setNature(nextToken, selectedNatureAs24); if (count > 1) { // Even though this code has to do quite a few duplicate lookups to get the ownerships initialized // the gas efficiency is still quite good. It's only about 5% cheaper to modify ERC721a to directly // set extra data. for (uint256 nextTokenIdx = nextToken + 1; nextTokenIdx < nextToken + count; nextTokenIdx++) { _initializeOwnershipAt(nextTokenIdx); _setNature(nextTokenIdx, selectedNatureAs24); } } } function _proofMintTokensPhaseOne( address minter, bytes32[] calldata proof, uint256 newBalance, uint256 count, uint256 selectedNature ) internal { uint256 totalMinted = _totalMinted(); if (totalMinted + count > MAX_NFTS_FOR_PRESALE_1) revert ExceedsPresaleSupply(); // Verify proof matches expected target total number of claim mints. if (!_phaseOneRoot._checkLeaf(proof, _generateIndexedLeaf(minter, newBalance - 1))) { //Zero-based index. revert ProofInvalidPresale(); } _internalMintTokens(minter, totalMinted, count, selectedNature); } function _proofMintTokensPhaseTwo( address minter, bytes32[] calldata proof, uint256 newBalance, uint256 count, uint256 selectedNature ) internal { // Verify address is eligible for presale mints. if (!_phaseTwoRoot._checkLeaf(proof, _generateIndexedLeaf(minter, newBalance - 1))) { //Zero-based index. revert ProofInvalidPresale(); } _internalMintTokens(minter, _totalMinted(), count, selectedNature); } function _setNatureFragments(uint256[] memory __natureIds, string[] memory __natureUris) internal { require(__natureIds.length == __natureUris.length, 'Unmatched arrays'); for (uint256 idx = 0; idx < __natureIds.length; idx++) { _natureUriFragments[__natureIds[idx]] = __natureUris[idx]; } } function _bindToUser( uint256 tokenId, string calldata userUri, bytes calldata threefaceSignature ) internal canBind { require(_exists(tokenId), 'No token'); require(msg.sender == _ownershipOf(tokenId).addr, 'Not owner'); TokenBindingData memory currentData = _tokenBindingMap[tokenId]; uint256 generation = currentData.generation + 1; // Verify the new binding. _verifyThreefaceBinding(msg.sender, tokenId, generation, userUri, threefaceSignature); // Bind the token to a new fragment. bool initialBinding = _setBindToUser(tokenId, currentData, userUri); if (initialBinding && _isRefundingEnabled()) { payable(msg.sender).transfer(bindingRefundAmount); emit TokenBindingRefunded(tokenId); } } function _setBindToUser( uint256 __tokenId, TokenBindingData memory currentData, string calldata __userUri ) internal returns (bool) { bool initialBinding = false; if (currentData.isBoundToUser == 0) { currentData.tokenId = uint64(__tokenId); currentData.isBoundToUser = 1; initialBinding = true; } else { // Emit the previous URI fragment to the event log. emit ReleaseURIFragment(__tokenId, currentData.generation, _userUriFragments[__tokenId]); } currentData.generation++; _userUriFragments[__tokenId] = __userUri; // Now write it back to the map. _tokenBindingMap[__tokenId] = currentData; return initialBinding; } function _setNature(uint256 tokenId, uint24 selectedNature) internal { if (selectedNature < NATURE_BASE_VAL + NATURE_MIN || selectedNature > NATURE_BASE_VAL + NATURE_MAX) revert InvalidSelectedNature(); _setExtraDataAt(tokenId, selectedNature); } function _extraData( address from, address to, uint24 previousExtraData ) internal pure override returns (uint24) { // Just return the existing extra data, which is the selected Nature for the token. It doesn't matter who minted it, once // its set, its set. return previousExtraData; } function _getNature(uint256 tokenId) internal view returns (uint256) { uint24 extraData = uint24(_ownershipAt(tokenId).extraData); return uint256(extraData); } function _isBoundToUser(uint256 tokenId) internal view returns (bool) { return _tokenBindingMap[tokenId].isBoundToUser == 1; } function _compareStrings(string memory a, string memory b) internal pure returns (bool) { return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b)); } function _verifyThreefaceBinding( address sender, uint256 tokenId, uint256 generation, string calldata userUriFragment, bytes calldata threefaceSignature ) internal view returns (bool) { bytes32 dataHash = keccak256(abi.encodePacked(sender, tokenId, generation, userUriFragment)); return _verify(dataHash, threefaceSignature, _threefaceSigner); } function _isBindingAllowed() internal view returns (bool) { return _bindingControlFlags.getBoolean(BINDING_ALLOWED); } function _isRefundingEnabled() internal view returns (bool) { return _bindingControlFlags.getBoolean(REFUNDING_ENABLED); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.11; contract THREEFACESplits { address[] internal addresses = [ 0x73565C1a7CC4A3AB19bf136aC9a1CAee60dD922c, 0x41Fb9227c703086B2d908E177A692EdCD3d7DE2C ]; uint256[] internal splits = [75, 25]; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** * @title GuardedAgainstContracts * @author @NiftyMike, NFT Culture * @dev Helper contract to help protect against contract based mint spamming attacks. */ abstract contract GuardedAgainstContracts { modifier onlyUsers() { require(tx.origin == msg.sender, 'Must be user'); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "./SlimPaymentSplitter.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /** * @title LockedPaymentSplitter * @author @NiftyMike, NFT Culture * @dev A wrapper around SlimPaymentSplitter which adds on security elements. * * Based on OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol) */ abstract contract LockedPaymentSplitter is SlimPaymentSplitter, Ownable { /** * @dev Overrides release() method, so that it can only be called by owner. * @notice Owner: Release funds to a specific address. * * @param account Payable address that will receive funds. */ function release(address payable account) public override onlyOwner { super.release(account); } /** * @dev Triggers a transfer to caller's address of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. * @notice Sender: request payment. */ function releaseToSelf() public { super.release(payable(msg.sender)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** * @title AuxHelper32 * @author @NiftyMike | NFT Culture * @dev Helper class for ERC721a Aux storage, using 32 bit ints. */ abstract contract AuxHelper32 { function _pack32(uint32 left32, uint32 right32) internal pure returns (uint64) { return (uint64(left32) << 32) | uint32(right32); } function _unpack32(uint64 aux) internal pure returns (uint32 left32, uint32 right32) { return (uint32(aux >> 32), uint32(aux)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** * @title AuxHelperFourInto256 * @author @KC, NFT Culture * @dev Helper class for ERC721a Aux-style storage. This flavor packs 4 64bit fields into a 256 bit int. */ abstract contract AuxHelperFourInto256 { function _pack64(uint64 left64, uint64 leftCenter64, uint64 rightCenter64, uint64 right64) internal pure returns (uint256) { return (uint256(left64) << 192) | (uint256(leftCenter64) << 128) | (uint256(rightCenter64) << 64) | uint64(right64); } function _unpack64(uint256 aux) internal pure returns (uint64 left64, uint64 leftCenter64, uint64 rightCenter64, uint64 right64) { return (uint64(aux >> 192), uint64(aux >> 128), uint64(aux >> 64), uint64(aux)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; error InvalidSignature(); /** * @title DigiSigHelper * @author @NiftyMike | @NFTCulture * @dev Helper class for handling ECDSA signatures with OpenZepplin library. */ abstract contract DigiSigHelper { using ECDSA for bytes32; function _verify( bytes32 dataHash, bytes memory signature, address expectedSigner ) internal pure returns (bool) { address signatureSigner = dataHash.toEthSignedMessageHash().recover(signature); if (signatureSigner != expectedSigner) revert InvalidSignature(); return true; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; // OZ Libraries import '@openzeppelin/contracts/access/Ownable.sol'; import './PhasedMintBase.sol'; /** * @title PhasedMintThree * @author @NiftyMike, NFT Culture * @dev PhasedMint: An approach to a standard system of controlling mint phases. * * This is the "Three" phase mint flavor of the PhasedMint approach. * * Note: Since the last phase is always assumed to be the public mint phase, we only * need to define the first and second phases here. */ contract PhasedMintThree is Ownable, PhasedMintBase { using BooleanPacking for uint256; uint256 private constant PHASE_ONE = 1; uint256 private constant PHASE_TWO = 2; uint256 public phaseOnePricePerNft; uint256 public phaseTwoPricePerNft; modifier isPhaseOne() { require(_mintControlFlags.getBoolean(PHASE_ONE), 'Phase one stopped'); _; } modifier isPhaseTwo() { require(_mintControlFlags.getBoolean(PHASE_TWO), 'Phase two stopped'); _; } constructor( uint256 __phaseOnePricePerNft, uint256 __phaseTwoPricePerNft, uint256 __publicMintPricePerNft ) PhasedMintBase(3, __publicMintPricePerNft) { phaseOnePricePerNft = __phaseOnePricePerNft; phaseTwoPricePerNft = __phaseTwoPricePerNft; } function setMintingState( bool __phaseOneActive, bool __phaseTwoActive, bool __publicMintingActive, uint256 __phaseOnePricePerNft, uint256 __phaseTwoPricePerNft, uint256 __publicMintPricePerNft ) external onlyOwner { uint256 tempControlFlags = _setMintingState(__publicMintingActive, __publicMintPricePerNft); tempControlFlags = tempControlFlags.setBoolean(PHASE_ONE, __phaseOneActive); tempControlFlags = tempControlFlags.setBoolean(PHASE_TWO, __phaseTwoActive); _mintControlFlags = tempControlFlags; if (__phaseOnePricePerNft > 0) { phaseOnePricePerNft = __phaseOnePricePerNft; } if (__phaseTwoPricePerNft > 0) { phaseTwoPricePerNft = __phaseTwoPricePerNft; } } function isPhaseOneActive() external view returns (bool) { return _isPhaseOneActive(); } function _isPhaseOneActive() internal view returns (bool) { return _mintControlFlags.getBoolean(PHASE_ONE); } function isPhaseTwoActive() external view returns (bool) { return _isPhaseTwoActive(); } function _isPhaseTwoActive() internal view returns (bool) { return _mintControlFlags.getBoolean(PHASE_TWO); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** * @title MerkleLeaves * @author @NiftyMike, NFT Culture * @dev Merkle Leaves for Merkle Trees - This is a companion contract to NFTC Labs' MerkleClaimList.sol library. * It provides leaf generation functions for both indexed and non-indexed merkle trees. * It also provides wrapper methods to expose the leaf generation functions to off-chain callers. * * Off-chain access is useful, because both the contract and the caller need to be able to generate the * leaves in a perfectly identical manner, so the generators are exposed to make it easier. */ abstract contract MerkleLeaves { /** * @notice External: generate a leaf for a wallet. * * @param wallet Address to hash. */ function getLeafFor(address wallet) external pure returns (bytes32) { return _generateLeaf(wallet); } /** * @notice External: generate a leaf for a wallet and an embedded index value. * * @param wallet Address to hash. * @param index integer index to assign the leaf. */ function getIndexedLeafFor(address wallet, uint256 index) external pure returns (bytes32) { return _generateIndexedLeaf(wallet, index); } /** * @dev Generate a merkle leaf based only on a wallet address. This is useful when all users * represented in the tree are eligible for the exact same thing, such as one free mint. * * A tiered system can be supported by this approach, by making seperate merkle trees and * mint functions per tier, but that approach will become ungainly if you have to support more * than a few tiers. */ function _generateLeaf(address wallet) internal pure returns (bytes32) { return keccak256(abi.encodePacked(wallet)); } /** * @dev Generate a merkle leaf based on a wallet address and an index. This is useful when all * users represented in the tree are eligible for different amounts of something. */ function _generateIndexedLeaf(address wallet, uint256 index) internal pure returns (bytes32) { return keccak256(abi.encodePacked(wallet, "_", index)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import {MerkleRoot} from './MerkleRoot.sol'; /** * @title MerkleClaimList * @author @NiftyMike, NFT Culture * @dev Basic functionality for a MerkleTree that will be used as a "Claimlist" * * "Claimlist" - an approach for validating callers that is backed by a Merkle Tree. * Cheap to set the master claim, not that expensive to check the claim. Requires * off-chain generation of the Merkle Tree. * * This library allows you to declare a member variable like: * MerkleClaimList.Root private _claimRoot; * * The benefit of packaging this as a library, is that if you need multiple merkle trees in your * contract, you can declare multiple member variables using this library, and use them in similar fashion. * * see also: NFTC Labs' MerkleLeaves.sol, which is a companion abstract contract which contains helper * methods for generating leaves for the Merkle Tree. */ library MerkleClaimList { using MerkleRoot for bytes32; struct Root { // This variable should never be directly accessed by users of the library. See OZ comments in other libraries for more info. bytes32 _root; } /** * @dev Validate that a leaf is part of this merkle tree. */ function _checkLeaf( Root storage root, bytes32[] calldata proof, bytes32 leaf ) internal view returns (bool) { return root._root.check(proof, leaf); } /** * @dev Set the root of this merkle tree. */ function _setRoot(Root storage root, bytes32 __root) internal { root._root = __root; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721ABurnable.sol'; import '../ERC721A.sol'; /** * @title ERC721ABurnable. * * @dev ERC721A token that can be irreversibly burned (destroyed). */ abstract contract ERC721ABurnable is ERC721A, IERC721ABurnable { /** * @dev Burns `tokenId`. See {ERC721A-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual override { _burn(tokenId, true); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; /** * @title SlimPaymentSplitter * @author @NiftyMike, NFT Culture * @dev A drop-in slim replacement version of OZ's Payment Splitter. All ERC-20 token functionality removed. * * Based on OpenZeppelin Contracts v4.4.1 (finance/PaymentSplitter.sol) */ contract SlimPaymentSplitter is Context { event PayeeAdded(address account, uint256 shares); event PaymentReleased(address to, uint256 amount); event PaymentReceived(address from, uint256 amount); event PayeeTransferred(address oldOwner, address newOwner); uint256 private _totalShares; uint256 private _totalReleased; mapping(address => uint256) private _shares; mapping(address => uint256) private _released; address[] private _payees; /** * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at * the matching position in the `shares` array. * * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no * duplicates in `payees`. */ constructor(address[] memory payees, uint256[] memory shares_) payable { require( payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch" ); require(payees.length > 0, "PaymentSplitter: no payees"); for (uint256 i = 0; i < payees.length; i++) { _addPayee(payees[i], shares_[i]); } } /** * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the * reliability of the events, and not the actual splitting of Ether. * * To learn more about this see the Solidity documentation for * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback * functions]. */ receive() external payable virtual { emit PaymentReceived(_msgSender(), msg.value); } /** * @dev Getter for the total shares held by payees. */ function totalShares() public view returns (uint256) { return _totalShares; } /** * @dev Getter for the total amount of Ether already released. */ function totalReleased() public view returns (uint256) { return _totalReleased; } /** * @dev Getter for the amount of shares held by an account. */ function shares(address account) public view returns (uint256) { return _shares[account]; } /** * @dev Getter for the amount of Ether already released to a payee. */ function released(address account) public view returns (uint256) { return _released[account]; } /** * @dev Getter for the address of the payee number `index`. */ function payee(uint256 index) public view returns (address) { return _payees[index]; } /** * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the * total shares and their previous withdrawals. */ function release(address payable account) public virtual { require(_shares[account] > 0, "PaymentSplitter: account has no shares"); uint256 totalReceived = address(this).balance + totalReleased(); uint256 payment = _pendingPayment( account, totalReceived, released(account) ); require(payment != 0, "PaymentSplitter: account is not due payment"); _released[account] += payment; _totalReleased += payment; Address.sendValue(account, payment); emit PaymentReleased(account, payment); } /** * @dev internal logic for computing the pending payment of an `account` given the token historical balances and * already released amounts. */ function _pendingPayment( address account, uint256 totalReceived, uint256 alreadyReleased ) private view returns (uint256) { return (totalReceived * _shares[account]) / _totalShares - alreadyReleased; } /** * @dev Add a new payee to the contract. * @param account The address of the payee to add. * @param shares_ The number of shares owned by the payee. */ function _addPayee(address account, uint256 shares_) private { require( account != address(0), "PaymentSplitter: account is the zero address" ); require(shares_ > 0, "PaymentSplitter: shares are 0"); require( _shares[account] == 0, "PaymentSplitter: account already has shares" ); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, shares_); } /** * @dev Allows owner to transfer their shares to somebody else; it can only be called by of a share. * @notice Owner: Release funds to a specific address. * * @param newOwner Payable address which has no shares and will receive the shares of the current owner. */ function transferPayee(address payable newOwner) public { require(newOwner != address(0), "PaymentSplitter: New payee is the zero address."); require(_shares[msg.sender] > 0, "PaymentSplitter: You have no shares."); require( _shares[newOwner] == 0, // why not _shares[newOwner] ?? "PaymentSplitter: New payee already has shares." ); _transferPayee(newOwner); emit PayeeTransferred(msg.sender, newOwner); } function _transferPayee(address newOwner) private { if (_payees.length == 0) return; for (uint i = 0; i < _payees.length - 1; i++) { if (_payees[i] == msg.sender) { _payees[i] = newOwner; _shares[newOwner] = _shares[msg.sender]; _shares[msg.sender] = 0; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; // NFTC Open Source Libraries See: https://github.com/NFTCulture/nftc-open-contracts import {BooleanPacking} from '@nftculture/nftc-open-contracts/contracts/utility/BooleanPacking.sol'; // OZ Libraries import '@openzeppelin/contracts/access/Ownable.sol'; /** * @title PhasedMintBase * @author @NiftyMike, NFT Culture * @dev PhasedMint: An approach to a standard system of controlling mint phases. */ abstract contract PhasedMintBase is Ownable { using BooleanPacking for uint256; // BooleanPacking used on _mintControlFlags uint256 internal _mintControlFlags; uint256 private immutable PUBLIC_MINT_PHASE; uint256 public publicMintPricePerNft; modifier isPublicMinting() { require(_mintControlFlags.getBoolean(PUBLIC_MINT_PHASE), 'Minting stopped'); _; } constructor(uint256 publicMintPhase, uint256 __publicMintPricePerNft) { PUBLIC_MINT_PHASE = publicMintPhase; publicMintPricePerNft = __publicMintPricePerNft; } function _setMintingState(bool __publicMintingActive, uint256 __publicMintPricePerNft) internal returns (uint256) { uint256 tempControlFlags; tempControlFlags = tempControlFlags.setBoolean(PUBLIC_MINT_PHASE, __publicMintingActive); if (__publicMintPricePerNft > 0) { publicMintPricePerNft = __publicMintPricePerNft; } return tempControlFlags; } function isPublicMintingActive() external view returns (bool) { return _isPublicMintingActive(); } function _isPublicMintingActive() internal view returns (bool) { return _mintControlFlags.getBoolean(PUBLIC_MINT_PHASE); } function supportedPhases() external view returns (uint256) { return PUBLIC_MINT_PHASE; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; /** * @title BooleanPacking * @author @NiftyMike, NFT Culture * @dev Credit to Zimri Leijen * See https://ethereum.stackexchange.com/a/92235 */ library BooleanPacking { function getBoolean(uint256 _packedBools, uint256 _columnNumber) internal pure returns (bool) { uint256 flag = (_packedBools >> _columnNumber) & uint256(1); return (flag == 1 ? true : false); } function setBoolean( uint256 _packedBools, uint256 _columnNumber, bool _value ) internal pure returns (uint256) { if (_value) { _packedBools = _packedBools | (uint256(1) << _columnNumber); return _packedBools; } else { _packedBools = _packedBools & ~(uint256(1) << _columnNumber); return _packedBools; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import {MerkleProof} from '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol'; /** * @title MerkleRoot * @author @NiftyMike, NFT Culture * @dev Companion library to OpenZeppelin's MerkleProof. * Allows you to abstract away merkle functionality a bit further, you now just need to * worry about dealing with your merkle root. * * Using this library allows you to treat bytes32 member variables as Merkle Roots, with a * slightly easier to use api then the OZ library. */ library MerkleRoot { using MerkleProof for bytes32[]; function check( bytes32 root, bytes32[] calldata proof, bytes32 leaf ) internal pure returns (bool) { return proof.verify(root, leaf); } }
// 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 MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { 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 // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721ABurnable. */ interface IERC721ABurnable is IERC721A { /** * @dev Burns `tokenId`. See {ERC721A-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) external; }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { 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 ERC721A is IERC721A { // Reference type for token approval. struct TokenApprovalRef { address value; } // ============================================================= // 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; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _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) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _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 _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 _currentIndex - _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 _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _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 _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_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 (_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(_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 = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _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 _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _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(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _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 < _currentIndex) { uint256 packed = _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 = _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(); } _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 _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(); _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 _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 < _currentIndex && // If within bounds, _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) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`. 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); // 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. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _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 (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @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 {} /** * @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 {} /** * @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__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(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 = _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`. _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`. _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. 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(); _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 = _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`. _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`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _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 = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_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;`. _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`. _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 (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _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 { _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 = _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); _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 aliged. // 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 // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * 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); // ============================================================= // 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) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` 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); // ============================================================= // 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 // ERC721A Contracts v4.2.2 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"BindingNotAllowed","type":"error"},{"inputs":[],"name":"ExceedsMaxSupply","type":"error"},{"inputs":[],"name":"ExceedsPresaleBatchSize","type":"error"},{"inputs":[],"name":"ExceedsPresaleSupply","type":"error"},{"inputs":[],"name":"ExceedsPublicMintBatchSize","type":"error"},{"inputs":[],"name":"ExceedsReserveBatchSize","type":"error"},{"inputs":[],"name":"InvalidPresalePayment","type":"error"},{"inputs":[],"name":"InvalidPublicMintPayment","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"InvalidRemoteMinter","type":"error"},{"inputs":[],"name":"InvalidSelectedNature","type":"error"},{"inputs":[],"name":"InvalidSignature","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":"ProofInvalidPresale","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":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"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"PayeeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"PayeeTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"generation","type":"uint256"},{"indexed":false,"internalType":"string","name":"previousUriFragment","type":"string"}],"name":"ReleaseURIFragment","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenBindingRefunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"NATURE_BASE_VAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATURE_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATURE_MIN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"auxMintValues","outputs":[{"internalType":"uint32","name":"presalePhaseOnePurchases","type":"uint32"},{"internalType":"uint32","name":"presalePhaseTwoPurchases","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"userUri","type":"string"},{"internalType":"bytes","name":"threefaceSignature","type":"bytes"}],"name":"bindToUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bindingRefundAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"checkProofPhaseOne","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"checkProofPhaseTwo","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"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":"getBindingInfo","outputs":[{"components":[{"internalType":"uint64","name":"tokenId","type":"uint64"},{"internalType":"uint64","name":"generation","type":"uint64"},{"internalType":"uint64","name":"isBoundToUser","type":"uint64"},{"internalType":"uint64","name":"reserved","type":"uint64"}],"internalType":"struct THREEFACEBase.TokenBindingData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getBindingInfo_CurrentFragment","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getBindingInfo_Generation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getBindingInfo_IsBoundToUser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"uriFragment","type":"string"}],"name":"getBindingInfo_Status","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getIndexedLeafFor","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"getLeafFor","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getNature","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"getNextProofIndexPhaseOne","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"getNextProofIndexPhaseTwo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"getPresalePhaseOneTokensPurchased","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"getPresalePhaseTwoTokensPurchased","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isBindingAllowed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOpenEdition","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"isPhaseOneActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPhaseTwoActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPublicMintingActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRefundingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPresaleOne","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"sets","type":"uint256"}],"name":"mintSet","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"count","type":"uint256"},{"internalType":"uint256","name":"selectedNature","type":"uint256"}],"name":"mintTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"count","type":"uint256"},{"internalType":"uint256","name":"selectedNature","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"mintTokensTo","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phaseOneBatchSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"phaseOnePricePerNft","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"phaseTwoBatchSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"phaseTwoPricePerNft","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"count","type":"uint256"},{"internalType":"uint256","name":"selectedNature","type":"uint256"}],"name":"presalePhaseOneTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"},{"internalType":"uint256","name":"count","type":"uint256"},{"internalType":"uint256","name":"selectedNature","type":"uint256"}],"name":"presalePhaseTwoTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicMintBatchSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"publicMintPricePerNft","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"releaseToSelf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"friends","type":"address[]"},{"internalType":"uint256","name":"sets","type":"uint256"}],"name":"reserveSets","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"friends","type":"address[]"},{"internalType":"uint256","name":"count","type":"uint256"},{"internalType":"uint256","name":"selectedNature","type":"uint256"}],"name":"reserveTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"selectedNature","type":"uint256"}],"name":"restoreToBlank","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"boundGenerationOverride","type":"uint256"},{"internalType":"string","name":"userUri","type":"string"},{"internalType":"bool","name":"flush","type":"bool"}],"name":"restoreUserFragment","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"__baseUri","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"__bindingAllowed","type":"bool"},{"internalType":"bool","name":"__refundingEnabled","type":"bool"},{"internalType":"uint256","name":"__bindingRefundAmount","type":"uint256"}],"name":"setBindingState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"__phaseOneRoot","type":"bytes32"},{"internalType":"bytes32","name":"__phaseTwoRoot","type":"bytes32"}],"name":"setMerkleRoots","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"__phaseOneActive","type":"bool"},{"internalType":"bool","name":"__phaseTwoActive","type":"bool"},{"internalType":"bool","name":"__publicMintingActive","type":"bool"},{"internalType":"uint256","name":"__phaseOnePricePerNft","type":"uint256"},{"internalType":"uint256","name":"__phaseTwoPricePerNft","type":"uint256"},{"internalType":"uint256","name":"__publicMintPricePerNft","type":"uint256"}],"name":"setMintingState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"__natureIds","type":"uint256[]"},{"internalType":"string[]","name":"__natureUris","type":"string[]"}],"name":"setNatureFragments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__newMinter","type":"address"}],"name":"setRemoteMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"__newSigner","type":"address"}],"name":"setThreefaceSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"supportedPhases","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":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"newOwner","type":"address"}],"name":"transferPayee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60e06040527373565c1a7cc4a3ab19bf136ac9a1caee60dd922c60a09081527341fb9227c703086b2d908e177a692edcd3d7de2c60c05262000046906000906002620008af565b5060408051808201909152604b8152601960208201526200006c90600190600262000919565b503480156200007a57600080fd5b506040518060400160405280600981526020016854485245454641434560b81b81525060405180604001604052806005815260200164334641434560d81b815250604051806060016040528060228152602001620062fe6022913960008054806020026020016040519081016040528092919081815260200182805480156200012d57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116200010e575b505050505060018054806020026020016040519081016040528092919081815260200182805480156200018057602002820191906000526020600020905b8154815260200190600101908083116200016b575b50505050506702c68af0bb14000067016345785d8a00006706f05b59d3b20000660aa87bee5380008383836003818a8a8f8f8160049080519060200190620001ca9291906200095c565b508051620001e09060059060208401906200095c565b506000600255505080518251146200025a5760405162461bcd60e51b815260206004820152603260248201527f5061796d656e7453706c69747465723a2070617965657320616e6420736861726044820152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b60648201526084015b60405180910390fd5b6000825111620002ad5760405162461bcd60e51b815260206004820152601a60248201527f5061796d656e7453706c69747465723a206e6f20706179656573000000000000604482015260640162000251565b60005b8251811015620003195762000304838281518110620002d357620002d3620009f0565b6020026020010151838381518110620002f057620002f0620009f0565b60200260200101516200059c60201b60201c565b80620003108162000a1c565b915050620002b0565b50505062000336620003306200078a60201b60201c565b6200078e565b6001601055608091909152601255506013919091556014558651620003639060179060208a01906200095c565b50601d80546001600160a01b03199081163317909155601e805490911673dab1a1854214684ace522439684a145e62505233179055601655506000965060049550620003b0945050505050565b604051908082528060200260200182016040528015620003da578160200160208202803683370190505b509050606481600081518110620003f557620003f5620009f0565b602002602001018181525050606581600181518110620004195762000419620009f0565b6020026020010181815250506066816002815181106200043d576200043d620009f0565b602002602001018181525050606781600381518110620004615762000461620009f0565b602090810291909101015260408051600480825260a08201909252600091816020015b6060815260200190600190039081620004845790505090506040518060600160405280602e8152602001620062d0602e913981600081518110620004cc57620004cc620009f0565b60200260200101819052506040518060600160405280602e815260200162006274602e913981600181518110620005075762000507620009f0565b60200260200101819052506040518060600160405280602e815260200162006246602e913981600281518110620005425762000542620009f0565b60200260200101819052506040518060600160405280602e8152602001620062a2602e9139816003815181106200057d576200057d620009f0565b6020908102919091010152620005948282620007e0565b505062000a92565b6001600160a01b038216620006095760405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b606482015260840162000251565b600081116200065b5760405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a20736861726573206172652030000000604482015260640162000251565b6001600160a01b0382166000908152600c602052604090205415620006d75760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b606482015260840162000251565b600e8054600181019091557fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd0180546001600160a01b0319166001600160a01b0384169081179091556000908152600c60205260409020819055600a546200074190829062000a3a565b600a55604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac910160405180910390a15050565b3390565b600f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8051825114620008265760405162461bcd60e51b815260206004820152601060248201526f556e6d6174636865642061727261797360801b604482015260640162000251565b60005b8251811015620008aa57818181518110620008485762000848620009f0565b6020026020010151601a6000858481518110620008695762000869620009f0565b602002602001015181526020019081526020016000209080519060200190620008949291906200095c565b5080620008a18162000a1c565b91505062000829565b505050565b82805482825590600052602060002090810192821562000907579160200282015b828111156200090757825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620008d0565b5062000915929150620009d9565b5090565b82805482825590600052602060002090810192821562000907579160200282015b8281111562000907578251829060ff169055916020019190600101906200093a565b8280546200096a9062000a55565b90600052602060002090601f0160209004810192826200098e576000855562000907565b82601f10620009a957805160ff191683800117855562000907565b8280016001018555821562000907579182015b8281111562000907578251825591602001919060010190620009bc565b5b80821115620009155760008155600101620009da565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141562000a335762000a3362000a06565b5060010190565b6000821982111562000a505762000a5062000a06565b500190565b600181811c9082168062000a6a57607f821691505b6020821081141562000a8c57634e487b7160e01b600052602260045260246000fd5b50919050565b60805161577562000ad160003960008181610f990152818161185001528181611e4701528181612b26015281816137120152613b4701526157756000f3fe6080604052600436106105985760003560e01c80638462151c116102e0578063c4f5758411610184578063e27c429c116100e1578063e985e9c511610095578063f48f800e1161006f578063f48f800e14611083578063fce2d35614611096578063fdb8e8a2146107fe57600080fd5b8063e985e9c514610fdd578063ec0cd2da14611026578063f2fde38b1461106357600080fd5b8063e8338882116100c6578063e833888214610f47578063e8ad246f14610f8a578063e8d4c20e14610fbd57600080fd5b8063e27c429c14610f12578063e33b7de314610f3257600080fd5b8063d1d130ae11610138578063db828e5d1161011d578063db828e5d14610ed2578063e1a2fe7614610ee7578063e228c6fe14610efd57600080fd5b8063d1d130ae14610eaa578063d5abeb0114610ebd57600080fd5b8063ca2d83f511610169578063ca2d83f514610e34578063ce7c2ac214610e54578063cfb00c6d14610e8a57600080fd5b8063c4f5758414610dff578063c87b56dd14610e1457600080fd5b806399a2557a1161023d578063a22cb465116101f1578063b7438d66116101cb578063b7438d6614610d9c578063b88d4fde14610db2578063c23dc68f14610dd257600080fd5b8063a22cb46514610d47578063a43a030814610d67578063a5e8516a14610d8757600080fd5b80639e04c452116102225780639e04c45214610d08578063a0e2406214610d1e578063a19835c514610d3457600080fd5b806399a2557a14610cc85780639a48eb5114610ce857600080fd5b806395d89b411161029457806396863230116102795780639686323014610c5d5780639794242114610c725780639852595c14610c9257600080fd5b806395d89b4114610c33578063961d128414610c4857600080fd5b80638b83209b116102c55780638b83209b14610be05780638da5cb5b14610c005780639392e30b14610c1e57600080fd5b80638462151c14610b7257806388b9516214610b9f57600080fd5b806342842e0e116104475780635bbb2177116103a45780636c0360eb116103585780637721f401116103325780637721f40114610b2a57806378a84d9314610b3f5780637c4712c414610b5257600080fd5b80636c0360eb14610ae057806370a0823114610af5578063715018a614610b1557600080fd5b806363ea0b361161038957806363ea0b3614610a98578063661c3c7f14610aad57806366e590e414610ac057600080fd5b80635bbb217714610a4b5780636352211e14610a7857600080fd5b80634f558e79116103fb57806355f804b3116103e057806355f804b314610a0b578063590a095e14610a2b5780635b18692b146107fe57600080fd5b80634f558e79146109cb57806354b8087e146109eb57600080fd5b806343a2b5761161042c57806343a2b5761461097657806348f271191461098b5780634d73f5f7146109ab57600080fd5b806342842e0e1461093657806342966c681461095657600080fd5b806320f22351116104f557806335841e50116104a95780633a98ef391161048e5780633a98ef39146108e15780633f0eaf67146108f657806340a4c9b61461091657600080fd5b806335841e50146108ad578063371ba7e2146108c157600080fd5b806323b872dd116104da57806323b872dd1461084557806333f587061461086557806334a7c2e71461089a57600080fd5b806320f223511461081257806321f2f8021461083257600080fd5b8063163480091161054c578063191655871161053157806319165587146107be5780631cf964a9146107de5780631df6051e146107fe57600080fd5b8063163480091461077b57806318160ddd1461079b57600080fd5b8063081812fc1161057d578063081812fc1461063d578063095ea7b3146106755780630ec37c3c1461069757600080fd5b806301ffc9a7146105e657806306fdde031461061b57600080fd5b366105e1577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156105f257600080fd5b50610606610601366004614909565b6110b6565b60405190151581526020015b60405180910390f35b34801561062757600080fd5b50610630611153565b604051610612919061497e565b34801561064957600080fd5b5061065d610658366004614991565b6111e5565b6040516001600160a01b039091168152602001610612565b34801561068157600080fd5b506106956106903660046149bf565b611242565b005b3480156106a357600080fd5b506107376106b2366004614991565b604080516080810182526000808252602082018190529181018290526060810191909152506000908152601c60209081526040918290208251608081018452905467ffffffffffffffff8082168352680100000000000000008204811693830193909352600160801b8104831693820193909352600160c01b90920416606082015290565b6040516106129190815167ffffffffffffffff9081168252602080840151821690830152604080840151821690830152606092830151169181019190915260800190565b34801561078757600080fd5b506106956107963660046149eb565b6112fb565b3480156107a757600080fd5b50600354600254035b604051908152602001610612565b3480156107ca57600080fd5b506106956107d93660046149eb565b6114d6565b3480156107ea57600080fd5b506107b06107f93660046149eb565b6114ea565b34801561080a57600080fd5b50600a6107b0565b34801561081e57600080fd5b5061069561082d366004614a4a565b61152e565b610695610840366004614ba3565b611542565b34801561085157600080fd5b50610695610860366004614be8565b6115cc565b34801561087157600080fd5b506108856108803660046149eb565b6117bf565b60405163ffffffff9091168152602001610612565b6106956108a8366004614c29565b6117ef565b3480156108b957600080fd5b506000610606565b3480156108cd57600080fd5b506106956108dc3660046149eb565b611927565b3480156108ed57600080fd5b50600a546107b0565b34801561090257600080fd5b506107b0610911366004614991565b611951565b34801561092257600080fd5b506107b06109313660046149eb565b61195c565b34801561094257600080fd5b50610695610951366004614be8565b611992565b34801561096257600080fd5b50610695610971366004614991565b6119b2565b34801561098257600080fd5b506106066119bd565b34801561099757600080fd5b506106306109a6366004614991565b6119cc565b3480156109b757600080fd5b506106956109c6366004614c60565b611a6e565b3480156109d757600080fd5b506106066109e6366004614991565b611aa8565b3480156109f757600080fd5b50610885610a063660046149eb565b611ab3565b348015610a1757600080fd5b50610695610a26366004614d14565b611ae3565b348015610a3757600080fd5b50610695610a46366004614dc9565b611b02565b348015610a5757600080fd5b50610a6b610a66366004614ec7565b611b14565b6040516106129190614f09565b348015610a8457600080fd5b5061065d610a93366004614991565b611be0565b348015610aa457600080fd5b506107b0600081565b610695610abb366004614f86565b611beb565b348015610acc57600080fd5b50610695610adb366004614fd4565b611c7a565b348015610aec57600080fd5b50610630611cd2565b348015610b0157600080fd5b506107b0610b103660046149eb565b611d60565b348015610b2157600080fd5b50610695611dc8565b348015610b3657600080fd5b50610606611ddc565b610695610b4d366004614991565b611de6565b348015610b5e57600080fd5b506107b0610b6d366004615033565b611f1e565b348015610b7e57600080fd5b50610b92610b8d3660046149eb565b611f9c565b604051610612919061507f565b348015610bab57600080fd5b50610606610bba366004614991565b6000908152601c6020526040902054600160801b900467ffffffffffffffff1660011490565b348015610bec57600080fd5b5061065d610bfb366004614991565b6120a4565b348015610c0c57600080fd5b50600f546001600160a01b031661065d565b348015610c2a57600080fd5b506107686107b0565b348015610c3f57600080fd5b506106306120d4565b348015610c5457600080fd5b506106066120e3565b348015610c6957600080fd5b506106066120ed565b348015610c7e57600080fd5b50610606610c8d3660046150b7565b6120f7565b348015610c9e57600080fd5b506107b0610cad3660046149eb565b6001600160a01b03166000908152600d602052604090205490565b348015610cd457600080fd5b50610b92610ce3366004615114565b612167565b348015610cf457600080fd5b50610695610d03366004614c29565b6122fc565b348015610d1457600080fd5b506107b060135481565b348015610d2a57600080fd5b506107b060125481565b610695610d42366004615149565b61230e565b348015610d5357600080fd5b50610695610d6236600461519a565b6124c8565b348015610d7357600080fd5b50610695610d823660046149eb565b612577565b348015610d9357600080fd5b506107b0600381565b348015610da857600080fd5b506107b060145481565b348015610dbe57600080fd5b50610695610dcd3660046151cf565b6125a1565b348015610dde57600080fd5b50610df2610ded366004614991565b6125e5565b604051610612919061524f565b348015610e0b57600080fd5b506107b0606481565b348015610e2057600080fd5b50610630610e2f366004614991565b61265d565b348015610e4057600080fd5b50610606610e4f3660046150b7565b612799565b348015610e6057600080fd5b506107b0610e6f3660046149eb565b6001600160a01b03166000908152600c602052604090205490565b348015610e9657600080fd5b506107b0610ea53660046149bf565b612800565b610695610eb8366004615149565b612852565b348015610ec957600080fd5b506110006107b0565b348015610ede57600080fd5b506106066129bf565b348015610ef357600080fd5b506107b060165481565b348015610f0957600080fd5b506106956129c9565b348015610f1e57600080fd5b506107b0610f2d3660046149eb565b6129d2565b348015610f3e57600080fd5b50600b546107b0565b348015610f5357600080fd5b506107b0610f62366004614991565b6000908152601c602052604090205468010000000000000000900467ffffffffffffffff1690565b348015610f9657600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006107b0565b348015610fc957600080fd5b50610695610fd8366004614c29565b6129dd565b348015610fe957600080fd5b50610606610ff8366004615294565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205460ff1690565b34801561103257600080fd5b506110466110413660046149eb565b612a07565b6040805163ffffffff938416815292909116602083015201610612565b34801561106f57600080fd5b5061069561107e3660046149eb565b612a38565b6106956110913660046152cd565b612ac5565b3480156110a257600080fd5b506106956110b1366004615306565b612c5a565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316148061111957507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061114d57507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6060600480546111629061536e565b80601f016020809104026020016040519081016040528092919081815260200182805461118e9061536e565b80156111db5780601f106111b0576101008083540402835291602001916111db565b820191906000526020600020905b8154815290600101906020018083116111be57829003601f168201915b5050505050905090565b60006111f082612d3d565b611226576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600860205260409020546001600160a01b031690565b600061124d82611be0565b9050336001600160a01b0382161461129f576112698133610ff8565b61129f576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526008602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6001600160a01b03811661137c5760405162461bcd60e51b815260206004820152602f60248201527f5061796d656e7453706c69747465723a204e657720706179656520697320746860448201527f65207a65726f20616464726573732e000000000000000000000000000000000060648201526084015b60405180910390fd5b336000908152600c60205260409020546113fd5760405162461bcd60e51b8152602060048201526024808201527f5061796d656e7453706c69747465723a20596f752068617665206e6f2073686160448201527f7265732e000000000000000000000000000000000000000000000000000000006064820152608401611373565b6001600160a01b0381166000908152600c6020526040902054156114895760405162461bcd60e51b815260206004820152602e60248201527f5061796d656e7453706c69747465723a204e657720706179656520616c72656160448201527f647920686173207368617265732e0000000000000000000000000000000000006064820152608401611373565b61149281612d65565b604080513381526001600160a01b03831660208201527f6829b4029cd073199f80f49556d32953c9bc4e14d395388e678d2cc4604d4819910160405180910390a150565b6114de612e2f565b6114e781612e89565b50565b600080611520611512846001600160a01b031660009081526007602052604090205460c01c90565b63ffffffff602082901c1691565b5063ffffffff169392505050565b61153b8585858585613063565b5050505050565b61154a612e2f565b8015806115575750602081115b15611575576040516302c4a14f60e21b815260040160405180910390fd5b600061158060025490565b905060005b83518110156115c6576115b28482815181106115a3576115a36153a9565b6020026020010151838561325f565b9150806115be816153d5565b915050611585565b50505050565b60006115d7826132d7565b9050836001600160a01b0316816001600160a01b031614611624576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260086020526040902080546116508187335b6001600160a01b039081169116811491141790565b61167b5761165e8633610ff8565b61167b57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166116bb576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80156116c657600082555b6001600160a01b038681166000908152600760205260408082208054600019019055918716808252919020805460010190554260a01b7fffffff000000000000000000000000000000000000000000000000000000000085161717600160e11b17600085815260066020526040902055600160e11b831661177557600184016000818152600660205260409020546117735760025481146117735760008181526006602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6000806117e7611512846001600160a01b031660009081526007602052604090205460c01c90565b949350505050565b600260105414156118425760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611373565b6002601055601154611874907f0000000000000000000000000000000000000000000000000000000000000000613351565b6118b25760405162461bcd60e51b815260206004820152600f60248201526e135a5b9d1a5b99c81cdd1bdc1c1959608a1b6044820152606401611373565b8115806118bf5750600a82115b156118dd5760405163c2d95d8760e01b815260040160405180910390fd5b816012546118eb91906153f0565b341461190a57604051632756c96160e21b815260040160405180910390fd5b61191e3361191760025490565b8484613372565b50506001601055565b61192f612e2f565b601d80546001600160a01b0319166001600160a01b0392909216919091179055565b600061114d82613469565b600080611984611512846001600160a01b031660009081526007602052604090205460c01c90565b63ffffffff16949350505050565b6119ad838383604051806020016040528060008152506125a1565b505050565b6114e7816001613485565b60006119c7613606565b905090565b6000818152601b602052604090208054606091906119e99061536e565b80601f0160208091040260200160405190810160405280929190818152602001828054611a159061536e565b8015611a625780601f10611a3757610100808354040283529160200191611a62565b820191906000526020600020905b815481529060010190602001808311611a4557829003601f168201915b50505050509050919050565b611a76612e2f565b601554611a8581600586613617565b9050611a9381600685613617565b6015819055905081156115c657506016555050565b600061114d82612d3d565b600080611adb611512846001600160a01b031660009081526007602052604090205460c01c90565b509392505050565b611aeb612e2f565b8051611afe9060179060208401906147e6565b5050565b611b0a612e2f565b611afe8282613640565b60608160008167ffffffffffffffff811115611b3257611b32614ac4565b604051908082528060200260200182016040528015611b8457816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181611b505790505b50905060005b828114611bd757611bb2868683818110611ba657611ba66153a9565b905060200201356125e5565b828281518110611bc457611bc46153a9565b6020908102919091010152600101611b8a565b50949350505050565b600061114d826132d7565b611bf3612e2f565b811580611c005750602082115b15611c1e576040516302c4a14f60e21b815260040160405180910390fd5b6000611c2960025490565b905060005b845181101561153b57611c5c858281518110611c4c57611c4c6153a9565b6020026020010151838686613372565b611c66848361540f565b915080611c72816153d5565b915050611c2e565b611c82612e2f565b6000611c8e8583613709565b9050611c9c81600189613617565b9050611caa81600288613617565b601181905590508315611cbd5760138490555b8215611cc95760148390555b50505050505050565b60178054611cdf9061536e565b80601f0160208091040260200160405190810160405280929190818152602001828054611d0b9061536e565b8015611d585780601f10611d2d57610100808354040283529160200191611d58565b820191906000526020600020905b815481529060010190602001808311611d3b57829003601f168201915b505050505081565b60006001600160a01b038216611da2576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526007602052604090205467ffffffffffffffff1690565b611dd0612e2f565b611dda600061374b565b565b60006119c761379d565b60026010541415611e395760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611373565b6002601055601154611e6b907f0000000000000000000000000000000000000000000000000000000000000000613351565b611ea95760405162461bcd60e51b815260206004820152600f60248201526e135a5b9d1a5b99c81cdd1bdc1c1959608a1b6044820152606401611373565b801580611eb65750600581115b15611ed45760405163c2d95d8760e01b815260040160405180910390fd5b611edf8160046153f0565b601254611eec91906153f0565b3414611f0b57604051632756c96160e21b815260040160405180910390fd5b61191e33611f1860025490565b8361325f565b6000808383604051602001611f34929190615427565b60408051601f1981840301815282825280516020918201206000898152601b8352929092209193508392611f699291016154a6565b604051602081830303815290604052805190602001201415611f8f576001915050611f95565b60009150505b9392505050565b60606000806000611fac85611d60565b905060008167ffffffffffffffff811115611fc957611fc9614ac4565b604051908082528060200260200182016040528015611ff2578160200160208202803683370190505b5060408051608081018252600080825260208201819052918101829052606081018290529192505b8386146120985761202a816137ae565b915081604001511561203b57612090565b81516001600160a01b03161561205057815194505b876001600160a01b0316856001600160a01b031614156120905780838780600101985081518110612083576120836153a9565b6020026020010181815250505b60010161201a565b50909695505050505050565b6000600e82815481106120b9576120b96153a9565b6000918252602090912001546001600160a01b031692915050565b6060600580546111629061536e565b60006119c761382d565b60006119c761383e565b600061215e858561215486866040516bffffffffffffffffffffffff19606084901b166020820152605f60f81b60348201526035810182905260009060550160405160208183030381529060405280519060200120905092915050565b601892919061384f565b95945050505050565b60608183106121a2576040517f32c1995a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806121ae60025490565b9050808411156121bc578093505b60006121c787611d60565b9050848610156121e657858503818110156121e0578091505b506121ea565b5060005b60008167ffffffffffffffff81111561220557612205614ac4565b60405190808252806020026020018201604052801561222e578160200160208202803683370190505b50905081612241579350611f9592505050565b600061224c886125e5565b90506000816040015161225d575080515b885b88811415801561226f5750848714155b156122eb5761227d816137ae565b925082604001511561228e576122e3565b82516001600160a01b0316156122a357825191505b8a6001600160a01b0316826001600160a01b031614156122e357808488806001019950815181106122d6576122d66153a9565b6020026020010181815250505b60010161225f565b505050928352509095945050505050565b612304612e2f565b611afe8282613860565b600260105414156123615760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611373565b6002601055601154612374906001613351565b6123c05760405162461bcd60e51b815260206004820152601160248201527f5068617365206f6e652073746f707065640000000000000000000000000000006044820152606401611373565b8115806123cd5750600a82115b156123eb5760405163d9e9e03f60e01b815260040160405180910390fd5b816013546123f991906153f0565b341461241857604051635a36be4d60e01b815260040160405180910390fd5b3360009081526007602052604081205481906124369060c01c611512565b9092509050600061244d8563ffffffff851661540f565b90506124ac3365ffff00000000602084901b1663ffffffff8516175b6001600160a01b039091166000908152600760205260409020805477ffffffffffffffffffffffffffffffffffffffffffffffff1660c09290921b919091179055565b6124ba338888848989613880565b505060016010555050505050565b6001600160a01b03821633141561250b576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360008181526009602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61257f612e2f565b601e80546001600160a01b0319166001600160a01b0392909216919091179055565b6125ac8484846115cc565b6001600160a01b0383163b156115c6576125c884848484613960565b6115c6576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060025483106126395792915050565b612642836137ae565b90508060400151156126545792915050565b611f9583613a45565b606061266882612d3d565b61269f5760405162461bcd60e51b81526020600482015260086024820152672737903a37b5b2b760c11b6044820152606401611373565b60006126a9613abd565b905060008151116126fc5760405162461bcd60e51b815260206004820152600a60248201527f4261736520756e736574000000000000000000000000000000000000000000006044820152606401611373565b600061270784613469565b6000858152601c6020526040902054909150600160801b900467ffffffffffffffff16600114612774576000818152601a60205260409020829061274a86613acc565b60405160200161275c939291906154b2565b60405160208183030381529060405292505050919050565b81601b600086815260200190815260200160002060405160200161275c9291906154ec565b600061215e85856127f686866040516bffffffffffffffffffffffff19606084901b166020820152605f60f81b60348201526035810182905260009060550160405160208183030381529060405280519060200120905092915050565b601992919061384f565b60408051606084901b6bffffffffffffffffffffffff1916602080830191909152605f60f81b603483015260358083018590528351808403909101815260559092019092528051910120600090611f95565b600260105414156128a55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611373565b600260108190556011546128b891613351565b6129045760405162461bcd60e51b815260206004820152601160248201527f50686173652074776f2073746f707065640000000000000000000000000000006044820152606401611373565b8115806129115750600a82115b1561292f5760405163d9e9e03f60e01b815260040160405180910390fd5b8160145461293d91906153f0565b341461295c57604051635a36be4d60e01b815260040160405180910390fd5b33600090815260076020526040812054819061297a9060c01c611512565b909250905060006129918563ffffffff841661540f565b90506129b13367ffffffff00000000602086901b1661ffff841617612469565b6124ba338888848989613afd565b60006119c7613b3b565b611dda33612e89565b600061114d82613b6b565b6129e5612e2f565b6000828152601c60205260408120556129fd82613bab565b611afe8282613bd9565b600080612a2f611512846001600160a01b031660009081526007602052604090205460c01c90565b91509150915091565b612a40612e2f565b6001600160a01b038116612abc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401611373565b6114e78161374b565b60026010541415612b185760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611373565b6002601055601154612b4a907f0000000000000000000000000000000000000000000000000000000000000000613351565b612b885760405162461bcd60e51b815260206004820152600f60248201526e135a5b9d1a5b99c81cdd1bdc1c1959608a1b6044820152606401611373565b821580612b955750600a83115b15612bb35760405163c2d95d8760e01b815260040160405180910390fd5b82601254612bc191906153f0565b3414612be057604051632756c96160e21b815260040160405180910390fd5b601e546001600160a01b03163314801590612c055750601e546001600160a01b031615155b15612c3c576040517fa3a7336e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c5081612c4960025490565b8585613372565b5050600160105550565b612c62612e2f565b8015612c78576000858152601c60205260408120555b6000858152601c60209081526040918290208251608081018452905467ffffffffffffffff8082168352680100000000000000008204811693830193909352600160801b8104831693820193909352600160c01b909204166060820152612ce29086908585613c2e565b50801561153b576000858152601c60205260409020805467ffffffffffffffff861668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff9091161790555050505050565b60006002548210801561114d575050600090815260066020526040902054600160e01b161590565b600e54612d6f5750565b60005b600e54612d819060019061550a565b811015611afe57336001600160a01b0316600e8281548110612da557612da56153a9565b6000918252602090912001546001600160a01b03161415612e1d5781600e8281548110612dd457612dd46153a9565b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905533808352600c90915260408083208054948716845290832093909355815290555b80612e27816153d5565b915050612d72565b600f546001600160a01b03163314611dda5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611373565b6001600160a01b0381166000908152600c6020526040902054612f145760405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201527f73686172657300000000000000000000000000000000000000000000000000006064820152608401611373565b6000612f1f600b5490565b612f29904761540f565b90506000612f568383612f51866001600160a01b03166000908152600d602052604090205490565b613da7565b905080612fcb5760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201527f647565207061796d656e740000000000000000000000000000000000000000006064820152608401611373565b6001600160a01b0383166000908152600d602052604081208054839290612ff390849061540f565b9250508190555080600b600082825461300c919061540f565b9091555061301c90508382613de5565b604080516001600160a01b0385168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a1505050565b601554613071906005613351565b6130a7576040517f0d7251e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6130b085612d3d565b6130e75760405162461bcd60e51b81526020600482015260086024820152672737903a37b5b2b760c11b6044820152606401611373565b6130f085613a45565b516001600160a01b031633146131485760405162461bcd60e51b815260206004820152600960248201527f4e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401611373565b6000858152601c602090815260408083208151608081018352905467ffffffffffffffff80821683526801000000000000000082048116948301859052600160801b8204811693830193909352600160c01b9004909116606082015291906131b1906001615521565b67ffffffffffffffff1690506131cc33888389898989613efe565b5060006131db88848989613c2e565b90508080156131ed57506131ed61382d565b1561325557601654604051339180156108fc02916000818181858888f19350505050158015613220573d6000803e3d6000fd5b506040518881527f41ea3f7d6e2fe3836ff4767bc7706d53a0afdde6d93b9e98ff79de9b8024e5a69060200160405180910390a15b5050505050505050565b600061326e8484846064613372565b613278828461540f565b925061329184848461328c6064600161540f565b613372565b61329b828461540f565b92506132af84848461328c6064600261540f565b6132b9828461540f565b92506132cd84848461328c6064600361540f565b6117e7828461540f565b60008160025481101561331f57600081815260066020526040902054600160e01b811661331d575b80611f955750600019016000818152600660205260409020546132ff565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600183831c81169081146133685760006117e7565b6001949350505050565b61100061337f838561540f565b11156133b7576040517fc30436e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6133c36000606461540f565b8110806133da57506133d76003606461540f565b81115b156133f857604051634c847c8760e11b815260040160405180910390fd5b80600061340460025490565b90506134108685613f8c565b61341a8183613bd9565b60018411156117b757600061343082600161540f565b90505b61343d858361540f565b811015611cc95761344d81613bab565b6134578184613bd9565b80613461816153d5565b915050613433565b600080613475836137ae565b6060015162ffffff169392505050565b6000613490836132d7565b9050806000806134ae86600090815260086020526040902080549091565b9150915084156134ee576134c381843361163b565b6134ee576134d18333610ff8565b6134ee57604051632ce44b5f60e11b815260040160405180910390fd5b80156134f957600082555b6001600160a01b038316600081815260076020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b7fffffff0000000000000000000000000000000000000000000000000000000000861617177c030000000000000000000000000000000000000000000000000000000017600087815260066020526040902055600160e11b84166135bd57600186016000818152600660205260409020546135bb5760025481146135bb5760008181526006602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505060038054600101905550505050565b6011546000906119c7906001613351565b6000811561362f57506001821b929092179182611f95565b506001821b19929092169182611f95565b80518251146136915760405162461bcd60e51b815260206004820152601060248201527f556e6d61746368656420617272617973000000000000000000000000000000006044820152606401611373565b60005b82518110156119ad578181815181106136af576136af6153a9565b6020026020010151601a60008584815181106136cd576136cd6153a9565b6020026020010151815260200190815260200160002090805190602001906136f69291906147e6565b5080613701816153d5565b915050613694565b600080613737817f000000000000000000000000000000000000000000000000000000000000000086613617565b90508215611f955760128390559392505050565b600f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6015546000906119c7906005613351565b60408051608081018252600080825260208201819052918101829052606081019190915260008281526006602052604090205461114d90604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b6015546000906119c7906006613351565b6011546000906119c7906002613351565b835460009061215e90858585613fa6565b8115613870576138706018839055565b8015611afe57611afe6019829055565b600061388b60025490565b905061076861389a848361540f565b11156138d2576040517f7b771dc200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61393786866121548a6138e660018a61550a565b6040516bffffffffffffffffffffffff19606084901b166020820152605f60f81b60348201526035810182905260009060550160405160208183030381529060405280519060200120905092915050565b61395457604051630c7296bb60e11b815260040160405180910390fd5b611cc987828585613372565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061399590339089908890889060040161554d565b6020604051808303816000875af19250505080156139d0575060408051601f3d908101601f191682019092526139cd91810190615589565b60015b613a2b573d8080156139fe576040519150601f19603f3d011682016040523d82523d6000602084013e613a03565b606091505b508051613a23576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506117e7565b60408051608081018252600080825260208201819052918101829052606081019190915261114d613a75836132d7565b604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b6060601780546111629061536e565b6060613ad782613fea565b604051602001613ae791906155a6565b6040516020818303038152906040529050919050565b613b1185856127f6896138e660018961550a565b613b2e57604051630c7296bb60e11b815260040160405180910390fd5b6117b78661191760025490565b6011546000906119c7907f0000000000000000000000000000000000000000000000000000000000000000613351565b6040516bffffffffffffffffffffffff19606083901b1660208201526000906034015b604051602081830303815290604052805190602001209050919050565b6000818152600660205260409020546114e757613bc7816132d7565b60008281526006602052604090205550565b613be56000606461540f565b8162ffffff161080613c065750613bfe6003606461540f565b8162ffffff16115b15613c2457604051634c847c8760e11b815260040160405180910390fd5b611afe828261411c565b6040830151600090819067ffffffffffffffff16613c62575067ffffffffffffffff85168452600160408501819052613cb4565b7f59ebe37edcc33bfbd8c05f098812c0e2f24e3bb8b2687deb4ef467e5740fc47b868660200151601b60008a8152602001908152602001600020604051613cab939291906155eb565b60405180910390a15b60208501805190613cc482615689565b67ffffffffffffffff169052506000868152601b60205260409020613cea90858561486a565b506000868152601c602090815260409182902087518154928901519389015160608a015167ffffffffffffffff908116600160c01b0277ffffffffffffffffffffffffffffffffffffffffffffffff928216600160801b02929092166fffffffffffffffffffffffffffffffff96821668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000000000000000000090961691909316179390931793909316929092171790559050949350505050565b600a546001600160a01b0384166000908152600c602052604081205490918391613dd190866153f0565b613ddb91906156c7565b6117e7919061550a565b80471015613e355760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401611373565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613e82576040519150601f19603f3d011682016040523d82523d6000602084013e613e87565b606091505b50509050806119ad5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401611373565b6000808888888888604051602001613f1a9594939291906156db565b604051602081830303815290604052805190602001209050613f7f8185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050601d546001600160a01b0316915061419d9050565b9998505050505050505050565b611afe82826040518060200160405280600081525061420b565b600061215e85838686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506142719050565b60608161402a57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115614054578061403e816153d5565b915061404d9050600a836156c7565b915061402e565b60008167ffffffffffffffff81111561406f5761406f614ac4565b6040519080825280601f01601f191660200182016040528015614099576020820181803683370190505b5090505b84156117e7576140ae60018361550a565b91506140bb600a86615715565b6140c690603061540f565b60f81b8183815181106140db576140db6153a9565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350614115600a866156c7565b945061409d565b60008281526006602052604090205480614161576040517ed5815300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000928352600660205260409092207cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9290921660e89190911b179055565b6000806141b3846141ad87614287565b906142c2565b9050826001600160a01b0316816001600160a01b031614614200576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001949350505050565b61421583836142de565b6001600160a01b0383163b156119ad576002548281035b61423f6000868380600101945086613960565b61425c576040516368d2bf6b60e11b815260040160405180910390fd5b81811061422c57816002541461153b57600080fd5b60008261427e8584614408565b14949350505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01613b8e565b60008060006142d1858561444d565b91509150611adb816144bd565b60025481614318576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03831660008181526007602090815260408083208054680100000000000000018802019055848352600690915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b8181146143c757808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161438f565b50816143ff576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025550505050565b600081815b8451811015611adb576144398286838151811061442c5761442c6153a9565b6020026020010151614678565b915080614445816153d5565b91505061440d565b6000808251604114156144845760208301516040840151606085015160001a614478878285856146a7565b945094505050506144b6565b8251604014156144ae57602083015160408401516144a3868383614794565b9350935050506144b6565b506000905060025b9250929050565b60008160048111156144d1576144d1615729565b14156144da5750565b60018160048111156144ee576144ee615729565b141561453c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401611373565b600281600481111561455057614550615729565b141561459e5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401611373565b60038160048111156145b2576145b2615729565b141561460b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401611373565b600481600481111561461f5761461f615729565b14156114e75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401611373565b6000818310614694576000828152602084905260409020611f95565b6000838152602083905260409020611f95565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156146de575060009050600361478b565b8460ff16601b141580156146f657508460ff16601c14155b15614707575060009050600461478b565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561475b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166147845760006001925092505061478b565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816147ca60ff86901c601b61540f565b90506147d8878288856146a7565b935093505050935093915050565b8280546147f29061536e565b90600052602060002090601f016020900481019282614814576000855561485a565b82601f1061482d57805160ff191683800117855561485a565b8280016001018555821561485a579182015b8281111561485a57825182559160200191906001019061483f565b506148669291506148de565b5090565b8280546148769061536e565b90600052602060002090601f016020900481019282614898576000855561485a565b82601f106148b15782800160ff1982351617855561485a565b8280016001018555821561485a579182015b8281111561485a5782358255916020019190600101906148c3565b5b8082111561486657600081556001016148df565b6001600160e01b0319811681146114e757600080fd5b60006020828403121561491b57600080fd5b8135611f95816148f3565b60005b83811015614941578181015183820152602001614929565b838111156115c65750506000910152565b6000815180845261496a816020860160208601614926565b601f01601f19169290920160200192915050565b602081526000611f956020830184614952565b6000602082840312156149a357600080fd5b5035919050565b6001600160a01b03811681146114e757600080fd5b600080604083850312156149d257600080fd5b82356149dd816149aa565b946020939093013593505050565b6000602082840312156149fd57600080fd5b8135611f95816149aa565b60008083601f840112614a1a57600080fd5b50813567ffffffffffffffff811115614a3257600080fd5b6020830191508360208285010111156144b657600080fd5b600080600080600060608688031215614a6257600080fd5b85359450602086013567ffffffffffffffff80821115614a8157600080fd5b614a8d89838a01614a08565b90965094506040880135915080821115614aa657600080fd5b50614ab388828901614a08565b969995985093965092949392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715614b0357614b03614ac4565b604052919050565b600067ffffffffffffffff821115614b2557614b25614ac4565b5060051b60200190565b600082601f830112614b4057600080fd5b81356020614b55614b5083614b0b565b614ada565b82815260059290921b84018101918181019086841115614b7457600080fd5b8286015b84811015614b98578035614b8b816149aa565b8352918301918301614b78565b509695505050505050565b60008060408385031215614bb657600080fd5b823567ffffffffffffffff811115614bcd57600080fd5b614bd985828601614b2f565b95602094909401359450505050565b600080600060608486031215614bfd57600080fd5b8335614c08816149aa565b92506020840135614c18816149aa565b929592945050506040919091013590565b60008060408385031215614c3c57600080fd5b50508035926020909101359150565b80358015158114614c5b57600080fd5b919050565b600080600060608486031215614c7557600080fd5b614c7e84614c4b565b9250614c8c60208501614c4b565b9150604084013590509250925092565b600067ffffffffffffffff831115614cb657614cb6614ac4565b614cc9601f8401601f1916602001614ada565b9050828152838383011115614cdd57600080fd5b828260208301376000602084830101529392505050565b600082601f830112614d0557600080fd5b611f9583833560208501614c9c565b600060208284031215614d2657600080fd5b813567ffffffffffffffff811115614d3d57600080fd5b6117e784828501614cf4565b600082601f830112614d5a57600080fd5b81356020614d6a614b5083614b0b565b82815260059290921b84018101918181019086841115614d8957600080fd5b8286015b84811015614b9857803567ffffffffffffffff811115614dad5760008081fd5b614dbb8986838b0101614cf4565b845250918301918301614d8d565b60008060408385031215614ddc57600080fd5b823567ffffffffffffffff80821115614df457600080fd5b818501915085601f830112614e0857600080fd5b81356020614e18614b5083614b0b565b82815260059290921b84018101918181019089841115614e3757600080fd5b948201945b83861015614e5557853582529482019490820190614e3c565b96505086013592505080821115614e6b57600080fd5b50614e7885828601614d49565b9150509250929050565b60008083601f840112614e9457600080fd5b50813567ffffffffffffffff811115614eac57600080fd5b6020830191508360208260051b85010111156144b657600080fd5b60008060208385031215614eda57600080fd5b823567ffffffffffffffff811115614ef157600080fd5b614efd85828601614e82565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561209857614f738385516001600160a01b03815116825267ffffffffffffffff602082015116602083015260408101511515604083015262ffffff60608201511660608301525050565b9284019260809290920191600101614f25565b600080600060608486031215614f9b57600080fd5b833567ffffffffffffffff811115614fb257600080fd5b614fbe86828701614b2f565b9660208601359650604090950135949350505050565b60008060008060008060c08789031215614fed57600080fd5b614ff687614c4b565b955061500460208801614c4b565b945061501260408801614c4b565b9350606087013592506080870135915060a087013590509295509295509295565b60008060006040848603121561504857600080fd5b83359250602084013567ffffffffffffffff81111561506657600080fd5b61507286828701614a08565b9497909650939450505050565b6020808252825182820181905260009190848201906040850190845b818110156120985783518352928401929184019160010161509b565b600080600080606085870312156150cd57600080fd5b843567ffffffffffffffff8111156150e457600080fd5b6150f087828801614e82565b9095509350506020850135615104816149aa565b9396929550929360400135925050565b60008060006060848603121561512957600080fd5b8335615134816149aa565b95602085013595506040909401359392505050565b6000806000806060858703121561515f57600080fd5b843567ffffffffffffffff81111561517657600080fd5b61518287828801614e82565b90989097506020870135966040013595509350505050565b600080604083850312156151ad57600080fd5b82356151b8816149aa565b91506151c660208401614c4b565b90509250929050565b600080600080608085870312156151e557600080fd5b84356151f0816149aa565b93506020850135615200816149aa565b925060408501359150606085013567ffffffffffffffff81111561522357600080fd5b8501601f8101871361523457600080fd5b61524387823560208401614c9c565b91505092959194509250565b81516001600160a01b0316815260208083015167ffffffffffffffff169082015260408083015115159082015260608083015162ffffff16908201526080810161114d565b600080604083850312156152a757600080fd5b82356152b2816149aa565b915060208301356152c2816149aa565b809150509250929050565b6000806000606084860312156152e257600080fd5b833592506020840135915060408401356152fb816149aa565b809150509250925092565b60008060008060006080868803121561531e57600080fd5b8535945060208601359350604086013567ffffffffffffffff81111561534357600080fd5b61534f88828901614a08565b9094509250615362905060608701614c4b565b90509295509295909350565b600181811c9082168061538257607f821691505b602082108114156153a357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156153e9576153e96153bf565b5060010190565b600081600019048311821515161561540a5761540a6153bf565b500290565b60008219821115615422576154226153bf565b500190565b8183823760009101908152919050565b600081546154448161536e565b6001828116801561545c576001811461546d5761549c565b60ff1984168752828701945061549c565b8560005260208060002060005b858110156154935781548a82015290840190820161547a565b50505082870194505b5050505092915050565b6000611f958284615437565b600084516154c4818460208901614926565b6154d081840186615437565b905083516154e2818360208801614926565b0195945050505050565b600083516154fe818460208801614926565b61215e81840185615437565b60008282101561551c5761551c6153bf565b500390565b600067ffffffffffffffff808316818516808303821115615544576155446153bf565b01949350505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261557f6080830184614952565b9695505050505050565b60006020828403121561559b57600080fd5b8151611f95816148f3565b7f2f000000000000000000000000000000000000000000000000000000000000008152600082516155de816001850160208701614926565b9190910160010192915050565b8381526000602067ffffffffffffffff85168184015260606040840152600084546156158161536e565b8060608701526080600180841660008114615637576001811461564b57615679565b60ff1985168984015260a089019550615679565b896000528660002060005b858110156156715781548b8201860152908301908801615656565b8a0184019650505b50939a9950505050505050505050565b600067ffffffffffffffff808316818114156156a7576156a76153bf565b6001019392505050565b634e487b7160e01b600052601260045260246000fd5b6000826156d6576156d66156b1565b500490565b6bffffffffffffffffffffffff198660601b1681528460148201528360348201528183605483013760009101605401908152949350505050565b600082615724576157246156b1565b500690565b634e487b7160e01b600052602160045260246000fdfea264697066735822122091042f0fe0084b1e999013c018d555cd1a84ca7b2df373ff6e0d01c08f71b7c564736f6c634300080b0033516d544c704b684e6475475264444668415a514a4d3664503136535961626d69623459534e3474426f457542456f516d5438397a714d34537a43756f77364c615a585366733850584d4841453838464a4c324b6a5851676662446334516d556747634b6e4754595845686f4a7836706a544e51554468627a516d6f6a3156423966585067375479355239516d613879386e68554a4e796d4e6438623277373738636747466470734a576d366475373544537863353336424768747470733a2f2f33666163652e6d7970696e6174612e636c6f75642f697066732f
Deployed Bytecode
0x6080604052600436106105985760003560e01c80638462151c116102e0578063c4f5758411610184578063e27c429c116100e1578063e985e9c511610095578063f48f800e1161006f578063f48f800e14611083578063fce2d35614611096578063fdb8e8a2146107fe57600080fd5b8063e985e9c514610fdd578063ec0cd2da14611026578063f2fde38b1461106357600080fd5b8063e8338882116100c6578063e833888214610f47578063e8ad246f14610f8a578063e8d4c20e14610fbd57600080fd5b8063e27c429c14610f12578063e33b7de314610f3257600080fd5b8063d1d130ae11610138578063db828e5d1161011d578063db828e5d14610ed2578063e1a2fe7614610ee7578063e228c6fe14610efd57600080fd5b8063d1d130ae14610eaa578063d5abeb0114610ebd57600080fd5b8063ca2d83f511610169578063ca2d83f514610e34578063ce7c2ac214610e54578063cfb00c6d14610e8a57600080fd5b8063c4f5758414610dff578063c87b56dd14610e1457600080fd5b806399a2557a1161023d578063a22cb465116101f1578063b7438d66116101cb578063b7438d6614610d9c578063b88d4fde14610db2578063c23dc68f14610dd257600080fd5b8063a22cb46514610d47578063a43a030814610d67578063a5e8516a14610d8757600080fd5b80639e04c452116102225780639e04c45214610d08578063a0e2406214610d1e578063a19835c514610d3457600080fd5b806399a2557a14610cc85780639a48eb5114610ce857600080fd5b806395d89b411161029457806396863230116102795780639686323014610c5d5780639794242114610c725780639852595c14610c9257600080fd5b806395d89b4114610c33578063961d128414610c4857600080fd5b80638b83209b116102c55780638b83209b14610be05780638da5cb5b14610c005780639392e30b14610c1e57600080fd5b80638462151c14610b7257806388b9516214610b9f57600080fd5b806342842e0e116104475780635bbb2177116103a45780636c0360eb116103585780637721f401116103325780637721f40114610b2a57806378a84d9314610b3f5780637c4712c414610b5257600080fd5b80636c0360eb14610ae057806370a0823114610af5578063715018a614610b1557600080fd5b806363ea0b361161038957806363ea0b3614610a98578063661c3c7f14610aad57806366e590e414610ac057600080fd5b80635bbb217714610a4b5780636352211e14610a7857600080fd5b80634f558e79116103fb57806355f804b3116103e057806355f804b314610a0b578063590a095e14610a2b5780635b18692b146107fe57600080fd5b80634f558e79146109cb57806354b8087e146109eb57600080fd5b806343a2b5761161042c57806343a2b5761461097657806348f271191461098b5780634d73f5f7146109ab57600080fd5b806342842e0e1461093657806342966c681461095657600080fd5b806320f22351116104f557806335841e50116104a95780633a98ef391161048e5780633a98ef39146108e15780633f0eaf67146108f657806340a4c9b61461091657600080fd5b806335841e50146108ad578063371ba7e2146108c157600080fd5b806323b872dd116104da57806323b872dd1461084557806333f587061461086557806334a7c2e71461089a57600080fd5b806320f223511461081257806321f2f8021461083257600080fd5b8063163480091161054c578063191655871161053157806319165587146107be5780631cf964a9146107de5780631df6051e146107fe57600080fd5b8063163480091461077b57806318160ddd1461079b57600080fd5b8063081812fc1161057d578063081812fc1461063d578063095ea7b3146106755780630ec37c3c1461069757600080fd5b806301ffc9a7146105e657806306fdde031461061b57600080fd5b366105e1577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156105f257600080fd5b50610606610601366004614909565b6110b6565b60405190151581526020015b60405180910390f35b34801561062757600080fd5b50610630611153565b604051610612919061497e565b34801561064957600080fd5b5061065d610658366004614991565b6111e5565b6040516001600160a01b039091168152602001610612565b34801561068157600080fd5b506106956106903660046149bf565b611242565b005b3480156106a357600080fd5b506107376106b2366004614991565b604080516080810182526000808252602082018190529181018290526060810191909152506000908152601c60209081526040918290208251608081018452905467ffffffffffffffff8082168352680100000000000000008204811693830193909352600160801b8104831693820193909352600160c01b90920416606082015290565b6040516106129190815167ffffffffffffffff9081168252602080840151821690830152604080840151821690830152606092830151169181019190915260800190565b34801561078757600080fd5b506106956107963660046149eb565b6112fb565b3480156107a757600080fd5b50600354600254035b604051908152602001610612565b3480156107ca57600080fd5b506106956107d93660046149eb565b6114d6565b3480156107ea57600080fd5b506107b06107f93660046149eb565b6114ea565b34801561080a57600080fd5b50600a6107b0565b34801561081e57600080fd5b5061069561082d366004614a4a565b61152e565b610695610840366004614ba3565b611542565b34801561085157600080fd5b50610695610860366004614be8565b6115cc565b34801561087157600080fd5b506108856108803660046149eb565b6117bf565b60405163ffffffff9091168152602001610612565b6106956108a8366004614c29565b6117ef565b3480156108b957600080fd5b506000610606565b3480156108cd57600080fd5b506106956108dc3660046149eb565b611927565b3480156108ed57600080fd5b50600a546107b0565b34801561090257600080fd5b506107b0610911366004614991565b611951565b34801561092257600080fd5b506107b06109313660046149eb565b61195c565b34801561094257600080fd5b50610695610951366004614be8565b611992565b34801561096257600080fd5b50610695610971366004614991565b6119b2565b34801561098257600080fd5b506106066119bd565b34801561099757600080fd5b506106306109a6366004614991565b6119cc565b3480156109b757600080fd5b506106956109c6366004614c60565b611a6e565b3480156109d757600080fd5b506106066109e6366004614991565b611aa8565b3480156109f757600080fd5b50610885610a063660046149eb565b611ab3565b348015610a1757600080fd5b50610695610a26366004614d14565b611ae3565b348015610a3757600080fd5b50610695610a46366004614dc9565b611b02565b348015610a5757600080fd5b50610a6b610a66366004614ec7565b611b14565b6040516106129190614f09565b348015610a8457600080fd5b5061065d610a93366004614991565b611be0565b348015610aa457600080fd5b506107b0600081565b610695610abb366004614f86565b611beb565b348015610acc57600080fd5b50610695610adb366004614fd4565b611c7a565b348015610aec57600080fd5b50610630611cd2565b348015610b0157600080fd5b506107b0610b103660046149eb565b611d60565b348015610b2157600080fd5b50610695611dc8565b348015610b3657600080fd5b50610606611ddc565b610695610b4d366004614991565b611de6565b348015610b5e57600080fd5b506107b0610b6d366004615033565b611f1e565b348015610b7e57600080fd5b50610b92610b8d3660046149eb565b611f9c565b604051610612919061507f565b348015610bab57600080fd5b50610606610bba366004614991565b6000908152601c6020526040902054600160801b900467ffffffffffffffff1660011490565b348015610bec57600080fd5b5061065d610bfb366004614991565b6120a4565b348015610c0c57600080fd5b50600f546001600160a01b031661065d565b348015610c2a57600080fd5b506107686107b0565b348015610c3f57600080fd5b506106306120d4565b348015610c5457600080fd5b506106066120e3565b348015610c6957600080fd5b506106066120ed565b348015610c7e57600080fd5b50610606610c8d3660046150b7565b6120f7565b348015610c9e57600080fd5b506107b0610cad3660046149eb565b6001600160a01b03166000908152600d602052604090205490565b348015610cd457600080fd5b50610b92610ce3366004615114565b612167565b348015610cf457600080fd5b50610695610d03366004614c29565b6122fc565b348015610d1457600080fd5b506107b060135481565b348015610d2a57600080fd5b506107b060125481565b610695610d42366004615149565b61230e565b348015610d5357600080fd5b50610695610d6236600461519a565b6124c8565b348015610d7357600080fd5b50610695610d823660046149eb565b612577565b348015610d9357600080fd5b506107b0600381565b348015610da857600080fd5b506107b060145481565b348015610dbe57600080fd5b50610695610dcd3660046151cf565b6125a1565b348015610dde57600080fd5b50610df2610ded366004614991565b6125e5565b604051610612919061524f565b348015610e0b57600080fd5b506107b0606481565b348015610e2057600080fd5b50610630610e2f366004614991565b61265d565b348015610e4057600080fd5b50610606610e4f3660046150b7565b612799565b348015610e6057600080fd5b506107b0610e6f3660046149eb565b6001600160a01b03166000908152600c602052604090205490565b348015610e9657600080fd5b506107b0610ea53660046149bf565b612800565b610695610eb8366004615149565b612852565b348015610ec957600080fd5b506110006107b0565b348015610ede57600080fd5b506106066129bf565b348015610ef357600080fd5b506107b060165481565b348015610f0957600080fd5b506106956129c9565b348015610f1e57600080fd5b506107b0610f2d3660046149eb565b6129d2565b348015610f3e57600080fd5b50600b546107b0565b348015610f5357600080fd5b506107b0610f62366004614991565b6000908152601c602052604090205468010000000000000000900467ffffffffffffffff1690565b348015610f9657600080fd5b507f00000000000000000000000000000000000000000000000000000000000000036107b0565b348015610fc957600080fd5b50610695610fd8366004614c29565b6129dd565b348015610fe957600080fd5b50610606610ff8366004615294565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205460ff1690565b34801561103257600080fd5b506110466110413660046149eb565b612a07565b6040805163ffffffff938416815292909116602083015201610612565b34801561106f57600080fd5b5061069561107e3660046149eb565b612a38565b6106956110913660046152cd565b612ac5565b3480156110a257600080fd5b506106956110b1366004615306565b612c5a565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316148061111957507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b8061114d57507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6060600480546111629061536e565b80601f016020809104026020016040519081016040528092919081815260200182805461118e9061536e565b80156111db5780601f106111b0576101008083540402835291602001916111db565b820191906000526020600020905b8154815290600101906020018083116111be57829003601f168201915b5050505050905090565b60006111f082612d3d565b611226576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600860205260409020546001600160a01b031690565b600061124d82611be0565b9050336001600160a01b0382161461129f576112698133610ff8565b61129f576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526008602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6001600160a01b03811661137c5760405162461bcd60e51b815260206004820152602f60248201527f5061796d656e7453706c69747465723a204e657720706179656520697320746860448201527f65207a65726f20616464726573732e000000000000000000000000000000000060648201526084015b60405180910390fd5b336000908152600c60205260409020546113fd5760405162461bcd60e51b8152602060048201526024808201527f5061796d656e7453706c69747465723a20596f752068617665206e6f2073686160448201527f7265732e000000000000000000000000000000000000000000000000000000006064820152608401611373565b6001600160a01b0381166000908152600c6020526040902054156114895760405162461bcd60e51b815260206004820152602e60248201527f5061796d656e7453706c69747465723a204e657720706179656520616c72656160448201527f647920686173207368617265732e0000000000000000000000000000000000006064820152608401611373565b61149281612d65565b604080513381526001600160a01b03831660208201527f6829b4029cd073199f80f49556d32953c9bc4e14d395388e678d2cc4604d4819910160405180910390a150565b6114de612e2f565b6114e781612e89565b50565b600080611520611512846001600160a01b031660009081526007602052604090205460c01c90565b63ffffffff602082901c1691565b5063ffffffff169392505050565b61153b8585858585613063565b5050505050565b61154a612e2f565b8015806115575750602081115b15611575576040516302c4a14f60e21b815260040160405180910390fd5b600061158060025490565b905060005b83518110156115c6576115b28482815181106115a3576115a36153a9565b6020026020010151838561325f565b9150806115be816153d5565b915050611585565b50505050565b60006115d7826132d7565b9050836001600160a01b0316816001600160a01b031614611624576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260086020526040902080546116508187335b6001600160a01b039081169116811491141790565b61167b5761165e8633610ff8565b61167b57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166116bb576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80156116c657600082555b6001600160a01b038681166000908152600760205260408082208054600019019055918716808252919020805460010190554260a01b7fffffff000000000000000000000000000000000000000000000000000000000085161717600160e11b17600085815260066020526040902055600160e11b831661177557600184016000818152600660205260409020546117735760025481146117735760008181526006602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45b505050505050565b6000806117e7611512846001600160a01b031660009081526007602052604090205460c01c90565b949350505050565b600260105414156118425760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611373565b6002601055601154611874907f0000000000000000000000000000000000000000000000000000000000000003613351565b6118b25760405162461bcd60e51b815260206004820152600f60248201526e135a5b9d1a5b99c81cdd1bdc1c1959608a1b6044820152606401611373565b8115806118bf5750600a82115b156118dd5760405163c2d95d8760e01b815260040160405180910390fd5b816012546118eb91906153f0565b341461190a57604051632756c96160e21b815260040160405180910390fd5b61191e3361191760025490565b8484613372565b50506001601055565b61192f612e2f565b601d80546001600160a01b0319166001600160a01b0392909216919091179055565b600061114d82613469565b600080611984611512846001600160a01b031660009081526007602052604090205460c01c90565b63ffffffff16949350505050565b6119ad838383604051806020016040528060008152506125a1565b505050565b6114e7816001613485565b60006119c7613606565b905090565b6000818152601b602052604090208054606091906119e99061536e565b80601f0160208091040260200160405190810160405280929190818152602001828054611a159061536e565b8015611a625780601f10611a3757610100808354040283529160200191611a62565b820191906000526020600020905b815481529060010190602001808311611a4557829003601f168201915b50505050509050919050565b611a76612e2f565b601554611a8581600586613617565b9050611a9381600685613617565b6015819055905081156115c657506016555050565b600061114d82612d3d565b600080611adb611512846001600160a01b031660009081526007602052604090205460c01c90565b509392505050565b611aeb612e2f565b8051611afe9060179060208401906147e6565b5050565b611b0a612e2f565b611afe8282613640565b60608160008167ffffffffffffffff811115611b3257611b32614ac4565b604051908082528060200260200182016040528015611b8457816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181611b505790505b50905060005b828114611bd757611bb2868683818110611ba657611ba66153a9565b905060200201356125e5565b828281518110611bc457611bc46153a9565b6020908102919091010152600101611b8a565b50949350505050565b600061114d826132d7565b611bf3612e2f565b811580611c005750602082115b15611c1e576040516302c4a14f60e21b815260040160405180910390fd5b6000611c2960025490565b905060005b845181101561153b57611c5c858281518110611c4c57611c4c6153a9565b6020026020010151838686613372565b611c66848361540f565b915080611c72816153d5565b915050611c2e565b611c82612e2f565b6000611c8e8583613709565b9050611c9c81600189613617565b9050611caa81600288613617565b601181905590508315611cbd5760138490555b8215611cc95760148390555b50505050505050565b60178054611cdf9061536e565b80601f0160208091040260200160405190810160405280929190818152602001828054611d0b9061536e565b8015611d585780601f10611d2d57610100808354040283529160200191611d58565b820191906000526020600020905b815481529060010190602001808311611d3b57829003601f168201915b505050505081565b60006001600160a01b038216611da2576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526007602052604090205467ffffffffffffffff1690565b611dd0612e2f565b611dda600061374b565b565b60006119c761379d565b60026010541415611e395760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611373565b6002601055601154611e6b907f0000000000000000000000000000000000000000000000000000000000000003613351565b611ea95760405162461bcd60e51b815260206004820152600f60248201526e135a5b9d1a5b99c81cdd1bdc1c1959608a1b6044820152606401611373565b801580611eb65750600581115b15611ed45760405163c2d95d8760e01b815260040160405180910390fd5b611edf8160046153f0565b601254611eec91906153f0565b3414611f0b57604051632756c96160e21b815260040160405180910390fd5b61191e33611f1860025490565b8361325f565b6000808383604051602001611f34929190615427565b60408051601f1981840301815282825280516020918201206000898152601b8352929092209193508392611f699291016154a6565b604051602081830303815290604052805190602001201415611f8f576001915050611f95565b60009150505b9392505050565b60606000806000611fac85611d60565b905060008167ffffffffffffffff811115611fc957611fc9614ac4565b604051908082528060200260200182016040528015611ff2578160200160208202803683370190505b5060408051608081018252600080825260208201819052918101829052606081018290529192505b8386146120985761202a816137ae565b915081604001511561203b57612090565b81516001600160a01b03161561205057815194505b876001600160a01b0316856001600160a01b031614156120905780838780600101985081518110612083576120836153a9565b6020026020010181815250505b60010161201a565b50909695505050505050565b6000600e82815481106120b9576120b96153a9565b6000918252602090912001546001600160a01b031692915050565b6060600580546111629061536e565b60006119c761382d565b60006119c761383e565b600061215e858561215486866040516bffffffffffffffffffffffff19606084901b166020820152605f60f81b60348201526035810182905260009060550160405160208183030381529060405280519060200120905092915050565b601892919061384f565b95945050505050565b60608183106121a2576040517f32c1995a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806121ae60025490565b9050808411156121bc578093505b60006121c787611d60565b9050848610156121e657858503818110156121e0578091505b506121ea565b5060005b60008167ffffffffffffffff81111561220557612205614ac4565b60405190808252806020026020018201604052801561222e578160200160208202803683370190505b50905081612241579350611f9592505050565b600061224c886125e5565b90506000816040015161225d575080515b885b88811415801561226f5750848714155b156122eb5761227d816137ae565b925082604001511561228e576122e3565b82516001600160a01b0316156122a357825191505b8a6001600160a01b0316826001600160a01b031614156122e357808488806001019950815181106122d6576122d66153a9565b6020026020010181815250505b60010161225f565b505050928352509095945050505050565b612304612e2f565b611afe8282613860565b600260105414156123615760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611373565b6002601055601154612374906001613351565b6123c05760405162461bcd60e51b815260206004820152601160248201527f5068617365206f6e652073746f707065640000000000000000000000000000006044820152606401611373565b8115806123cd5750600a82115b156123eb5760405163d9e9e03f60e01b815260040160405180910390fd5b816013546123f991906153f0565b341461241857604051635a36be4d60e01b815260040160405180910390fd5b3360009081526007602052604081205481906124369060c01c611512565b9092509050600061244d8563ffffffff851661540f565b90506124ac3365ffff00000000602084901b1663ffffffff8516175b6001600160a01b039091166000908152600760205260409020805477ffffffffffffffffffffffffffffffffffffffffffffffff1660c09290921b919091179055565b6124ba338888848989613880565b505060016010555050505050565b6001600160a01b03821633141561250b576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360008181526009602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61257f612e2f565b601e80546001600160a01b0319166001600160a01b0392909216919091179055565b6125ac8484846115cc565b6001600160a01b0383163b156115c6576125c884848484613960565b6115c6576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060025483106126395792915050565b612642836137ae565b90508060400151156126545792915050565b611f9583613a45565b606061266882612d3d565b61269f5760405162461bcd60e51b81526020600482015260086024820152672737903a37b5b2b760c11b6044820152606401611373565b60006126a9613abd565b905060008151116126fc5760405162461bcd60e51b815260206004820152600a60248201527f4261736520756e736574000000000000000000000000000000000000000000006044820152606401611373565b600061270784613469565b6000858152601c6020526040902054909150600160801b900467ffffffffffffffff16600114612774576000818152601a60205260409020829061274a86613acc565b60405160200161275c939291906154b2565b60405160208183030381529060405292505050919050565b81601b600086815260200190815260200160002060405160200161275c9291906154ec565b600061215e85856127f686866040516bffffffffffffffffffffffff19606084901b166020820152605f60f81b60348201526035810182905260009060550160405160208183030381529060405280519060200120905092915050565b601992919061384f565b60408051606084901b6bffffffffffffffffffffffff1916602080830191909152605f60f81b603483015260358083018590528351808403909101815260559092019092528051910120600090611f95565b600260105414156128a55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611373565b600260108190556011546128b891613351565b6129045760405162461bcd60e51b815260206004820152601160248201527f50686173652074776f2073746f707065640000000000000000000000000000006044820152606401611373565b8115806129115750600a82115b1561292f5760405163d9e9e03f60e01b815260040160405180910390fd5b8160145461293d91906153f0565b341461295c57604051635a36be4d60e01b815260040160405180910390fd5b33600090815260076020526040812054819061297a9060c01c611512565b909250905060006129918563ffffffff841661540f565b90506129b13367ffffffff00000000602086901b1661ffff841617612469565b6124ba338888848989613afd565b60006119c7613b3b565b611dda33612e89565b600061114d82613b6b565b6129e5612e2f565b6000828152601c60205260408120556129fd82613bab565b611afe8282613bd9565b600080612a2f611512846001600160a01b031660009081526007602052604090205460c01c90565b91509150915091565b612a40612e2f565b6001600160a01b038116612abc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401611373565b6114e78161374b565b60026010541415612b185760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611373565b6002601055601154612b4a907f0000000000000000000000000000000000000000000000000000000000000003613351565b612b885760405162461bcd60e51b815260206004820152600f60248201526e135a5b9d1a5b99c81cdd1bdc1c1959608a1b6044820152606401611373565b821580612b955750600a83115b15612bb35760405163c2d95d8760e01b815260040160405180910390fd5b82601254612bc191906153f0565b3414612be057604051632756c96160e21b815260040160405180910390fd5b601e546001600160a01b03163314801590612c055750601e546001600160a01b031615155b15612c3c576040517fa3a7336e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612c5081612c4960025490565b8585613372565b5050600160105550565b612c62612e2f565b8015612c78576000858152601c60205260408120555b6000858152601c60209081526040918290208251608081018452905467ffffffffffffffff8082168352680100000000000000008204811693830193909352600160801b8104831693820193909352600160c01b909204166060820152612ce29086908585613c2e565b50801561153b576000858152601c60205260409020805467ffffffffffffffff861668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff9091161790555050505050565b60006002548210801561114d575050600090815260066020526040902054600160e01b161590565b600e54612d6f5750565b60005b600e54612d819060019061550a565b811015611afe57336001600160a01b0316600e8281548110612da557612da56153a9565b6000918252602090912001546001600160a01b03161415612e1d5781600e8281548110612dd457612dd46153a9565b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905533808352600c90915260408083208054948716845290832093909355815290555b80612e27816153d5565b915050612d72565b600f546001600160a01b03163314611dda5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611373565b6001600160a01b0381166000908152600c6020526040902054612f145760405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201527f73686172657300000000000000000000000000000000000000000000000000006064820152608401611373565b6000612f1f600b5490565b612f29904761540f565b90506000612f568383612f51866001600160a01b03166000908152600d602052604090205490565b613da7565b905080612fcb5760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201527f647565207061796d656e740000000000000000000000000000000000000000006064820152608401611373565b6001600160a01b0383166000908152600d602052604081208054839290612ff390849061540f565b9250508190555080600b600082825461300c919061540f565b9091555061301c90508382613de5565b604080516001600160a01b0385168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a1505050565b601554613071906005613351565b6130a7576040517f0d7251e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6130b085612d3d565b6130e75760405162461bcd60e51b81526020600482015260086024820152672737903a37b5b2b760c11b6044820152606401611373565b6130f085613a45565b516001600160a01b031633146131485760405162461bcd60e51b815260206004820152600960248201527f4e6f74206f776e657200000000000000000000000000000000000000000000006044820152606401611373565b6000858152601c602090815260408083208151608081018352905467ffffffffffffffff80821683526801000000000000000082048116948301859052600160801b8204811693830193909352600160c01b9004909116606082015291906131b1906001615521565b67ffffffffffffffff1690506131cc33888389898989613efe565b5060006131db88848989613c2e565b90508080156131ed57506131ed61382d565b1561325557601654604051339180156108fc02916000818181858888f19350505050158015613220573d6000803e3d6000fd5b506040518881527f41ea3f7d6e2fe3836ff4767bc7706d53a0afdde6d93b9e98ff79de9b8024e5a69060200160405180910390a15b5050505050505050565b600061326e8484846064613372565b613278828461540f565b925061329184848461328c6064600161540f565b613372565b61329b828461540f565b92506132af84848461328c6064600261540f565b6132b9828461540f565b92506132cd84848461328c6064600361540f565b6117e7828461540f565b60008160025481101561331f57600081815260066020526040902054600160e01b811661331d575b80611f955750600019016000818152600660205260409020546132ff565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000600183831c81169081146133685760006117e7565b6001949350505050565b61100061337f838561540f565b11156133b7576040517fc30436e900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6133c36000606461540f565b8110806133da57506133d76003606461540f565b81115b156133f857604051634c847c8760e11b815260040160405180910390fd5b80600061340460025490565b90506134108685613f8c565b61341a8183613bd9565b60018411156117b757600061343082600161540f565b90505b61343d858361540f565b811015611cc95761344d81613bab565b6134578184613bd9565b80613461816153d5565b915050613433565b600080613475836137ae565b6060015162ffffff169392505050565b6000613490836132d7565b9050806000806134ae86600090815260086020526040902080549091565b9150915084156134ee576134c381843361163b565b6134ee576134d18333610ff8565b6134ee57604051632ce44b5f60e11b815260040160405180910390fd5b80156134f957600082555b6001600160a01b038316600081815260076020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b7fffffff0000000000000000000000000000000000000000000000000000000000861617177c030000000000000000000000000000000000000000000000000000000017600087815260066020526040902055600160e11b84166135bd57600186016000818152600660205260409020546135bb5760025481146135bb5760008181526006602052604090208590555b505b60405186906000906001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505060038054600101905550505050565b6011546000906119c7906001613351565b6000811561362f57506001821b929092179182611f95565b506001821b19929092169182611f95565b80518251146136915760405162461bcd60e51b815260206004820152601060248201527f556e6d61746368656420617272617973000000000000000000000000000000006044820152606401611373565b60005b82518110156119ad578181815181106136af576136af6153a9565b6020026020010151601a60008584815181106136cd576136cd6153a9565b6020026020010151815260200190815260200160002090805190602001906136f69291906147e6565b5080613701816153d5565b915050613694565b600080613737817f000000000000000000000000000000000000000000000000000000000000000386613617565b90508215611f955760128390559392505050565b600f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6015546000906119c7906005613351565b60408051608081018252600080825260208201819052918101829052606081019190915260008281526006602052604090205461114d90604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b6015546000906119c7906006613351565b6011546000906119c7906002613351565b835460009061215e90858585613fa6565b8115613870576138706018839055565b8015611afe57611afe6019829055565b600061388b60025490565b905061076861389a848361540f565b11156138d2576040517f7b771dc200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61393786866121548a6138e660018a61550a565b6040516bffffffffffffffffffffffff19606084901b166020820152605f60f81b60348201526035810182905260009060550160405160208183030381529060405280519060200120905092915050565b61395457604051630c7296bb60e11b815260040160405180910390fd5b611cc987828585613372565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a029061399590339089908890889060040161554d565b6020604051808303816000875af19250505080156139d0575060408051601f3d908101601f191682019092526139cd91810190615589565b60015b613a2b573d8080156139fe576040519150601f19603f3d011682016040523d82523d6000602084013e613a03565b606091505b508051613a23576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506117e7565b60408051608081018252600080825260208201819052918101829052606081019190915261114d613a75836132d7565b604080516080810182526001600160a01b038316815260a083901c67ffffffffffffffff166020820152600160e01b831615159181019190915260e89190911c606082015290565b6060601780546111629061536e565b6060613ad782613fea565b604051602001613ae791906155a6565b6040516020818303038152906040529050919050565b613b1185856127f6896138e660018961550a565b613b2e57604051630c7296bb60e11b815260040160405180910390fd5b6117b78661191760025490565b6011546000906119c7907f0000000000000000000000000000000000000000000000000000000000000003613351565b6040516bffffffffffffffffffffffff19606083901b1660208201526000906034015b604051602081830303815290604052805190602001209050919050565b6000818152600660205260409020546114e757613bc7816132d7565b60008281526006602052604090205550565b613be56000606461540f565b8162ffffff161080613c065750613bfe6003606461540f565b8162ffffff16115b15613c2457604051634c847c8760e11b815260040160405180910390fd5b611afe828261411c565b6040830151600090819067ffffffffffffffff16613c62575067ffffffffffffffff85168452600160408501819052613cb4565b7f59ebe37edcc33bfbd8c05f098812c0e2f24e3bb8b2687deb4ef467e5740fc47b868660200151601b60008a8152602001908152602001600020604051613cab939291906155eb565b60405180910390a15b60208501805190613cc482615689565b67ffffffffffffffff169052506000868152601b60205260409020613cea90858561486a565b506000868152601c602090815260409182902087518154928901519389015160608a015167ffffffffffffffff908116600160c01b0277ffffffffffffffffffffffffffffffffffffffffffffffff928216600160801b02929092166fffffffffffffffffffffffffffffffff96821668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000000000000000000090961691909316179390931793909316929092171790559050949350505050565b600a546001600160a01b0384166000908152600c602052604081205490918391613dd190866153f0565b613ddb91906156c7565b6117e7919061550a565b80471015613e355760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401611373565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613e82576040519150601f19603f3d011682016040523d82523d6000602084013e613e87565b606091505b50509050806119ad5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401611373565b6000808888888888604051602001613f1a9594939291906156db565b604051602081830303815290604052805190602001209050613f7f8185858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050601d546001600160a01b0316915061419d9050565b9998505050505050505050565b611afe82826040518060200160405280600081525061420b565b600061215e85838686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506142719050565b60608161402a57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115614054578061403e816153d5565b915061404d9050600a836156c7565b915061402e565b60008167ffffffffffffffff81111561406f5761406f614ac4565b6040519080825280601f01601f191660200182016040528015614099576020820181803683370190505b5090505b84156117e7576140ae60018361550a565b91506140bb600a86615715565b6140c690603061540f565b60f81b8183815181106140db576140db6153a9565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350614115600a866156c7565b945061409d565b60008281526006602052604090205480614161576040517ed5815300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000928352600660205260409092207cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9290921660e89190911b179055565b6000806141b3846141ad87614287565b906142c2565b9050826001600160a01b0316816001600160a01b031614614200576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001949350505050565b61421583836142de565b6001600160a01b0383163b156119ad576002548281035b61423f6000868380600101945086613960565b61425c576040516368d2bf6b60e11b815260040160405180910390fd5b81811061422c57816002541461153b57600080fd5b60008261427e8584614408565b14949350505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01613b8e565b60008060006142d1858561444d565b91509150611adb816144bd565b60025481614318576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03831660008181526007602090815260408083208054680100000000000000018802019055848352600690915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b8181146143c757808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a460010161438f565b50816143ff576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025550505050565b600081815b8451811015611adb576144398286838151811061442c5761442c6153a9565b6020026020010151614678565b915080614445816153d5565b91505061440d565b6000808251604114156144845760208301516040840151606085015160001a614478878285856146a7565b945094505050506144b6565b8251604014156144ae57602083015160408401516144a3868383614794565b9350935050506144b6565b506000905060025b9250929050565b60008160048111156144d1576144d1615729565b14156144da5750565b60018160048111156144ee576144ee615729565b141561453c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401611373565b600281600481111561455057614550615729565b141561459e5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401611373565b60038160048111156145b2576145b2615729565b141561460b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401611373565b600481600481111561461f5761461f615729565b14156114e75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401611373565b6000818310614694576000828152602084905260409020611f95565b6000838152602083905260409020611f95565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156146de575060009050600361478b565b8460ff16601b141580156146f657508460ff16601c14155b15614707575060009050600461478b565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561475b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166147845760006001925092505061478b565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816147ca60ff86901c601b61540f565b90506147d8878288856146a7565b935093505050935093915050565b8280546147f29061536e565b90600052602060002090601f016020900481019282614814576000855561485a565b82601f1061482d57805160ff191683800117855561485a565b8280016001018555821561485a579182015b8281111561485a57825182559160200191906001019061483f565b506148669291506148de565b5090565b8280546148769061536e565b90600052602060002090601f016020900481019282614898576000855561485a565b82601f106148b15782800160ff1982351617855561485a565b8280016001018555821561485a579182015b8281111561485a5782358255916020019190600101906148c3565b5b8082111561486657600081556001016148df565b6001600160e01b0319811681146114e757600080fd5b60006020828403121561491b57600080fd5b8135611f95816148f3565b60005b83811015614941578181015183820152602001614929565b838111156115c65750506000910152565b6000815180845261496a816020860160208601614926565b601f01601f19169290920160200192915050565b602081526000611f956020830184614952565b6000602082840312156149a357600080fd5b5035919050565b6001600160a01b03811681146114e757600080fd5b600080604083850312156149d257600080fd5b82356149dd816149aa565b946020939093013593505050565b6000602082840312156149fd57600080fd5b8135611f95816149aa565b60008083601f840112614a1a57600080fd5b50813567ffffffffffffffff811115614a3257600080fd5b6020830191508360208285010111156144b657600080fd5b600080600080600060608688031215614a6257600080fd5b85359450602086013567ffffffffffffffff80821115614a8157600080fd5b614a8d89838a01614a08565b90965094506040880135915080821115614aa657600080fd5b50614ab388828901614a08565b969995985093965092949392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715614b0357614b03614ac4565b604052919050565b600067ffffffffffffffff821115614b2557614b25614ac4565b5060051b60200190565b600082601f830112614b4057600080fd5b81356020614b55614b5083614b0b565b614ada565b82815260059290921b84018101918181019086841115614b7457600080fd5b8286015b84811015614b98578035614b8b816149aa565b8352918301918301614b78565b509695505050505050565b60008060408385031215614bb657600080fd5b823567ffffffffffffffff811115614bcd57600080fd5b614bd985828601614b2f565b95602094909401359450505050565b600080600060608486031215614bfd57600080fd5b8335614c08816149aa565b92506020840135614c18816149aa565b929592945050506040919091013590565b60008060408385031215614c3c57600080fd5b50508035926020909101359150565b80358015158114614c5b57600080fd5b919050565b600080600060608486031215614c7557600080fd5b614c7e84614c4b565b9250614c8c60208501614c4b565b9150604084013590509250925092565b600067ffffffffffffffff831115614cb657614cb6614ac4565b614cc9601f8401601f1916602001614ada565b9050828152838383011115614cdd57600080fd5b828260208301376000602084830101529392505050565b600082601f830112614d0557600080fd5b611f9583833560208501614c9c565b600060208284031215614d2657600080fd5b813567ffffffffffffffff811115614d3d57600080fd5b6117e784828501614cf4565b600082601f830112614d5a57600080fd5b81356020614d6a614b5083614b0b565b82815260059290921b84018101918181019086841115614d8957600080fd5b8286015b84811015614b9857803567ffffffffffffffff811115614dad5760008081fd5b614dbb8986838b0101614cf4565b845250918301918301614d8d565b60008060408385031215614ddc57600080fd5b823567ffffffffffffffff80821115614df457600080fd5b818501915085601f830112614e0857600080fd5b81356020614e18614b5083614b0b565b82815260059290921b84018101918181019089841115614e3757600080fd5b948201945b83861015614e5557853582529482019490820190614e3c565b96505086013592505080821115614e6b57600080fd5b50614e7885828601614d49565b9150509250929050565b60008083601f840112614e9457600080fd5b50813567ffffffffffffffff811115614eac57600080fd5b6020830191508360208260051b85010111156144b657600080fd5b60008060208385031215614eda57600080fd5b823567ffffffffffffffff811115614ef157600080fd5b614efd85828601614e82565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561209857614f738385516001600160a01b03815116825267ffffffffffffffff602082015116602083015260408101511515604083015262ffffff60608201511660608301525050565b9284019260809290920191600101614f25565b600080600060608486031215614f9b57600080fd5b833567ffffffffffffffff811115614fb257600080fd5b614fbe86828701614b2f565b9660208601359650604090950135949350505050565b60008060008060008060c08789031215614fed57600080fd5b614ff687614c4b565b955061500460208801614c4b565b945061501260408801614c4b565b9350606087013592506080870135915060a087013590509295509295509295565b60008060006040848603121561504857600080fd5b83359250602084013567ffffffffffffffff81111561506657600080fd5b61507286828701614a08565b9497909650939450505050565b6020808252825182820181905260009190848201906040850190845b818110156120985783518352928401929184019160010161509b565b600080600080606085870312156150cd57600080fd5b843567ffffffffffffffff8111156150e457600080fd5b6150f087828801614e82565b9095509350506020850135615104816149aa565b9396929550929360400135925050565b60008060006060848603121561512957600080fd5b8335615134816149aa565b95602085013595506040909401359392505050565b6000806000806060858703121561515f57600080fd5b843567ffffffffffffffff81111561517657600080fd5b61518287828801614e82565b90989097506020870135966040013595509350505050565b600080604083850312156151ad57600080fd5b82356151b8816149aa565b91506151c660208401614c4b565b90509250929050565b600080600080608085870312156151e557600080fd5b84356151f0816149aa565b93506020850135615200816149aa565b925060408501359150606085013567ffffffffffffffff81111561522357600080fd5b8501601f8101871361523457600080fd5b61524387823560208401614c9c565b91505092959194509250565b81516001600160a01b0316815260208083015167ffffffffffffffff169082015260408083015115159082015260608083015162ffffff16908201526080810161114d565b600080604083850312156152a757600080fd5b82356152b2816149aa565b915060208301356152c2816149aa565b809150509250929050565b6000806000606084860312156152e257600080fd5b833592506020840135915060408401356152fb816149aa565b809150509250925092565b60008060008060006080868803121561531e57600080fd5b8535945060208601359350604086013567ffffffffffffffff81111561534357600080fd5b61534f88828901614a08565b9094509250615362905060608701614c4b565b90509295509295909350565b600181811c9082168061538257607f821691505b602082108114156153a357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156153e9576153e96153bf565b5060010190565b600081600019048311821515161561540a5761540a6153bf565b500290565b60008219821115615422576154226153bf565b500190565b8183823760009101908152919050565b600081546154448161536e565b6001828116801561545c576001811461546d5761549c565b60ff1984168752828701945061549c565b8560005260208060002060005b858110156154935781548a82015290840190820161547a565b50505082870194505b5050505092915050565b6000611f958284615437565b600084516154c4818460208901614926565b6154d081840186615437565b905083516154e2818360208801614926565b0195945050505050565b600083516154fe818460208801614926565b61215e81840185615437565b60008282101561551c5761551c6153bf565b500390565b600067ffffffffffffffff808316818516808303821115615544576155446153bf565b01949350505050565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261557f6080830184614952565b9695505050505050565b60006020828403121561559b57600080fd5b8151611f95816148f3565b7f2f000000000000000000000000000000000000000000000000000000000000008152600082516155de816001850160208701614926565b9190910160010192915050565b8381526000602067ffffffffffffffff85168184015260606040840152600084546156158161536e565b8060608701526080600180841660008114615637576001811461564b57615679565b60ff1985168984015260a089019550615679565b896000528660002060005b858110156156715781548b8201860152908301908801615656565b8a0184019650505b50939a9950505050505050505050565b600067ffffffffffffffff808316818114156156a7576156a76153bf565b6001019392505050565b634e487b7160e01b600052601260045260246000fd5b6000826156d6576156d66156b1565b500490565b6bffffffffffffffffffffffff198660601b1681528460148201528360348201528183605483013760009101605401908152949350505050565b600082615724576157246156b1565b500690565b634e487b7160e01b600052602160045260246000fdfea264697066735822122091042f0fe0084b1e999013c018d555cd1a84ca7b2df373ff6e0d01c08f71b7c564736f6c634300080b0033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.