ETH Price: $3,298.03 (-0.97%)

Contract

0x7581871e1C11f85ec7F02382632B8574FAd11B22
 
Transaction Hash
Method
Block
From
To
Update Token URI...213856152024-12-12 9:45:2310 days ago1733996723IN
Manifold: ERC721Edition
0 ETH0.0012084419.00607866
Update Claim213650122024-12-09 12:41:2313 days ago1733748083IN
Manifold: ERC721Edition
0 ETH0.003316737.34228847
Update Claim213649842024-12-09 12:35:4713 days ago1733747747IN
Manifold: ERC721Edition
0 ETH0.0026774638.4434178
Update Token URI...211102032024-11-03 22:48:3549 days ago1730674115IN
Manifold: ERC721Edition
0 ETH0.000265744.18027589
Update Token URI...211101952024-11-03 22:46:5949 days ago1730674019IN
Manifold: ERC721Edition
0 ETH0.000223433.51477844
Update Token URI...211101832024-11-03 22:44:3549 days ago1730673875IN
Manifold: ERC721Edition
0 ETH0.000260054.09080778
Update Token URI...211101762024-11-03 22:43:1149 days ago1730673791IN
Manifold: ERC721Edition
0 ETH0.000220763.47274213
Update Token URI...211101662024-11-03 22:41:1149 days ago1730673671IN
Manifold: ERC721Edition
0 ETH0.000251473.95592679
Update Token URI...211101572024-11-03 22:39:2349 days ago1730673563IN
Manifold: ERC721Edition
0 ETH0.000268194.21889741
Update Token URI...211101452024-11-03 22:36:5949 days ago1730673419IN
Manifold: ERC721Edition
0 ETH0.000246913.88420206
Update Claim211059632024-11-03 8:37:2349 days ago1730623043IN
Manifold: ERC721Edition
0 ETH0.000228333.60267128
Update Claim207750372024-09-18 4:16:2396 days ago1726632983IN
Manifold: ERC721Edition
0 ETH0.000316714.7917761
Mint207659632024-09-16 21:48:4797 days ago1726523327IN
Manifold: ERC721Edition
0.0574 ETH0.000686993.35421666
Mint Batch206945392024-09-06 22:28:59107 days ago1725661739IN
Manifold: ERC721Edition
0.0055 ETH0.000467812.4088934
Mint206276492024-08-28 14:21:23116 days ago1724854883IN
Manifold: ERC721Edition
0.0074 ETH0.000932954.89527368
Update Claim206276092024-08-28 14:13:23116 days ago1724854403IN
Manifold: ERC721Edition
0 ETH0.000293814.64025943
Update Claim206271972024-08-28 12:50:23116 days ago1724849423IN
Manifold: ERC721Edition
0 ETH0.000238743.32889529
Mint205134442024-08-12 15:31:59132 days ago1723476719IN
Manifold: ERC721Edition
0.0085 ETH0.0033126519.70096927
Mint205005772024-08-10 20:22:59134 days ago1723321379IN
Manifold: ERC721Edition
0.0215 ETH0.000163850.97446237
Mint204602352024-08-05 5:20:11140 days ago1722835211IN
Manifold: ERC721Edition
0.0205 ETH0.0090578454.51900487
Update Claim203529862024-07-21 6:01:47155 days ago1721541707IN
Manifold: ERC721Edition
0 ETH0.000160462.32564637
Mint202711422024-07-09 19:52:11166 days ago1720554731IN
Manifold: ERC721Edition
0.1005 ETH0.000561823.3412638
Update Claim202291122024-07-03 22:56:59172 days ago1720047419IN
Manifold: ERC721Edition
0 ETH0.000314744.96467459
Mint200435252024-06-08 0:27:23198 days ago1717806443IN
Manifold: ERC721Edition
0.00716 ETH0.001195546.34467937
Update Claim198973622024-05-18 14:15:35218 days ago1716041735IN
Manifold: ERC721Edition
0 ETH0.000229383.46934194
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
209244042024-10-09 0:20:2375 days ago1728433223
Manifold: ERC721Edition
0.008 ETH
207659632024-09-16 21:48:4797 days ago1726523327
Manifold: ERC721Edition
0.0569 ETH
206945392024-09-06 22:28:59107 days ago1725661739
Manifold: ERC721Edition
0.005 ETH
206276492024-08-28 14:21:23116 days ago1724854883
Manifold: ERC721Edition
0.0069 ETH
205134442024-08-12 15:31:59132 days ago1723476719
Manifold: ERC721Edition
0.008 ETH
205005772024-08-10 20:22:59134 days ago1723321379
Manifold: ERC721Edition
0.021 ETH
204602352024-08-05 5:20:11140 days ago1722835211
Manifold: ERC721Edition
0.02 ETH
202711422024-07-09 19:52:11166 days ago1720554731
Manifold: ERC721Edition
0.1 ETH
200435252024-06-08 0:27:23198 days ago1717806443
Manifold: ERC721Edition
0.00666 ETH
197736652024-05-01 7:03:35236 days ago1714547015
Manifold: ERC721Edition
0.1138 ETH
197638412024-04-29 22:07:35237 days ago1714428455
Manifold: ERC721Edition
0.1 ETH
197221542024-04-24 2:06:47243 days ago1713924407
Manifold: ERC721Edition
0.0569 ETH
196697902024-04-16 18:20:47250 days ago1713291647
Manifold: ERC721Edition
0.05 ETH
196138762024-04-08 22:18:47258 days ago1712614727
Manifold: ERC721Edition
0.02 ETH
196008802024-04-07 2:35:47260 days ago1712457347
Manifold: ERC721Edition
0.00666 ETH
195860912024-04-05 0:52:35262 days ago1712278355
Manifold: ERC721Edition
0.00666 ETH
195727742024-04-03 4:09:59264 days ago1712117399
Manifold: ERC721Edition
0.02357 ETH
195717082024-04-03 0:35:35264 days ago1712104535
Manifold: ERC721Edition
0.02357 ETH
194986962024-03-23 17:10:11274 days ago1711213811
Manifold: ERC721Edition
0.17 ETH
194388672024-03-15 7:30:35283 days ago1710487835
Manifold: ERC721Edition
0.1 ETH
193989722024-03-09 17:16:11288 days ago1710004571
Manifold: ERC721Edition
0.17 ETH
192767742024-02-21 14:58:11305 days ago1708527491
Manifold: ERC721Edition
0.17 ETH
192305922024-02-15 3:16:11312 days ago1707966971
Manifold: ERC721Edition
0.04 ETH
192081262024-02-11 23:36:35315 days ago1707694595
Manifold: ERC721Edition
0.17 ETH
191416502024-02-02 15:38:11324 days ago1706888291
Manifold: ERC721Edition
0.17 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC721LazyPayableClaim

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 19 : ERC721LazyPayableClaim.sol
// SPDX-License-Identifier: MIT
// solhint-disable reason-string
pragma solidity ^0.8.0;

import "@manifoldxyz/creator-core-solidity/contracts/core/IERC721CreatorCore.sol";
import "@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol";

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

import "./LazyPayableClaim.sol";
import "./IERC721LazyPayableClaim.sol";

/**
 * @title Lazy Payable Claim
 * @author manifold.xyz
 * @notice Lazy payable claim with optional whitelist ERC721 tokens
 */
contract ERC721LazyPayableClaim is IERC165, IERC721LazyPayableClaim, ICreatorExtensionTokenURI, LazyPayableClaim {
    using Strings for uint256;

    // stores mapping from tokenId to the claim it represents
    // { contractAddress => { tokenId => Claim } }
    mapping(address => mapping(uint256 => Claim)) private _claims;

    struct TokenClaim {
        uint224 claimIndex;
        uint32 mintOrder;
    }

    // stores which tokenId corresponds to which claimIndex, used to generate token uris
    // { contractAddress => { tokenId => TokenClaim } }
    mapping(address => mapping(uint256 => TokenClaim)) private _tokenClaims;

    function supportsInterface(bytes4 interfaceId) public view virtual override(AdminControl, IERC165) returns (bool) {
        return interfaceId == type(IERC721LazyPayableClaim).interfaceId ||
            interfaceId == type(ILazyPayableClaim).interfaceId ||
            interfaceId == type(ICreatorExtensionTokenURI).interfaceId ||
            interfaceId == type(IAdminControl).interfaceId ||
            interfaceId == type(IERC165).interfaceId;
    }

    constructor(address delegationRegistry) LazyPayableClaim(delegationRegistry) {}

    /**
     * See {IERC721LazyClaim-initializeClaim}.
     */
    function initializeClaim(
        address creatorContractAddress,
        uint256 claimIndex,
        ClaimParameters calldata claimParameters
    ) external override creatorAdminRequired(creatorContractAddress) {
        // Revert if claim at claimIndex already exists
        require(_claims[creatorContractAddress][claimIndex].storageProtocol == StorageProtocol.INVALID, "Claim already initialized");

        // Sanity checks
        require(claimParameters.storageProtocol != StorageProtocol.INVALID, "Cannot initialize with invalid storage protocol");
        require(claimParameters.endDate == 0 || claimParameters.startDate < claimParameters.endDate, "Cannot have startDate greater than or equal to endDate");
        require(claimParameters.merkleRoot == "" || claimParameters.walletMax == 0, "Cannot provide both walletMax and merkleRoot");

        // Create the claim
        _claims[creatorContractAddress][claimIndex] = Claim({
            total: 0,
            totalMax: claimParameters.totalMax,
            walletMax: claimParameters.walletMax,
            startDate: claimParameters.startDate,
            endDate: claimParameters.endDate,
            storageProtocol: claimParameters.storageProtocol,
            identical: claimParameters.identical,
            merkleRoot: claimParameters.merkleRoot,
            location: claimParameters.location,
            cost: claimParameters.cost,
            paymentReceiver: claimParameters.paymentReceiver,
            erc20: claimParameters.erc20
        });

        emit ClaimInitialized(creatorContractAddress, claimIndex, msg.sender);
    }

    /**
     * See {IERC721LazyClaim-udpateClaim}.
     */
    function updateClaim(
        address creatorContractAddress,
        uint256 claimIndex,
        ClaimParameters memory claimParameters
    ) external override creatorAdminRequired(creatorContractAddress) {
        // Sanity checks
        Claim memory claim = _claims[creatorContractAddress][claimIndex];
        require(claim.storageProtocol != StorageProtocol.INVALID, "Claim not initialized");
        require(claimParameters.storageProtocol != StorageProtocol.INVALID, "Cannot set invalid storage protocol");
        require(claimParameters.endDate == 0 || claimParameters.startDate < claimParameters.endDate, "Cannot have startDate greater than or equal to endDate");
        require(claimParameters.erc20 == claim.erc20, "Cannot change payment token");
        if (claimParameters.totalMax != 0 && claim.total > claimParameters.totalMax) {
            claimParameters.totalMax = claim.total;
        }

        // Overwrite the existing claim
        _claims[creatorContractAddress][claimIndex] = Claim({
            total: claim.total,
            totalMax: claimParameters.totalMax,
            walletMax: claimParameters.walletMax,
            startDate: claimParameters.startDate,
            endDate: claimParameters.endDate,
            storageProtocol: claimParameters.storageProtocol,
            identical: claimParameters.identical,
            merkleRoot: claimParameters.merkleRoot,
            location: claimParameters.location,
            cost: claimParameters.cost,
            paymentReceiver: claimParameters.paymentReceiver,
            erc20: claim.erc20
        });
        emit ClaimUpdated(creatorContractAddress, claimIndex);
    }

    /**
     * See {IERC721LazyClaim-updateTokenURIParams}.
     */
    function updateTokenURIParams(
        address creatorContractAddress, uint256 claimIndex,
        StorageProtocol storageProtocol,
        bool identical,
        string calldata location
    ) external override creatorAdminRequired(creatorContractAddress)  {
        Claim memory claim = _claims[creatorContractAddress][claimIndex];
        require(_claims[creatorContractAddress][claimIndex].storageProtocol != StorageProtocol.INVALID, "Claim not initialized");
        require(storageProtocol != StorageProtocol.INVALID, "Cannot set invalid storage protocol");

        // Overwrite the existing claim
        _claims[creatorContractAddress][claimIndex] = Claim({
            total: claim.total,
            totalMax: claim.totalMax,
            walletMax: claim.walletMax,
            startDate: claim.startDate,
            endDate: claim.endDate,
            storageProtocol: storageProtocol,
            identical: identical,
            merkleRoot: claim.merkleRoot,
            location: location,
            cost: claim.cost,
            paymentReceiver: claim.paymentReceiver,
            erc20: claim.erc20
        });
        emit ClaimUpdated(creatorContractAddress, claimIndex);
    }

    /**
     * See {ILazyPayableClaim-getClaim}.
     */
    function getClaim(address creatorContractAddress, uint256 claimIndex) public override view returns(Claim memory) {
        return _getClaim(creatorContractAddress, claimIndex);
    }

    function _getClaim(address creatorContractAddress, uint256 claimIndex) private view returns(Claim storage claim) {
        claim = _claims[creatorContractAddress][claimIndex];
        require(claim.storageProtocol != StorageProtocol.INVALID, "Claim not initialized");
    }

    /**
     * See {ILazyPayableClaim-checkMintIndex}.
     */
    function checkMintIndex(address creatorContractAddress, uint256 claimIndex, uint32 mintIndex) external override view returns(bool) {
        Claim memory claim = getClaim(creatorContractAddress, claimIndex);
        return _checkMintIndex(creatorContractAddress, claimIndex, claim.merkleRoot, mintIndex);
    }

    /**
     * See {ILazyPayableClaim-checkMintIndices}.
     */
    function checkMintIndices(address creatorContractAddress, uint256 claimIndex, uint32[] calldata mintIndices) external override view returns(bool[] memory minted) {
        Claim memory claim = getClaim(creatorContractAddress, claimIndex);
        uint256 mintIndicesLength = mintIndices.length;
        minted = new bool[](mintIndices.length);
        for (uint256 i; i < mintIndicesLength;) {
            minted[i] = _checkMintIndex(creatorContractAddress, claimIndex, claim.merkleRoot, mintIndices[i]);
            unchecked{ ++i; }
        }
    }

    /**
     * See {ILazyPayableClaim-getTotalMints}.
     */
    function getTotalMints(address minter, address creatorContractAddress, uint256 claimIndex) external override view returns(uint32) {
        Claim memory claim = getClaim(creatorContractAddress, claimIndex);
        return _getTotalMints(claim.walletMax, minter, creatorContractAddress, claimIndex);
    }

    /**
     * See {ILazyPayableClaim-mint}.
     */
    function mint(address creatorContractAddress, uint256 claimIndex, uint32 mintIndex, bytes32[] calldata merkleProof, address mintFor) external payable override {
        Claim storage claim = _getClaim(creatorContractAddress, claimIndex);

        // Check totalMax
        require(++claim.total <= claim.totalMax || claim.totalMax == 0, "Maximum tokens already minted for this claim");

        // Validate mint
        _validateMint(creatorContractAddress, claimIndex, claim.startDate, claim.endDate, claim.walletMax, claim.merkleRoot, mintIndex, merkleProof, mintFor);

        // Transfer funds
        _transferFunds(claim.erc20, claim.cost, claim.paymentReceiver, 1, claim.merkleRoot != "");

        // Do mint
        uint256 newTokenId = IERC721CreatorCore(creatorContractAddress).mintExtension(msg.sender);

        // Insert the new tokenId into _tokenClaims for the current claim address & index
        _tokenClaims[creatorContractAddress][newTokenId] = TokenClaim(uint224(claimIndex), claim.total);

        emit ClaimMint(creatorContractAddress, claimIndex);
    }

    /**
     * See {ILazyPayableClaim-mintBatch}.
     */
    function mintBatch(address creatorContractAddress, uint256 claimIndex, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) external payable override {
        Claim storage claim = _getClaim(creatorContractAddress, claimIndex);

        // Check totalMax
        claim.total += mintCount;
        require(claim.totalMax == 0 || claim.total <= claim.totalMax, "Too many requested for this claim");

        // Validate mint
        _validateMint(creatorContractAddress, claimIndex, claim.startDate, claim.endDate, claim.walletMax, claim.merkleRoot, mintCount, mintIndices, merkleProofs, mintFor);
        uint256 newMintIndex = claim.total - mintCount + 1;

        // Transfer funds
        _transferFunds(claim.erc20, claim.cost, claim.paymentReceiver, mintCount, claim.merkleRoot != "");

        uint256[] memory newTokenIds = IERC721CreatorCore(creatorContractAddress).mintExtensionBatch(msg.sender, mintCount);
        for (uint256 i; i < mintCount;) {
            _tokenClaims[creatorContractAddress][newTokenIds[i]] = TokenClaim(uint224(claimIndex), uint32(newMintIndex+i));
            unchecked { ++i; }
        }

        emit ClaimMintBatch(creatorContractAddress, claimIndex, mintCount);
    }

    /**
     * See {ILazyPayableClaim-mintProxy}.
     */
    function mintProxy(address creatorContractAddress, uint256 claimIndex, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) external payable override {
        Claim storage claim = _getClaim(creatorContractAddress, claimIndex);

        // Check totalMax
        claim.total += mintCount;
        require(claim.totalMax == 0 || claim.total <= claim.totalMax, "Too many requested for this claim");

        // Validate mint
        _validateMintProxy(creatorContractAddress, claimIndex, claim.startDate, claim.endDate, claim.walletMax, claim.merkleRoot, mintCount, mintIndices, merkleProofs, mintFor);
        uint256 newMintIndex = claim.total - mintCount + 1;

        // Transfer funds
        _transferFundsProxy(claim.erc20, claim.cost, claim.paymentReceiver, mintCount, claim.merkleRoot != "");

        uint256[] memory newTokenIds = IERC721CreatorCore(creatorContractAddress).mintExtensionBatch(mintFor, mintCount);
        for (uint256 i; i < mintCount;) {
            _tokenClaims[creatorContractAddress][newTokenIds[i]] = TokenClaim(uint224(claimIndex), uint32(newMintIndex+i));
            unchecked { ++i; }
        }

        emit ClaimMintProxy(creatorContractAddress, claimIndex, mintCount, msg.sender, mintFor);
    }

    /**
     * See {IERC721LazyClaim-airdrop}.
     */
    function airdrop(address creatorContractAddress, uint256 claimIndex, address[] calldata recipients,
            uint16[] calldata amounts) external override creatorAdminRequired(creatorContractAddress) {
        require(recipients.length == amounts.length, "Unequal number of recipients and amounts provided");

        // Fetch the claim, create newMintIndex to keep track of token ids created by the airdrop
        Claim storage claim = _claims[creatorContractAddress][claimIndex];
        uint256 newMintIndex = claim.total+1;

        for (uint256 i; i < recipients.length;) {
            // Airdrop the tokens
            uint256[] memory newTokenIds = IERC721CreatorCore(creatorContractAddress).mintExtensionBatch(recipients[i], amounts[i]);

            // Register the tokenClaims, so that tokenURI will work for airdropped tokens
            for (uint256 j; j < newTokenIds.length;) {
                _tokenClaims[creatorContractAddress][newTokenIds[j]] = TokenClaim(uint224(claimIndex), uint32(newMintIndex+j));
                unchecked { ++j; }
            }

            // Increment claim.total and newMintIndex for the next airdrop
            unchecked{ newMintIndex += newTokenIds.length; }

            unchecked{ ++i; }
        }
        require(newMintIndex - claim.total - 1 <= MAX_UINT_32, "Too many requested");
        claim.total += uint32(newMintIndex - claim.total - 1);
        if (claim.totalMax != 0 && claim.total > claim.totalMax) {
            claim.totalMax = claim.total;
        }
    }

    /**
     * See {ICreatorExtensionTokenURI-tokenURI}.
     */
    function tokenURI(address creatorContractAddress, uint256 tokenId) external override view returns(string memory uri) {
        TokenClaim memory tokenClaim = _tokenClaims[creatorContractAddress][tokenId];
        require(tokenClaim.claimIndex > 0, "Token does not exist");
        Claim memory claim = _claims[creatorContractAddress][tokenClaim.claimIndex];

        string memory prefix = "";
        if (claim.storageProtocol == StorageProtocol.ARWEAVE) {
            prefix = ARWEAVE_PREFIX;
        } else if (claim.storageProtocol == StorageProtocol.IPFS) {
            prefix = IPFS_PREFIX;
        }
        uri = string(abi.encodePacked(prefix, claim.location));

        // Depending on params, we may want to append a suffix to location
        if (!claim.identical) {
            uri = string(abi.encodePacked(uri, "/", uint256(tokenClaim.mintOrder).toString()));
        }
    }
}

File 2 of 19 : IERC721LazyPayableClaim.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "./ILazyPayableClaim.sol";

/**
 * Lazy Payable Claim interface
 */
interface IERC721LazyPayableClaim is ILazyPayableClaim {
    struct ClaimParameters {
        uint32 totalMax;
        uint32 walletMax;
        uint48 startDate;
        uint48 endDate;
        StorageProtocol storageProtocol;
        bool identical;
        bytes32 merkleRoot;
        string location;
        uint256 cost;
        address payable paymentReceiver;
        address erc20;
    }

    struct Claim {
        uint32 total;
        uint32 totalMax;
        uint32 walletMax;
        uint48 startDate;
        uint48 endDate;
        StorageProtocol storageProtocol;
        bool identical;
        bytes32 merkleRoot;
        string location;
        uint256 cost;
        address payable paymentReceiver;
        address erc20;
    }

    /**
     * @notice initialize a new claim, emit initialize event, and return the newly created index
     * @param creatorContractAddress    the creator contract the claim will mint tokens for
     * @param claimIndex                the index of the claim in the list of creatorContractAddress' _claims
     * @param claimParameters           the parameters which will affect the minting behavior of the claim
     */
    function initializeClaim(address creatorContractAddress, uint256 claimIndex, ClaimParameters calldata claimParameters) external;

    /**
     * @notice update an existing claim at claimIndex
     * @param creatorContractAddress    the creator contract corresponding to the claim
     * @param claimIndex                the index of the claim in the list of creatorContractAddress' _claims
     * @param claimParameters           the parameters which will affect the minting behavior of the claim
     */
    function updateClaim(address creatorContractAddress, uint256 claimIndex, ClaimParameters calldata claimParameters) external;

    /**
     * @notice update tokenURI parameters for an existing claim at claimIndex
     * @param creatorContractAddress    the creator contract corresponding to the claim
     * @param claimIndex                the index of the claim in the list of creatorContractAddress' _claims
     * @param storageProtocol           the new storage protocol
     * @param identical                 the new value of identical
     * @param location                  the new location
     */
    function updateTokenURIParams(address creatorContractAddress, uint256 claimIndex, StorageProtocol storageProtocol, bool identical, string calldata location) external;

    /**
     * @notice get a claim corresponding to a creator contract and index
     * @param creatorContractAddress    the address of the creator contract
     * @param claimIndex                the index of the claim
     * @return                          the claim object
     */
    function getClaim(address creatorContractAddress, uint256 claimIndex) external view returns(Claim memory);

    /**
     * @notice allow admin to airdrop arbitrary tokens 
     * @param creatorContractAddress    the creator contract the claim will mint tokens for
     * @param claimIndex                the index of the claim in the list of creatorContractAddress' _claims
     * @param recipients                addresses to airdrop to
     * @param amounts                   number of tokens to airdrop to each address in addresses
     */
    function airdrop(address creatorContractAddress, uint256 claimIndex, address[] calldata recipients, uint16[] calldata amounts) external;
}

File 3 of 19 : LazyPayableClaim.sol
// SPDX-License-Identifier: MIT
// solhint-disable reason-string
pragma solidity ^0.8.0;

import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "../../libraries/delegation-registry/IDelegationRegistry.sol";
import "../../libraries/manifold-membership/IManifoldMembership.sol";

import "./ILazyPayableClaim.sol";

/**
 * @title Lazy Payable Claim
 * @author manifold.xyz
 * @notice Lazy payable claim with optional whitelist ERC721 tokens
 */
abstract contract LazyPayableClaim is ILazyPayableClaim, AdminControl {
    using EnumerableSet for EnumerableSet.AddressSet;

    string internal constant ARWEAVE_PREFIX = "https://arweave.net/";
    string internal constant IPFS_PREFIX = "ipfs://";

    uint256 internal constant MINT_INDEX_BITMASK = 0xFF;
    // solhint-disable-next-line
    address public immutable DELEGATION_REGISTRY;

    uint256 public constant MINT_FEE = 500000000000000;
    uint256 public constant MINT_FEE_MERKLE = 690000000000000;
    address public MEMBERSHIP_ADDRESS;

    uint256 internal constant MAX_UINT_32 = 0xffffffff;
    uint256 internal constant MAX_UINT_256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
    address private constant ADDRESS_ZERO = 0x0000000000000000000000000000000000000000;

    // ONLY USED FOR NON-MERKLE MINTS: stores the number of tokens minted per wallet per claim, in order to limit maximum
    // { contractAddress => { claimIndex => { walletAddress => walletMints } } }
    mapping(address => mapping(uint256 => mapping(address => uint256))) internal _mintsPerWallet;

    // ONLY USED FOR MERKLE MINTS: stores mapping from claim to indices minted
    // { contractAddress => {claimIndex => { claimIndexOffset => index } } }
    mapping(address => mapping(uint256 => mapping(uint256 => uint256))) internal _claimMintIndices;

    EnumerableSet.AddressSet private _proxyAddresses;

    /**
     * @notice This extension is shared, not single-creator. So we must ensure
     * that a claim's initializer is an admin on the creator contract
     * @param creatorContractAddress    the address of the creator contract to check the admin against
     */
    modifier creatorAdminRequired(address creatorContractAddress) {
        AdminControl creatorCoreContract = AdminControl(creatorContractAddress);
        require(creatorCoreContract.isAdmin(msg.sender), "Wallet is not an administrator for contract");
        _;
    }

    constructor(address delegationRegistry) {
        DELEGATION_REGISTRY = delegationRegistry;
    }

    /**
     * See {ILazyPayableClaim-withdraw}.
     */
    function withdraw(address payable receiver, uint256 amount) external override adminRequired {
        (bool sent, ) = receiver.call{value: amount}("");
        require(sent, "Failed to transfer to receiver");
    }

    /**
     * See {ILazyPayableClaim-setMembershipAddress}.
     */
    function setMembershipAddress(address membershipAddress) external override adminRequired {
        MEMBERSHIP_ADDRESS = membershipAddress;
    }

    /**
     * See {ILazyPayableClaim-addMintProxyAddresses}.
     */
    function addMintProxyAddresses(address[] calldata proxyAddresses) external override adminRequired {
        for (uint256 i; i < proxyAddresses.length;) {
            _proxyAddresses.add(proxyAddresses[i]);
            unchecked { ++i; }
        }
    }

    /**
     * See {ILazyPayableClaim-removeMintProxyAddresses}.
     */
    function removeMintProxyAddresses(address[] calldata proxyAddresses) external override adminRequired {
        for (uint256 i; i < proxyAddresses.length;) {
            _proxyAddresses.remove(proxyAddresses[i]);
            unchecked { ++i; }
        }
    }

    function _transferFunds(address erc20, uint256 cost, address payable recipient, uint16 mintCount, bool merkle) internal {
        uint256 payableCost;
        if (erc20 != ADDRESS_ZERO) {
            require(IERC20(erc20).transferFrom(msg.sender, recipient, cost*mintCount), "Insufficient funds");
        } else {
            payableCost = cost;
        }
        if (MEMBERSHIP_ADDRESS != ADDRESS_ZERO) {
            if (!IManifoldMembership(MEMBERSHIP_ADDRESS).isActiveMember(msg.sender)) {
                payableCost += merkle ? MINT_FEE_MERKLE : MINT_FEE; 
            }
        } else {
            payableCost += merkle ? MINT_FEE_MERKLE : MINT_FEE; 
        }
        if (mintCount > 1) {
            payableCost *= mintCount;
            cost *= mintCount;
        }

        // Check price
        require(msg.value >= payableCost, "Invalid amount");
        if (erc20 == ADDRESS_ZERO && cost != 0) {
            // solhint-disable-next-line
            (bool sent, ) = recipient.call{value: cost}("");
            require(sent, "Failed to transfer to receiver");
        }
    }

    function _transferFundsProxy(address erc20, uint256 cost, address payable recipient, uint16 mintCount, bool merkle) internal {
        require(erc20 == address(0) && _proxyAddresses.contains(msg.sender), "Not approved");
        uint256 payableCost = cost + (merkle ? MINT_FEE_MERKLE : MINT_FEE);
        if (mintCount > 1) {
            payableCost *= mintCount;
            cost *= mintCount;
        }
        // Check price
        require(msg.value == payableCost, "Invalid amount");
        if (cost != 0) {
            // solhint-disable-next-line
            (bool sent, ) = recipient.call{value: cost}("");
            require(sent, "Failed to transfer to receiver");
        }
    }

    function _checkMintIndex(address creatorContractAddress, uint256 claimIndex, bytes32 merkleRoot, uint32 mintIndex) internal view returns (bool) {
        uint256 claimMintIndex = mintIndex >> 8;
        require(merkleRoot != "", "Can only check merkle claims");
        uint256 claimMintTracking = _claimMintIndices[creatorContractAddress][claimIndex][claimMintIndex];
        uint256 mintBitmask = 1 << (mintIndex & MINT_INDEX_BITMASK);
        return mintBitmask & claimMintTracking != 0;
    }

    function _validateMint(address creatorContractAddress, uint256 claimIndex, uint48 startDate, uint48 endDate, uint32 walletMax, bytes32 merkleRoot, uint32 mintIndex, bytes32[] calldata merkleProof, address mintFor) internal {
        // Check timestamps
        require(
            (startDate <= block.timestamp) &&
            (endDate == 0 || endDate >= block.timestamp),
            "Claim inactive"
        );

        if (merkleRoot != "") {
            // Merkle mint
            _checkMerkleAndUpdate(msg.sender, creatorContractAddress, claimIndex, merkleRoot, mintIndex, merkleProof, mintFor);
        } else {
            require(mintFor == msg.sender, "Invalid input");
            // Non-merkle mint
            if (walletMax != 0) {
                require(++_mintsPerWallet[creatorContractAddress][claimIndex][msg.sender] <= walletMax, "Maximum tokens already minted for this wallet");
            }
        }
    }

    function _validateMint(address creatorContractAddress, uint256 claimIndex, uint48 startDate, uint48 endDate, uint32 walletMax, bytes32 merkleRoot, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) internal {
        // Check timestamps
        require(
            (startDate <= block.timestamp) &&
            (endDate == 0 || endDate >= block.timestamp),
            "Claim inactive"
        );

        if (merkleRoot != "") {
            require(mintCount == mintIndices.length && mintCount == merkleProofs.length, "Invalid input");
            // Merkle mint
            for (uint256 i; i < mintCount;) {
                _checkMerkleAndUpdate(msg.sender, creatorContractAddress, claimIndex, merkleRoot, mintIndices[i], merkleProofs[i], mintFor);
                unchecked { ++i; }
            }
        } else {
            require(mintFor == msg.sender, "Invalid input");
            // Non-merkle mint
            if (walletMax != 0) {
                _mintsPerWallet[creatorContractAddress][claimIndex][mintFor] += mintCount;
                require(_mintsPerWallet[creatorContractAddress][claimIndex][mintFor] <= walletMax, "Too many requested for this wallet");
            }
        }
    }

    function _validateMintProxy(address creatorContractAddress, uint256 claimIndex, uint48 startDate, uint48 endDate, uint32 walletMax, bytes32 merkleRoot, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) internal {
        // Check timestamps
        require(
            (startDate <= block.timestamp) &&
            (endDate == 0 || endDate >= block.timestamp),
            "Claim inactive"
        );

        if (merkleRoot != "") {
            require(mintCount == mintIndices.length && mintCount == merkleProofs.length, "Invalid input");
            // Merkle mint
            for (uint256 i; i < mintCount;) {
                // Proxy mints treat the mintFor as the transaction sender
                _checkMerkleAndUpdate(mintFor, creatorContractAddress, claimIndex, merkleRoot, mintIndices[i], merkleProofs[i], mintFor);
                unchecked { ++i; }
            }
        } else {
            // Non-merkle mint
            if (walletMax != 0) {
                _mintsPerWallet[creatorContractAddress][claimIndex][mintFor] += mintCount;
                require(_mintsPerWallet[creatorContractAddress][claimIndex][mintFor] <= walletMax, "Too many requested for this wallet");
            }
        }
    }

    function _checkMerkleAndUpdate(address sender, address creatorContractAddress, uint256 claimIndex, bytes32 merkleRoot, uint32 mintIndex, bytes32[] memory merkleProof, address mintFor) private {
        // Merkle mint
        bytes32 leaf;
        if (mintFor == sender) {
            leaf = keccak256(abi.encodePacked(sender, mintIndex));
        } else {
            // Direct verification failed, try delegate verification
            IDelegationRegistry dr = IDelegationRegistry(DELEGATION_REGISTRY);
            require(dr.checkDelegateForContract(sender, mintFor, address(this)), "Invalid delegate");
            leaf = keccak256(abi.encodePacked(mintFor, mintIndex));
        }
        require(MerkleProof.verify(merkleProof, merkleRoot, leaf), "Could not verify merkle proof");

        // Check if mintIndex has been minted
        uint256 claimMintIndex = mintIndex >> 8;
        uint256 claimMintTracking = _claimMintIndices[creatorContractAddress][claimIndex][claimMintIndex];
        uint256 mintBitmask = 1 << (mintIndex & MINT_INDEX_BITMASK);
        require(mintBitmask & claimMintTracking == 0, "Already minted");
        _claimMintIndices[creatorContractAddress][claimIndex][claimMintIndex] = claimMintTracking | mintBitmask;
    }

    function _getTotalMints(uint32 walletMax, address minter, address creatorContractAddress, uint256 claimIndex) internal view returns(uint32) {
        require(walletMax != 0, "Can only retrieve for non-merkle claims with walletMax");
        return uint32(_mintsPerWallet[creatorContractAddress][claimIndex][minter]);
    }

}

File 4 of 19 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 5 of 19 : ICreatorExtensionTokenURI.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @dev Implement this if you want your extension to have overloadable URI's
 */
interface ICreatorExtensionTokenURI is IERC165 {

    /**
     * Get the uri for a given creator/tokenId
     */
    function tokenURI(address creator, uint256 tokenId) external view returns (string memory);
}

File 6 of 19 : IERC721CreatorCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "./ICreatorCore.sol";

/**
 * @dev Core ERC721 creator interface
 */
interface IERC721CreatorCore is ICreatorCore {

    /**
     * @dev mint a token with no extension. Can only be called by an admin.
     * Returns tokenId minted
     */
    function mintBase(address to) external returns (uint256);

    /**
     * @dev mint a token with no extension. Can only be called by an admin.
     * Returns tokenId minted
     */
    function mintBase(address to, string calldata uri) external returns (uint256);

    /**
     * @dev batch mint a token with no extension. Can only be called by an admin.
     * Returns tokenId minted
     */
    function mintBaseBatch(address to, uint16 count) external returns (uint256[] memory);

    /**
     * @dev batch mint a token with no extension. Can only be called by an admin.
     * Returns tokenId minted
     */
    function mintBaseBatch(address to, string[] calldata uris) external returns (uint256[] memory);

    /**
     * @dev mint a token. Can only be called by a registered extension.
     * Returns tokenId minted
     */
    function mintExtension(address to) external returns (uint256);

    /**
     * @dev mint a token. Can only be called by a registered extension.
     * Returns tokenId minted
     */
    function mintExtension(address to, string calldata uri) external returns (uint256);

    /**
     * @dev batch mint a token. Can only be called by a registered extension.
     * Returns tokenIds minted
     */
    function mintExtensionBatch(address to, uint16 count) external returns (uint256[] memory);

    /**
     * @dev batch mint a token. Can only be called by a registered extension.
     * Returns tokenId minted
     */
    function mintExtensionBatch(address to, string[] calldata uris) external returns (uint256[] memory);

    /**
     * @dev burn a token. Can only be called by token owner or approved address.
     * On burn, calls back to the registered extension's onBurn method
     */
    function burn(uint256 tokenId) external;

}

File 7 of 19 : ILazyPayableClaim.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

/**
 * Lazy Payable Claim interface
 */
interface ILazyPayableClaim {
    enum StorageProtocol { INVALID, NONE, ARWEAVE, IPFS }
    
    event ClaimInitialized(address indexed creatorContract, uint256 indexed claimIndex, address initializer);
    event ClaimUpdated(address indexed creatorContract, uint256 indexed claimIndex);
    event ClaimMint(address indexed creatorContract, uint256 indexed claimIndex);
    event ClaimMintBatch(address indexed creatorContract, uint256 indexed claimIndex, uint16 mintCount);
    event ClaimMintProxy(address indexed creatorContract, uint256 indexed claimIndex, uint16 mintCount, address proxy, address mintFor);

    /**
     * @notice Withdraw funds
     */
    function withdraw(address payable receiver, uint256 amount) external;

    /**
     * @notice Set the Manifold Membership address
     */
    function setMembershipAddress(address membershipAddress) external;

    /**
     * @notice Add mint proxy addresses
     */
    function addMintProxyAddresses(address[] calldata proxyAddresses) external;

    /**
     * @notice Remove mint proxy addresses
     */
    function removeMintProxyAddresses(address[] calldata proxyAddresses) external;

    /**
     * @notice check if a mint index has been consumed or not (only for merkle claims)
     *
     * @param creatorContractAddress    the address of the creator contract for the claim
     * @param claimIndex                the index of the claim
     * @param mintIndex                 the mint index of the claim
     * @return                          whether or not the mint index was consumed
     */
    function checkMintIndex(address creatorContractAddress, uint256 claimIndex, uint32 mintIndex) external view returns(bool);

    /**
     * @notice check if multiple mint indices has been consumed or not (only for merkle claims)
     *
     * @param creatorContractAddress    the address of the creator contract for the claim
     * @param claimIndex                the index of the claim
     * @param mintIndices               the mint index of the claim
     * @return                          whether or not the mint index was consumed
     */
    function checkMintIndices(address creatorContractAddress, uint256 claimIndex, uint32[] calldata mintIndices) external view returns(bool[] memory);

    /**
     * @notice get mints made for a wallet (only for non-merkle claims with walletMax)
     *
     * @param minter                    the address of the minting address
     * @param creatorContractAddress    the address of the creator contract for the claim
     * @param claimIndex                the index of the claim
     * @return                          how many mints the minter has made
     */
    function getTotalMints(address minter, address creatorContractAddress, uint256 claimIndex) external view returns(uint32);

    /**
     * @notice allow a wallet to lazily claim a token according to parameters
     * @param creatorContractAddress    the creator contract address
     * @param claimIndex                the index of the claim for which we will mint
     * @param mintIndex                 the mint index (only needed for merkle claims)
     * @param merkleProof               if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it  (only needed for merkle claims)
     * @param mintFor                   mintFor must be the msg.sender or a delegate wallet address (in the case of merkle based mints)
     */
    function mint(address creatorContractAddress, uint256 claimIndex, uint32 mintIndex, bytes32[] calldata merkleProof, address mintFor) external payable;

    /**
     * @notice allow a wallet to lazily claim a token according to parameters
     * @param creatorContractAddress    the creator contract address
     * @param claimIndex                the index of the claim for which we will mint
     * @param mintCount                 the number of claims to mint
     * @param mintIndices               the mint index (only needed for merkle claims)
     * @param merkleProofs              if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it  (only needed for merkle claims)
     * @param mintFor                   mintFor must be the msg.sender or a delegate wallet address (in the case of merkle based mints)
     */
    function mintBatch(address creatorContractAddress, uint256 claimIndex, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) external payable;

    /**
     * @notice allow a proxy to mint a token for another address (non-merkle mints only)
     * @param creatorContractAddress    the creator contract address
     * @param claimIndex                the index of the claim for which we will mint
     * @param mintCount                 the number of claims to mint
     * @param mintIndices               the mint index (only needed for merkle claims)
     * @param merkleProofs              if the claim has a merkleRoot, verifying merkleProof ensures that address + minterValue was used to construct it  (only needed for merkle claims)
     * @param mintFor                   the address to mint for
     */
    function mintProxy(address creatorContractAddress, uint256 claimIndex, uint16 mintCount, uint32[] calldata mintIndices, bytes32[][] calldata merkleProofs, address mintFor) external payable;

}

File 8 of 19 : IManifoldMembership.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

/**
 * Manifold Membership interface
 */
interface IManifoldMembership {
   function isActiveMember(address sender) external view returns (bool);
}

File 9 of 19 : IDelegationRegistry.sol
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.9;

/**
 * @title An immutable registry contract to be deployed as a standalone primitive
 * @dev See EIP-5639, new project launches can read previous cold wallet -> hot wallet delegations
 * from here and integrate those permissions into their flow
 */
interface IDelegationRegistry {
    /// @notice Delegation type
    enum DelegationType {
        NONE,
        ALL,
        CONTRACT,
        TOKEN
    }

    /// @notice Info about a single delegation, used for onchain enumeration
    struct DelegationInfo {
        DelegationType type_;
        address vault;
        address delegate;
        address contract_;
        uint256 tokenId;
    }

    /// @notice Info about a single contract-level delegation
    struct ContractDelegation {
        address contract_;
        address delegate;
    }

    /// @notice Info about a single token-level delegation
    struct TokenDelegation {
        address contract_;
        uint256 tokenId;
        address delegate;
    }

    /// @notice Emitted when a user delegates their entire wallet
    event DelegateForAll(address vault, address delegate, bool value);

    /// @notice Emitted when a user delegates a specific contract
    event DelegateForContract(address vault, address delegate, address contract_, bool value);

    /// @notice Emitted when a user delegates a specific token
    event DelegateForToken(address vault, address delegate, address contract_, uint256 tokenId, bool value);

    /// @notice Emitted when a user revokes all delegations
    event RevokeAllDelegates(address vault);

    /// @notice Emitted when a user revoes all delegations for a given delegate
    event RevokeDelegate(address vault, address delegate);

    /**
     * -----------  WRITE -----------
     */

    /**
     * @notice Allow the delegate to act on your behalf for all contracts
     * @param delegate The hotwallet to act on your behalf
     * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking
     */
    function delegateForAll(address delegate, bool value) external;

    /**
     * @notice Allow the delegate to act on your behalf for a specific contract
     * @param delegate The hotwallet to act on your behalf
     * @param contract_ The address for the contract you're delegating
     * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking
     */
    function delegateForContract(address delegate, address contract_, bool value) external;

    /**
     * @notice Allow the delegate to act on your behalf for a specific token
     * @param delegate The hotwallet to act on your behalf
     * @param contract_ The address for the contract you're delegating
     * @param tokenId The token id for the token you're delegating
     * @param value Whether to enable or disable delegation for this address, true for setting and false for revoking
     */
    function delegateForToken(address delegate, address contract_, uint256 tokenId, bool value) external;

    /**
     * @notice Revoke all delegates
     */
    function revokeAllDelegates() external;

    /**
     * @notice Revoke a specific delegate for all their permissions
     * @param delegate The hotwallet to revoke
     */
    function revokeDelegate(address delegate) external;

    /**
     * @notice Remove yourself as a delegate for a specific vault
     * @param vault The vault which delegated to the msg.sender, and should be removed
     */
    function revokeSelf(address vault) external;

    /**
     * -----------  READ -----------
     */

    /**
     * @notice Returns all active delegations a given delegate is able to claim on behalf of
     * @param delegate The delegate that you would like to retrieve delegations for
     * @return info Array of DelegationInfo structs
     */
    function getDelegationsByDelegate(address delegate) external view returns (DelegationInfo[] memory);

    /**
     * @notice Returns an array of wallet-level delegates for a given vault
     * @param vault The cold wallet who issued the delegation
     * @return addresses Array of wallet-level delegates for a given vault
     */
    function getDelegatesForAll(address vault) external view returns (address[] memory);

    /**
     * @notice Returns an array of contract-level delegates for a given vault and contract
     * @param vault The cold wallet who issued the delegation
     * @param contract_ The address for the contract you're delegating
     * @return addresses Array of contract-level delegates for a given vault and contract
     */
    function getDelegatesForContract(address vault, address contract_) external view returns (address[] memory);

    /**
     * @notice Returns an array of contract-level delegates for a given vault's token
     * @param vault The cold wallet who issued the delegation
     * @param contract_ The address for the contract holding the token
     * @param tokenId The token id for the token you're delegating
     * @return addresses Array of contract-level delegates for a given vault's token
     */
    function getDelegatesForToken(address vault, address contract_, uint256 tokenId)
        external
        view
        returns (address[] memory);

    /**
     * @notice Returns all contract-level delegations for a given vault
     * @param vault The cold wallet who issued the delegations
     * @return delegations Array of ContractDelegation structs
     */
    function getContractLevelDelegations(address vault)
        external
        view
        returns (ContractDelegation[] memory delegations);

    /**
     * @notice Returns all token-level delegations for a given vault
     * @param vault The cold wallet who issued the delegations
     * @return delegations Array of TokenDelegation structs
     */
    function getTokenLevelDelegations(address vault) external view returns (TokenDelegation[] memory delegations);

    /**
     * @notice Returns true if the address is delegated to act on the entire vault
     * @param delegate The hotwallet to act on your behalf
     * @param vault The cold wallet who issued the delegation
     */
    function checkDelegateForAll(address delegate, address vault) external view returns (bool);

    /**
     * @notice Returns true if the address is delegated to act on your behalf for a token contract or an entire vault
     * @param delegate The hotwallet to act on your behalf
     * @param contract_ The address for the contract you're delegating
     * @param vault The cold wallet who issued the delegation
     */
    function checkDelegateForContract(address delegate, address vault, address contract_)
        external
        view
        returns (bool);

    /**
     * @notice Returns true if the address is delegated to act on your behalf for a specific token, the token's contract or an entire vault
     * @param delegate The hotwallet to act on your behalf
     * @param contract_ The address for the contract you're delegating
     * @param tokenId The token id for the token you're delegating
     * @param vault The cold wallet who issued the delegation
     */
    function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId)
        external
        view
        returns (bool);
}

File 10 of 19 : Strings.sol
// 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);
    }
}

File 11 of 19 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 12 of 19 : MerkleProof.sol
// 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)
        }
    }
}

File 13 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 14 of 19 : AdminControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IAdminControl.sol";

abstract contract AdminControl is Ownable, IAdminControl, ERC165 {
    using EnumerableSet for EnumerableSet.AddressSet;

    // Track registered admins
    EnumerableSet.AddressSet private _admins;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IAdminControl).interfaceId
            || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Only allows approved admins to call the specified function
     */
    modifier adminRequired() {
        require(owner() == msg.sender || _admins.contains(msg.sender), "AdminControl: Must be owner or admin");
        _;
    }   

    /**
     * @dev See {IAdminControl-getAdmins}.
     */
    function getAdmins() external view override returns (address[] memory admins) {
        admins = new address[](_admins.length());
        for (uint i = 0; i < _admins.length(); i++) {
            admins[i] = _admins.at(i);
        }
        return admins;
    }

    /**
     * @dev See {IAdminControl-approveAdmin}.
     */
    function approveAdmin(address admin) external override onlyOwner {
        if (!_admins.contains(admin)) {
            emit AdminApproved(admin, msg.sender);
            _admins.add(admin);
        }
    }

    /**
     * @dev See {IAdminControl-revokeAdmin}.
     */
    function revokeAdmin(address admin) external override onlyOwner {
        if (_admins.contains(admin)) {
            emit AdminRevoked(admin, msg.sender);
            _admins.remove(admin);
        }
    }

    /**
     * @dev See {IAdminControl-isAdmin}.
     */
    function isAdmin(address admin) public override view returns (bool) {
        return (owner() == admin || _admins.contains(admin));
    }

}

File 15 of 19 : ICreatorCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @dev Core creator interface
 */
interface ICreatorCore is IERC165 {

    event ExtensionRegistered(address indexed extension, address indexed sender);
    event ExtensionUnregistered(address indexed extension, address indexed sender);
    event ExtensionBlacklisted(address indexed extension, address indexed sender);
    event MintPermissionsUpdated(address indexed extension, address indexed permissions, address indexed sender);
    event RoyaltiesUpdated(uint256 indexed tokenId, address payable[] receivers, uint256[] basisPoints);
    event DefaultRoyaltiesUpdated(address payable[] receivers, uint256[] basisPoints);
    event ApproveTransferUpdated(address extension);
    event ExtensionRoyaltiesUpdated(address indexed extension, address payable[] receivers, uint256[] basisPoints);
    event ExtensionApproveTransferUpdated(address indexed extension, bool enabled);

    /**
     * @dev gets address of all extensions
     */
    function getExtensions() external view returns (address[] memory);

    /**
     * @dev add an extension.  Can only be called by contract owner or admin.
     * extension address must point to a contract implementing ICreatorExtension.
     * Returns True if newly added, False if already added.
     */
    function registerExtension(address extension, string calldata baseURI) external;

    /**
     * @dev add an extension.  Can only be called by contract owner or admin.
     * extension address must point to a contract implementing ICreatorExtension.
     * Returns True if newly added, False if already added.
     */
    function registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) external;

    /**
     * @dev add an extension.  Can only be called by contract owner or admin.
     * Returns True if removed, False if already removed.
     */
    function unregisterExtension(address extension) external;

    /**
     * @dev blacklist an extension.  Can only be called by contract owner or admin.
     * This function will destroy all ability to reference the metadata of any tokens created
     * by the specified extension. It will also unregister the extension if needed.
     * Returns True if removed, False if already removed.
     */
    function blacklistExtension(address extension) external;

    /**
     * @dev set the baseTokenURI of an extension.  Can only be called by extension.
     */
    function setBaseTokenURIExtension(string calldata uri) external;

    /**
     * @dev set the baseTokenURI of an extension.  Can only be called by extension.
     * For tokens with no uri configured, tokenURI will return "uri+tokenId"
     */
    function setBaseTokenURIExtension(string calldata uri, bool identical) external;

    /**
     * @dev set the common prefix of an extension.  Can only be called by extension.
     * If configured, and a token has a uri set, tokenURI will return "prefixURI+tokenURI"
     * Useful if you want to use ipfs/arweave
     */
    function setTokenURIPrefixExtension(string calldata prefix) external;

    /**
     * @dev set the tokenURI of a token extension.  Can only be called by extension that minted token.
     */
    function setTokenURIExtension(uint256 tokenId, string calldata uri) external;

    /**
     * @dev set the tokenURI of a token extension for multiple tokens.  Can only be called by extension that minted token.
     */
    function setTokenURIExtension(uint256[] memory tokenId, string[] calldata uri) external;

    /**
     * @dev set the baseTokenURI for tokens with no extension.  Can only be called by owner/admin.
     * For tokens with no uri configured, tokenURI will return "uri+tokenId"
     */
    function setBaseTokenURI(string calldata uri) external;

    /**
     * @dev set the common prefix for tokens with no extension.  Can only be called by owner/admin.
     * If configured, and a token has a uri set, tokenURI will return "prefixURI+tokenURI"
     * Useful if you want to use ipfs/arweave
     */
    function setTokenURIPrefix(string calldata prefix) external;

    /**
     * @dev set the tokenURI of a token with no extension.  Can only be called by owner/admin.
     */
    function setTokenURI(uint256 tokenId, string calldata uri) external;

    /**
     * @dev set the tokenURI of multiple tokens with no extension.  Can only be called by owner/admin.
     */
    function setTokenURI(uint256[] memory tokenIds, string[] calldata uris) external;

    /**
     * @dev set a permissions contract for an extension.  Used to control minting.
     */
    function setMintPermissions(address extension, address permissions) external;

    /**
     * @dev Configure so transfers of tokens created by the caller (must be extension) gets approval
     * from the extension before transferring
     */
    function setApproveTransferExtension(bool enabled) external;

    /**
     * @dev get the extension of a given token
     */
    function tokenExtension(uint256 tokenId) external view returns (address);

    /**
     * @dev Set default royalties
     */
    function setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) external;

    /**
     * @dev Set royalties of a token
     */
    function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;

    /**
     * @dev Set royalties of an extension
     */
    function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external;

    /**
     * @dev Get royalites of a token.  Returns list of receivers and basisPoints
     */
    function getRoyalties(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
    
    // Royalty support for various other standards
    function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory);
    function getFeeBps(uint256 tokenId) external view returns (uint[] memory);
    function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
    function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);

    /**
     * @dev Set the default approve transfer contract location.
     */
    function setApproveTransfer(address extension) external; 

    /**
     * @dev Get the default approve transfer contract location.
     */
    function getApproveTransfer() external view returns (address);
}

File 16 of 19 : IAdminControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @dev Interface for admin control
 */
interface IAdminControl is IERC165 {

    event AdminApproved(address indexed account, address indexed sender);
    event AdminRevoked(address indexed account, address indexed sender);

    /**
     * @dev gets address of all admins
     */
    function getAdmins() external view returns (address[] memory);

    /**
     * @dev add an admin.  Can only be called by contract owner.
     */
    function approveAdmin(address admin) external;

    /**
     * @dev remove an admin.  Can only be called by contract owner.
     */
    function revokeAdmin(address admin) external;

    /**
     * @dev checks whether or not given address is an admin
     * Returns True if they are
     */
    function isAdmin(address admin) external view returns (bool);

}

File 17 of 19 : Ownable.sol
// 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);
    }
}

File 18 of 19 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 19 of 19 : Context.sol
// 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;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"delegationRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creatorContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"claimIndex","type":"uint256"},{"indexed":false,"internalType":"address","name":"initializer","type":"address"}],"name":"ClaimInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creatorContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"claimIndex","type":"uint256"}],"name":"ClaimMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creatorContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"claimIndex","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"mintCount","type":"uint16"}],"name":"ClaimMintBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creatorContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"claimIndex","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"mintCount","type":"uint16"},{"indexed":false,"internalType":"address","name":"proxy","type":"address"},{"indexed":false,"internalType":"address","name":"mintFor","type":"address"}],"name":"ClaimMintProxy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creatorContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"claimIndex","type":"uint256"}],"name":"ClaimUpdated","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"},{"inputs":[],"name":"DELEGATION_REGISTRY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MEMBERSHIP_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_FEE_MERKLE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"proxyAddresses","type":"address[]"}],"name":"addMintProxyAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"},{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint16[]","name":"amounts","type":"uint16[]"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"approveAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"},{"internalType":"uint32","name":"mintIndex","type":"uint32"}],"name":"checkMintIndex","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"},{"internalType":"uint32[]","name":"mintIndices","type":"uint32[]"}],"name":"checkMintIndices","outputs":[{"internalType":"bool[]","name":"minted","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAdmins","outputs":[{"internalType":"address[]","name":"admins","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"}],"name":"getClaim","outputs":[{"components":[{"internalType":"uint32","name":"total","type":"uint32"},{"internalType":"uint32","name":"totalMax","type":"uint32"},{"internalType":"uint32","name":"walletMax","type":"uint32"},{"internalType":"uint48","name":"startDate","type":"uint48"},{"internalType":"uint48","name":"endDate","type":"uint48"},{"internalType":"enum ILazyPayableClaim.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"bool","name":"identical","type":"bool"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"string","name":"location","type":"string"},{"internalType":"uint256","name":"cost","type":"uint256"},{"internalType":"address payable","name":"paymentReceiver","type":"address"},{"internalType":"address","name":"erc20","type":"address"}],"internalType":"struct IERC721LazyPayableClaim.Claim","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"}],"name":"getTotalMints","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"},{"components":[{"internalType":"uint32","name":"totalMax","type":"uint32"},{"internalType":"uint32","name":"walletMax","type":"uint32"},{"internalType":"uint48","name":"startDate","type":"uint48"},{"internalType":"uint48","name":"endDate","type":"uint48"},{"internalType":"enum ILazyPayableClaim.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"bool","name":"identical","type":"bool"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"string","name":"location","type":"string"},{"internalType":"uint256","name":"cost","type":"uint256"},{"internalType":"address payable","name":"paymentReceiver","type":"address"},{"internalType":"address","name":"erc20","type":"address"}],"internalType":"struct IERC721LazyPayableClaim.ClaimParameters","name":"claimParameters","type":"tuple"}],"name":"initializeClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"},{"internalType":"uint32","name":"mintIndex","type":"uint32"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"address","name":"mintFor","type":"address"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"},{"internalType":"uint16","name":"mintCount","type":"uint16"},{"internalType":"uint32[]","name":"mintIndices","type":"uint32[]"},{"internalType":"bytes32[][]","name":"merkleProofs","type":"bytes32[][]"},{"internalType":"address","name":"mintFor","type":"address"}],"name":"mintBatch","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"},{"internalType":"uint16","name":"mintCount","type":"uint16"},{"internalType":"uint32[]","name":"mintIndices","type":"uint32[]"},{"internalType":"bytes32[][]","name":"merkleProofs","type":"bytes32[][]"},{"internalType":"address","name":"mintFor","type":"address"}],"name":"mintProxy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"proxyAddresses","type":"address[]"}],"name":"removeMintProxyAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"revokeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"membershipAddress","type":"address"}],"name":"setMembershipAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"uri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"},{"components":[{"internalType":"uint32","name":"totalMax","type":"uint32"},{"internalType":"uint32","name":"walletMax","type":"uint32"},{"internalType":"uint48","name":"startDate","type":"uint48"},{"internalType":"uint48","name":"endDate","type":"uint48"},{"internalType":"enum ILazyPayableClaim.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"bool","name":"identical","type":"bool"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"string","name":"location","type":"string"},{"internalType":"uint256","name":"cost","type":"uint256"},{"internalType":"address payable","name":"paymentReceiver","type":"address"},{"internalType":"address","name":"erc20","type":"address"}],"internalType":"struct IERC721LazyPayableClaim.ClaimParameters","name":"claimParameters","type":"tuple"}],"name":"updateClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"claimIndex","type":"uint256"},{"internalType":"enum ILazyPayableClaim.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"bool","name":"identical","type":"bool"},{"internalType":"string","name":"location","type":"string"}],"name":"updateTokenURIParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b506040516200551f3803806200551f8339810160408190526200003491620000a3565b80620000403362000053565b6001600160a01b031660805250620000d5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000b657600080fd5b81516001600160a01b0381168114620000ce57600080fd5b9392505050565b608051615427620000f860003960008181610327015261416f01526154276000f3fe6080604052600436106101b75760003560e01c80637ab39392116100ec578063d7bf81a31161008a578063f2fde38b11610064578063f2fde38b1461050d578063f3fef3a31461052d578063f8a6137b1461054d578063fa2b068f1461057a57600080fd5b8063d7bf81a3146104a5578063e9dc6375146104c0578063ea38446d146104ed57600080fd5b806399c14347116100c657806399c143471461041c5780639c8eb4891461043c578063cb7997161461045c578063cda085361461048557600080fd5b80637ab39392146103be5780638da5cb5b146103de578063975b4d95146103fc57600080fd5b806342f3bef411610159578063511952f611610133578063511952f6146103495780635f2f5129146103695780636d73e66914610389578063715018a6146103a957600080fd5b806342f3bef4146102a85780634baa62bf146102dd5780634daadff71461031557600080fd5b806324d7806c1161019557806324d7806c1461023357806326c858a4146102535780632d3456701461026657806331ae450b1461028657600080fd5b806301ffc9a7146101bc57806307591acc146101f15780630f79ab3914610206575b600080fd5b3480156101c857600080fd5b506101dc6101d736600461459d565b61058d565b60405190151581526020015b60405180910390f35b6102046101ff36600461464a565b610692565b005b34801561021257600080fd5b506102266102213660046146fa565b61099e565b6040516101e891906147ae565b34801561023f57600080fd5b506101dc61024e3660046148aa565b610b7d565b61020461026136600461464a565b610bb6565b34801561027257600080fd5b506102046102813660046148aa565b610e98565b34801561029257600080fd5b5061029b610ef6565b6040516101e891906148c7565b3480156102b457600080fd5b506102c86102c3366004614914565b610fa5565b60405163ffffffff90911681526020016101e8565b3480156102e957600080fd5b506003546102fd906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b34801561032157600080fd5b506102fd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561035557600080fd5b50610204610364366004614955565b610fcd565b34801561037557600080fd5b50610204610384366004614997565b61109e565b34801561039557600080fd5b506102046103a43660046148aa565b6114e2565b3480156103b557600080fd5b5061020461153a565b3480156103ca57600080fd5b506102046103d93660046148aa565b61154e565b3480156103ea57600080fd5b506000546001600160a01b03166102fd565b34801561040857600080fd5b50610204610417366004614a23565b6115f6565b34801561042857600080fd5b50610204610437366004614aac565b611c64565b34801561044857600080fd5b50610204610457366004614c68565b612270565b34801561046857600080fd5b506104776602738d24e5200081565b6040519081526020016101e8565b34801561049157600080fd5b506101dc6104a0366004614d97565b612977565b3480156104b157600080fd5b506104776601c6bf5263400081565b3480156104cc57600080fd5b506104e06104db3660046146fa565b612996565b6040516101e89190614dd5565b3480156104f957600080fd5b50610204610508366004614955565b612d05565b34801561051957600080fd5b506102046105283660046148aa565b612dd1565b34801561053957600080fd5b506102046105483660046146fa565b612e5e565b34801561055957600080fd5b5061056d610568366004614de8565b612f87565b6040516101e89190614e44565b610204610588366004614e7e565b613053565b60006001600160e01b031982167fc242404b0000000000000000000000000000000000000000000000000000000014806105f057506001600160e01b031982167f9e231af400000000000000000000000000000000000000000000000000000000145b8061062457506001600160e01b031982167fe9dc637500000000000000000000000000000000000000000000000000000000145b8061065857506001600160e01b031982167f553e757e00000000000000000000000000000000000000000000000000000000145b8061068c57506001600160e01b031982167f01ffc9a700000000000000000000000000000000000000000000000000000000145b92915050565b600061069e89896132bd565b805490915061ffff88169082906000906106bf90849063ffffffff16614f17565b82546101009290920a63ffffffff8181021990931691831602179091558254640100000000900416159050806107065750805463ffffffff64010000000082048116911611155b6107615760405162461bcd60e51b815260206004820152602160248201527f546f6f206d616e792072657175657374656420666f72207468697320636c61696044820152606d60f81b60648201526084015b60405180910390fd5b805460018201546107a6918b918b9165ffffffffffff600160601b8204811692600160901b83049091169163ffffffff600160401b90910416908d8d8d8d8d8d61334b565b80546000906107c09061ffff8a169063ffffffff16614f34565b6107cb906001614f17565b600583015460038401546004850154600186015463ffffffff949094169450610807936001600160a01b0393841693909116908c9015156135c3565b60405163e00aab4b60e01b81526001600160a01b03848116600483015261ffff8a166024830152600091908c169063e00aab4b906044016000604051808303816000875af115801561085d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108859190810190614f51565b905060005b8961ffff1681101561093a5760405180604001604052808c6001600160e01b0316815260200182856108bc9190614ff7565b63ffffffff1690526001600160a01b038d16600090815260096020526040812084519091908590859081106108f3576108f361500a565b6020908102919091018101518252818101929092526040016000208251929091015163ffffffff16600160e01b026001600160e01b0390921691909117905560010161088a565b506040805161ffff8b1681523360208201526001600160a01b03868116928201929092528b918d16907f61039ad47d0b05ec206a4450fd164cc2055af66ac594c12b8dd747e8803a90de906060015b60405180910390a35050505050505050505050565b604080516101808101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e0820183905261010082015261012081018290526101408101829052610160810191909152610a0883836132bd565b6040805161018081018252825463ffffffff8082168352640100000000820481166020840152600160401b8204169282019290925265ffffffffffff600160601b830481166060830152600160901b8304166080820152919060a083019060ff600160c01b909104166003811115610a8257610a82614726565b6003811115610a9357610a93614726565b81528154600160c81b900460ff161515602082015260018201546040820152600282018054606090920191610ac790615020565b80601f0160208091040260200160405190810160405280929190818152602001828054610af390615020565b8015610b405780601f10610b1557610100808354040283529160200191610b40565b820191906000526020600020905b815481529060010190602001808311610b2357829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b0390811660408301526005909201549091166060909101529392505050565b6000816001600160a01b0316610b9b6000546001600160a01b031690565b6001600160a01b0316148061068c575061068c600183613786565b6000610bc289896132bd565b805490915061ffff8816908290600090610be390849063ffffffff16614f17565b82546101009290920a63ffffffff818102199093169183160217909155825464010000000090041615905080610c2a5750805463ffffffff64010000000082048116911611155b610c805760405162461bcd60e51b815260206004820152602160248201527f546f6f206d616e792072657175657374656420666f72207468697320636c61696044820152606d60f81b6064820152608401610758565b80546001820154610cc5918b918b9165ffffffffffff600160601b8204811692600160901b83049091169163ffffffff600160401b90910416908d8d8d8d8d8d6137ab565b8054600090610cdf9061ffff8a169063ffffffff16614f34565b610cea906001614f17565b600583015460038401546004850154600186015463ffffffff949094169450610d26936001600160a01b0393841693909116908c9015156138e8565b60405163e00aab4b60e01b815233600482015261ffff891660248201526000906001600160a01b038c169063e00aab4b906044016000604051808303816000875af1158015610d79573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610da19190810190614f51565b905060005b8961ffff16811015610e565760405180604001604052808c6001600160e01b031681526020018285610dd89190614ff7565b63ffffffff1690526001600160a01b038d1660009081526009602052604081208451909190859085908110610e0f57610e0f61500a565b6020908102919091018101518252818101929092526040016000208251929091015163ffffffff16600160e01b026001600160e01b03909216919091179055600101610da6565b5060405161ffff8a1681528a906001600160a01b038d16907f74f5d3254dfa39a7b1217a27d5d9b3e061eafe11720eca1cf499da2dc1eb125990602001610989565b610ea0613b81565b610eab600182613786565b15610ef35760405133906001600160a01b038316907f7c0c3c84c67c85fcac635147348bfe374c24a1a93d0366d1cfe9d8853cbf89d590600090a3610ef1600182613bdb565b505b50565b6060610f026001613bf0565b67ffffffffffffffff811115610f1a57610f1a614b5d565b604051908082528060200260200182016040528015610f43578160200160208202803683370190505b50905060005b610f536001613bf0565b811015610fa157610f65600182613bfa565b828281518110610f7757610f7761500a565b6001600160a01b039092166020928302919091019091015280610f998161505a565b915050610f49565b5090565b600080610fb2848461099e565b9050610fc48160400151868686613c06565b95945050505050565b33610fe06000546001600160a01b031690565b6001600160a01b03161480610ffb5750610ffb600133613786565b6110535760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610758565b60005b81811015611099576110908383838181106110735761107361500a565b905060200201602081019061108891906148aa565b600690613bdb565b50600101611056565b505050565b604051630935e01b60e21b8152336004820152869081906001600160a01b038216906324d7806c90602401602060405180830381865afa1580156110e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110a9190615073565b61116a5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610758565b8483146111df5760405162461bcd60e51b815260206004820152603160248201527f556e657175616c206e756d626572206f6620726563697069656e747320616e6460448201527f20616d6f756e74732070726f76696465640000000000000000000000000000006064820152608401610758565b6001600160a01b03881660009081526008602090815260408083208a8452909152812080549091906112189063ffffffff166001614f17565b63ffffffff16905060005b878110156113c25760008b6001600160a01b031663e00aab4b8b8b8581811061124e5761124e61500a565b905060200201602081019061126391906148aa565b8a8a868181106112755761127561500a565b905060200201602081019061128a9190615090565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015261ffff1660248201526044016000604051808303816000875af11580156112d9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113019190810190614f51565b905060005b81518110156113b35760405180604001604052808d6001600160e01b0316815260200182866113359190614ff7565b63ffffffff1690526001600160a01b038e166000908152600960205260408120845190919085908590811061136c5761136c61500a565b6020908102919091018101518252818101929092526040016000208251929091015163ffffffff16600160e01b026001600160e01b03909216919091179055600101611306565b50519190910190600101611223565b50815463ffffffff906001906113da908316846150ab565b6113e491906150ab565b11156114325760405162461bcd60e51b815260206004820152601260248201527f546f6f206d616e792072657175657374656400000000000000000000000000006044820152606401610758565b81546001906114479063ffffffff16836150ab565b61145191906150ab565b8254839060009061146990849063ffffffff16614f17565b82546101009290920a63ffffffff818102199093169183160217909155835464010000000090041615801591506114b05750815463ffffffff640100000000820481169116115b156114d657815464010000000063ffffffff82160267ffffffff00000000199091161782555b50505050505050505050565b6114ea613b81565b6114f5600182613786565b610ef35760405133906001600160a01b038316907f7e1a1a08d52e4ba0e21554733d66165fd5151f99460116223d9e3a608eec5cb190600090a3610ef1600182613cbb565b611542613b81565b61154c6000613cd0565b565b336115616000546001600160a01b031690565b6001600160a01b0316148061157c575061157c600133613786565b6115d45760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610758565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b604051630935e01b60e21b8152336004820152839081906001600160a01b038216906324d7806c90602401602060405180830381865afa15801561163e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116629190615073565b6116c25760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610758565b60006001600160a01b0386166000908152600860209081526040808320888452909152902054600160c01b900460ff16600381111561170357611703614726565b146117505760405162461bcd60e51b815260206004820152601960248201527f436c61696d20616c726561647920696e697469616c697a6564000000000000006044820152606401610758565b600061176260a08501608086016150be565b600381111561177357611773614726565b036117e65760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420696e697469616c697a65207769746820696e76616c6964207360448201527f746f726167652070726f746f636f6c00000000000000000000000000000000006064820152608401610758565b6117f660808401606085016150d9565b65ffffffffffff161580611837575061181560808401606085016150d9565b65ffffffffffff1661182d60608501604086016150d9565b65ffffffffffff16105b6118a95760405162461bcd60e51b815260206004820152603660248201527f43616e6e6f74206861766520737461727444617465206772656174657220746860448201527f616e206f7220657175616c20746f20656e6444617465000000000000000000006064820152608401610758565b60c083013515806118cd57506118c560408401602085016150f4565b63ffffffff16155b61193f5760405162461bcd60e51b815260206004820152602c60248201527f43616e6e6f742070726f7669646520626f74682077616c6c65744d617820616e60448201527f64206d65726b6c65526f6f7400000000000000000000000000000000000000006064820152608401610758565b60408051610180810190915260008152602080820190611961908601866150f4565b63ffffffff16815260200184602001602081019061197f91906150f4565b63ffffffff16815260200161199a60608601604087016150d9565b65ffffffffffff1681526020016119b760808601606087016150d9565b65ffffffffffff1681526020016119d460a08601608087016150be565b60038111156119e5576119e5614726565b81526020016119fa60c0860160a0870161510f565b1515815260c08501356020820152604001611a1860e086018661512c565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506101008501356020820152604001611a6f610140860161012087016148aa565b6001600160a01b03168152602001611a8f610160860161014087016148aa565b6001600160a01b03908116909152861660009081526008602090815260408083208884528252918290208351815492850151938501516060860151608087015165ffffffffffff908116600160901b0265ffffffffffff60901b1991909216600160601b0271ffffffffffff0000000000000000000000001963ffffffff948516600160401b021671ffffffffffffffffffff0000000000000000199885166401000000000267ffffffffffffffff199098169490951693909317959095179590951691909117179182168317815560a084015190929091839160ff60c01b191666ffffffffffffff60901b1990911617600160c01b836003811115611b9757611b97614726565b021790555060c08201518154901515600160c81b0260ff60c81b1990911617815560e082015160018201556101008201516002820190611bd790826151b9565b5061012082015160038201556101408201516004820180546001600160a01b03199081166001600160a01b039384161790915561016090930151600590920180549093169181169190911790915560405133815285918716907fd02727da4c6c6c111e00310108209a4de39f6817414df43ca1a10730d47c6a349060200160405180910390a35050505050565b604051630935e01b60e21b8152336004820152869081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015611cac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd09190615073565b611d305760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610758565b6001600160a01b03881660009081526008602090815260408083208a84528252808320815161018081018352815463ffffffff80821683526401000000008204811695830195909552600160401b81049094169281019290925265ffffffffffff600160601b840481166060840152600160901b8404166080830152909160a083019060ff600160c01b909104166003811115611dcf57611dcf614726565b6003811115611de057611de0614726565b81528154600160c81b900460ff161515602082015260018201546040820152600282018054606090920191611e1490615020565b80601f0160208091040260200160405190810160405280929190818152602001828054611e4090615020565b8015611e8d5780601f10611e6257610100808354040283529160200191611e8d565b820191906000526020600020905b815481529060010190602001808311611e7057829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b039081166040830152600590920154909116606090910152905060006001600160a01b038a1660009081526008602090815260408083208c8452909152902054600160c01b900460ff166003811115611f0657611f06614726565b03611f535760405162461bcd60e51b815260206004820152601560248201527f436c61696d206e6f7420696e697469616c697a656400000000000000000000006044820152606401610758565b6000876003811115611f6757611f67614726565b03611fc05760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420696e76616c69642073746f726167652070726f746f60448201526218dbdb60ea1b6064820152608401610758565b604051806101800160405280826000015163ffffffff168152602001826020015163ffffffff168152602001826040015163ffffffff168152602001826060015165ffffffffffff168152602001826080015165ffffffffffff16815260200188600381111561203257612032614726565b815260200187151581526020018260e00151815260200186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050506101208401516020808401919091526101408501516001600160a01b039081166040808601919091526101608701518216606095860152908e168352600882528083208d845282529182902084518154928601519386015194860151608087015165ffffffffffff908116600160901b0265ffffffffffff60901b1991909216600160601b0271ffffffffffff0000000000000000000000001963ffffffff988916600160401b021671ffffffffffffffffffff0000000000000000199789166401000000000267ffffffffffffffff199097169890941697909717949094179490941617939093179081168217835560a084015191839160ff60c01b1990911666ffffffffffffff60901b1990911617600160c01b8360038111156121a9576121a9614726565b021790555060c08201518154901515600160c81b0260ff60c81b1990911617815560e0820151600182015561010082015160028201906121e990826151b9565b5061012082015160038201556101408201516004820180546001600160a01b03199081166001600160a01b039384161790915561016090930151600590920180549093169181169190911790915560405189918b16907f657336af9bb6c51d60c05491508d7d3026a24ee549d7a0af42e44c75bfaec47c90600090a3505050505050505050565b604051630935e01b60e21b8152336004820152839081906001600160a01b038216906324d7806c90602401602060405180830381865afa1580156122b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122dc9190615073565b61233c5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610758565b6001600160a01b03851660009081526008602090815260408083208784528252808320815161018081018352815463ffffffff80821683526401000000008204811695830195909552600160401b81049094169281019290925265ffffffffffff600160601b840481166060840152600160901b8404166080830152909160a083019060ff600160c01b9091041660038111156123db576123db614726565b60038111156123ec576123ec614726565b81528154600160c81b900460ff16151560208201526001820154604082015260028201805460609092019161242090615020565b80601f016020809104026020016040519081016040528092919081815260200182805461244c90615020565b80156124995780601f1061246e57610100808354040283529160200191612499565b820191906000526020600020905b81548152906001019060200180831161247c57829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b039081166040830152600590920154909116606090910152905060008160a0015160038111156124e9576124e9614726565b036125365760405162461bcd60e51b815260206004820152601560248201527f436c61696d206e6f7420696e697469616c697a656400000000000000000000006044820152606401610758565b60008460800151600381111561254e5761254e614726565b036125a75760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420696e76616c69642073746f726167652070726f746f60448201526218dbdb60ea1b6064820152608401610758565b606084015165ffffffffffff1615806125d75750836060015165ffffffffffff16846040015165ffffffffffff16105b6126495760405162461bcd60e51b815260206004820152603660248201527f43616e6e6f74206861766520737461727444617465206772656174657220746860448201527f616e206f7220657175616c20746f20656e6444617465000000000000000000006064820152608401610758565b8061016001516001600160a01b03168461014001516001600160a01b0316146126b45760405162461bcd60e51b815260206004820152601b60248201527f43616e6e6f74206368616e6765207061796d656e7420746f6b656e00000000006044820152606401610758565b835163ffffffff16158015906126d557508351815163ffffffff9182169116115b156126e557805163ffffffff1684525b604051806101800160405280826000015163ffffffff168152602001856000015163ffffffff168152602001856020015163ffffffff168152602001856040015165ffffffffffff168152602001856060015165ffffffffffff1681526020018560800151600381111561275b5761275b614726565b815260a080870151151560208084019190915260c08089015160408086019190915260e08a01516060808701919091526101008b01516080808801919091526101208c01516001600160a01b03908116878901526101608a015181169490970193909352948c166000908152600884528181208c82528452819020865181549488015192880151968801519388015165ffffffffffff908116600160901b0265ffffffffffff60901b1991909516600160601b0271ffffffffffff0000000000000000000000001963ffffffff998a16600160401b021671ffffffffffffffffffff000000000000000019958a166401000000000267ffffffffffffffff19909816999093169890981795909517929092169190911794909417918216811784559184015191839160ff60c01b1990911666ffffffffffffff60901b1990911617600160c01b8360038111156128b3576128b3614726565b021790555060c08201518154901515600160c81b0260ff60c81b1990911617815560e0820151600182015561010082015160028201906128f390826151b9565b5061012082015160038201556101408201516004820180546001600160a01b03199081166001600160a01b039384161790915561016090930151600590920180549093169181169190911790915560405186918816907f657336af9bb6c51d60c05491508d7d3026a24ee549d7a0af42e44c75bfaec47c90600090a3505050505050565b600080612984858561099e565b9050610fc485858360e0015186613d20565b6001600160a01b03821660009081526009602090815260408083208484528252918290208251808401909352546001600160e01b038116808452600160e01b90910463ffffffff169183019190915260609190612a355760405162461bcd60e51b815260206004820152601460248201527f546f6b656e20646f6573206e6f742065786973740000000000000000000000006044820152606401610758565b6001600160a01b038416600090815260086020908152604080832084516001600160e01b031684528252808320815161018081018352815463ffffffff80821683526401000000008204811695830195909552600160401b81049094169281019290925265ffffffffffff600160601b840481166060840152600160901b8404166080830152909160a083019060ff600160c01b909104166003811115612ade57612ade614726565b6003811115612aef57612aef614726565b81528154600160c81b900460ff161515602082015260018201546040820152600282018054606090920191612b2390615020565b80601f0160208091040260200160405190810160405280929190818152602001828054612b4f90615020565b8015612b9c5780601f10612b7157610100808354040283529160200191612b9c565b820191906000526020600020905b815481529060010190602001808311612b7f57829003601f168201915b5050509183525050600382015460208083019190915260048301546001600160a01b039081166040808501919091526005909401541660609092019190915281519081019091526000815290915060028260a001516003811115612c0257612c02614726565b03612c41575060408051808201909152601481527f68747470733a2f2f617277656176652e6e65742f0000000000000000000000006020820152612c94565b60038260a001516003811115612c5957612c59614726565b03612c94575060408051808201909152600781527f697066733a2f2f0000000000000000000000000000000000000000000000000060208201525b610100820151604051612cab918391602001615279565b60405160208183030381529060405293508160c00151612cfc5783612cd9846020015163ffffffff16613dba565b604051602001612cea9291906152a8565b60405160208183030381529060405293505b50505092915050565b33612d186000546001600160a01b031690565b6001600160a01b03161480612d335750612d33600133613786565b612d8b5760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610758565b60005b8181101561109957612dc8838383818110612dab57612dab61500a565b9050602002016020810190612dc091906148aa565b600690613cbb565b50600101612d8e565b612dd9613b81565b6001600160a01b038116612e555760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610758565b610ef381613cd0565b33612e716000546001600160a01b031690565b6001600160a01b03161480612e8c5750612e8c600133613786565b612ee45760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610758565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612f31576040519150601f19603f3d011682016040523d82523d6000602084013e612f36565b606091505b50509050806110995760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f207472616e7366657220746f20726563656976657200006044820152606401610758565b60606000612f95868661099e565b9050828067ffffffffffffffff811115612fb157612fb1614b5d565b604051908082528060200260200182016040528015612fda578160200160208202803683370190505b50925060005b818110156130485761301e88888560e001518989868181106130045761300461500a565b905060200201602081019061301991906150f4565b613d20565b8482815181106130305761303061500a565b91151560209283029190910190910152600101612fe0565b505050949350505050565b600061305f87876132bd565b805490915063ffffffff640100000000820481169183916000916130839116615300565b91906101000a81548163ffffffff021916908363ffffffff160217905563ffffffff161115806130c057508054640100000000900463ffffffff16155b6131325760405162461bcd60e51b815260206004820152602c60248201527f4d6178696d756d20746f6b656e7320616c7265616479206d696e74656420666f60448201527f72207468697320636c61696d00000000000000000000000000000000000000006064820152608401610758565b80546001820154613175918991899165ffffffffffff600160601b8204811692600160901b83049091169163ffffffff600160401b90910416908b8b8b8b613ef7565b6005810154600382015460048301546001808501546131a5946001600160a01b03908116949316919015156138e8565b6040517f2928ca580000000000000000000000000000000000000000000000000000000081523360048201526000906001600160a01b03891690632928ca58906024016020604051808303816000875af1158015613207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061322b9190615323565b6040805180820182526001600160e01b03808b168252855463ffffffff90811660208085019182526001600160a01b038f1660008181526009835287812089825290925286822095519251909316600160e01b0291909316179092559151929350899290917f5d404f369772cfab2b65717fca9bc2077efeab89a0dbec036bf0c13783154eb191a35050505050505050565b6001600160a01b03821660009081526008602090815260408083208484529091528120908154600160c01b900460ff1660038111156132fe576132fe614726565b0361068c5760405162461bcd60e51b815260206004820152601560248201527f436c61696d206e6f7420696e697469616c697a656400000000000000000000006044820152606401610758565b428a65ffffffffffff161115801561337b575065ffffffffffff8916158061337b5750428965ffffffffffff1610155b6133b85760405162461bcd60e51b815260206004820152600e60248201526d436c61696d20696e61637469766560901b6044820152606401610758565b86156134b85761ffff8616841480156133d4575061ffff861682145b6134105760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b6044820152606401610758565b60005b8661ffff168110156134b2576134aa828e8e8b8a8a878181106134385761343861500a565b905060200201602081019061344d91906150f4565b89898881811061345f5761345f61500a565b9050602002810190613471919061533c565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b92506140be915050565b600101613413565b506135b5565b63ffffffff8816156135b5576001600160a01b03808d1660009081526004602090815260408083208f845282528083209385168352929052908120805461ffff89169290613507908490614ff7565b90915550506001600160a01b03808d1660009081526004602090815260408083208f845282528083209385168352929052205463ffffffff891610156135b55760405162461bcd60e51b815260206004820152602260248201527f546f6f206d616e792072657175657374656420666f7220746869732077616c6c60448201527f65740000000000000000000000000000000000000000000000000000000000006064820152608401610758565b505050505050505050505050565b6001600160a01b0385161580156135e057506135e0600633613786565b61362c5760405162461bcd60e51b815260206004820152600c60248201527f4e6f7420617070726f76656400000000000000000000000000000000000000006044820152606401610758565b600081613640576601c6bf52634000613649565b6602738d24e520005b6136539086614ff7565b905060018361ffff1611156136835761367061ffff841682615386565b905061368061ffff841686615386565b94505b8034146136d25760405162461bcd60e51b815260206004820152600e60248201527f496e76616c696420616d6f756e740000000000000000000000000000000000006044820152606401610758565b841561377e576000846001600160a01b0316866040515b60006040518083038185875af1925050503d8060008114613726576040519150601f19603f3d011682016040523d82523d6000602084013e61372b565b606091505b505090508061377c5760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f207472616e7366657220746f20726563656976657200006044820152606401610758565b505b505050505050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b428a65ffffffffffff16111580156137db575065ffffffffffff891615806137db5750428965ffffffffffff1610155b6138185760405162461bcd60e51b815260206004820152600e60248201526d436c61696d20696e61637469766560901b6044820152606401610758565b86156138a05761ffff861684148015613834575061ffff861682145b6138705760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b6044820152606401610758565b60005b8661ffff168110156134b257613898338e8e8b8a8a878181106134385761343861500a565b600101613873565b6001600160a01b03811633146134b85760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b6044820152606401610758565b60006001600160a01b038616156139e1576001600160a01b0386166323b872dd338661391861ffff88168a615386565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af115801561396c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139909190615073565b6139dc5760405162461bcd60e51b815260206004820152601260248201527f496e73756666696369656e742066756e647300000000000000000000000000006044820152606401610758565b6139e4565b50835b6003546001600160a01b031615613aab576003546040517f45ecd02f0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03909116906345ecd02f90602401602060405180830381865afa158015613a56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a7a9190615073565b613aa65781613a90576601c6bf52634000613a99565b6602738d24e520005b613aa39082614ff7565b90505b613ad3565b81613abd576601c6bf52634000613ac6565b6602738d24e520005b613ad09082614ff7565b90505b60018361ffff161115613b0157613aee61ffff841682615386565b9050613afe61ffff841686615386565b94505b80341015613b515760405162461bcd60e51b815260206004820152600e60248201527f496e76616c696420616d6f756e740000000000000000000000000000000000006044820152606401610758565b6001600160a01b038616158015613b6757508415155b1561377e576000846001600160a01b0316866040516136e9565b6000546001600160a01b0316331461154c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610758565b60006137a4836001600160a01b038416614398565b600061068c825490565b60006137a48383614492565b60008463ffffffff16600003613c845760405162461bcd60e51b815260206004820152603660248201527f43616e206f6e6c7920726574726965766520666f72206e6f6e2d6d65726b6c6560448201527f20636c61696d7320776974682077616c6c65744d6178000000000000000000006064820152608401610758565b506001600160a01b038083166000908152600460209081526040808320858452825280832093871683529290522054949350505050565b60006137a4836001600160a01b0384166144bc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600062ffffff600883901c16838203613d7b5760405162461bcd60e51b815260206004820152601c60248201527f43616e206f6e6c7920636865636b206d65726b6c6520636c61696d73000000006044820152606401610758565b6001600160a01b038616600090815260056020908152604080832088845282528083209383529290522054600160ff84161b1615159050949350505050565b606081600003613dfd57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115613e275780613e118161505a565b9150613e209050600a836153b3565b9150613e01565b60008167ffffffffffffffff811115613e4257613e42614b5d565b6040519080825280601f01601f191660200182016040528015613e6c576020820181803683370190505b5090505b8415613eef57613e816001836150ab565b9150613e8e600a866153c7565b613e99906030614ff7565b60f81b818381518110613eae57613eae61500a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350613ee8600a866153b3565b9450613e70565b949350505050565b428865ffffffffffff1611158015613f27575065ffffffffffff87161580613f275750428765ffffffffffff1610155b613f645760405162461bcd60e51b815260206004820152600e60248201526d436c61696d20696e61637469766560901b6044820152606401610758565b8415613fb257613fad338b8b88888888808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508a92506140be915050565b6114d6565b6001600160a01b0381163314613ffa5760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b6044820152606401610758565b63ffffffff8616156114d6576001600160a01b038a1660009081526004602090815260408083208c845282528083203384529091528120805463ffffffff891692906140459061505a565b918290555011156114d65760405162461bcd60e51b815260206004820152602d60248201527f4d6178696d756d20746f6b656e7320616c7265616479206d696e74656420666f60448201527f7220746869732077616c6c6574000000000000000000000000000000000000006064820152608401610758565b6000876001600160a01b0316826001600160a01b031603614129576040516bffffffffffffffffffffffff1960608a901b1660208201526001600160e01b031960e086901b166034820152603801604051602081830303815290604052805190602001209050614276565b6040517f90c9a2d00000000000000000000000000000000000000000000000000000000081526001600160a01b03898116600483015283811660248301523060448301527f000000000000000000000000000000000000000000000000000000000000000091908216906390c9a2d090606401602060405180830381865afa1580156141b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141dd9190615073565b6142295760405162461bcd60e51b815260206004820152601060248201527f496e76616c69642064656c6567617465000000000000000000000000000000006044820152606401610758565b6040516bffffffffffffffffffffffff19606085901b1660208201526001600160e01b031960e087901b166034820152603801604051602081830303815290604052805190602001209150505b61428183868361450b565b6142cd5760405162461bcd60e51b815260206004820152601d60248201527f436f756c64206e6f7420766572696679206d65726b6c652070726f6f660000006044820152606401610758565b6001600160a01b0387166000908152600560209081526040808320898452825280832062ffffff600889901c16808552925290912054600160ff87161b8082161561435a5760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d696e7465640000000000000000000000000000000000006044820152606401610758565b6001600160a01b0390991660009081526005602090815260408083209a83529981528982209382529290925296902095909617909455505050505050565b600081815260018301602052604081205480156144815760006143bc6001836150ab565b85549091506000906143d0906001906150ab565b90508181146144355760008660000182815481106143f0576143f061500a565b90600052602060002001549050808760000184815481106144135761441361500a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614446576144466153db565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061068c565b600091505061068c565b5092915050565b60008260000182815481106144a9576144a961500a565b9060005260206000200154905092915050565b60008181526001830160205260408120546145035750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561068c565b50600061068c565b6000826145188584614521565b14949350505050565b600081815b845181101561456657614552828683815181106145455761454561500a565b602002602001015161456e565b91508061455e8161505a565b915050614526565b509392505050565b600081831061458a5760008281526020849052604090206137a4565b60008381526020839052604090206137a4565b6000602082840312156145af57600080fd5b81356001600160e01b0319811681146137a457600080fd5b6001600160a01b0381168114610ef357600080fd5b80356145e7816145c7565b919050565b803561ffff811681146145e757600080fd5b60008083601f84011261461057600080fd5b50813567ffffffffffffffff81111561462857600080fd5b6020830191508360208260051b850101111561464357600080fd5b9250929050565b60008060008060008060008060c0898b03121561466657600080fd5b8835614671816145c7565b97506020890135965061468660408a016145ec565b9550606089013567ffffffffffffffff808211156146a357600080fd5b6146af8c838d016145fe565b909750955060808b01359150808211156146c857600080fd5b506146d58b828c016145fe565b90945092505060a08901356146e9816145c7565b809150509295985092959890939650565b6000806040838503121561470d57600080fd5b8235614718816145c7565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6004811061475a57634e487b7160e01b600052602160045260246000fd5b9052565b60005b83811015614779578181015183820152602001614761565b50506000910152565b6000815180845261479a81602086016020860161475e565b601f01601f19169290920160200192915050565b602081526147c560208201835163ffffffff169052565b600060208301516147de604084018263ffffffff169052565b50604083015163ffffffff8116606084015250606083015165ffffffffffff8116608084015250608083015165ffffffffffff811660a08401525060a083015161482b60c084018261473c565b5060c083015180151560e08401525060e0830151610100838101919091528301516101806101208085018290526148666101a0860184614782565b9086015161014086810191909152860151909250610160614891818701836001600160a01b03169052565b909501516001600160a01b031693019290925250919050565b6000602082840312156148bc57600080fd5b81356137a4816145c7565b6020808252825182820181905260009190848201906040850190845b818110156149085783516001600160a01b0316835292840192918401916001016148e3565b50909695505050505050565b60008060006060848603121561492957600080fd5b8335614934816145c7565b92506020840135614944816145c7565b929592945050506040919091013590565b6000806020838503121561496857600080fd5b823567ffffffffffffffff81111561497f57600080fd5b61498b858286016145fe565b90969095509350505050565b600080600080600080608087890312156149b057600080fd5b86356149bb816145c7565b955060208701359450604087013567ffffffffffffffff808211156149df57600080fd5b6149eb8a838b016145fe565b90965094506060890135915080821115614a0457600080fd5b50614a1189828a016145fe565b979a9699509497509295939492505050565b600080600060608486031215614a3857600080fd5b8335614a43816145c7565b925060208401359150604084013567ffffffffffffffff811115614a6657600080fd5b84016101608187031215614a7957600080fd5b809150509250925092565b8035600481106145e757600080fd5b8015158114610ef357600080fd5b80356145e781614a93565b60008060008060008060a08789031215614ac557600080fd5b8635614ad0816145c7565b955060208701359450614ae560408801614a84565b93506060870135614af581614a93565b9250608087013567ffffffffffffffff80821115614b1257600080fd5b818901915089601f830112614b2657600080fd5b813581811115614b3557600080fd5b8a6020828501011115614b4757600080fd5b6020830194508093505050509295509295509295565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff81118282101715614b9757614b97614b5d565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614bc657614bc6614b5d565b604052919050565b803563ffffffff811681146145e757600080fd5b803565ffffffffffff811681146145e757600080fd5b600082601f830112614c0957600080fd5b813567ffffffffffffffff811115614c2357614c23614b5d565b614c36601f8201601f1916602001614b9d565b818152846020838601011115614c4b57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215614c7d57600080fd5b8335614c88816145c7565b925060208401359150604084013567ffffffffffffffff80821115614cac57600080fd5b908501906101608288031215614cc157600080fd5b614cc9614b73565b614cd283614bce565b8152614ce060208401614bce565b6020820152614cf160408401614be2565b6040820152614d0260608401614be2565b6060820152614d1360808401614a84565b6080820152614d2460a08401614aa1565b60a082015260c083013560c082015260e083013582811115614d4557600080fd5b614d5189828601614bf8565b60e08301525061010083810135908201526101209150614d728284016145dc565b828201526101409150614d868284016145dc565b828201528093505050509250925092565b600080600060608486031215614dac57600080fd5b8335614db7816145c7565b925060208401359150614dcc60408501614bce565b90509250925092565b6020815260006137a46020830184614782565b60008060008060608587031215614dfe57600080fd5b8435614e09816145c7565b935060208501359250604085013567ffffffffffffffff811115614e2c57600080fd5b614e38878288016145fe565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b81811015614908578351151583529284019291840191600101614e60565b60008060008060008060a08789031215614e9757600080fd5b8635614ea2816145c7565b955060208701359450614eb760408801614bce565b9350606087013567ffffffffffffffff811115614ed357600080fd5b614edf89828a016145fe565b9094509250506080870135614ef3816145c7565b809150509295509295509295565b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821601908082111561448b5761448b614f01565b63ffffffff82811682821603908082111561448b5761448b614f01565b60006020808385031215614f6457600080fd5b825167ffffffffffffffff80821115614f7c57600080fd5b818501915085601f830112614f9057600080fd5b815181811115614fa257614fa2614b5d565b8060051b9150614fb3848301614b9d565b8181529183018401918481019088841115614fcd57600080fd5b938501935b83851015614feb57845182529385019390850190614fd2565b98975050505050505050565b8082018082111561068c5761068c614f01565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061503457607f821691505b60208210810361505457634e487b7160e01b600052602260045260246000fd5b50919050565b60006001820161506c5761506c614f01565b5060010190565b60006020828403121561508557600080fd5b81516137a481614a93565b6000602082840312156150a257600080fd5b6137a4826145ec565b8181038181111561068c5761068c614f01565b6000602082840312156150d057600080fd5b6137a482614a84565b6000602082840312156150eb57600080fd5b6137a482614be2565b60006020828403121561510657600080fd5b6137a482614bce565b60006020828403121561512157600080fd5b81356137a481614a93565b6000808335601e1984360301811261514357600080fd5b83018035915067ffffffffffffffff82111561515e57600080fd5b60200191503681900382131561464357600080fd5b601f82111561109957600081815260208120601f850160051c8101602086101561519a5750805b601f850160051c820191505b8181101561377e578281556001016151a6565b815167ffffffffffffffff8111156151d3576151d3614b5d565b6151e7816151e18454615020565b84615173565b602080601f83116001811461521c57600084156152045750858301515b600019600386901b1c1916600185901b17855561377e565b600085815260208120601f198616915b8281101561524b5788860151825594840194600190910190840161522c565b50858210156152695787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000835161528b81846020880161475e565b83519083019061529f81836020880161475e565b01949350505050565b600083516152ba81846020880161475e565b7f2f0000000000000000000000000000000000000000000000000000000000000090830190815283516152f481600184016020880161475e565b01600101949350505050565b600063ffffffff80831681810361531957615319614f01565b6001019392505050565b60006020828403121561533557600080fd5b5051919050565b6000808335601e1984360301811261535357600080fd5b83018035915067ffffffffffffffff82111561536e57600080fd5b6020019150600581901b360382131561464357600080fd5b808202811582820484141761068c5761068c614f01565b634e487b7160e01b600052601260045260246000fd5b6000826153c2576153c261539d565b500490565b6000826153d6576153d661539d565b500690565b634e487b7160e01b600052603160045260246000fdfea26469706673582212202fbaacd8823514426e3cf61c68cc76485dad05a4cb671a75602fcaa6e93c585b64736f6c6343000811003300000000000000000000000000000000000076a84fef008cdabe6409d2fe638b

Deployed Bytecode

0x6080604052600436106101b75760003560e01c80637ab39392116100ec578063d7bf81a31161008a578063f2fde38b11610064578063f2fde38b1461050d578063f3fef3a31461052d578063f8a6137b1461054d578063fa2b068f1461057a57600080fd5b8063d7bf81a3146104a5578063e9dc6375146104c0578063ea38446d146104ed57600080fd5b806399c14347116100c657806399c143471461041c5780639c8eb4891461043c578063cb7997161461045c578063cda085361461048557600080fd5b80637ab39392146103be5780638da5cb5b146103de578063975b4d95146103fc57600080fd5b806342f3bef411610159578063511952f611610133578063511952f6146103495780635f2f5129146103695780636d73e66914610389578063715018a6146103a957600080fd5b806342f3bef4146102a85780634baa62bf146102dd5780634daadff71461031557600080fd5b806324d7806c1161019557806324d7806c1461023357806326c858a4146102535780632d3456701461026657806331ae450b1461028657600080fd5b806301ffc9a7146101bc57806307591acc146101f15780630f79ab3914610206575b600080fd5b3480156101c857600080fd5b506101dc6101d736600461459d565b61058d565b60405190151581526020015b60405180910390f35b6102046101ff36600461464a565b610692565b005b34801561021257600080fd5b506102266102213660046146fa565b61099e565b6040516101e891906147ae565b34801561023f57600080fd5b506101dc61024e3660046148aa565b610b7d565b61020461026136600461464a565b610bb6565b34801561027257600080fd5b506102046102813660046148aa565b610e98565b34801561029257600080fd5b5061029b610ef6565b6040516101e891906148c7565b3480156102b457600080fd5b506102c86102c3366004614914565b610fa5565b60405163ffffffff90911681526020016101e8565b3480156102e957600080fd5b506003546102fd906001600160a01b031681565b6040516001600160a01b0390911681526020016101e8565b34801561032157600080fd5b506102fd7f00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b81565b34801561035557600080fd5b50610204610364366004614955565b610fcd565b34801561037557600080fd5b50610204610384366004614997565b61109e565b34801561039557600080fd5b506102046103a43660046148aa565b6114e2565b3480156103b557600080fd5b5061020461153a565b3480156103ca57600080fd5b506102046103d93660046148aa565b61154e565b3480156103ea57600080fd5b506000546001600160a01b03166102fd565b34801561040857600080fd5b50610204610417366004614a23565b6115f6565b34801561042857600080fd5b50610204610437366004614aac565b611c64565b34801561044857600080fd5b50610204610457366004614c68565b612270565b34801561046857600080fd5b506104776602738d24e5200081565b6040519081526020016101e8565b34801561049157600080fd5b506101dc6104a0366004614d97565b612977565b3480156104b157600080fd5b506104776601c6bf5263400081565b3480156104cc57600080fd5b506104e06104db3660046146fa565b612996565b6040516101e89190614dd5565b3480156104f957600080fd5b50610204610508366004614955565b612d05565b34801561051957600080fd5b506102046105283660046148aa565b612dd1565b34801561053957600080fd5b506102046105483660046146fa565b612e5e565b34801561055957600080fd5b5061056d610568366004614de8565b612f87565b6040516101e89190614e44565b610204610588366004614e7e565b613053565b60006001600160e01b031982167fc242404b0000000000000000000000000000000000000000000000000000000014806105f057506001600160e01b031982167f9e231af400000000000000000000000000000000000000000000000000000000145b8061062457506001600160e01b031982167fe9dc637500000000000000000000000000000000000000000000000000000000145b8061065857506001600160e01b031982167f553e757e00000000000000000000000000000000000000000000000000000000145b8061068c57506001600160e01b031982167f01ffc9a700000000000000000000000000000000000000000000000000000000145b92915050565b600061069e89896132bd565b805490915061ffff88169082906000906106bf90849063ffffffff16614f17565b82546101009290920a63ffffffff8181021990931691831602179091558254640100000000900416159050806107065750805463ffffffff64010000000082048116911611155b6107615760405162461bcd60e51b815260206004820152602160248201527f546f6f206d616e792072657175657374656420666f72207468697320636c61696044820152606d60f81b60648201526084015b60405180910390fd5b805460018201546107a6918b918b9165ffffffffffff600160601b8204811692600160901b83049091169163ffffffff600160401b90910416908d8d8d8d8d8d61334b565b80546000906107c09061ffff8a169063ffffffff16614f34565b6107cb906001614f17565b600583015460038401546004850154600186015463ffffffff949094169450610807936001600160a01b0393841693909116908c9015156135c3565b60405163e00aab4b60e01b81526001600160a01b03848116600483015261ffff8a166024830152600091908c169063e00aab4b906044016000604051808303816000875af115801561085d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108859190810190614f51565b905060005b8961ffff1681101561093a5760405180604001604052808c6001600160e01b0316815260200182856108bc9190614ff7565b63ffffffff1690526001600160a01b038d16600090815260096020526040812084519091908590859081106108f3576108f361500a565b6020908102919091018101518252818101929092526040016000208251929091015163ffffffff16600160e01b026001600160e01b0390921691909117905560010161088a565b506040805161ffff8b1681523360208201526001600160a01b03868116928201929092528b918d16907f61039ad47d0b05ec206a4450fd164cc2055af66ac594c12b8dd747e8803a90de906060015b60405180910390a35050505050505050505050565b604080516101808101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e0820183905261010082015261012081018290526101408101829052610160810191909152610a0883836132bd565b6040805161018081018252825463ffffffff8082168352640100000000820481166020840152600160401b8204169282019290925265ffffffffffff600160601b830481166060830152600160901b8304166080820152919060a083019060ff600160c01b909104166003811115610a8257610a82614726565b6003811115610a9357610a93614726565b81528154600160c81b900460ff161515602082015260018201546040820152600282018054606090920191610ac790615020565b80601f0160208091040260200160405190810160405280929190818152602001828054610af390615020565b8015610b405780601f10610b1557610100808354040283529160200191610b40565b820191906000526020600020905b815481529060010190602001808311610b2357829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b0390811660408301526005909201549091166060909101529392505050565b6000816001600160a01b0316610b9b6000546001600160a01b031690565b6001600160a01b0316148061068c575061068c600183613786565b6000610bc289896132bd565b805490915061ffff8816908290600090610be390849063ffffffff16614f17565b82546101009290920a63ffffffff818102199093169183160217909155825464010000000090041615905080610c2a5750805463ffffffff64010000000082048116911611155b610c805760405162461bcd60e51b815260206004820152602160248201527f546f6f206d616e792072657175657374656420666f72207468697320636c61696044820152606d60f81b6064820152608401610758565b80546001820154610cc5918b918b9165ffffffffffff600160601b8204811692600160901b83049091169163ffffffff600160401b90910416908d8d8d8d8d8d6137ab565b8054600090610cdf9061ffff8a169063ffffffff16614f34565b610cea906001614f17565b600583015460038401546004850154600186015463ffffffff949094169450610d26936001600160a01b0393841693909116908c9015156138e8565b60405163e00aab4b60e01b815233600482015261ffff891660248201526000906001600160a01b038c169063e00aab4b906044016000604051808303816000875af1158015610d79573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610da19190810190614f51565b905060005b8961ffff16811015610e565760405180604001604052808c6001600160e01b031681526020018285610dd89190614ff7565b63ffffffff1690526001600160a01b038d1660009081526009602052604081208451909190859085908110610e0f57610e0f61500a565b6020908102919091018101518252818101929092526040016000208251929091015163ffffffff16600160e01b026001600160e01b03909216919091179055600101610da6565b5060405161ffff8a1681528a906001600160a01b038d16907f74f5d3254dfa39a7b1217a27d5d9b3e061eafe11720eca1cf499da2dc1eb125990602001610989565b610ea0613b81565b610eab600182613786565b15610ef35760405133906001600160a01b038316907f7c0c3c84c67c85fcac635147348bfe374c24a1a93d0366d1cfe9d8853cbf89d590600090a3610ef1600182613bdb565b505b50565b6060610f026001613bf0565b67ffffffffffffffff811115610f1a57610f1a614b5d565b604051908082528060200260200182016040528015610f43578160200160208202803683370190505b50905060005b610f536001613bf0565b811015610fa157610f65600182613bfa565b828281518110610f7757610f7761500a565b6001600160a01b039092166020928302919091019091015280610f998161505a565b915050610f49565b5090565b600080610fb2848461099e565b9050610fc48160400151868686613c06565b95945050505050565b33610fe06000546001600160a01b031690565b6001600160a01b03161480610ffb5750610ffb600133613786565b6110535760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610758565b60005b81811015611099576110908383838181106110735761107361500a565b905060200201602081019061108891906148aa565b600690613bdb565b50600101611056565b505050565b604051630935e01b60e21b8152336004820152869081906001600160a01b038216906324d7806c90602401602060405180830381865afa1580156110e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110a9190615073565b61116a5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610758565b8483146111df5760405162461bcd60e51b815260206004820152603160248201527f556e657175616c206e756d626572206f6620726563697069656e747320616e6460448201527f20616d6f756e74732070726f76696465640000000000000000000000000000006064820152608401610758565b6001600160a01b03881660009081526008602090815260408083208a8452909152812080549091906112189063ffffffff166001614f17565b63ffffffff16905060005b878110156113c25760008b6001600160a01b031663e00aab4b8b8b8581811061124e5761124e61500a565b905060200201602081019061126391906148aa565b8a8a868181106112755761127561500a565b905060200201602081019061128a9190615090565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015261ffff1660248201526044016000604051808303816000875af11580156112d9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113019190810190614f51565b905060005b81518110156113b35760405180604001604052808d6001600160e01b0316815260200182866113359190614ff7565b63ffffffff1690526001600160a01b038e166000908152600960205260408120845190919085908590811061136c5761136c61500a565b6020908102919091018101518252818101929092526040016000208251929091015163ffffffff16600160e01b026001600160e01b03909216919091179055600101611306565b50519190910190600101611223565b50815463ffffffff906001906113da908316846150ab565b6113e491906150ab565b11156114325760405162461bcd60e51b815260206004820152601260248201527f546f6f206d616e792072657175657374656400000000000000000000000000006044820152606401610758565b81546001906114479063ffffffff16836150ab565b61145191906150ab565b8254839060009061146990849063ffffffff16614f17565b82546101009290920a63ffffffff818102199093169183160217909155835464010000000090041615801591506114b05750815463ffffffff640100000000820481169116115b156114d657815464010000000063ffffffff82160267ffffffff00000000199091161782555b50505050505050505050565b6114ea613b81565b6114f5600182613786565b610ef35760405133906001600160a01b038316907f7e1a1a08d52e4ba0e21554733d66165fd5151f99460116223d9e3a608eec5cb190600090a3610ef1600182613cbb565b611542613b81565b61154c6000613cd0565b565b336115616000546001600160a01b031690565b6001600160a01b0316148061157c575061157c600133613786565b6115d45760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610758565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b604051630935e01b60e21b8152336004820152839081906001600160a01b038216906324d7806c90602401602060405180830381865afa15801561163e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116629190615073565b6116c25760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610758565b60006001600160a01b0386166000908152600860209081526040808320888452909152902054600160c01b900460ff16600381111561170357611703614726565b146117505760405162461bcd60e51b815260206004820152601960248201527f436c61696d20616c726561647920696e697469616c697a6564000000000000006044820152606401610758565b600061176260a08501608086016150be565b600381111561177357611773614726565b036117e65760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f7420696e697469616c697a65207769746820696e76616c6964207360448201527f746f726167652070726f746f636f6c00000000000000000000000000000000006064820152608401610758565b6117f660808401606085016150d9565b65ffffffffffff161580611837575061181560808401606085016150d9565b65ffffffffffff1661182d60608501604086016150d9565b65ffffffffffff16105b6118a95760405162461bcd60e51b815260206004820152603660248201527f43616e6e6f74206861766520737461727444617465206772656174657220746860448201527f616e206f7220657175616c20746f20656e6444617465000000000000000000006064820152608401610758565b60c083013515806118cd57506118c560408401602085016150f4565b63ffffffff16155b61193f5760405162461bcd60e51b815260206004820152602c60248201527f43616e6e6f742070726f7669646520626f74682077616c6c65744d617820616e60448201527f64206d65726b6c65526f6f7400000000000000000000000000000000000000006064820152608401610758565b60408051610180810190915260008152602080820190611961908601866150f4565b63ffffffff16815260200184602001602081019061197f91906150f4565b63ffffffff16815260200161199a60608601604087016150d9565b65ffffffffffff1681526020016119b760808601606087016150d9565b65ffffffffffff1681526020016119d460a08601608087016150be565b60038111156119e5576119e5614726565b81526020016119fa60c0860160a0870161510f565b1515815260c08501356020820152604001611a1860e086018661512c565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506101008501356020820152604001611a6f610140860161012087016148aa565b6001600160a01b03168152602001611a8f610160860161014087016148aa565b6001600160a01b03908116909152861660009081526008602090815260408083208884528252918290208351815492850151938501516060860151608087015165ffffffffffff908116600160901b0265ffffffffffff60901b1991909216600160601b0271ffffffffffff0000000000000000000000001963ffffffff948516600160401b021671ffffffffffffffffffff0000000000000000199885166401000000000267ffffffffffffffff199098169490951693909317959095179590951691909117179182168317815560a084015190929091839160ff60c01b191666ffffffffffffff60901b1990911617600160c01b836003811115611b9757611b97614726565b021790555060c08201518154901515600160c81b0260ff60c81b1990911617815560e082015160018201556101008201516002820190611bd790826151b9565b5061012082015160038201556101408201516004820180546001600160a01b03199081166001600160a01b039384161790915561016090930151600590920180549093169181169190911790915560405133815285918716907fd02727da4c6c6c111e00310108209a4de39f6817414df43ca1a10730d47c6a349060200160405180910390a35050505050565b604051630935e01b60e21b8152336004820152869081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015611cac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cd09190615073565b611d305760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610758565b6001600160a01b03881660009081526008602090815260408083208a84528252808320815161018081018352815463ffffffff80821683526401000000008204811695830195909552600160401b81049094169281019290925265ffffffffffff600160601b840481166060840152600160901b8404166080830152909160a083019060ff600160c01b909104166003811115611dcf57611dcf614726565b6003811115611de057611de0614726565b81528154600160c81b900460ff161515602082015260018201546040820152600282018054606090920191611e1490615020565b80601f0160208091040260200160405190810160405280929190818152602001828054611e4090615020565b8015611e8d5780601f10611e6257610100808354040283529160200191611e8d565b820191906000526020600020905b815481529060010190602001808311611e7057829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b039081166040830152600590920154909116606090910152905060006001600160a01b038a1660009081526008602090815260408083208c8452909152902054600160c01b900460ff166003811115611f0657611f06614726565b03611f535760405162461bcd60e51b815260206004820152601560248201527f436c61696d206e6f7420696e697469616c697a656400000000000000000000006044820152606401610758565b6000876003811115611f6757611f67614726565b03611fc05760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420696e76616c69642073746f726167652070726f746f60448201526218dbdb60ea1b6064820152608401610758565b604051806101800160405280826000015163ffffffff168152602001826020015163ffffffff168152602001826040015163ffffffff168152602001826060015165ffffffffffff168152602001826080015165ffffffffffff16815260200188600381111561203257612032614726565b815260200187151581526020018260e00151815260200186868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509385525050506101208401516020808401919091526101408501516001600160a01b039081166040808601919091526101608701518216606095860152908e168352600882528083208d845282529182902084518154928601519386015194860151608087015165ffffffffffff908116600160901b0265ffffffffffff60901b1991909216600160601b0271ffffffffffff0000000000000000000000001963ffffffff988916600160401b021671ffffffffffffffffffff0000000000000000199789166401000000000267ffffffffffffffff199097169890941697909717949094179490941617939093179081168217835560a084015191839160ff60c01b1990911666ffffffffffffff60901b1990911617600160c01b8360038111156121a9576121a9614726565b021790555060c08201518154901515600160c81b0260ff60c81b1990911617815560e0820151600182015561010082015160028201906121e990826151b9565b5061012082015160038201556101408201516004820180546001600160a01b03199081166001600160a01b039384161790915561016090930151600590920180549093169181169190911790915560405189918b16907f657336af9bb6c51d60c05491508d7d3026a24ee549d7a0af42e44c75bfaec47c90600090a3505050505050505050565b604051630935e01b60e21b8152336004820152839081906001600160a01b038216906324d7806c90602401602060405180830381865afa1580156122b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122dc9190615073565b61233c5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610758565b6001600160a01b03851660009081526008602090815260408083208784528252808320815161018081018352815463ffffffff80821683526401000000008204811695830195909552600160401b81049094169281019290925265ffffffffffff600160601b840481166060840152600160901b8404166080830152909160a083019060ff600160c01b9091041660038111156123db576123db614726565b60038111156123ec576123ec614726565b81528154600160c81b900460ff16151560208201526001820154604082015260028201805460609092019161242090615020565b80601f016020809104026020016040519081016040528092919081815260200182805461244c90615020565b80156124995780601f1061246e57610100808354040283529160200191612499565b820191906000526020600020905b81548152906001019060200180831161247c57829003601f168201915b50505091835250506003820154602082015260048201546001600160a01b039081166040830152600590920154909116606090910152905060008160a0015160038111156124e9576124e9614726565b036125365760405162461bcd60e51b815260206004820152601560248201527f436c61696d206e6f7420696e697469616c697a656400000000000000000000006044820152606401610758565b60008460800151600381111561254e5761254e614726565b036125a75760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742073657420696e76616c69642073746f726167652070726f746f60448201526218dbdb60ea1b6064820152608401610758565b606084015165ffffffffffff1615806125d75750836060015165ffffffffffff16846040015165ffffffffffff16105b6126495760405162461bcd60e51b815260206004820152603660248201527f43616e6e6f74206861766520737461727444617465206772656174657220746860448201527f616e206f7220657175616c20746f20656e6444617465000000000000000000006064820152608401610758565b8061016001516001600160a01b03168461014001516001600160a01b0316146126b45760405162461bcd60e51b815260206004820152601b60248201527f43616e6e6f74206368616e6765207061796d656e7420746f6b656e00000000006044820152606401610758565b835163ffffffff16158015906126d557508351815163ffffffff9182169116115b156126e557805163ffffffff1684525b604051806101800160405280826000015163ffffffff168152602001856000015163ffffffff168152602001856020015163ffffffff168152602001856040015165ffffffffffff168152602001856060015165ffffffffffff1681526020018560800151600381111561275b5761275b614726565b815260a080870151151560208084019190915260c08089015160408086019190915260e08a01516060808701919091526101008b01516080808801919091526101208c01516001600160a01b03908116878901526101608a015181169490970193909352948c166000908152600884528181208c82528452819020865181549488015192880151968801519388015165ffffffffffff908116600160901b0265ffffffffffff60901b1991909516600160601b0271ffffffffffff0000000000000000000000001963ffffffff998a16600160401b021671ffffffffffffffffffff000000000000000019958a166401000000000267ffffffffffffffff19909816999093169890981795909517929092169190911794909417918216811784559184015191839160ff60c01b1990911666ffffffffffffff60901b1990911617600160c01b8360038111156128b3576128b3614726565b021790555060c08201518154901515600160c81b0260ff60c81b1990911617815560e0820151600182015561010082015160028201906128f390826151b9565b5061012082015160038201556101408201516004820180546001600160a01b03199081166001600160a01b039384161790915561016090930151600590920180549093169181169190911790915560405186918816907f657336af9bb6c51d60c05491508d7d3026a24ee549d7a0af42e44c75bfaec47c90600090a3505050505050565b600080612984858561099e565b9050610fc485858360e0015186613d20565b6001600160a01b03821660009081526009602090815260408083208484528252918290208251808401909352546001600160e01b038116808452600160e01b90910463ffffffff169183019190915260609190612a355760405162461bcd60e51b815260206004820152601460248201527f546f6b656e20646f6573206e6f742065786973740000000000000000000000006044820152606401610758565b6001600160a01b038416600090815260086020908152604080832084516001600160e01b031684528252808320815161018081018352815463ffffffff80821683526401000000008204811695830195909552600160401b81049094169281019290925265ffffffffffff600160601b840481166060840152600160901b8404166080830152909160a083019060ff600160c01b909104166003811115612ade57612ade614726565b6003811115612aef57612aef614726565b81528154600160c81b900460ff161515602082015260018201546040820152600282018054606090920191612b2390615020565b80601f0160208091040260200160405190810160405280929190818152602001828054612b4f90615020565b8015612b9c5780601f10612b7157610100808354040283529160200191612b9c565b820191906000526020600020905b815481529060010190602001808311612b7f57829003601f168201915b5050509183525050600382015460208083019190915260048301546001600160a01b039081166040808501919091526005909401541660609092019190915281519081019091526000815290915060028260a001516003811115612c0257612c02614726565b03612c41575060408051808201909152601481527f68747470733a2f2f617277656176652e6e65742f0000000000000000000000006020820152612c94565b60038260a001516003811115612c5957612c59614726565b03612c94575060408051808201909152600781527f697066733a2f2f0000000000000000000000000000000000000000000000000060208201525b610100820151604051612cab918391602001615279565b60405160208183030381529060405293508160c00151612cfc5783612cd9846020015163ffffffff16613dba565b604051602001612cea9291906152a8565b60405160208183030381529060405293505b50505092915050565b33612d186000546001600160a01b031690565b6001600160a01b03161480612d335750612d33600133613786565b612d8b5760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610758565b60005b8181101561109957612dc8838383818110612dab57612dab61500a565b9050602002016020810190612dc091906148aa565b600690613cbb565b50600101612d8e565b612dd9613b81565b6001600160a01b038116612e555760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610758565b610ef381613cd0565b33612e716000546001600160a01b031690565b6001600160a01b03161480612e8c5750612e8c600133613786565b612ee45760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610758565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612f31576040519150601f19603f3d011682016040523d82523d6000602084013e612f36565b606091505b50509050806110995760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f207472616e7366657220746f20726563656976657200006044820152606401610758565b60606000612f95868661099e565b9050828067ffffffffffffffff811115612fb157612fb1614b5d565b604051908082528060200260200182016040528015612fda578160200160208202803683370190505b50925060005b818110156130485761301e88888560e001518989868181106130045761300461500a565b905060200201602081019061301991906150f4565b613d20565b8482815181106130305761303061500a565b91151560209283029190910190910152600101612fe0565b505050949350505050565b600061305f87876132bd565b805490915063ffffffff640100000000820481169183916000916130839116615300565b91906101000a81548163ffffffff021916908363ffffffff160217905563ffffffff161115806130c057508054640100000000900463ffffffff16155b6131325760405162461bcd60e51b815260206004820152602c60248201527f4d6178696d756d20746f6b656e7320616c7265616479206d696e74656420666f60448201527f72207468697320636c61696d00000000000000000000000000000000000000006064820152608401610758565b80546001820154613175918991899165ffffffffffff600160601b8204811692600160901b83049091169163ffffffff600160401b90910416908b8b8b8b613ef7565b6005810154600382015460048301546001808501546131a5946001600160a01b03908116949316919015156138e8565b6040517f2928ca580000000000000000000000000000000000000000000000000000000081523360048201526000906001600160a01b03891690632928ca58906024016020604051808303816000875af1158015613207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061322b9190615323565b6040805180820182526001600160e01b03808b168252855463ffffffff90811660208085019182526001600160a01b038f1660008181526009835287812089825290925286822095519251909316600160e01b0291909316179092559151929350899290917f5d404f369772cfab2b65717fca9bc2077efeab89a0dbec036bf0c13783154eb191a35050505050505050565b6001600160a01b03821660009081526008602090815260408083208484529091528120908154600160c01b900460ff1660038111156132fe576132fe614726565b0361068c5760405162461bcd60e51b815260206004820152601560248201527f436c61696d206e6f7420696e697469616c697a656400000000000000000000006044820152606401610758565b428a65ffffffffffff161115801561337b575065ffffffffffff8916158061337b5750428965ffffffffffff1610155b6133b85760405162461bcd60e51b815260206004820152600e60248201526d436c61696d20696e61637469766560901b6044820152606401610758565b86156134b85761ffff8616841480156133d4575061ffff861682145b6134105760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b6044820152606401610758565b60005b8661ffff168110156134b2576134aa828e8e8b8a8a878181106134385761343861500a565b905060200201602081019061344d91906150f4565b89898881811061345f5761345f61500a565b9050602002810190613471919061533c565b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b92506140be915050565b600101613413565b506135b5565b63ffffffff8816156135b5576001600160a01b03808d1660009081526004602090815260408083208f845282528083209385168352929052908120805461ffff89169290613507908490614ff7565b90915550506001600160a01b03808d1660009081526004602090815260408083208f845282528083209385168352929052205463ffffffff891610156135b55760405162461bcd60e51b815260206004820152602260248201527f546f6f206d616e792072657175657374656420666f7220746869732077616c6c60448201527f65740000000000000000000000000000000000000000000000000000000000006064820152608401610758565b505050505050505050505050565b6001600160a01b0385161580156135e057506135e0600633613786565b61362c5760405162461bcd60e51b815260206004820152600c60248201527f4e6f7420617070726f76656400000000000000000000000000000000000000006044820152606401610758565b600081613640576601c6bf52634000613649565b6602738d24e520005b6136539086614ff7565b905060018361ffff1611156136835761367061ffff841682615386565b905061368061ffff841686615386565b94505b8034146136d25760405162461bcd60e51b815260206004820152600e60248201527f496e76616c696420616d6f756e740000000000000000000000000000000000006044820152606401610758565b841561377e576000846001600160a01b0316866040515b60006040518083038185875af1925050503d8060008114613726576040519150601f19603f3d011682016040523d82523d6000602084013e61372b565b606091505b505090508061377c5760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f207472616e7366657220746f20726563656976657200006044820152606401610758565b505b505050505050565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b428a65ffffffffffff16111580156137db575065ffffffffffff891615806137db5750428965ffffffffffff1610155b6138185760405162461bcd60e51b815260206004820152600e60248201526d436c61696d20696e61637469766560901b6044820152606401610758565b86156138a05761ffff861684148015613834575061ffff861682145b6138705760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b6044820152606401610758565b60005b8661ffff168110156134b257613898338e8e8b8a8a878181106134385761343861500a565b600101613873565b6001600160a01b03811633146134b85760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b6044820152606401610758565b60006001600160a01b038616156139e1576001600160a01b0386166323b872dd338661391861ffff88168a615386565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af115801561396c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139909190615073565b6139dc5760405162461bcd60e51b815260206004820152601260248201527f496e73756666696369656e742066756e647300000000000000000000000000006044820152606401610758565b6139e4565b50835b6003546001600160a01b031615613aab576003546040517f45ecd02f0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03909116906345ecd02f90602401602060405180830381865afa158015613a56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a7a9190615073565b613aa65781613a90576601c6bf52634000613a99565b6602738d24e520005b613aa39082614ff7565b90505b613ad3565b81613abd576601c6bf52634000613ac6565b6602738d24e520005b613ad09082614ff7565b90505b60018361ffff161115613b0157613aee61ffff841682615386565b9050613afe61ffff841686615386565b94505b80341015613b515760405162461bcd60e51b815260206004820152600e60248201527f496e76616c696420616d6f756e740000000000000000000000000000000000006044820152606401610758565b6001600160a01b038616158015613b6757508415155b1561377e576000846001600160a01b0316866040516136e9565b6000546001600160a01b0316331461154c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610758565b60006137a4836001600160a01b038416614398565b600061068c825490565b60006137a48383614492565b60008463ffffffff16600003613c845760405162461bcd60e51b815260206004820152603660248201527f43616e206f6e6c7920726574726965766520666f72206e6f6e2d6d65726b6c6560448201527f20636c61696d7320776974682077616c6c65744d6178000000000000000000006064820152608401610758565b506001600160a01b038083166000908152600460209081526040808320858452825280832093871683529290522054949350505050565b60006137a4836001600160a01b0384166144bc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600062ffffff600883901c16838203613d7b5760405162461bcd60e51b815260206004820152601c60248201527f43616e206f6e6c7920636865636b206d65726b6c6520636c61696d73000000006044820152606401610758565b6001600160a01b038616600090815260056020908152604080832088845282528083209383529290522054600160ff84161b1615159050949350505050565b606081600003613dfd57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115613e275780613e118161505a565b9150613e209050600a836153b3565b9150613e01565b60008167ffffffffffffffff811115613e4257613e42614b5d565b6040519080825280601f01601f191660200182016040528015613e6c576020820181803683370190505b5090505b8415613eef57613e816001836150ab565b9150613e8e600a866153c7565b613e99906030614ff7565b60f81b818381518110613eae57613eae61500a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350613ee8600a866153b3565b9450613e70565b949350505050565b428865ffffffffffff1611158015613f27575065ffffffffffff87161580613f275750428765ffffffffffff1610155b613f645760405162461bcd60e51b815260206004820152600e60248201526d436c61696d20696e61637469766560901b6044820152606401610758565b8415613fb257613fad338b8b88888888808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508a92506140be915050565b6114d6565b6001600160a01b0381163314613ffa5760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081a5b9c1d5d609a1b6044820152606401610758565b63ffffffff8616156114d6576001600160a01b038a1660009081526004602090815260408083208c845282528083203384529091528120805463ffffffff891692906140459061505a565b918290555011156114d65760405162461bcd60e51b815260206004820152602d60248201527f4d6178696d756d20746f6b656e7320616c7265616479206d696e74656420666f60448201527f7220746869732077616c6c6574000000000000000000000000000000000000006064820152608401610758565b6000876001600160a01b0316826001600160a01b031603614129576040516bffffffffffffffffffffffff1960608a901b1660208201526001600160e01b031960e086901b166034820152603801604051602081830303815290604052805190602001209050614276565b6040517f90c9a2d00000000000000000000000000000000000000000000000000000000081526001600160a01b03898116600483015283811660248301523060448301527f00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b91908216906390c9a2d090606401602060405180830381865afa1580156141b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141dd9190615073565b6142295760405162461bcd60e51b815260206004820152601060248201527f496e76616c69642064656c6567617465000000000000000000000000000000006044820152606401610758565b6040516bffffffffffffffffffffffff19606085901b1660208201526001600160e01b031960e087901b166034820152603801604051602081830303815290604052805190602001209150505b61428183868361450b565b6142cd5760405162461bcd60e51b815260206004820152601d60248201527f436f756c64206e6f7420766572696679206d65726b6c652070726f6f660000006044820152606401610758565b6001600160a01b0387166000908152600560209081526040808320898452825280832062ffffff600889901c16808552925290912054600160ff87161b8082161561435a5760405162461bcd60e51b815260206004820152600e60248201527f416c7265616479206d696e7465640000000000000000000000000000000000006044820152606401610758565b6001600160a01b0390991660009081526005602090815260408083209a83529981528982209382529290925296902095909617909455505050505050565b600081815260018301602052604081205480156144815760006143bc6001836150ab565b85549091506000906143d0906001906150ab565b90508181146144355760008660000182815481106143f0576143f061500a565b90600052602060002001549050808760000184815481106144135761441361500a565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080614446576144466153db565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061068c565b600091505061068c565b5092915050565b60008260000182815481106144a9576144a961500a565b9060005260206000200154905092915050565b60008181526001830160205260408120546145035750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561068c565b50600061068c565b6000826145188584614521565b14949350505050565b600081815b845181101561456657614552828683815181106145455761454561500a565b602002602001015161456e565b91508061455e8161505a565b915050614526565b509392505050565b600081831061458a5760008281526020849052604090206137a4565b60008381526020839052604090206137a4565b6000602082840312156145af57600080fd5b81356001600160e01b0319811681146137a457600080fd5b6001600160a01b0381168114610ef357600080fd5b80356145e7816145c7565b919050565b803561ffff811681146145e757600080fd5b60008083601f84011261461057600080fd5b50813567ffffffffffffffff81111561462857600080fd5b6020830191508360208260051b850101111561464357600080fd5b9250929050565b60008060008060008060008060c0898b03121561466657600080fd5b8835614671816145c7565b97506020890135965061468660408a016145ec565b9550606089013567ffffffffffffffff808211156146a357600080fd5b6146af8c838d016145fe565b909750955060808b01359150808211156146c857600080fd5b506146d58b828c016145fe565b90945092505060a08901356146e9816145c7565b809150509295985092959890939650565b6000806040838503121561470d57600080fd5b8235614718816145c7565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6004811061475a57634e487b7160e01b600052602160045260246000fd5b9052565b60005b83811015614779578181015183820152602001614761565b50506000910152565b6000815180845261479a81602086016020860161475e565b601f01601f19169290920160200192915050565b602081526147c560208201835163ffffffff169052565b600060208301516147de604084018263ffffffff169052565b50604083015163ffffffff8116606084015250606083015165ffffffffffff8116608084015250608083015165ffffffffffff811660a08401525060a083015161482b60c084018261473c565b5060c083015180151560e08401525060e0830151610100838101919091528301516101806101208085018290526148666101a0860184614782565b9086015161014086810191909152860151909250610160614891818701836001600160a01b03169052565b909501516001600160a01b031693019290925250919050565b6000602082840312156148bc57600080fd5b81356137a4816145c7565b6020808252825182820181905260009190848201906040850190845b818110156149085783516001600160a01b0316835292840192918401916001016148e3565b50909695505050505050565b60008060006060848603121561492957600080fd5b8335614934816145c7565b92506020840135614944816145c7565b929592945050506040919091013590565b6000806020838503121561496857600080fd5b823567ffffffffffffffff81111561497f57600080fd5b61498b858286016145fe565b90969095509350505050565b600080600080600080608087890312156149b057600080fd5b86356149bb816145c7565b955060208701359450604087013567ffffffffffffffff808211156149df57600080fd5b6149eb8a838b016145fe565b90965094506060890135915080821115614a0457600080fd5b50614a1189828a016145fe565b979a9699509497509295939492505050565b600080600060608486031215614a3857600080fd5b8335614a43816145c7565b925060208401359150604084013567ffffffffffffffff811115614a6657600080fd5b84016101608187031215614a7957600080fd5b809150509250925092565b8035600481106145e757600080fd5b8015158114610ef357600080fd5b80356145e781614a93565b60008060008060008060a08789031215614ac557600080fd5b8635614ad0816145c7565b955060208701359450614ae560408801614a84565b93506060870135614af581614a93565b9250608087013567ffffffffffffffff80821115614b1257600080fd5b818901915089601f830112614b2657600080fd5b813581811115614b3557600080fd5b8a6020828501011115614b4757600080fd5b6020830194508093505050509295509295509295565b634e487b7160e01b600052604160045260246000fd5b604051610160810167ffffffffffffffff81118282101715614b9757614b97614b5d565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715614bc657614bc6614b5d565b604052919050565b803563ffffffff811681146145e757600080fd5b803565ffffffffffff811681146145e757600080fd5b600082601f830112614c0957600080fd5b813567ffffffffffffffff811115614c2357614c23614b5d565b614c36601f8201601f1916602001614b9d565b818152846020838601011115614c4b57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215614c7d57600080fd5b8335614c88816145c7565b925060208401359150604084013567ffffffffffffffff80821115614cac57600080fd5b908501906101608288031215614cc157600080fd5b614cc9614b73565b614cd283614bce565b8152614ce060208401614bce565b6020820152614cf160408401614be2565b6040820152614d0260608401614be2565b6060820152614d1360808401614a84565b6080820152614d2460a08401614aa1565b60a082015260c083013560c082015260e083013582811115614d4557600080fd5b614d5189828601614bf8565b60e08301525061010083810135908201526101209150614d728284016145dc565b828201526101409150614d868284016145dc565b828201528093505050509250925092565b600080600060608486031215614dac57600080fd5b8335614db7816145c7565b925060208401359150614dcc60408501614bce565b90509250925092565b6020815260006137a46020830184614782565b60008060008060608587031215614dfe57600080fd5b8435614e09816145c7565b935060208501359250604085013567ffffffffffffffff811115614e2c57600080fd5b614e38878288016145fe565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b81811015614908578351151583529284019291840191600101614e60565b60008060008060008060a08789031215614e9757600080fd5b8635614ea2816145c7565b955060208701359450614eb760408801614bce565b9350606087013567ffffffffffffffff811115614ed357600080fd5b614edf89828a016145fe565b9094509250506080870135614ef3816145c7565b809150509295509295509295565b634e487b7160e01b600052601160045260246000fd5b63ffffffff81811683821601908082111561448b5761448b614f01565b63ffffffff82811682821603908082111561448b5761448b614f01565b60006020808385031215614f6457600080fd5b825167ffffffffffffffff80821115614f7c57600080fd5b818501915085601f830112614f9057600080fd5b815181811115614fa257614fa2614b5d565b8060051b9150614fb3848301614b9d565b8181529183018401918481019088841115614fcd57600080fd5b938501935b83851015614feb57845182529385019390850190614fd2565b98975050505050505050565b8082018082111561068c5761068c614f01565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061503457607f821691505b60208210810361505457634e487b7160e01b600052602260045260246000fd5b50919050565b60006001820161506c5761506c614f01565b5060010190565b60006020828403121561508557600080fd5b81516137a481614a93565b6000602082840312156150a257600080fd5b6137a4826145ec565b8181038181111561068c5761068c614f01565b6000602082840312156150d057600080fd5b6137a482614a84565b6000602082840312156150eb57600080fd5b6137a482614be2565b60006020828403121561510657600080fd5b6137a482614bce565b60006020828403121561512157600080fd5b81356137a481614a93565b6000808335601e1984360301811261514357600080fd5b83018035915067ffffffffffffffff82111561515e57600080fd5b60200191503681900382131561464357600080fd5b601f82111561109957600081815260208120601f850160051c8101602086101561519a5750805b601f850160051c820191505b8181101561377e578281556001016151a6565b815167ffffffffffffffff8111156151d3576151d3614b5d565b6151e7816151e18454615020565b84615173565b602080601f83116001811461521c57600084156152045750858301515b600019600386901b1c1916600185901b17855561377e565b600085815260208120601f198616915b8281101561524b5788860151825594840194600190910190840161522c565b50858210156152695787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000835161528b81846020880161475e565b83519083019061529f81836020880161475e565b01949350505050565b600083516152ba81846020880161475e565b7f2f0000000000000000000000000000000000000000000000000000000000000090830190815283516152f481600184016020880161475e565b01600101949350505050565b600063ffffffff80831681810361531957615319614f01565b6001019392505050565b60006020828403121561533557600080fd5b5051919050565b6000808335601e1984360301811261535357600080fd5b83018035915067ffffffffffffffff82111561536e57600080fd5b6020019150600581901b360382131561464357600080fd5b808202811582820484141761068c5761068c614f01565b634e487b7160e01b600052601260045260246000fd5b6000826153c2576153c261539d565b500490565b6000826153d6576153d661539d565b500690565b634e487b7160e01b600052603160045260246000fdfea26469706673582212202fbaacd8823514426e3cf61c68cc76485dad05a4cb671a75602fcaa6e93c585b64736f6c63430008110033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b

-----Decoded View---------------
Arg [0] : delegationRegistry (address): 0x00000000000076A84feF008CDAbe6409d2FE638B

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000076a84fef008cdabe6409d2fe638b


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.