ETH Price: $3,477.97 (+4.32%)
Gas: 5.85 Gwei

Token

Horde of the Undead: Guardians (MORTIS)
 

Overview

Max Total Supply

537 MORTIS

Holders

125

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Filtered by Token Holder
uncircumsized.eth
Balance
5 MORTIS
0x13ca18e529915107bcbbf51ae590834e606e7919
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
RiteOfTheGuardian

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
File 1 of 34 : RiteOfTheGuardian.sol
/**
 *   .......................................';,..'lkOxxxkOx:'..:;........................................
 *   ....................,xl.................';..:KMMMMMMMW0,.,,..................,;.....................
 *   ..................;cxkkl:;...............';..lXMMMMMMK:.;,..............''..,:c;....................
 *   .................lxlxKOoxx,...............,:..:0WMMWO,.;:...............,;ccclldl,,.................
 *   .................';,lKx;,'...............',',..,ONNx'.',;,...............,o0000OOd;..,;.............
 *   ..................':kxxd::;.............,'......'co;......;'.........';cd0XNNNNNXKxlc;..............
 *   ...............,odooxxxxodkxc..........',.......:kKOc......,........,,'c0XNNWWWNNXXOl;,;'...........
 *   ..............;kOx,.;OKc..dOx;.......';........lOl'l0o......;,....'.';cd0XNWMWWMWXKOl:,,............
 *   ..............':cl:.,0Nl.;c;,........,'......'dk;';';kx,.....''........cKNNNWWWWNXNOc...............
 *   .................';.:XMk'..........;;.......,xd':0NO;'dk;.....;;....';;cdOKKXXXXXNKc,;,'............
 *   ....................dNNX:..........'.......:kl.:dk0xo:.lOl......,'......:dkkxOO0Odkc................
 *   ...................;kocko'.......;,.......lO:.cl:okxcll.:Od......;'....',;;;,;',:.,:................
 *   ...........''....';xklc,'......',.......'dk;'lc:o;.,occl',kk,.....,,...'.....;c:,;......',,,'.......
 *   ......,;;:ooc::lclol0Nd'.......;'......,kx''oc:o,...'lcco'.dO:.....,........,dXXdc:,,::::ldl:::,....
 *   ....,ll:;,c:',:ldd;:o;.......,,.......cOo.,o:co,......ll:o;.lOl.....';........,dd;cxdl::,:o;':llc,..
 *   ...:c:cl;.:;.,co::xl........''.......ok:.;o;l0c.......,Od;o:.:Od'....''.........''::'::c:co''cl::o;.
 *   ..;c,;'.,;ol;'.':;oc.......;,......,xx,.:l;lodc.......;dol:oc.,kk,.....;'........,l;;'.,lkkc;'.:;lo.
 *   ..cdc:;;;cOk:,,;lcoc.....',.......:Oo.'ll:oc.ll.......:l.:o:ll,,dOc.....,'.......;dc::;;ck0d:;;llod'
 *   ..;c',,.',cc,'.,;;l,....';....,;:dKk:lkl:o;..cl.......cl..;o:lklc0Xdcc;..,,......'l;';.''cl,,.':;cl.
 *   ...c:'cdc':;.:l:;c;....,'.....cXWXd,:o::o,...co. .....ll...,o::l,cKWWKc...',......,locc:.:l';lc:cc..
 *   ....,ccc:;lc;::::'....,;......cKXdlxOlcl'....lkl:::::ckl....'lloOdlkXk;.....;,......clll;lo:cccc,...
 *   ......';;;cc;;,.....,;.......cOocccloOOl..'ccokc.....ckdc:..'lOklo:;:lOc.....,'.......,;;::;;;......
 *   ...................';.......oOc..lo,ll;cloo:..o:.....:o'.:ool;,lc,o:..:Oo.....;;....................
 *   ..................:,......'xO;..lc,ll...:d'...ll.....lc...,d:...cc,lc..;kd'.....'...................
 *   .................''......,kx,.'dd:dx;;,ckd;:::dOdodoxOo;;;;dkc;:lkolOl..,xk,....';'.................
 *   ...............',.......;Od..;odk0d:;;;lkl;;;;;oXMMMXo,,,,,cxl,:dxkkcol..'xO;.....',................
 *   ..............,........:Oo..:o,'kO'....'o;......lXMNl......;d,..;o:lc.:o'..oOc.....,,...............
 *   .............,,.......lOc..:o'.l0d......co.......oXx'.....'o:....o:.oc.:o,..cOl......;,.............
 *   ...........,;........dk;..ll..lcco'......co,.....:ko.....:o:.....lc..ol.;o,..:Od'.....''............
 *   ...........'.......'xx,..ll..ll..oc.......,cc:,..:ko'.;clc'.....,o;...ol.;d;..,kk,.....;;...........
 *   .........;;.......,kd'.'oc..ol...:ko........';:::d0kc::,........dk;....ll.,o:..'xO;......''.........
 *   .......','.......:Oo..,o:..oc..:cc:cl:...........cOo..........,lc;:c:,..co.'oc...oOc.....';.........
 *   ......':,.......lOc..;o;.'do:oxd:,,,:dxo;,;,,,,,,o0d;,,,;;;,cdko::;cdOxlcxd..ol...cOl.......,.......
 *   .....;:........dk;..:o,.'kKdllc:::::::clclkko:::;d0x:;;cokxlc::;;;;;;;::lxx:..ll...:Od......,,......
 *   ....;;.......'xx,..co'.:oo;................,'....:Ol....;;................,:c:,co,..,kx'......,,....
 *   ...:;.......;kd...lxlloc,.................''.....l0d,.'.''''''...''''''''''',codkk:..'xk,......;,...
 *   .':,.......:kl...;oddoc:::::::::::::::::::::::clcdKklol::::::::::::cccccccccccclooc....oO:......;:..
 *   ,:'.......:00xddddddddoooooooooooooooooloolloldkk0NKOOxlllllllllllllllllllllllllllloollo0Kc......''.
 *   :.........',,,,,,,,,,'','''','','',,,,,,,,,,;,,,oXMNx;,;;;;;:;;;;::::::::::::::::ccccccccc;........,
 *   ,.','.',..';,'.;;..;,..,.''.'.''.''.'.''.'.',....:xl....''.',.','''.'.''.''.,.''.'.',.'''..,,..''..;
 *   ...........,d:.l:.ol.......................,'...........,...........................................
 *   ...........'ol:kx:oc.................;dl::c00l;:ldxl:;ckKo::cxx,.................'coddolc'..........
 *   ............c::Ox,::..................ld,.lxkd'.:KMk'.lkkd'.cd;.................;kKkocldOOc.........
 *   ............cc:kd;l;...................cddccx0kclddxlokxddddl'..................xKk:.;',d0k,........
 *   ...............oc......................,k0:,llkXo. ;00:;llO0;..................;OOc:;';;cOO:........
 *   ...............oc.....................;xl;dl.:odxoldooo,cxccx:.................:Kk',:;;.;O0:........
 *   ...............oc....................c0x:;lO0Ol;dXWk;:kK0o;:d0c................:Kk;lO0kcl0x'........
 *   ...............oc....................;c:::::dOodOdokxoOxc:c::c;.................d0xdxkxdx0l.........
 *   ...............ox:ld,........................cxd;..'dkl.........................'lxkOOOkd:..........
 *   ...............oxcdx;.........................ll....;l'............................;clc,............

 */
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "./RitualBindings.sol";

error MarkedByGuardian(uint256 tokenId);
error ReachingBeyondAbility();
error Unphased();
error Impostor();
error AlreadyInscribed();
error UnacceptableOffering(uint256 cost, uint256 amount);
error ElderAlreadyClaimed(uint256 elder);


contract RiteOfTheGuardian is RitualBindings {    

    uint256 constant UNDEAD_KEY = 0;
    uint256 constant MORTAL_KEY = 1;

    uint256 inscriptionCost = .05 ether;

    mapping(string => uint256[]) scribe;

    constructor(string memory invocation, string memory seal) RitualBindings(invocation,seal) {}

    function pactWithCharun(address pact) external onlyOwner {
        invokeCharun(pact);        
    }        

    function pactWithElders(address pact) external onlyOwner {
        consumeElders(pact);
    }

    function pactOfSustenance(address pact) external onlyOwner {
        consumeBrainz(pact);
    }

    function bestowBountyOfCharun(address recipient, uint256 quantity) internal {
        
        uint256 bounty = quantity * 1000 * (10**18);
        if (ResidualBrainz(seekBrainz()).balanceOf(address(this)) > bounty) {
            ResidualBrainz(seekBrainz()).transfer(recipient,bounty);
        }
    }

    function elderRitual(uint64 quantity, uint256[] memory elders, bytes calldata sigil) external 
    requiresClaimSig(sigil,msg.sender,elders) {
        for (uint i = 0; i < elders.length; i++) {
            if (hasBeenClaimed(elders[i], findElders())) {
                revert ElderAlreadyClaimed(elders[i]);
            }
            
            claim(elders[i], findElders());
        }
        
        phasedMint(ELDER, quantity, false);
        
        bestowBountyOfCharun(msg.sender,quantity);

        markGuardian(ELDER,quantity);
    }  

    function initiateRitual(uint256 quantity, bytes calldata sigil) external 
    requiresAllowSig(sigil,msg.sender) {
        Phase memory phased = findPhase(INITIATE);
        
        giveCharunHisBrainz(phased.cost, quantity);
        
        phasedMint(INITIATE, quantity, false);

        markGuardian(INITIATE,quantity);
    }      

    function acolyteRitual(uint256 quantity, bytes calldata sigil) external payable
    requiresAllowSig(sigil,msg.sender) {
        Phase memory phased = findPhase(ACOLYTE);
        
        giveCharunHisCoin(phased.cost, quantity);
        
        phasedMint(ACOLYTE, quantity, false);

        bestowBountyOfCharun(msg.sender,quantity);

        markGuardian(ACOLYTE,quantity);
    }   

    function ritualPhase(uint256 quantity, uint256 phase) external payable {

        Phase memory phased = findPhase(phase);

        giveCharunHisCoin(phased.cost, quantity);

        phasedMint(phase, quantity, false);

        bestowBountyOfCharun(msg.sender,quantity);

        markGuardian(phase,quantity);  
    }  

    function necrophize(uint256 tokenId) public {
        if (!canTransform(NECRO)) {
            revert ReachingBeyondAbility();
        }
        validateApprovedOrOwner(msg.sender, tokenId);  

        setSupplemental(tokenId, true, UNDEAD_KEY);

        if (!enumerationExists(tokenId)) {
            enumerateToken(msg.sender, tokenId);
        }
    }
    function judgement(uint256 scriptClass,uint256 tokenId) private view {
        if (!canInscribe(scriptClass,tokenId)) {
            revert ReachingBeyondAbility();
        }
        if (inscriptionRequestExists(scriptClass,tokenId)) {
            revert AlreadyInscribed();
        }  
    }
    function necroscribe(uint256 tokenId, string memory btcAddress) external payable {
        judgement(NECRO,tokenId);
        necrophize(tokenId);
      
        
        giveCharunHisCoin(inscriptionCost,1);

        script(NECRO,tokenId,btcAddress);    
    }  

    function vitalize(uint256 tokenId) public {
        if (!canTransform(MORTAL)) {
            revert ReachingBeyondAbility();
        }
        validateApprovedOrOwner(msg.sender, tokenId);  

        setSupplemental(tokenId, false, UNDEAD_KEY);
    }   

    function vitascribe(uint256 tokenId, string memory btcAddress) external payable {
        judgement(MORTAL,tokenId);

        vitalize(tokenId);

        giveCharunHisCoin(inscriptionCost,1);

        script(MORTAL,tokenId,btcAddress);    
    }  


    function inscribe(string memory inscription, uint256 inscriptionClass, uint256 tokenId) external onlyOwner {
        inscript(inscription,inscriptionClass,tokenId);
    }

    function sacrifice(uint256 tokenId) external {

        validateApprovedOrOwner(msg.sender, tokenId);
        
        validateLock(tokenId);   

        if (enumerationExists(tokenId)) {
            enumerateBurn(msg.sender,tokenId);
            selfDestruct(tokenId);
        }

        packedBurn(tokenId);
    }  

    function isWorthyOffering(uint256 cost, uint256 quantity) internal view {        
        if (msg.value != (cost*quantity)) {
            revert UnacceptableOffering(cost*quantity, msg.value);
        }
    } 

    function giveCharunHisCoin(uint256 cost, uint256 quantity) internal {   
        isWorthyOffering(cost,quantity);           
        (summonCharun()).transfer(cost*quantity);
    }      
    function giveCharunHisBrainz(uint256 cost, uint256 quantity) internal {   
        ResidualBrainz(seekBrainz()).transferFrom(msg.sender, summonCharun(), quantity*cost*(10**18));          
    }
}

/**
 * Ordo Signum Machina - 2023
 */

File 2 of 34 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 3 of 34 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 4 of 34 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 5 of 34 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 6 of 34 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 7 of 34 : 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;
    }
}

File 8 of 34 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 9 of 34 : 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 10 of 34 : 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 11 of 34 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 12 of 34 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _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) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _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 13 of 34 : Approvable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "./Ownable.sol";
import "./Nameable.sol";
import { TokenNonOwner } from "./SetOwnerEnumerable.sol";
import { OwnerEnumerable } from "./OwnerEnumerable.sol";
import { SetApprovable, ApprovableData, TokenNonExistent } from "./SetApprovable.sol";

abstract contract Approvable is OwnerEnumerable {  
    using SetApprovable for ApprovableData; 
    ApprovableData approvable;
    uint256 tokenCount;

    function _checkTokenOwner(uint256 tokenId) internal view virtual {
        if (ownerOf(tokenId) != msg.sender) {
            revert TokenNonOwner(msg.sender, tokenId);
        }
    }    
 
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return approvable.isApprovedForAll(owner,operator);
    }  

    function approve(address to, uint256 tokenId) public virtual override {  
        _checkTokenOwner(tokenId);      
        approvable.approveForToken(to, tokenId);
        emit Approval(ownerOf(tokenId), to, tokenId);        
    }  

    function setApprovalForAll(address operator, bool approved) public virtual override {   
        approved ? approvable.approveForContract(operator): approvable.revokeApprovalForContract(operator, msg.sender);
    }       

    function validateApprovedOrOwner(address spender, uint256 tokenId) internal view {        
        if (!(spender == ownerOf(tokenId) || isApprovedForAll(ownerOf(tokenId), spender) || approvable.getApproved(tokenId) == spender)) {
            revert TokenNonOwner(spender, tokenId);
        }
    }  

    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        requireMinted(tokenId);
        return approvable.tokens[tokenId].approval;
    }       

    function revokeTokenApproval(uint256 tokenId) internal {
        approvable.revokeTokenApproval(tokenId);
    }

    function revokeApprovals(address holder) internal {
        approvable.revokeApprovals(holder,tokensOwnedBy(holder));                    
    }

    function requireMinted(uint256 tokenId) internal view virtual {
        if (tokenId <= tokenCount) {
            revert TokenNonExistent(tokenId);
        }
    }
}

File 14 of 34 : Assignable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import { SetAssignable, AssignableData, NotTokenOwner, NotAssigned } from "./SetAssignable.sol";
import { OwnerEnumerable } from "./OwnerEnumerable.sol";
import "./Phaseable.sol";


abstract contract Assignable is Phaseable {  
    using SetAssignable for AssignableData;
    AssignableData assignables;
    
    function assignColdStorage(uint256 tokenId) external {        
        if (msg.sender != ownerOf(tokenId)) {
            revert NotTokenOwner();
        }
        assignables.addAssignment(msg.sender,tokenId);
    }
    
    function revokeColdStorage(uint256 tokenId) external {        
        if (assignables.findAssignment(msg.sender) != tokenId) {
            revert NotAssigned(msg.sender);
        }
        assignables.removeAssignment(msg.sender);
    }   
    
    function revokeAssignments(uint256 tokenId) external {        
        if (msg.sender != ownerOf(tokenId)) {
            revert NotTokenOwner();
        }
        assignables.revokeAll(tokenId);
    }    
    
    function findAssignments(uint256 tokenId) external view returns (address[] memory){        
        return assignables.findAssignees(tokenId);
    }        

    function balanceOf(address seekingContract, address owner) external view returns (uint256) {        
        uint256 guardianBalance = balanceOf(owner);
        if (guardianBalance > 0) {
            uint256[] memory guardians = tokensOwnedBy(owner);
            return assignables.iterateGuardiansBalance(guardians, seekingContract, 0);
        }
        return 0;
    }     
}

File 15 of 34 : EIP712Allowlisting.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./EIP712Listable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

bytes32 constant ALLOW_MINT_TYPE =
    keccak256("Minter(address wallet)");

bytes32 constant INITIATE_MINT_TYPE =
    keccak256("Minter(string initiateAddress)");

bytes32 constant FREE_MINT_TYPE =
    keccak256("Minter(string elderAddress)");    


abstract contract EIP712Allowlisting is EIP712Listable {
    using ECDSA for bytes32;
    using Strings for uint256;
    using Strings for uint160;
    using Strings for address;
    string constant invalid = "invalid signature";
    function isValid(address recovery, address recip) private view {
        require(recovery == sigKey, invalid);
        require(msg.sender == recip, invalid);
    }
    modifier requiresAllowSig(bytes calldata sig, address recip) {
        require(sigKey != address(0), "allowlist not enabled");
        bytes32 digest = keccak256(
            abi.encodePacked(
                "\x19\x01",
                DOM_SEP,
                keccak256(abi.encode(ALLOW_MINT_TYPE, recip))
            )
        );
        isValid(digest.recover(sig),recip);
        _;
    }
       
    modifier requiresClaimSig(bytes calldata sig, address recip, uint256[] memory bag) {
        require(sigKey != address(0), "not enabled");
        uint total = uint(uint160(recip));
        for (uint i; i < bag.length; i++) {
            total += bag[i];
        }
   
        string memory bagged = total.toString();
        bytes32 digest = keccak256(
            abi.encodePacked(
                "\x19\x01",
                DOM_SEP,
                keccak256(abi.encode(FREE_MINT_TYPE,keccak256(abi.encodePacked(bagged))))
            )
        );
        
        isValid(digest.recover(sig),recip);
        _;
    }    
}

File 16 of 34 : EIP712Listable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./Assignable.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

abstract contract EIP712Listable is Assignable {
    using ECDSA for bytes32;

    address internal sigKey = address(0);

    bytes32 internal DOM_SEP;    

    uint256 chainid = 420;

    function setDomainSeparator(string memory _name, string memory _version) internal {
        DOM_SEP = keccak256(
            abi.encode(
                keccak256(
                    "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
                ),
                keccak256(bytes(_name)),
                keccak256(bytes(_version)),
                chainid,
                address(this)
            )
        );
    }

    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(DOM_SEP, structHash);
    }    

    function getSigningAddress() public view returns (address) {
        return sigKey;
    }

    function setSigningAddress(address _sigKey) public onlyOwner {
        sigKey = _sigKey;
    }
  
}

File 17 of 34 : FlexibleMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "./Ownable.sol";
import "./Nameable.sol";
import { DEFAULT, FLAG, PRE, Supplement, SetFlexibleMetadata, FlexibleMetadataData } from "./SetFlexibleMetadata.sol";

abstract contract FlexibleMetadata is Ownable, Context, ERC165, IERC721, Nameable {  
    using SetFlexibleMetadata for FlexibleMetadataData;
    FlexibleMetadataData flexible;   

    constructor(string memory _name, string memory _symbol) Nameable(_name,_symbol) {
    }   
    
    function setContractUri(string memory uri) external onlyOwner {
        flexible.setContractMetadataURI(uri);
    }

    function reveal(bool _reveal) external onlyOwner {
        flexible.reveal(_reveal);
    }

    function setTokenUri(string memory uri, uint256 tokenType) external onlyOwner {
        tokenType == FLAG ?
            flexible.setFlaggedTokenMetadataURI(uri):
            (tokenType == PRE) ?
                flexible.setPrerevealTokenMetadataURI(uri):
                    flexible.setDefaultTokenMetadataURI(uri);
    }

    function setSupplementalTokenUri(uint256 key, string memory uri) external onlyOwner {
        flexible.setSupplementalTokenMetadataURI(key,uri);
    }

    function flagToken(uint256 tokenId, bool isFlagged) external onlyOwner {
        flexible.flagToken(tokenId,isFlagged);
    }

    function setSupplemental(uint256 tokenId, bool isSupplemental, uint256 key) internal {
        if (isSupplemental) {
            flexible.supplemental[tokenId] = Supplement(key,true);
        } else {
            delete flexible.supplemental[tokenId];
        }
    }    

    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165,IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }   

    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {        
        return flexible.getTokenMetadata(tokenId);
    }          
    function contractURI() external view returns (string memory) {
        return flexible.getContractMetadata();
    }    
}

File 18 of 34 : Lockable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./Approvable.sol";
import { SetLockable, LockableStatus,  LockableData, WalletLockedByOwner } from "./SetLockable.sol";
abstract contract Lockable is Approvable {    
    using SetLockable for LockableData; 
    LockableData lockable;

    function custodianOf(uint256 id)
        public
        view
        returns (address)
    {             
        return lockable.findCustodian(ownerOf(id));
    }     

    function lockWallet(uint256 id) public {           
        revokeApprovals(ownerOf(id));
        lockable.lockWallet(ownerOf(id));
    }

    function unlockWallet(uint256 id) public {              
        lockable.unlockWallet(ownerOf(id));
    }    

    function _forceUnlock(uint256 id) internal {  
        lockable.forceUnlock(ownerOf(id));
    }    

    function setCustodian(uint256 id, address custodianAddress) public {       
        lockable.setCustodian(custodianAddress,ownerOf(id));
    }

    function isLocked(uint256 id) public view returns (bool) {     
        return lockable.lockableStatus[ownerOf(id)].isLocked;
    } 

    function lockedSince(uint256 id) public view returns (uint256) {     
        return lockable.lockableStatus[ownerOf(id)].lockedAt;
    }     

    function validateLock(uint256 tokenId) internal view {
        if (isLocked(tokenId)) {
            revert WalletLockedByOwner();
        }
    }
}

File 19 of 34 : LockableTransferrable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./Lockable.sol";
import { LockableStatus,InvalidTransferRecipient,ContractIsNot721Receiver } from "./SetLockable.sol";



abstract contract LockableTransferrable is Lockable {  
    using Address for address;

    function approve(address to, uint256 tokenId) public virtual override {  
        validateLock(tokenId);
        super.approve(to,tokenId);      
    }  

    function setApprovalForAll(address operator, bool approved) public virtual override {           
        validateLock(tokensOwnedBy(msg.sender)[0]);
        super.setApprovalForAll(operator,approved);     
    }        

    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {        
        validateApprovedOrOwner(msg.sender, tokenId);
        validateLock(tokenId);
        _transfer(from,to,tokenId);
    }

    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal {
                
        if(to == address(0)) {
            revert InvalidTransferRecipient();
        }

        revokeTokenApproval(tokenId);   

        if (enumerationExists(tokenId)) {
            swapOwner(from,to,tokenId);
        }
        
        packedTransferFrom(from, to, tokenId);

        completeTransfer(from,to,tokenId);    
    }   

    function completeTransfer(
        address from,
        address to,
        uint256 tokenId) internal {

        emit Transfer(from, to, tokenId);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }    

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) public virtual override {
        validateApprovedOrOwner(msg.sender, tokenId);
        validateLock(tokenId);
        _safeTransfer(from, to, tokenId, data);
    }     

    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) internal virtual {
        if (!_checkOnERC721Received(from, to, tokenId, data)) {
            revert ContractIsNot721Receiver();
        }        
        _transfer(from, to, tokenId);
    }

    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert InvalidTransferRecipient();
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }    

}

File 20 of 34 : Mintable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./LockableTransferrable.sol";
import { TokenOwnership } from "./SetOwnerEnumerable.sol";
error InvalidRecipient(address zero);
error TokenAlreadyMinted(uint256 tokenId);
error InvalidToken(uint256 tokenId);
error MintIsNotLive();

abstract contract Mintable is LockableTransferrable {  

    mapping(address => mapping(uint256 => bool)) claimed; 

    bool isLive;

    function setMintLive(bool _isLive) public onlyOwner {
        isLive = _isLive;
    }

    function hasBeenClaimed(uint256 tokenId, address addressed) public view returns (bool) {
        return claimed[addressed][tokenId];
    }

    function claim(uint256 tokenId, address addressed) internal {
        claimed[addressed][tokenId] = true;
    }

    function getSenderMints() internal view returns (uint256) {
        return numberMinted(msg.sender);
    }

    function _mint(address to, uint256 quantity, bool enumerate) internal virtual returns (uint256) {
        if (!isLive) {
            revert MintIsNotLive();
        }
        if (to == address(0)) {
            revert InvalidRecipient(to);
        }
        
        return enumerate ? enumerateMint(to, quantity) : packedMint(to, quantity);
    }
}

File 21 of 34 : Nameable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";


abstract contract Nameable is IERC721Metadata {   
    string named;
    string symbolic;

    constructor(string memory _name, string memory _symbol) {
        named = _name;
        symbolic = _symbol;
    }

    function name() public virtual override view returns (string memory) {
        return named;
    }  

    function symbol() public virtual override view returns (string memory) {
        return symbolic;
    }          
      
}

File 22 of 34 : Ownable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/**
 * @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 {
    address private _owner;

    error CallerIsNotOwner(address caller);
    error OwnerCannotBeZeroAddress();

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(msg.sender);
    }

    /**
     * @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 {
        if (owner() != msg.sender) {
            revert CallerIsNotOwner(msg.sender);
        }
    }

    /**
     * @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 {
        if(newOwner == address(0)) {
            revert OwnerCannotBeZeroAddress();
        }
        _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 23 of 34 : OwnerEnumerable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import { SetOwnerEnumerable, OwnerEnumerableData, TokenNonOwner, InvalidOwner, TokenOwnership } from "./SetOwnerEnumerable.sol";
import { PackableOwnership } from "./PackableOwnership.sol";


abstract contract OwnerEnumerable is PackableOwnership {  
    using SetOwnerEnumerable for OwnerEnumerableData;
    OwnerEnumerableData enumerable;      

    function tokensOwnedBy(address holder) public view returns (uint256[] memory) {
        return enumerable.findTokensOwned(holder);
    }

    function enumeratedBalanceOf(address owner) public view virtual returns (uint256) {
        validateNonZeroAddress(owner);
        return enumerable.ownedTokens[owner].length;
    }   

    function validateNonZeroAddress(address owner) internal pure {
        if(owner == address(0)) {
            revert InvalidOwner();
        }
    }
    
    function enumerateToken(address to, uint256 tokenId) internal {
        enumerable.addTokenToEnumeration(to, tokenId);
    }

    function enumerateMint(address to, uint256 quantity) internal returns (uint256) {
        uint256 start = minted()+1;
        uint256 end = packedMint(to,quantity);
        for (uint256 i = start; i <= end; i++) {
            enumerateToken(to, i);
        }
        return end;
    }

    function enumerateBurn(address from, uint256 tokenId) internal {
        enumerable.addBurnToEnumeration(from, tokenId);
        enumerable.removeTokenFromEnumeration(from, tokenId);
    }

    function swapOwner(address from, address to, uint256 tokenId) internal {
        enumerable.removeTokenFromEnumeration(from, tokenId);
        enumerable.addTokenToEnumeration(to, tokenId);
    }
    
    function enumerationExists(uint256 tokenId) internal view virtual returns (bool) {
        return enumerable.tokens[tokenId].exists;
    }    

    function selfDestruct(uint256 tokenId) internal {
        delete enumerable.tokens[tokenId];
    }    
}

File 24 of 34 : PackableOwnership.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import { FlexibleMetadata } from "./FlexibleMetadata.sol";
import { PackableData, SetPackable } from "./SetPackable.sol";


struct TokenApproval {
    address approval;
    bool exists;
}

abstract contract PackableOwnership is FlexibleMetadata {
    using SetPackable for PackableData;
    PackableData packable;

    constructor() {
        packable._currentIndex = packable._startTokenId();     
    } 
     


    function numberMinted(address minter) public view returns (uint256) {
        return packable._numberMinted(minter);
    }

    function ownerOf(uint256 tokenId) public view returns (address) {
        return packable.ownerOf(tokenId);
    }

    function balanceOf(address owner) public view virtual override returns (uint256) {
        return packable.balanceOf(owner);
    }         
       
    function totalSupply() public view virtual returns (uint256) {
        return packable.totalSupply();
    }    
       
    function minted() internal view virtual returns (uint256) {
        return packable._currentIndex;
    }
    function exists(uint256 tokenId) internal view returns (bool) {
        return packable._exists(tokenId);
    }
    function packedTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) internal {
        packable.transferFrom(from,to,tokenId);
    }
    function packedMint(address to, uint256 quantity) internal returns (uint256) {
        return packable._mint(to,quantity);
    }
    function packedBurn(uint256 tokenId) internal  {
        packable._burn(tokenId);
    }
    /**
     * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     */
    // function getAux(address owner) public view returns (uint32[2] memory) {
    //     return packable.unpack64(packable._getAux(owner));
    // }

    function getAux16(address owner) internal view returns (uint16[4] memory) {
        return packable.getAux16(owner);
    }    
    // function getAux8(address owner) public view returns (uint8[8] memory) {

    //     uint32[2] memory pack32 = packable.unpack64(packable._getAux(owner));
        
    //     uint16[2] memory pack16a = packable.unpack32(pack32[0]);
        
    //     uint8[2] memory pack8a1 = packable.unpack16(pack16a[0]);
    //     uint8[2] memory pack8a2 = packable.unpack16(pack16a[1]);
        
    //     uint16[2] memory pack16b = packable.unpack32(pack32[1]);
        
    //     uint8[2] memory pack8b1 = packable.unpack16(pack16b[0]);
    //     uint8[2] memory pack8b2 = packable.unpack16(pack16b[1]);

    //     return [pack8a1[0],pack8a1[1],pack8a2[0],pack8a2[1],pack8b1[0],pack8b1[1],pack8b2[0],pack8b2[1]];
    // }    

    /**
     * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     * If there are multiple variables, please pack them into a uint64.
     */
    // function setAux(address owner, uint32[2] memory aux) internal {
    //     packable._setAux(owner,packable.pack64(aux[0],aux[1]));
    // }    

    function setAux32(address owner, uint16[4] memory aux) internal {
        packable._setAux(owner,packable.pack64(packable.pack32(aux[0],aux[1]),packable.pack32(aux[2],aux[3])));
    }       
    
    // function setAux16(address owner, uint8[8] memory aux) internal {
    //     packable._setAux(owner,packable.pack64(
    //         packable.pack32(
    //             packable.pack16(aux[0],aux[1]),
    //             packable.pack16(aux[2],aux[3])
    //         ),
    //         packable.pack32(
    //             packable.pack16(aux[4],aux[5]),
    //             packable.pack16(aux[6],aux[7])
    //         )
    //     ));
    // }        

}

File 25 of 34 : Phaseable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import { SetPhaseable, PhaseableData, MintIsNotAllowedRightNow, ExceedsMaxSupply, Phase } from "./SetPhaseable.sol";
import { OwnerEnumerable } from "./OwnerEnumerable.sol";
import "./Mintable.sol";


abstract contract Phaseable is Mintable {  
    using SetPhaseable for PhaseableData;
    PhaseableData phaseables;    
    
    function canMint(uint256 phase, uint256 quantity) internal virtual returns(bool);

    function initialize(Phase[] storage phases, uint256 maxSupply) internal {
        phaseables.initialize(phases,maxSupply);
    }

    function phasedMint(uint256 phase, uint256 quantity, bool enumerate) internal returns (uint256) {
        if (!canMint(phase, quantity)) {
            revert MintIsNotAllowedRightNow();
        }        
        if (minted()+quantity > phaseables.getMaxSupply()) {
            revert ExceedsMaxSupply();
        }        
        return _mint(msg.sender,quantity,enumerate);        
    }

    function airdrop(address recipient, uint256 quantity, bool enumerate) public onlyOwner {        
        if (minted()+quantity > phaseables.getMaxSupply()) {
            revert ExceedsMaxSupply();
        }
        _mint(recipient,quantity, enumerate);
    }

    function activePhase() internal view returns (uint256) {
        return phaseables.getActivePhase();
    }

    function nextPhase() public onlyOwner {
        phaseables.startNextPhase();
    }

    function previousPhase() public onlyOwner {
        phaseables.revertPhase();
    }    

    function getPhases() internal view returns (Phase[] storage) {
        return phaseables.getPhases();
    }

    function findPhase(uint256 phaseId) internal view returns (Phase memory) {
        return phaseables.findPhase(phaseId);
    }

    function updatePhase(uint256 phaseId, Phase memory phase) internal {
        Phase[] storage existing = phaseables.getPhases();
        existing[phaseId] = phase;
    }    

    function getMaxSupply() internal view returns (uint256) {
        return phaseables.getMaxSupply();
    }  

    function setMaxSupply(uint256 newMax) internal {
        phaseables.setMaxSupply(newMax);
    }    

}

File 26 of 34 : RitualBindings.sol
/**
                                               cNX:                                                  
                                             ;0Xkdd,                                                
                                            :kOOxdxx:                                               
                                          .cooc.ckddxc.                                             
                                         .llcl.  ;xxxOd.                                            
                                        .oc;l'     :KK0x'                                           
                                       .dc,o;    .,ldxxxk;                                          
                                      'd:.oc    .lOl..odokc                                         
                                     ,d:.ll.  ..dx:,...ldoOo.                                       
                                    ,d:.o0d::::l0Oolcc:cOOdOx.                                      
                                   ;0kc::,..    'lll:.  .,;lOk;.                                    
                                 ,loc.    ..';;:codxxc'.    .,coc.                                  
                              .;oc.  .';:::::,;ccc:c:;:::::'.  .;ol.                                
                             ;dc. .;cc:;.     .colc;.    .'::cc'  ;d:.                              
                           .lx'.,ll:.     .',:ddlllol:,.     .;ll:..oo.                             
                          .od',ol'    .;cccc:cko.,:xx:cccc:.    .co:'od.                            
                          ck:od'   .;ol:.     .dKOd:.    .:ol,    .ldcxo.                           
                         'OOxc   .:oc.    .';:ododxoc:,.    ,lo,    'dO0:                           
                      .. cN0;   .ol.    ,lcc;,dxcdkc';:cl:.   'ol.   .dNx...                        
                     ,Ox'oX:   'xc    'ol'    .,:'.     .co;   .ld.   .O0lk0,                       
                    :kdk0Ko   .dl    ;x;                  .dl.  .oo.   cXNxdO:                      
                  .ok:lkK0,   :kl;' ,x;       '::::,       ,k:   :0:   ,0Xx,;ko.                    
                 .dd;ox,ck;,::do:oxdxklc.   ,ol;,;:ld,   'co0x;clxXk:ccd0olk,'dx'                   
                'dkldd. ,Okl:l0kxklokockl  'x:      lx.  lxoko,dkd0k'..dXc ckc;xk;                  
               ;o,:0O;  .kx.  lkl:..o0o,.  .dl.    .dd.  .,x0; ,:;x:   cO, .dXx.,xc                 
              :o''o:':c' ck'  ;x'   'x:     .clclccl:.    .od.   :x.  .ko.;l;:ko..do.               
            .ll.;d;   'lc,do.  ld.   ;x;       .'..      .od.   'x:  .dOol;.  .xd..ox'              
           .o:.:d'      'cxKd. .ld.   'ol'      .      .:oc.   .dl  .oXO:.     .dx'.cx,             
          ,o,.co.         ,xXO;  ;d:.   ,ccc::llcodl;;cc:.    ,d:  .x0l.        .lk; ;x:            
        .co'.oo.            ;0Ko, .co:.   ..,o0: lNO;..     ,lo' .c00;            :Oc 'xl.          
       .oo.'xx,.......'''''',o0Okdc..:ll;.    :xkxd,    .':ol,.,lok0c..............l0l..do.         
      .okookOkkkxxxkOOOOkkkxxxxxdxOxlc;:cccclld0OOOdccccccc::ldKKk0KOOOOOOkkkxkkO000XXkox0d.        
          .................         .;lllccllldkcd0xllllclllc'..'''''''''.......''''''.....         
                                        .';cccokkkkdllc:,.                                          
                                         .,ccclokxllc;,,'.                                          
                                      .,c:;,....:,    .';cc,.                                       
                                    .;c;.  ''   ..    .. .'cl'                                      
                                   .cl.  .':x:       ;c'.   :d;                                     
                                  .:c.   .,;lkd::;;ckOl;,.   ;l'                                    
                                  ;o'        ;x, ..lk'       .l;                                    
                                  :l.        .ol .:xc        .:c.                                   
                                  :o.         ld.;kk;        .:o'                                   
                                  'o:        .ol 'ox;        .lc.                                   
                                   ,l'    .''oOl;clkd,'..   .;;.                                    
                                    'c,  .''lx;....'l:...  'l;                                      
                                     .cl,  ';.  .    .  .'cl;.                                      
                                       .;;::;,.:d:..'',::,..                                        
                                         ..':od:,cdo:...                                            
                                           .,cxl;ok:                                                
                                            ,:';;,,;.                                               
                                           ',. ',   ,,                                              
                                         .'.  .lo'   .;;:'                                          
                                      .,lc. .;l0Kdl;. .x0o.                                         
                                      .cd;.'cd0NXOOxl. 'l;                                          
                                     .,'cl;:oxxKKddlc:;c:',.                                        
                                    ',. ;o:,;cdKXko:'':o; .,.                                       
                                  .;'   .;cc:xKNN0xd:;c:.   ''                                      
                                 .oo;;;. ...c0XxxO0Kd,'...  .,;.                                    
                                ,okkkdllll:..od..o0d',oollocldl;.                                   
                              .:dkkxxoodllkl .:..,,..;lloddlcl:.',.                                 
                             ,;.:kxl;:o:ckk:.':;;;,. 'oddoodxd:. .,.                                
                           .::..,c;..'ccld:'.,;ll,,'..::;;'',,....,:.                               
                           .'..........'''...',:c'..             ...:,                              

 */
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "./EIP712Allowlisting.sol";
import "./Phaseable.sol";
import "./FlexibleMetadata.sol";
import "./Nameable.sol";
import { Phase, PhaseNotActiveYet, PhaseExhausted, WalletMintsFilled } from "./SetPhaseable.sol";
import { SetInscribable, InscribableData, Script } from "./SetInscribable.sol";

interface ElderBond {    
    function ownerOf(uint256 tokenId) external view returns (address);
}

interface ResidualBrainz {    
    function balanceOf(address account) external view returns (uint256);
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
    function transfer(address to, uint256 amount) external;
}     
contract RitualBindings is EIP712Allowlisting {  
    using SetInscribable for InscribableData;      
    InscribableData inscribable;

    address payable treasury;
    address currency;
    address legacy;

    uint64 constant ELDER = 0;
    uint64 constant INITIATE = 1;
    uint64 constant ACOLYTE = 2;
    uint64 constant OPEN = 3;
    uint256 constant NECRO = 0;
    uint256 constant MORTAL = 1; 
  

    constructor(string memory name, string memory symbol) FlexibleMetadata(name,symbol) {
        setSigningAddress(msg.sender);
        setDomainSeparator(name, symbol);
        Phase[] storage phases = getPhases();
                          
        phases.push(Phase(ELDER, 32, 381, 0));
        phases.push(Phase(INITIATE, 2, 441, 2500)); // BRAINZ
        phases.push(Phase(ACOLYTE, 3, 891, .02 ether)); // eth (480 after phases 1 & 2)
        phases.push(Phase(OPEN, 4, 1002, .04 ether)); // eth (111 after phases 1, 2, 3)
        
        initialize(phases,1002);
    }

    function isOsmRegisted(uint256 tokenId) external view returns (bool) {
      return enumerationExists(tokenId);
    }

    function summonCharun() internal view returns (address payable) {
      return treasury;
    }
    function invokeCharun(address charun) internal {
      treasury = payable(charun);
    }
    function seekBrainz() internal view returns (address) {
      return currency;
    }
    function consumeBrainz(address brainz) internal {
      currency = brainz;
    }
    function findElders() internal view returns (address) {
      return legacy;
    }
    function consumeElders(address elders) internal {
       legacy = elders;
    }

    function markGuardian(uint256 phase, uint256 quantity) internal {
      uint16[4] memory aux = getAux16(msg.sender);
      aux[phase] = uint16(quantity);
      setAux32(msg.sender,aux);
    }

    function canMint(uint256 phase, uint256 quantity) internal override virtual returns(bool) {
        uint256 activePhase = activePhase();
        if (phase > activePhase) {
            revert PhaseNotActiveYet();
        }
        uint256 requestedSupply = minted()+quantity;
        Phase memory requestedPhase = findPhase(phase);
        if (requestedSupply > requestedPhase.highestSupply) {
            revert PhaseExhausted();
        }
        uint16[4] memory aux = getAux16(msg.sender);
        uint256 requestedMints = quantity + aux[phase];

        if (requestedMints > requestedPhase.maxPerWallet) {
            revert WalletMintsFilled(requestedMints);
        }
        return true;
    }

    function script(uint256 scriptClass, uint256 tokenId, string memory btcAddress) internal {
      inscribable.script(scriptClass,tokenId,btcAddress);
    }    
    function retrieveRequests(uint256 scriptClass) external view returns (Script[] memory) {
      return inscribable.retrieveRequests(scriptClass);
    }    
    function inscript(string memory inscription, uint256 scriptClass, uint256 tokenId) internal {
      inscribable.inscribe(scriptClass,inscription,tokenId);
    }
    function findInscription(uint256 scriptClass, uint256 tokenId) public view returns (string memory) {
      return inscribable.findInscription(scriptClass,tokenId);
    }
    function inscriptionRequestExists(uint256 scriptClass, uint256 tokenId) public view returns (bool) {
      return inscribable.inscriptionRequestExists(scriptClass,tokenId);
    }
    function openInscription(uint256 scriptClass) public onlyOwner {
      inscribable.setInscribable(scriptClass,true);
    }
    function canInscribe(uint256 scriptClass, uint256 tokenId) public view returns (bool) {
      return (inscribable.inscribable(scriptClass) &&! inscribable.inscriptionRequestExists(scriptClass,tokenId));
    }
    function canTransform(uint256 scriptClass) internal view returns (bool) {
      return (inscribable.inscribable(scriptClass));
    }
}

/**
 * Ordo Signum Machina - 2023
 */

File 27 of 34 : SetApprovable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

struct ApprovableData { 

    mapping(address => uint256) contractApprovals;
    mapping(address => address[]) approvedForAll;
    mapping(address => mapping(address => uint256)) approvedForAllIndex;

    mapping(uint256 => uint256) tokenApprovals;
    mapping(uint256 => TokenApproval[]) approvedForToken;
    mapping(uint256 => mapping(address => uint256)) approvedForTokenIndex;

    mapping(uint256 => TokenApproval) tokens;

    bool exists;
}    

struct TokenApproval {
    address approval;
    bool exists;
}

error AlreadyApproved(address operator, uint256 tokenId);
error AlreadyApprovedContract(address operator);
error AlreadyRevoked(address operator, uint256 tokenId);
error AlreadyRevokedContract(address operator);
error TokenNonExistent(uint256 tokenId);


library SetApprovable {     

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);    

    function isApprovedForAll(ApprovableData storage self, address owner, address operator) public view returns (bool) {        
        return self.approvedForAll[owner].length > self.approvedForAllIndex[owner][operator] ? 
            (self.approvedForAll[owner][self.approvedForAllIndex[owner][operator]] != address(0)) :
            false;
    }   

    function revokeApprovals(ApprovableData storage self, address owner, uint256[] memory ownedTokens) public {            
        
        for (uint256 i = 0; i < ownedTokens.length; i++) {
            revokeTokenApproval(self,ownedTokens[i]);
        }
        
        address[] memory contractApprovals = self.approvedForAll[owner];
        for (uint256 i = 0; i < contractApprovals.length; i++) {
            address approved = contractApprovals[i];    
            revokeApprovalForContract(self, approved, owner);             
        }
    }   

    function revokeTokenApproval(ApprovableData storage self, uint256 token) public {            
        TokenApproval[] memory approvals = self.approvedForToken[token];
        for (uint256 j = 0; j < approvals.length; j++) {
            revokeApprovalForToken(self, approvals[j].approval, token);
        }         
    }       

    function getApproved(ApprovableData storage self, uint256 tokenId) public view returns (address) {
        return self.approvedForToken[tokenId].length > 0 ? self.approvedForToken[tokenId][0].approval : address(0);
    }     

    function approveForToken(ApprovableData storage self, address operator, uint256 tokenId) public {
        uint256 index = self.approvedForTokenIndex[tokenId][operator];
        if (index < self.approvedForToken[tokenId].length) {
            if (self.approvedForToken[tokenId][index].exists) {
                revert AlreadyApproved(operator, tokenId);
            }            
        }
   
        self.approvedForToken[tokenId].push(TokenApproval(operator,true));
        self.approvedForTokenIndex[tokenId][operator] = self.approvedForToken[tokenId].length-1;
        self.tokenApprovals[tokenId]++;
        
        emit Approval(msg.sender, operator, tokenId); 
    } 

    function revokeApprovalForToken(ApprovableData storage self, address revoked, uint256 tokenId) public {
        uint256 index = self.approvedForTokenIndex[tokenId][revoked];
        if (!self.approvedForToken[tokenId][index].exists) {
            revert AlreadyRevoked(revoked,tokenId);
        }
        
        // When the token to delete is not the last token, the swap operation is unnecessary
        if (index != self.approvedForToken[tokenId].length - 1) {
            TokenApproval storage tmp = self.approvedForToken[tokenId][self.approvedForToken[tokenId].length - 1];
            self.approvedForToken[tokenId][self.approvedForToken[tokenId].length - 1] = self.approvedForToken[tokenId][index];
            self.approvedForToken[tokenId][index] = tmp;
            self.approvedForTokenIndex[tokenId][tmp.approval] = index;            
        }

        // This also deletes the contents at the last position of the array
        delete self.approvedForTokenIndex[tokenId][revoked];
        self.approvedForToken[tokenId].pop();

        self.tokenApprovals[tokenId]--;
    }

    function approveForContract(ApprovableData storage self, address operator) public {
        uint256 index = self.approvedForAllIndex[msg.sender][operator];
        if (self.approvedForAll[msg.sender].length > index) {
            if (self.approvedForAll[msg.sender][index] != address(0)) {
                revert AlreadyApprovedContract(self.approvedForAll[msg.sender][index]);
            }
        }
   
        self.approvedForAll[msg.sender].push(operator);
        self.approvedForAllIndex[msg.sender][operator] = self.approvedForAll[msg.sender].length-1;
        self.contractApprovals[msg.sender]++;

        emit ApprovalForAll(msg.sender, operator, true); 
    } 

    function revokeApprovalForContract(ApprovableData storage self, address revoked, address owner) public {
        uint256 index = self.approvedForAllIndex[owner][revoked];
        address revokee = self.approvedForAll[owner][index];
        if (revokee != revoked) {
            revert AlreadyRevokedContract(revoked);
        }
        
        // When the token to delete is not the last token, the swap operation is unnecessary
        if (index != self.approvedForAll[owner].length - 1) {
            address tmp = self.approvedForAll[owner][self.approvedForAll[owner].length - 1];
            self.approvedForAll[owner][self.approvedForAll[owner].length - 1] = self.approvedForAll[owner][index];
            self.approvedForAll[owner][index] = tmp;
            self.approvedForAllIndex[owner][tmp] = index;            
        }
        // This also deletes the contents at the last position of the array
        delete self.approvedForAllIndex[owner][revoked];
        self.approvedForAll[owner].pop();

        self.contractApprovals[owner]--;

        emit ApprovalForAll(owner, revoked, false); 
    }    

}

File 28 of 34 : SetAssignable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

struct AssignableData { 
    mapping(uint256 => address[]) assignments;

    mapping(address => mapping(uint256 => uint256)) assignmentIndex; 

    mapping(address => uint256) assigned;
}    

error AlreadyAssigned(uint256 tokenId);
error NotAssigned(address to);
error NotTokenOwner();

interface Supportable {
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
    function balanceOf(address owner) external view returns (uint256);
    function ownerOf(uint256 tokenId) external view returns (address);
    function balanceOf(address owner, uint256 tokenId) external view returns (uint256);
}

library SetAssignable {

    function findAssignees(AssignableData storage self, uint256 tokenId) public view returns (address[] memory) {
        return self.assignments[tokenId];
    }

    function revokeAll(AssignableData storage self, uint256 tokenId) public {        
        for (uint256 iterator = 0; iterator < self.assignments[tokenId].length; iterator++) {
            address target = self.assignments[tokenId][iterator];
            delete self.assignmentIndex[target][tokenId];
            delete self.assigned[target];
        }
        while ( self.assignments[tokenId].length > 0) {
            self.assignments[tokenId].pop();
        }        
    }

    function iterateGuardiansBalance(AssignableData storage self, uint256[] memory guardians, address seeking, uint256 tokenId) public view returns (uint256)  {
        uint256 balance = 0;
        for (uint256 iterator = 0; iterator < guardians.length; iterator++) {
            uint256 guardian = guardians[iterator];
            balance += iterateAssignmentsBalance(self,guardian,seeking,tokenId);
        }
        return balance;
    }

    function iterateAssignmentsBalance(AssignableData storage self, uint256 guardian, address seeking, uint256 tokenId) public view returns (uint256)  {
        uint256 balance = 0;
        for (uint256 iterator = 0; iterator < self.assignments[guardian].length; iterator++) {
            address assignment =self.assignments[guardian][iterator];
            Supportable supporting = Supportable(seeking);
            if (supporting.supportsInterface(type(IERC721).interfaceId)) {
                balance += supporting.balanceOf(assignment); 
            }            
            if (supporting.supportsInterface(type(IERC1155).interfaceId)) {
                balance += supporting.balanceOf(assignment, tokenId); 
            }               
        }       
        return balance; 
    } 

    function addAssignment(AssignableData storage self, address to, uint256 tokenId) public {
        uint256 assigned = findAssignment(self, to);
        if (assigned > 0) {
            revert AlreadyAssigned(assigned);
        }
        
        self.assignments[tokenId].push(to);     
        uint256 length = self.assignments[tokenId].length;
        self.assignmentIndex[to][tokenId] = length-1;
        self.assigned[to] = tokenId;
    }    

    function removeAssignment(AssignableData storage self, address to) public {
        uint256 assigned = findAssignment(self, to);
        if (assigned > 0) {
            uint256 existingAddressIndex = self.assignmentIndex[to][assigned];
            uint256 lastAssignmentIndex = self.assignments[assigned].length-1;
            
            if (existingAddressIndex != lastAssignmentIndex) {
                address lastAssignment = self.assignments[assigned][lastAssignmentIndex];
                self.assignments[assigned][existingAddressIndex] = lastAssignment; 
                self.assignmentIndex[lastAssignment][assigned] = existingAddressIndex;
            }
            delete self.assignmentIndex[to][assigned];
            self.assignments[assigned].pop();
        } else {
            revert NotAssigned(to);
        }
    }

    function findAssignment(AssignableData storage self, address to) public view returns (uint256) {
        return self.assigned[to];
    }     
}

File 29 of 34 : SetFlexibleMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

struct FlexibleMetadataData { 
    string defaultTokenMetadata;
    string prerevealTokenMetadata;
    string flaggedTokenMetadata;
    mapping(uint256 => string) supplementalTokenMetadata;
    string contractMetadata;
    mapping(uint256 => bool) tokenFlag;
    mapping(uint256 => Supplement) supplemental;
    bool tokenReveal; 
}    
struct Supplement {
    uint256 key;
    bool exists;
}
bytes16 constant _SYMBOLS = "0123456789abcdef";
uint256 constant DEFAULT = 1;
uint256 constant FLAG = 2;
uint256 constant PRE = 3;
library SetFlexibleMetadata {
    function setDefaultTokenMetadataURI(FlexibleMetadataData storage self, string memory uri) public {
        self.defaultTokenMetadata = uri;
    }  
    function setPrerevealTokenMetadataURI(FlexibleMetadataData storage self, string memory uri) public {
        self.prerevealTokenMetadata = uri;
    }  
    function setFlaggedTokenMetadataURI(FlexibleMetadataData storage self, string memory uri) public {
        self.flaggedTokenMetadata = uri;
    }  
    function setSupplementalTokenMetadataURI(FlexibleMetadataData storage self, uint256 key, string memory uri) public {
        self.supplementalTokenMetadata[key] = uri;
    }      
    function setContractMetadataURI(FlexibleMetadataData storage self, string memory uri) public {
        self.contractMetadata = uri;
    }  
    function reveal(FlexibleMetadataData storage self, bool revealed) public {
        self.tokenReveal = revealed;
    }

    function flagToken(FlexibleMetadataData storage self, uint256 tokenId, bool flagged) public {
        self.tokenFlag[tokenId] = flagged;
    }

    function getTokenMetadata(FlexibleMetadataData storage self, uint256 tokenId) public view returns (string memory) {
        if (self.tokenFlag[tokenId]) {
            return encodeURI(self.flaggedTokenMetadata,tokenId);
        } 
        if (!self.tokenReveal) {
            return encodeURI(self.prerevealTokenMetadata,tokenId);
        }
        if (self.supplemental[tokenId].exists) {
            return encodeURI(self.supplementalTokenMetadata[self.supplemental[tokenId].key],tokenId);
        }
        return encodeURI(self.defaultTokenMetadata,tokenId);
    }

    function getContractMetadata(FlexibleMetadataData storage self) public view returns (string memory) { 
        return self.contractMetadata;
    }    

    function encodeURI(string storage uri, uint256 tokenId) public pure returns (string memory) {
        return string(abi.encodePacked(uri, "/", toString(tokenId)));
    }

    function toString(uint256 value) public pure returns (string memory) {
        unchecked {
            uint256 length = log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    function log10(uint256 value) public pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }        
}

File 30 of 34 : SetInscribable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
struct InscribableData {
    mapping(uint256 => mapping(uint256 => Inscription)) inscriptions;
    mapping(uint256 => Script[]) scribe;
    mapping(uint256 => bool) canInscribe;
}
struct Script {
    uint256 tokenId;
    string btcAddress;
}
struct Inscription {
    string inscription;
    string btcAddress;
    uint256 inscriptix;
    bool inscriptionRequestExists;
    bool inscriptionRequested;
}  

error AlreadyInscribed();
error AlreadyRequested();

library SetInscribable {    
    function script(InscribableData storage self, uint256 inscriptionClass, uint256 tokenId, string memory btcAddress) public {  

        if (self.inscriptions[inscriptionClass][tokenId].inscriptionRequested) {
            revert AlreadyRequested();
        }

        self.inscriptions[inscriptionClass][tokenId] = Inscription("",btcAddress,self.scribe[inscriptionClass].length,false,true);

        self.scribe[inscriptionClass].push(Script(tokenId,btcAddress));  
    }  

    function inscribe(InscribableData storage self, uint256 inscriptionClass, string memory inscription, uint256 tokenId) public {
        if (self.inscriptions[inscriptionClass][tokenId].inscriptionRequestExists) {
            revert AlreadyInscribed();
        }
        if ((self.scribe[inscriptionClass].length - 1) > self.inscriptions[inscriptionClass][tokenId].inscriptix) {            
            self.scribe[inscriptionClass][self.inscriptions[inscriptionClass][tokenId].inscriptix] = self.scribe[inscriptionClass][self.scribe[inscriptionClass].length - 1];            
        }
        self.scribe[inscriptionClass].pop();

        delete self.inscriptions[inscriptionClass][tokenId].inscriptix;

        self.inscriptions[inscriptionClass][tokenId].inscription = inscription;

        self.inscriptions[inscriptionClass][tokenId].inscriptionRequestExists = true;
    }

    function retrieveRequests(InscribableData storage self, uint256 inscriptionClass) public view returns (Script[] memory) {
        return self.scribe[inscriptionClass];
    }

    function findInscription(InscribableData storage self, uint256 inscriptionClass, uint256 tokenId) public view returns (string memory) {
        return self.inscriptions[inscriptionClass][tokenId].inscription;
    }

    function inscriptionRequestExists(InscribableData storage self, uint256 inscriptionClass, uint256 tokenId) public view returns (bool) {
        return self.inscriptions[inscriptionClass][tokenId].inscriptionRequestExists;
    }

    function inscribable(InscribableData storage self, uint256 inscriptionClass) public view returns (bool) {
        return self.canInscribe[inscriptionClass];
    }

    function setInscribable(InscribableData storage self, uint256 inscriptionClass, bool _canInscribe) public {
        self.canInscribe[inscriptionClass] = _canInscribe;
    }

}

File 31 of 34 : SetLockable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { InvalidOwner } from "./SetOwnerEnumerable.sol";
struct LockableData { 

    mapping(address => uint256) lockableStatusIndex; 

    mapping(address => LockableStatus) lockableStatus;  
} 




struct LockableStatus {
    bool isLocked;
    uint256 lockedAt;
    address custodian;
    uint256 balance;
    address[] approvedAll;
    bool exists;
}

uint64 constant MAX_INT = 2**64 - 1;

error OnlyCustodianCanLock();

error OnlyOwnerCanSetCustodian();

error WalletLockedByOwner();

error InvalidTransferRecipient();

error NotApprovedOrOwner();

error ContractIsNot721Receiver();

library SetLockable {           

    function lockWallet(LockableData storage self, address holder) public {
        LockableStatus storage status = self.lockableStatus[holder];    
        if (msg.sender != status.custodian) {
            revert OnlyCustodianCanLock();
        }       
        status.isLocked = true;
        status.lockedAt = block.timestamp;
    }

    function unlockWallet(LockableData storage self, address holder) public {        
        LockableStatus storage status = self.lockableStatus[holder];
        if (msg.sender != status.custodian) {
            revert OnlyCustodianCanLock();
        }                   
        
        status.isLocked = false;
        status.lockedAt = MAX_INT;
    }

    function setCustodian(LockableData storage self, address custodianAddress,  address holder) public {
        if (msg.sender != holder) {
            revert OnlyOwnerCanSetCustodian();
        }    
        LockableStatus storage status = self.lockableStatus[holder];
        status.custodian = custodianAddress;
    }

    function findCustodian(LockableData storage self, address wallet) public view returns (address) {
        return self.lockableStatus[wallet].custodian;
    }

    function forceUnlock(LockableData storage self, address owner) public {        
        LockableStatus storage status = self.lockableStatus[owner];
        status.isLocked = false;
        status.lockedAt = MAX_INT;
    }
            
}

File 32 of 34 : SetOwnerEnumerable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

struct OwnerEnumerableData { 
    mapping(uint256 => TokenOwnership) tokens;
    mapping(address => uint256[]) ownedTokens;

    mapping(address => mapping(uint256 => uint256)) ownedTokensIndex; 

    mapping(address => uint256[]) burnedTokens;

    mapping(address => mapping(uint256 => uint256)) burnedTokensIndex; 
} 



struct TokenOwnership {
    address ownedBy;
    bool exists;
}

error TokenNonOwner(address requester, uint256 tokenId); 
error InvalidOwner();

library SetOwnerEnumerable {
    function addTokenToEnumeration(OwnerEnumerableData storage self, address to, uint256 tokenId) public {       
        self.ownedTokens[to].push(tokenId);        
        uint256 length = self.ownedTokens[to].length;
        self.ownedTokensIndex[to][tokenId] = length-1;
        self.tokens[tokenId] = TokenOwnership(to,true);
    }

    function addBurnToEnumeration(OwnerEnumerableData storage self, address to, uint256 tokenId) public {       
        self.burnedTokens[to].push(tokenId);        
        uint256 length = self.burnedTokens[to].length;
        self.burnedTokensIndex[to][tokenId] = length-1;        
    }    

    function removeTokenFromEnumeration(OwnerEnumerableData storage self, address to, uint256 tokenId) public {

        uint256 length = self.ownedTokens[to].length;
        if (self.ownedTokensIndex[to][tokenId] > 0) {
            if (self.ownedTokensIndex[to][tokenId] != length - 1) {
                uint256 lastTokenId = self.ownedTokens[to][length - 1];
                self.ownedTokens[to][self.ownedTokensIndex[to][tokenId]] = lastTokenId; 
                self.ownedTokensIndex[to][lastTokenId] = self.ownedTokensIndex[to][tokenId];
            }
        }

        delete self.ownedTokensIndex[to][tokenId];
        if (self.ownedTokens[to].length > 0) {
            self.ownedTokens[to].pop();
        }
    }    

    function findTokensOwned(OwnerEnumerableData storage self, address wallet) public view returns (uint256[] storage) {
        return self.ownedTokens[wallet];
    }  

    function tokenIndex(OwnerEnumerableData storage self, address wallet, uint256 index) public view returns (uint256) {
        return self.ownedTokens[wallet][index];
    }    

    function ownerOf(OwnerEnumerableData storage self, uint256 tokenId) public view returns (address) {
        address owner = self.tokens[tokenId].ownedBy;
        if (owner == address(0)) {
            revert TokenNonOwner(owner,tokenId);
        }
        return owner;
    }      
}

File 33 of 34 : SetPackable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;


/**
    * The caller must own the token or be an approved operator.
    */
error ApprovalCallerNotOwnerNorApproved();

/**
    * The token does not exist.
    */
error ApprovalQueryForNonexistentToken();

/**
    * Cannot query the balance for the zero address.
    */
error BalanceQueryForZeroAddress();

/**
    * Cannot mint to the zero address.
    */
error MintToZeroAddress();

/**
    * The quantity of tokens minted must be more than zero.
    */
error MintZeroQuantity();

/**
    * The token does not exist.
    */
error OwnerQueryForNonexistentToken();

/**
    * The caller must own the token or be an approved operator.
    */
error TransferCallerNotOwnerNorApproved();

/**
    * The token must be owned by `from`.
    */
error TransferFromIncorrectOwner();

/**
    * Cannot safely transfer to a contract that does not implement the
    * ERC721Receiver interface.
    */
error TransferToNonERC721ReceiverImplementer();

/**
    * Cannot transfer to the zero address.
    */
error TransferToZeroAddress();

/**
    * The token does not exist.
    */
error URIQueryForNonexistentToken();

/**
    * The `quantity` minted with ERC2309 exceeds the safety limit.
    */
error MintERC2309QuantityExceedsLimit();

/**
    * The `extraData` cannot be set on an unintialized ownership slot.
    */
error OwnershipNotInitializedForExtraData();

// =============================================================
//                            STRUCTS
// =============================================================

struct TokenOwnership {
    // The address of the owner.
    address addr;
    // Stores the start time of ownership with minimal overhead for tokenomics.
    uint64 startTimestamp;
    // Whether the token has been burned.
    bool burned;
    // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
    uint24 extraData;
}    


struct DualAuxData {
    uint32 data1;
    uint32 data2;
}

struct QuadAuxData {
    uint16 data1;
    uint16 data2;
    uint16 data3;
    uint16 data4;
}
struct OctAuxData {
    uint8 data1;
    uint8 data2;
    uint8 data3;
    uint8 data4;
    uint8 data5;
    uint8 data6;
    uint8 data7;
    uint8 data8;
}

// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned.
// See {_packedOwnershipOf} implementation for details.
//
// Bits Layout:
// - [0..159]   `addr`
// - [160..223] `startTimestamp`
// - [224]      `burned`
// - [225]      `nextInitialized`
// - [232..255] `extraData`

// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63]    `balance`
// - [64..127]  `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
struct PackableData {
    mapping(uint256 => uint256) _packedOwnerships;
    mapping(address => uint256) _packedAddressData;
    uint256 _currentIndex;
    uint256 _burnCounter;
}

library SetPackable {

    

    // =============================================================
    //                           CONSTANTS
    // =============================================================

    // Mask of an entry in packed address data.
    uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;

    // The bit position of `numberMinted` in packed address data.
    uint256 private constant _BITPOS_NUMBER_MINTED = 64;

    // The bit position of `numberBurned` in packed address data.
    uint256 private constant _BITPOS_NUMBER_BURNED = 128;

    // The bit position of `aux` in packed address data.
    uint256 private constant _BITPOS_AUX = 192;

    // Mask of all 256 bits in packed address data except the 64 bits for `aux`.
    uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;

    // The bit position of `startTimestamp` in packed ownership.
    uint256 private constant _BITPOS_START_TIMESTAMP = 160;

    // The bit mask of the `burned` bit in packed ownership.
    uint256 private constant _BITMASK_BURNED = 1 << 224;

    // The bit position of the `nextInitialized` bit in packed ownership.
    uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;

    // The bit mask of the `nextInitialized` bit in packed ownership.
    uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;

    // The bit position of `extraData` in packed ownership.
    uint256 private constant _BITPOS_EXTRA_DATA = 232;

    // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
    uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;

    // The mask of the lower 160 bits for addresses.
    uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;

    // The maximum `quantity` that can be minted with {_mintERC2309}.
    // This limit is to prevent overflows on the address data entries.
    // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
    // is required to cause an overflow, which is unrealistic.
    uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;

    // The `Transfer` event signature is given by:
    // `keccak256(bytes("Transfer(address,address,uint256)"))`.
    bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;


    // =============================================================
    //                    ADDRESS DATA OPERATIONS
    // =============================================================

    /**
     * @dev Returns the number of tokens in `owner`'s account.
     */
    function balanceOf(PackableData storage self, address owner) public view returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return self._packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(PackableData storage self,address owner) public view returns (uint256) {
        return (self._packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens burned by or on behalf of `owner`.
     */
    function _numberBurned(PackableData storage self,address owner) public view returns (uint256) {
        return (self._packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     */
    function _getAux(PackableData storage self,address owner) public view returns (uint64 aux) {
        return uint64(self._packedAddressData[owner] >> _BITPOS_AUX);
    }

    /**
     * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     * If there are multiple variables, please pack them into a uint64.
     */
    function _setAux(PackableData storage self, address owner, uint64 aux) public {
        uint256 packed = self._packedAddressData[owner];
        uint256 auxCasted;
        // Cast `aux` with assembly to avoid redundant masking.
        assembly {
            auxCasted := aux
        }
        packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
        self._packedAddressData[owner] = packed;
    }

    function getAux16(PackableData storage self, address owner) internal view returns (uint16[4] memory) {
        
        uint32[2] memory packed32 = unpack64(self,_getAux(self,owner));
        uint16[2] memory pack16a = unpack32(self,packed32[0]);
        uint16[2] memory pack16b = unpack32(self,packed32[1]);
        
        return [pack16a[0],pack16a[1],pack16b[0],pack16b[1]];
    }   

    function pack16(PackableData storage, uint8 pack1, uint8 pack2) public pure returns (uint16) {
        return (uint16(pack2) << 8) | pack1;
    }

    function pack32(PackableData storage, uint16 pack1, uint16 pack2) public pure returns (uint32) {
        return (uint32(pack2) << 16) | pack1;
    }    

    function pack64(PackableData storage, uint32 pack1, uint32 pack2) public pure returns (uint64) {
        return (uint64(pack2) << 32) | pack1;
    }        

    function unpack64(PackableData storage, uint64 packed) public pure returns (uint32[2] memory unpacked){
        uint32 pack2 = uint32(packed >> 32); 
        uint32 pack1 = uint32(packed);       
        return [pack1, pack2];
    }       

    function unpack32(PackableData storage, uint32 packed) public pure returns (uint16[2] memory unpacked){
        uint16 pack2 = uint16(packed >> 16); 
        uint16 pack1 = uint16(packed);       
        return [pack1, pack2];
    }        

    function unpack16(PackableData storage, uint16 packed) public pure returns (uint8[2] memory unpacked){
        uint8 pack2 = uint8(packed >> 8); 
        uint8 pack1 = uint8(packed);       
        return [pack1, pack2];
    }    

    // =============================================================
    //                     OWNERSHIPS OPERATIONS
    // =============================================================

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(PackableData storage self, uint256 tokenId) public view returns (address) {
        return address(uint160(_packedOwnershipOf(self,tokenId)));
    }

    /**
     * @dev Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around over time.
     */
    function _ownershipOf(PackableData storage self, uint256 tokenId) internal view returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnershipOf(self,tokenId));
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct at `index`.
     */
    function _ownershipAt(PackableData storage self, uint256 index) internal view returns (TokenOwnership memory) {
        return _unpackedOwnership(self._packedOwnerships[index]);
    }

    /**
     * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
     */
    function _initializeOwnershipAt(PackableData storage self, uint256 index) internal {
        if (self._packedOwnerships[index] == 0) {
            self._packedOwnerships[index] = _packedOwnershipOf(self,index);
        }
    }

    /**
     * Returns the packed ownership data of `tokenId`.
     */
    function _packedOwnershipOf(PackableData storage self, uint256 tokenId) private view returns (uint256) {
        uint256 curr = tokenId;

        unchecked {
            if (_startTokenId(self) <= curr)
                if (curr < self._currentIndex) {
                    uint256 packed = self._packedOwnerships[curr];
                    // If not burned.
                    if (packed & _BITMASK_BURNED == 0) {
                        // Invariant:
                        // There will always be an initialized ownership slot
                        // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                        // before an unintialized ownership slot
                        // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                        // Hence, `curr` will not underflow.
                        //
                        // We can directly compare the packed value.
                        // If the address is zero, packed will be zero.
                        while (packed == 0) {
                            packed = self._packedOwnerships[--curr];
                        }
                        return packed;
                    }
                }
        }
        revert OwnerQueryForNonexistentToken();
    }

    /**
     * @dev Returns the unpacked `TokenOwnership` struct from `packed`.
     */
    function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
        ownership.addr = address(uint160(packed));
        ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
        ownership.burned = packed & _BITMASK_BURNED != 0;
        ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
    }

    /**
     * @dev Packs ownership data into a single uint256.
     */
    function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, _BITMASK_ADDRESS)
            // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
            result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
        }
    }



    /**
     * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
     */
    function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
        // For branchless setting of the `nextInitialized` flag.
        assembly {
            // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
            result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
        }
    }    

    /**
     * @dev Returns the starting token ID.
     * To change the starting token ID, please override this function.
     */
    function _startTokenId(PackableData storage) internal pure returns (uint256) {
        return 1;
    }  

/**
     * @dev Returns the next token ID to be minted.
     */
    function _nextTokenId(PackableData storage self) public view returns (uint256) {
        return self._currentIndex;
    }

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply(PackableData storage self) public view returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than `_currentIndex - _startTokenId()` times.
        unchecked {
            return self._currentIndex - self._burnCounter;
        }
    }

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted(PackableData storage self) public view returns (uint256) {
        // Counter underflow is impossible as `_currentIndex` does not decrement,
        // and it is initialized to `_startTokenId()`.
        unchecked {
            return self._currentIndex;
        }
    }

    /**
     * @dev Returns the total number of tokens burned.
     */
    function _totalBurned(PackableData storage self) public view returns (uint256) {
        return self._burnCounter;
    }      

/**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted. See {_mint}.
     */
    function _exists(PackableData storage self, uint256 tokenId) public view returns (bool) {
        return
            _startTokenId(self) <= tokenId &&
            tokenId < self._currentIndex && // If within bounds,
            self._packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
    }

    // =============================================================
    //                      TRANSFER OPERATIONS
    // =============================================================

    function transferFrom(
        PackableData storage self,
        address from,
        address to,
        uint256 tokenId
    ) public {
        uint256 prevOwnershipPacked = _packedOwnershipOf(self,tokenId);

        if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();        

        if (to == address(0)) revert TransferToZeroAddress();

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // We can directly increment and decrement the balances.
            --self._packedAddressData[from]; // Updates: `balance -= 1`.
            ++self._packedAddressData[to]; // Updates: `balance += 1`.

            // Updates:
            // - `address` to the next owner.
            // - `startTimestamp` to the timestamp of transfering.
            // - `burned` to `false`.
            // - `nextInitialized` to `true`.
            self._packedOwnerships[tokenId] = _packOwnershipData(
                to,
                _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (self._packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != self._currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        self._packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }
    }

    

    // =============================================================
    //                        MINT OPERATIONS
    // =============================================================

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _mint(PackableData storage self, address to, uint256 quantity) public returns (uint256) {
        uint256 startTokenId = self._currentIndex;
        if (quantity == 0) revert MintZeroQuantity();        

        // Overflows are incredibly unrealistic.
        // `balance` and `numberMinted` have a maximum limit of 2**64.
        // `tokenId` has a maximum limit of 2**256.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            self._packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            self._packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            uint256 toMasked;
            uint256 end = startTokenId + quantity;

            // Use assembly to loop and emit the `Transfer` event for gas savings.
            // The duplicated `log4` removes an extra check and reduces stack juggling.
            // The assembly, together with the surrounding Solidity code, have been
            // delicately arranged to nudge the compiler into producing optimized opcodes.
            assembly {
                // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
                toMasked := and(to, _BITMASK_ADDRESS)
                // Emit the `Transfer` event.
                log4(
                    0, // Start of data (0, since no data).
                    0, // End of data (0, since no data).
                    _TRANSFER_EVENT_SIGNATURE, // Signature.
                    0, // `address(0)`.
                    toMasked, // `to`.
                    startTokenId // `tokenId`.
                )

                // The `iszero(eq(,))` check ensures that large values of `quantity`
                // that overflows uint256 will make the loop run out of gas.
                // The compiler will optimize the `iszero` away for performance.
                for {
                    let tokenId := add(startTokenId, 1)
                } iszero(eq(tokenId, end)) {
                    tokenId := add(tokenId, 1)
                } {
                    // Emit the `Transfer` event. Similar to above.
                    log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                }
            }
            if (toMasked == 0) revert MintToZeroAddress();

            self._currentIndex = end;
        }     
        return self._currentIndex;
    }

    

    // =============================================================
    //                        BURN OPERATIONS
    // =============================================================

    function _burn(PackableData storage self, uint256 tokenId) public {
        uint256 prevOwnershipPacked = _packedOwnershipOf(self,tokenId);

        address from = address(uint160(prevOwnershipPacked));

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // Updates:
            // - `balance -= 1`.
            // - `numberBurned += 1`.
            //
            // We can directly decrement the balance, and increment the number burned.
            // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
            self._packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;

            // Updates:
            // - `address` to the last owner.
            // - `startTimestamp` to the timestamp of burning.
            // - `burned` to `true`.
            // - `nextInitialized` to `true`.
            self._packedOwnerships[tokenId] = _packOwnershipData(
                from,
                (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (self._packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != self._currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        self._packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
        unchecked {
            self._burnCounter++;
        }
    }

    // =============================================================
    //                     EXTRA DATA OPERATIONS
    // =============================================================

    /**
     * @dev Directly sets the extra data for the ownership data `index`.
     */
    function _setExtraDataAt(PackableData storage self, uint256 index, uint24 extraData) public {
        uint256 packed = self._packedOwnerships[index];
        if (packed == 0) revert OwnershipNotInitializedForExtraData();
        uint256 extraDataCasted;
        // Cast `extraData` with assembly to avoid redundant masking.
        assembly {
            extraDataCasted := extraData
        }
        packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
        self._packedOwnerships[index] = packed;
    }

    /**
     * @dev Called during each token transfer to set the 24bit `extraData` field.
     * Intended to be overridden by the cosumer contract.
     *
     * `previousExtraData` - the value of `extraData` before transfer.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _extraData(
        address from,
        address to,
        uint24 previousExtraData
    ) public view returns (uint24) {}

    /**
     * @dev Returns the next extra data for the packed ownership data.
     * The returned result is shifted into position.
     */
    function _nextExtraData(
        address from,
        address to,
        uint256 prevOwnershipPacked
    ) private view returns (uint256) {
        uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
        return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
    }

    // =============================================================
    //                       OTHER OPERATIONS
    // =============================================================

    /**
     * @dev Converts a uint256 to its ASCII string decimal representation.
     */
    function _toString(uint256 value) public pure returns (string memory str) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
            let m := add(mload(0x40), 0xa0)
            // Update the free memory pointer to allocate.
            mstore(0x40, m)
            // Assign the `str` to the end.
            str := sub(m, 0x20)
            // Zeroize the slot after the string.
            mstore(str, 0)

            // Cache the end of the memory to calculate the length later.
            let end := str

            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            // prettier-ignore
            for { let temp := value } 1 {} {
                str := sub(str, 1)
                // Write the character to the pointer.
                // The ASCII index of the '0' character is 48.
                mstore8(str, add(48, mod(temp, 10)))
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
                // prettier-ignore
                if iszero(temp) { break }
            }

            let length := sub(end, str)
            // Move the pointer 32 bytes leftwards to make room for the length.
            str := sub(str, 0x20)
            // Store the length.
            mstore(str, length)
        }
    }    

}

File 34 of 34 : SetPhaseable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

struct PhaseableData { 
    Phase[] phases;
    uint256 activePhase;
    uint256 maxSupply;
}    

struct Phase {
    uint64 name;
    uint64 maxPerWallet;
    uint64 highestSupply;
    uint64 cost;
}

error MintIsNotAllowedRightNow();
error ExceedsMaxSupply();
error PhaseNotActiveYet();
error PhaseExhausted();
error WalletMintsFilled(uint256 requested);

library SetPhaseable {
    function initialize(PhaseableData storage self, Phase[] storage phases, uint256 maxSupply) public {
        self.phases = phases;
        self.activePhase = 0;
        self.maxSupply = maxSupply;
    }
    function getMaxSupply(PhaseableData storage self) public view returns (uint256) {
        return self.maxSupply;
    }
    function setMaxSupply(PhaseableData storage self, uint256 newMax) public {
        self.maxSupply = newMax;
    }
    function getPhases(PhaseableData storage self) public view returns (Phase[] storage) {
        return self.phases;
    }
    function getActivePhase(PhaseableData storage self) public view returns (uint256) {
        return self.activePhase;
    }
    function findPhase(PhaseableData storage self, uint256 phaseId) public view returns (Phase memory) {
        return self.phases[phaseId];
    }
    function startNextPhase(PhaseableData storage self) public {
        self.activePhase += 1;
    }
    function revertPhase(PhaseableData storage self) public {
        self.activePhase -= 1;
    }
    function addPhase(PhaseableData storage self,Phase calldata nextPhase) public {
        self.phases.push(nextPhase);
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {
    "contracts/SetApprovable.sol": {
      "SetApprovable": "0x5beb03b964115906ae157be77debc55fec6d47d5"
    },
    "contracts/SetAssignable.sol": {
      "SetAssignable": "0xfc3b49b6257d7eba30a5a1d81f99d6c896ec3568"
    },
    "contracts/SetFlexibleMetadata.sol": {
      "SetFlexibleMetadata": "0xc2dc8b9b633a6a8b00058cd0dc74732182cd58e3"
    },
    "contracts/SetInscribable.sol": {
      "SetInscribable": "0xd7703437ed73f49fb6183caf673a534ae8fd7fd7"
    },
    "contracts/SetLockable.sol": {
      "SetLockable": "0x2d65c58e6106660eddbd6cbbbf25d154ba105137"
    },
    "contracts/SetOwnerEnumerable.sol": {
      "SetOwnerEnumerable": "0x3b6b80eca0a8f524ac43365ac5c1c67f24806d72"
    },
    "contracts/SetPackable.sol": {
      "SetPackable": "0x1b2868f3a937a3a9e6dedb33e0804c00fc6bd6c4"
    },
    "contracts/SetPhaseable.sol": {
      "SetPhaseable": "0xffd2d5be009c0f9257523f62856639a26db10875"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"invocation","type":"string"},{"internalType":"string","name":"seal","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInscribed","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"CallerIsNotOwner","type":"error"},{"inputs":[],"name":"ContractIsNot721Receiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"elder","type":"uint256"}],"name":"ElderAlreadyClaimed","type":"error"},{"inputs":[],"name":"ExceedsMaxSupply","type":"error"},{"inputs":[],"name":"InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"zero","type":"address"}],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidTransferRecipient","type":"error"},{"inputs":[],"name":"MintIsNotAllowedRightNow","type":"error"},{"inputs":[],"name":"MintIsNotLive","type":"error"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"NotAssigned","type":"error"},{"inputs":[],"name":"NotTokenOwner","type":"error"},{"inputs":[],"name":"OwnerCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"PhaseExhausted","type":"error"},{"inputs":[],"name":"PhaseNotActiveYet","type":"error"},{"inputs":[],"name":"ReachingBeyondAbility","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenNonExistent","type":"error"},{"inputs":[{"internalType":"address","name":"requester","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenNonOwner","type":"error"},{"inputs":[{"internalType":"uint256","name":"cost","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnacceptableOffering","type":"error"},{"inputs":[],"name":"WalletLockedByOwner","type":"error"},{"inputs":[{"internalType":"uint256","name":"requested","type":"uint256"}],"name":"WalletMintsFilled","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes","name":"sigil","type":"bytes"}],"name":"acolyteRitual","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bool","name":"enumerate","type":"bool"}],"name":"airdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"assignColdStorage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"seekingContract","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"scriptClass","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"canInscribe","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"custodianOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"quantity","type":"uint64"},{"internalType":"uint256[]","name":"elders","type":"uint256[]"},{"internalType":"bytes","name":"sigil","type":"bytes"}],"name":"elderRitual","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"enumeratedBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"findAssignments","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"scriptClass","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"findInscription","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"isFlagged","type":"bool"}],"name":"flagToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSigningAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"addressed","type":"address"}],"name":"hasBeenClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes","name":"sigil","type":"bytes"}],"name":"initiateRitual","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"inscription","type":"string"},{"internalType":"uint256","name":"inscriptionClass","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"inscribe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"scriptClass","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"inscriptionRequestExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isOsmRegisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"lockWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"lockedSince","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"necrophize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"btcAddress","type":"string"}],"name":"necroscribe","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"nextPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"numberMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"scriptClass","type":"uint256"}],"name":"openInscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pact","type":"address"}],"name":"pactOfSustenance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pact","type":"address"}],"name":"pactWithCharun","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pact","type":"address"}],"name":"pactWithElders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"previousPhase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"scriptClass","type":"uint256"}],"name":"retrieveRequests","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"btcAddress","type":"string"}],"internalType":"struct Script[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_reveal","type":"bool"}],"name":"reveal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"revokeAssignments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"revokeColdStorage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"phase","type":"uint256"}],"name":"ritualPhase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"sacrifice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setContractUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"custodianAddress","type":"address"}],"name":"setCustodian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isLive","type":"bool"}],"name":"setMintLive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sigKey","type":"address"}],"name":"setSigningAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"key","type":"uint256"},{"internalType":"string","name":"uri","type":"string"}],"name":"setSupplementalTokenUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"tokenType","type":"uint256"}],"name":"setTokenUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"tokensOwnedBy","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unlockWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"vitalize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"btcAddress","type":"string"}],"name":"vitascribe","outputs":[],"stateMutability":"payable","type":"function"}]

6080604052602780546001600160a01b03191690556101a460295566b1a2bc2ec500006030553480156200003257600080fd5b50604051620053dc380380620053dc83398101604081905262000055916200087e565b8181818181816200006633620005fd565b600162000074838262000973565b50600262000083828262000973565b50505050506200009f600b6200064d60201b620022e41760201c565b600d55620000ad3362000653565b6200012b82828151602080840191909120825183830120602954604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f95810195909552840192909252606083015260808201523060a082015260c00160408051601f1981840301815291905280516020909101206028555050565b6000620001376200067f565b905080604051806080016040528060006001600160401b0316815260200160206001600160401b0316815260200161017d6001600160401b0316815260200160006001600160401b03168152509080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a8154816001600160401b0302191690836001600160401b0316021790555060208201518160000160086101000a8154816001600160401b0302191690836001600160401b0316021790555060408201518160000160106101000a8154816001600160401b0302191690836001600160401b0316021790555060608201518160000160186101000a8154816001600160401b0302191690836001600160401b03160217905550505080604051806080016040528060016001600160401b0316815260200160026001600160401b031681526020016101b96001600160401b031681526020016109c46001600160401b03168152509080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a8154816001600160401b0302191690836001600160401b0316021790555060208201518160000160086101000a8154816001600160401b0302191690836001600160401b0316021790555060408201518160000160106101000a8154816001600160401b0302191690836001600160401b0316021790555060608201518160000160186101000a8154816001600160401b0302191690836001600160401b03160217905550505080604051806080016040528060026001600160401b0316815260200160036001600160401b0316815260200161037b6001600160401b0316815260200166470de4df8200006001600160401b03168152509080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a8154816001600160401b0302191690836001600160401b0316021790555060208201518160000160086101000a8154816001600160401b0302191690836001600160401b0316021790555060408201518160000160106101000a8154816001600160401b0302191690836001600160401b0316021790555060608201518160000160186101000a8154816001600160401b0302191690836001600160401b03160217905550505080604051806080016040528060036001600160401b0316815260200160046001600160401b031681526020016103ea6001600160401b03168152602001668e1bc9bf0400006001600160401b03168152509080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a8154816001600160401b0302191690836001600160401b0316021790555060208201518160000160086101000a8154816001600160401b0302191690836001600160401b0316021790555060408201518160000160106101000a8154816001600160401b0302191690836001600160401b0316021790555060608201518160000160186101000a8154816001600160401b0302191690836001600160401b031602179055505050620005f2816103ea620006fe60201b60201c565b505050505062000a59565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b50600190565b6200065d62000775565b602780546001600160a01b0319166001600160a01b0392909216919091179055565b604051632d827d9160e11b81526021600482015260009073ffd2d5be009c0f9257523f62856639a26db1087590635b04fb2290602401602060405180830381865af4158015620006d3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006f9919062000a3f565b905090565b6040516347e5f1e960e01b815260216004820152602481018390526044810182905273ffd2d5be009c0f9257523f62856639a26db10875906347e5f1e99060640160006040518083038186803b1580156200075857600080fd5b505af41580156200076d573d6000803e3d6000fd5b505050505050565b33620007896000546001600160a01b031690565b6001600160a01b031614620007b75760405163d4ed9a1760e01b815233600482015260240160405180910390fd5b565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620007e157600080fd5b81516001600160401b0380821115620007fe57620007fe620007b9565b604051601f8301601f19908116603f01168101908282118183101715620008295762000829620007b9565b816040528381526020925086838588010111156200084657600080fd5b600091505b838210156200086a57858201830151818301840152908201906200084b565b600093810190920192909252949350505050565b600080604083850312156200089257600080fd5b82516001600160401b0380821115620008aa57600080fd5b620008b886838701620007cf565b93506020850151915080821115620008cf57600080fd5b50620008de85828601620007cf565b9150509250929050565b600181811c90821680620008fd57607f821691505b6020821081036200091e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200096e57600081815260208120601f850160051c810160208610156200094d5750805b601f850160051c820191505b818110156200076d5782815560010162000959565b505050565b81516001600160401b038111156200098f576200098f620007b9565b620009a781620009a08454620008e8565b8462000924565b602080601f831160018114620009df5760008415620009c65750858301515b600019600386901b1c1916600185901b1785556200076d565b600085815260208120601f198616915b8281101562000a1057888601518255948401946001909101908401620009ef565b508582101562000a2f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121562000a5257600080fd5b5051919050565b6149738062000a696000396000f3fe6080604052600436106102c85760003560e01c806301ece7cb146102cd57806301ffc9a7146102e257806306fdde0314610317578063081812fc14610339578063095ea7b31461036657806318160ddd1461038657806323b872dd146103a95780632c01a10e146103c9578063315be132146103e957806331beb605146104095780633594cb0e1461042957806335ca1c79146104495780633be795f2146104695780633eadb6db1461048957806342842e0e1461049e57806346dc94a1146104be578063477e3c73146104eb57806349dfc1e4146105005780634eba5f1e1461052057806353ca912a1461054057806356a3d732146105605780636352211e1461058057806366dfc384146105a05780636afc1334146105c05780636bda4f50146105e057806370a0823114610600578063715018a6146106205780637381f9ae1461063557806386126853146106485780638da5cb5b1461068b578063911c9874146106a0578063940cd05b146106c057806395d89b41146106e0578063a1a39af2146106f5578063a22cb46514610715578063a3d90b1614610735578063ab6f644a14610748578063af2827be14610768578063b88d4fde14610788578063c87b56dd146107a8578063ccb4807b146107c8578063cea06b03146107e8578063cefc56cf14610808578063d04c406b14610828578063d068a1811461083b578063d480924d1461085b578063d5688cdc1461087b578063d67f3ee11461089b578063d855a579146108bb578063d97de9b6146108d9578063dbc3f80b146108f9578063dc33e68114610919578063dd10819014610939578063de3efc9114610966578063e178e05114610986578063e84e2ffd146109a6578063e8a3d485146109c6578063e985e9c5146109db578063ea66aeb3146109fb578063ea6ef37114610a28578063f2fde38b14610a48578063f6aacfb114610a68578063f7888aec14610a88575b600080fd5b6102e06102db366004613bd8565b610aa8565b005b3480156102ee57600080fd5b506103026102fd366004613c34565b610ad9565b60405190151581526020015b60405180910390f35b34801561032357600080fd5b5061032c610b2b565b60405161030e9190613ca1565b34801561034557600080fd5b50610359610354366004613cb4565b610bbd565b60405161030e9190613ccd565b34801561037257600080fd5b506102e0610381366004613cf6565b610be4565b34801561039257600080fd5b5061039b610bf7565b60405190815260200161030e565b3480156103b557600080fd5b506102e06103c4366004613d22565b610c74565b3480156103d557600080fd5b506103026103e4366004613d63565b610c97565b3480156103f557600080fd5b506102e0610404366004613cb4565b610d1e565b34801561041557600080fd5b506102e0610424366004613d85565b610d96565b34801561043557600080fd5b506102e0610444366004613d85565b610dc0565b34801561045557600080fd5b506102e0610464366004613cb4565b610de9565b34801561047557600080fd5b506102e0610484366004613cb4565b610e2b565b34801561049557600080fd5b506102e0610e9f565b3480156104aa57600080fd5b506102e06104b9366004613d22565b610f0d565b3480156104ca57600080fd5b506104de6104d9366004613cb4565b610f28565b60405161030e9190613da2565b3480156104f757600080fd5b506102e0610faa565b34801561050c57600080fd5b506102e061051b366004613bd8565b610fea565b34801561052c57600080fd5b506102e061053b366004613e68565b611062565b34801561054c57600080fd5b506102e061055b366004613f45565b611316565b34801561056c57600080fd5b506102e061057b366004613f62565b611331565b34801561058c57600080fd5b5061035961059b366004613cb4565b6113eb565b3480156105ac57600080fd5b506102e06105bb366004613d85565b611469565b3480156105cc57600080fd5b506102e06105db366004613cb4565b61148f565b3480156105ec57600080fd5b506102e06105fb366004613cb4565b6114c5565b34801561060c57600080fd5b5061039b61061b366004613d85565b611502565b34801561062c57600080fd5b506102e0611580565b6102e0610643366004613fa4565b611594565b34801561065457600080fd5b50610302610663366004613fef565b6001600160a01b03166000908152601f60209081526040808320938352929052205460ff1690565b34801561069757600080fd5b506103596116c4565b3480156106ac57600080fd5b506102e06106bb366004613fef565b6116d3565b3480156106cc57600080fd5b506102e06106db366004613f45565b611717565b3480156106ec57600080fd5b5061032c61175f565b34801561070157600080fd5b5061039b610710366004613cb4565b61176e565b34801561072157600080fd5b506102e061073036600461401f565b61179f565b6102e0610743366004613bd8565b6117d4565b34801561075457600080fd5b506102e0610763366004613cb4565b611801565b34801561077457600080fd5b50610302610783366004613cb4565b611856565b34801561079457600080fd5b506102e06107a336600461404d565b611861565b3480156107b457600080fd5b5061032c6107c3366004613cb4565b611880565b3480156107d457600080fd5b506102e06107e33660046140cc565b611902565b3480156107f457600080fd5b50610302610803366004613d63565b611944565b34801561081457600080fd5b506102e0610823366004614100565b611a4e565b6102e0610836366004613d63565b611a61565b34801561084757600080fd5b506102e061085636600461414d565b611aa6565b34801561086757600080fd5b506102e0610876366004614172565b611aea565b34801561088757600080fd5b506102e0610896366004613cb4565b611bb0565b3480156108a757600080fd5b506102e06108b6366004613fa4565b611c26565b3480156108c757600080fd5b506027546001600160a01b0316610359565b3480156108e557600080fd5b5061039b6108f4366004613d85565b611d3c565b34801561090557600080fd5b5061032c610914366004613d63565b611d63565b34801561092557600080fd5b5061039b610934366004613d85565b611de7565b34801561094557600080fd5b50610959610954366004613cb4565b611e24565b60405161030e91906141b6565b34801561097257600080fd5b50610359610981366004613cb4565b611ea6565b34801561099257600080fd5b506102e06109a1366004613cb4565b611eea565b3480156109b257600080fd5b506102e06109c1366004613d85565b611f3b565b3480156109d257600080fd5b5061032c611f61565b3480156109e757600080fd5b506103026109f636600461422a565b611fdc565b348015610a0757600080fd5b50610a1b610a16366004613d85565b61201b565b60405161030e9190614258565b348015610a3457600080fd5b506102e0610a43366004613cb4565b6120ef565b348015610a5457600080fd5b506102e0610a63366004613d85565b6121c6565b348015610a7457600080fd5b50610302610a83366004613cb4565b6121fe565b348015610a9457600080fd5b5061039b610aa336600461422a565b61222f565b610ab36001836122ea565b610abc826114c5565b610ac96030546001612339565b610ad560018383612389565b5050565b60006001600160e01b031982166380ac58cd60e01b1480610b0a57506001600160e01b03198216635b5e139f60e01b145b80610b2557506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060018054610b3a90614290565b80601f0160208091040260200160405190810160405280929190818152602001828054610b6690614290565b8015610bb35780601f10610b8857610100808354040283529160200191610bb3565b820191906000526020600020905b815481529060010190602001808311610b9657829003601f168201915b5050505050905090565b6000610bc8826123fc565b506000908152601a60205260409020546001600160a01b031690565b610bed81612421565b610ad58282612448565b60405163fe6e324760e01b8152600b6004820152600090731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c49063fe6e3247906024015b602060405180830381865af4158015610c4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6f91906142ca565b905090565b610c7e338261250a565b610c8781612421565b610c928383836125f7565b505050565b60405163d751a37360e01b815260009073d7703437ed73f49fb6183caf673a534ae8fd7fd79063d751a37390610cd690602a90879087906004016142e3565b602060405180830381865af4158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1791906142f9565b9392505050565b610d26612656565b6040516301d6edb360e21b815273d7703437ed73f49fb6183caf673a534ae8fd7fd79063075bb6cc90610d6390602a908590600190600401614316565b60006040518083038186803b158015610d7b57600080fd5b505af4158015610d8f573d6000803e3d6000fd5b5050505050565b610d9e612656565b602780546001600160a01b0319166001600160a01b0392909216919091179055565b610dc8612656565b602e80546001600160a01b0319166001600160a01b03831617905550565b50565b732d65c58e6106660eddbd6cbbbf25d154ba105137638fb14e3b601d610e0e846113eb565b6040518363ffffffff1660e01b8152600401610d6392919061432e565b610e34816113eb565b6001600160a01b0316336001600160a01b031614610e65576040516359dc379f60e01b815260040160405180910390fd5b604051630d03463560e31b815273fc3b49b6257d7eba30a5a1d81f99d6c896ec35689063681a31a890610d63906024908590600401614345565b610ea7612656565b60405163bbc884db60e01b81526021600482015273ffd2d5be009c0f9257523f62856639a26db108759063bbc884db906024015b60006040518083038186803b158015610ef357600080fd5b505af4158015610f07573d6000803e3d6000fd5b50505050565b610c9283838360405180602001604052806000815250611861565b60405163989fba7d60e01b815260609073fc3b49b6257d7eba30a5a1d81f99d6c896ec35689063989fba7d90610f65906024908690600401614345565b600060405180830381865af4158015610f82573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b259190810190614353565b610fb2612656565b6040516344ece89360e01b81526021600482015273ffd2d5be009c0f9257523f62856639a26db10875906344ece89390602401610edb565b610ff2612656565b60405163c6c30e7760e01b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e39063c6c30e779061102e90600390869086906004016143ec565b60006040518083038186803b15801561104657600080fd5b505af415801561105a573d6000803e3d6000fd5b505050505050565b60275482908290339086906001600160a01b03166110b55760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08195b98589b195960aa1b60448201526064015b60405180910390fd5b6001600160a01b03821660005b8251811015611104578281815181106110dd576110dd614414565b6020026020010151826110f09190614440565b9150806110fc81614453565b9150506110c2565b50600061111082612688565b905060006028547f8abec9904ffaaac97c67514e7b42ae500930baa09e317d39b633a9f7c059d08c83604051602001611149919061446c565b60405160208183030381529060405280519060200120604051602001611170929190614345565b60405160208183030381529060405280519060200120604051602001611197929190614488565b6040516020818303038152906040528051906020012090506111fa6111f488888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869392505061271a9050565b8661273e565b60005b8a518110156112cb5761122b8b828151811061121b5761121b614414565b60200260200101516106636127e7565b15611266578a818151811061124257611242614414565b602002602001015160405163115b0f0760e01b81526004016110ac91815260200190565b6112b98b828151811061127b5761127b614414565b602002602001015161128b6127e7565b6001600160a01b03166000908152601f6020908152604080832093835292905220805460ff19166001179055565b806112c381614453565b9150506111fd565b506112e160006001600160401b038d16816127f6565b506112f5338c6001600160401b03166128d9565b61130960006001600160401b038d166129d9565b5050505050505050505050565b61131e612656565b6020805460ff1916911515919091179055565b611339612656565b60405163ddffa49760e01b81526021600482015273ffd2d5be009c0f9257523f62856639a26db108759063ddffa49790602401602060405180830381865af4158015611389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ad91906142ca565b826113b7600d5490565b6113c19190614440565b11156113e05760405163c30436e960e01b815260040160405180910390fd5b610f07838383612a11565b60405163307866fb60e01b8152600090731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c49063307866fb9061142890600b908690600401614345565b602060405180830381865af4158015611445573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2591906144a3565b611471612656565b602f80546001600160a01b0319166001600160a01b03831617905550565b6114a061149b826113eb565b612a7e565b732d65c58e6106660eddbd6cbbbf25d154ba10513763b0468662601d610e0e846113eb565b6114cf6001612ac2565b6114ec57604051633ad0c0bb60e11b815260040160405180910390fd5b6114f6338261250a565b610de681600080612b40565b604051630672195960e11b8152600090731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c490630ce432b29061153f90600b90869060040161432e565b602060405180830381865af415801561155c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2591906142ca565b611588612656565b6115926000612ba4565b565b6027548290829033906001600160a01b03166115c25760405162461bcd60e51b81526004016110ac906144c0565b600060285460008051602061491e833981519152836040516020016115e892919061432e565b6040516020818303038152906040528051906020012060405160200161160f929190614488565b60405160208183030381529060405280519060200120905061167261166c85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869392505061271a9050565b8361273e565b600061167e6002612bf4565b905061169781606001516001600160401b031689612339565b6116a460028960006127f6565b506116af33896128d9565b6116ba6002896129d9565b5050505050505050565b6000546001600160a01b031690565b732d65c58e6106660eddbd6cbbbf25d154ba1051376311841d70601d836116f9866113eb565b6040518463ffffffff1660e01b815260040161102e939291906144ef565b61171f612656565b604051636d0aa15360e11b815260036004820152811515602482015273c2dc8b9b633a6a8b00058cd0dc74732182cd58e39063da1542a690604401610d63565b606060028054610b3a90614290565b6000601e8161177c846113eb565b6001600160a01b0316815260208101919091526040016000206001015492915050565b6117ca6117ab3361201b565b6000815181106117bd576117bd614414565b6020026020010151612421565b610ad58282612c8f565b6117df6000836122ea565b6117e882611801565b6117f56030546001612339565b610ad560008383612389565b61180b6000612ac2565b61182857604051633ad0c0bb60e11b815260040160405180910390fd5b611832338261250a565b61183f8160016000612b40565b61184881612d0a565b610de657610de63382612d26565b6000610b2582612d0a565b61186b338361250a565b61187482612421565b610f0784848484612d62565b60405163d30eae4760e01b815260609073c2dc8b9b633a6a8b00058cd0dc74732182cd58e39063d30eae47906118bd906003908690600401614345565b600060405180830381865af41580156118da573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b259190810190614553565b61190a612656565b6040516316aa2cf160e11b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e390632d5459e290610d63906003908590600401614587565b60405163614ea3d560e11b815260009073d7703437ed73f49fb6183caf673a534ae8fd7fd79063c29d47aa9061198190602a908790600401614345565b602060405180830381865af415801561199e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c291906142f9565b8015610d17575060405163d751a37360e01b815273d7703437ed73f49fb6183caf673a534ae8fd7fd79063d751a37390611a0590602a90879087906004016142e3565b602060405180830381865af4158015611a22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4691906142f9565b159392505050565b611a56612656565b610c92838383612d96565b6000611a6c82612bf4565b9050611a8581606001516001600160401b031684612339565b611a91828460006127f6565b50611a9c33846128d9565b610c9282846129d9565b611aae612656565b6040516318aea9b160e01b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e3906318aea9b19061102e9060039086908690600401614316565b611af2612656565b60028114611b765760038114611b3c576040516345f5dac360e11b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e390638bebb5869061102e906003908690600401614587565b6040516348b5a5a360e01b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e3906348b5a5a39061102e906003908690600401614587565b60405163db6a3cab60e01b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e39063db6a3cab9061102e906003908690600401614587565b611bb9816113eb565b6001600160a01b0316336001600160a01b031614611bea576040516359dc379f60e01b815260040160405180910390fd5b604051636271484f60e11b815273fc3b49b6257d7eba30a5a1d81f99d6c896ec35689063c4e2909e90610d6390602490339086906004016145a0565b6027548290829033906001600160a01b0316611c545760405162461bcd60e51b81526004016110ac906144c0565b600060285460008051602061491e83398151915283604051602001611c7a92919061432e565b60405160208183030381529060405280519060200120604051602001611ca1929190614488565b604051602081830303815290604052805190602001209050611cfe61166c85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869392505061271a9050565b6000611d0a6001612bf4565b9050611d2381606001516001600160401b031689612dd4565b611d3060018960006127f6565b506116ba6001896129d9565b6000611d4782612e87565b506001600160a01b031660009081526010602052604090205490565b60405163977470b160e01b815260609073d7703437ed73f49fb6183caf673a534ae8fd7fd79063977470b190611da290602a90879087906004016142e3565b600060405180830381865af4158015611dbf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d179190810190614553565b60405163ae33168f60e01b8152600090731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c49063ae33168f9061153f90600b90869060040161432e565b604051633fa15fa760e21b815260609073d7703437ed73f49fb6183caf673a534ae8fd7fd79063fe857e9c90611e6190602a908690600401614345565b600060405180830381865af4158015611e7e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b2591908101906145bf565b6000732d65c58e6106660eddbd6cbbbf25d154ba10513763f1650c05601d611ecd856113eb565b6040518363ffffffff1660e01b815260040161142892919061432e565b611ef4338261250a565b611efd81612421565b611f0681612d0a565b15611f3257611f153382612eae565b6000818152600f6020526040902080546001600160a81b03191690555b610de681612f56565b611f43612656565b602d80546001600160a01b0319166001600160a01b03831617905550565b604051633571c1ef60e11b81526003600482015260609073c2dc8b9b633a6a8b00058cd0dc74732182cd58e390636ae383de90602401600060405180830381865af4158015611fb4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c6f9190810190614553565b60405163e4e0a72360e01b8152600090735beb03b964115906ae157be77debc55fec6d47d59063e4e0a72390610cd690601490879087906004016144ef565b6040516303c2425160e01b8152606090733b6b80eca0a8f524ac43365ac5c1c67f24806d72906303c242519061205890600f90869060040161432e565b602060405180830381865af4158015612075573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209991906142ca565b8054806020026020016040519081016040528092919081815260200182805480156120e357602002820191906000526020600020905b8154815260200190600101908083116120cf575b50505050509050919050565b604051633745024960e01b8152819073fc3b49b6257d7eba30a5a1d81f99d6c896ec35689063374502499061212b90602490339060040161432e565b602060405180830381865af4158015612148573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216c91906142ca565b1461218c573360405163377a707b60e11b81526004016110ac9190613ccd565b604051635a3f7e5160e01b815273fc3b49b6257d7eba30a5a1d81f99d6c896ec356890635a3f7e5190610d6390602490339060040161432e565b6121ce612656565b6001600160a01b0381166121f557604051630640d5fb60e51b815260040160405180910390fd5b610de681612ba4565b6000601e8161220c846113eb565b6001600160a01b0316815260208101919091526040016000205460ff1692915050565b60008061223b83611502565b905080156122da57600061224e8461201b565b60405163cc6a6bdf60e01b815290915073fc3b49b6257d7eba30a5a1d81f99d6c896ec35689063cc6a6bdf906122909060249085908a906000906004016146e8565b602060405180830381865af41580156122ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d191906142ca565b92505050610b25565b5060009392505050565b50600190565b6122f48282611944565b61231157604051633ad0c0bb60e11b815260040160405180910390fd5b61231b8282610c97565b15610ad5576040516342c3924b60e11b815260040160405180910390fd5b6123438282612f90565b61234b612fc6565b6001600160a01b03166108fc612361838561471d565b6040518115909202916000818181858888f19350505050158015610c92573d6000803e3d6000fd5b604051631fa1a2ed60e21b815273d7703437ed73f49fb6183caf673a534ae8fd7fd790637e868bb4906123c790602a90879087908790600401614734565b60006040518083038186803b1580156123df57600080fd5b505af41580156123f3573d6000803e3d6000fd5b50505050505050565b601c548111610de657604051631e97bf7b60e11b8152600481018290526024016110ac565b61242a816121fe565b15610de65760405163035857a760e41b815260040160405180910390fd5b61245181612fd5565b6040516339adbc2360e11b8152735beb03b964115906ae157be77debc55fec6d47d59063735b78469061248d90601490869086906004016145a0565b60006040518083038186803b1580156124a557600080fd5b505af41580156124b9573d6000803e3d6000fd5b5050505080826001600160a01b03166124d1836113eb565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b612513816113eb565b6001600160a01b0316826001600160a01b0316148061253f575061253f612539826113eb565b83611fdc565b806125d65750604051636e367b3f60e11b81526001600160a01b03831690735beb03b964115906ae157be77debc55fec6d47d59063dc6cf67e9061258a906014908690600401614345565b602060405180830381865af41580156125a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125cb91906144a3565b6001600160a01b0316145b610ad557818160405163a528473560e01b81526004016110ac929190614763565b6001600160a01b03821661261e57604051639b7cfcb760e01b815260040160405180910390fd5b6126278161300a565b61263081612d0a565b1561264057612640838383613044565b61264b8383836130ec565b610c92838383613142565b3361265f6116c4565b6001600160a01b031614611592573360405163d4ed9a1760e01b81526004016110ac9190613ccd565b6060600061269583613188565b60010190506000816001600160401b038111156126b4576126b4613ae5565b6040519080825280601f01601f1916602001820160405280156126de576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846126e857509392505050565b6000806000612729858561325e565b91509150612736816132a3565b509392505050565b602754604080518082019091526011815270696e76616c6964207369676e617475726560781b6020820152906001600160a01b038481169116146127955760405162461bcd60e51b81526004016110ac9190613ca1565b50604080518082019091526011815270696e76616c6964207369676e617475726560781b6020820152336001600160a01b03831614610c925760405162461bcd60e51b81526004016110ac9190613ca1565b602f546001600160a01b031690565b600061280284846133e8565b61281f57604051634f69b16b60e01b815260040160405180910390fd5b60405163ddffa49760e01b81526021600482015273ffd2d5be009c0f9257523f62856639a26db108759063ddffa49790602401602060405180830381865af415801561286f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289391906142ca565b8361289d600d5490565b6128a79190614440565b11156128c65760405163c30436e960e01b815260040160405180910390fd5b6128d1338484612a11565b949350505050565b60006128e7826103e861471d565b6128f990670de0b6b3a764000061471d565b9050806129046134de565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161292f9190613ccd565b602060405180830381865afa15801561294c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061297091906142ca565b1115610c925761297e6134de565b6001600160a01b031663a9059cbb84836040518363ffffffff1660e01b81526004016129ab929190614763565b600060405180830381600087803b1580156129c557600080fd5b505af11580156123f3573d6000803e3d6000fd5b60006129e4336134ed565b9050818184600481106129f9576129f9614414565b61ffff9092166020929092020152610c923382613500565b60205460009060ff16612a37576040516303eaac9360e01b815260040160405180910390fd5b6001600160a01b038416612a605783604051630bc2c5df60e11b81526004016110ac9190613ccd565b81612a7457612a6f84846136d1565b6128d1565b6128d18484613751565b735beb03b964115906ae157be77debc55fec6d47d5633f4e7cce601483612aa48161201b565b6040518463ffffffff1660e01b8152600401610d639392919061477c565b60405163614ea3d560e11b815260009073d7703437ed73f49fb6183caf673a534ae8fd7fd79063c29d47aa90612aff90602a908690600401614345565b602060405180830381865af4158015612b1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2591906142f9565b8115612b845760408051808201825291825260016020808401828152600096875260099091529190942091518255519201805460ff19169215159290921790915550565b50506000908152600960205260408120908155600101805460ff19169055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040805160808101825260008082526020820181905281830181905260608201529051633946d61960e21b815273ffd2d5be009c0f9257523f62856639a26db108759063e51b586490612c4e906021908690600401614345565b608060405180830381865af4158015612c6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2591906147a6565b80612cd057604051630aeeeecb60e01b8152735beb03b964115906ae157be77debc55fec6d47d590630aeeeecb9061102e90601490869033906004016144ef565b60405163b2875b1960e01b8152735beb03b964115906ae157be77debc55fec6d47d59063b2875b199061102e90601490869060040161432e565b6000908152600f6020526040902054600160a01b900460ff1690565b60405163c213e42f60e01b8152733b6b80eca0a8f524ac43365ac5c1c67f24806d729063c213e42f9061102e90600f90869086906004016145a0565b612d6e848484846137a6565b612d8b57604051637063b1a960e11b815260040160405180910390fd5b610f078484846125f7565b6040516343a4697d60e01b815273d7703437ed73f49fb6183caf673a534ae8fd7fd7906343a4697d906123c790602a9086908890879060040161482a565b612ddc6134de565b6001600160a01b03166323b872dd33612df3612fc6565b612dfd868661471d565b612e0f90670de0b6b3a764000061471d565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015612e63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9291906142f9565b6001600160a01b038116610de6576040516349e27cff60e01b815260040160405180910390fd5b604051630ba3340f60e21b8152733b6b80eca0a8f524ac43365ac5c1c67f24806d7290632e8cd03c90612eea90600f90869086906004016145a0565b60006040518083038186803b158015612f0257600080fd5b505af4158015612f16573d6000803e3d6000fd5b505060405163502bb5d160e11b8152733b6b80eca0a8f524ac43365ac5c1c67f24806d72925063a0576ba2915061102e90600f90869086906004016145a0565b60405163cf2563bd60e01b8152731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c49063cf2563bd90610d6390600b908590600401614345565b612f9a818361471d565b3414610ad557612faa818361471d565b34604051638078f8b560e01b81526004016110ac929190614345565b602d546001600160a01b031690565b33612fdf826113eb565b6001600160a01b031614610de657338160405163a528473560e01b81526004016110ac929190614763565b6040516356c7310360e11b8152735beb03b964115906ae157be77debc55fec6d47d59063ad8e620690610d63906014908590600401614345565b60405163502bb5d160e11b8152733b6b80eca0a8f524ac43365ac5c1c67f24806d729063a0576ba29061308090600f90879086906004016145a0565b60006040518083038186803b15801561309857600080fd5b505af41580156130ac573d6000803e3d6000fd5b505060405163c213e42f60e01b8152733b6b80eca0a8f524ac43365ac5c1c67f24806d72925063c213e42f91506123c790600f90869086906004016145a0565b604051630a13733160e21b8152600b60048201526001600160a01b0380851660248301528316604482015260648101829052731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c49063284dccc4906084016123c7565b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106131c75772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6904ee2d6d415b85acef8160201b83106131f1576904ee2d6d415b85acef8160201b830492506020015b662386f26fc10000831061320f57662386f26fc10000830492506010015b6305f5e1008310613227576305f5e100830492506008015b612710831061323b57612710830492506004015b6064831061324d576064830492506002015b600a8310610b255760010192915050565b60008082516041036132945760208301516040840151606085015160001a613288878285856138a8565b9450945050505061329c565b506000905060025b9250929050565b60008160048111156132b7576132b761485a565b036132bf5750565b60018160048111156132d3576132d361485a565b0361331b5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016110ac565b600281600481111561332f5761332f61485a565b0361337c5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016110ac565b60038160048111156133905761339061485a565b03610de65760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016110ac565b6000806133f3613962565b9050808411156134165760405163f60be67160e01b815260040160405180910390fd5b600083613422600d5490565b61342c9190614440565b9050600061343986612bf4565b905080604001516001600160401b0316821115613469576040516323e4615760e11b815260040160405180910390fd5b6000613474336134ed565b9050600081886004811061348a5761348a614414565b602002015161349d9061ffff1688614440565b905082602001516001600160401b03168111156134d057604051632dbcfc5560e21b8152600481018290526024016110ac565b506001979650505050505050565b602e546001600160a01b031690565b6134f5613aa9565b610b25600b8361399d565b805160208201516040516386e37b2760e01b8152731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c492639adeb2d292600b9287928692633838ced992869285926386e37b27926135579286929091600401614870565b602060405180830381865af4158015613574573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613598919061488a565b6040808a015160608b015191516386e37b2760e01b8152731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c4926386e37b27926135db92600b9290600401614870565b602060405180830381865af41580156135f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361c919061488a565b6040516001600160e01b031960e086901b168152600481019390935263ffffffff9182166024840152166044820152606401602060405180830381865af415801561366b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061368f91906148b0565b6040516001600160e01b031960e086901b16815260048101939093526001600160a01b0390911660248301526001600160401b0316604482015260640161102e565b604051634ae9f7ab60e01b8152600090731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c490634ae9f7ab9061371090600b90879087906004016145a0565b602060405180830381865af415801561372d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1791906142ca565b60008061375d600d5490565b613768906001614440565b9050600061377685856136d1565b9050815b81811161379d5761378b8682612d26565b8061379581614453565b91505061377a565b50949350505050565b60006001600160a01b0384163b1561389d57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906137ea9033908990889088906004016148cd565b6020604051808303816000875af1925050508015613825575060408051601f3d908101601f1916820190925261382291810190614900565b60015b613883573d808015613853576040519150601f19603f3d011682016040523d82523d6000602084013e613858565b606091505b50805160000361387b57604051639b7cfcb760e01b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506128d1565b506001949350505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156138d55750600090506003613959565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613929573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661395257600060019250925050613959565b9150600090505b94509492505050565b60405163d73ee61560e01b81526021600482015260009073ffd2d5be009c0f9257523f62856639a26db108759063d73ee61590602401610c2e565b6139a5613aa9565b6001600160a01b03821660009081526001840160205260408120546139ce90859060c01c613a4e565b905060006139e38583835b6020020151613a7d565b905060006139f3868460016139d9565b9050604051806080016040528083600060028110613a1357613a13614414565b6020908102919091015161ffff9081168352948101518516828201528351851660408301529290920151909216606090910152949350505050565b613a56613ac7565b506040805180820190915263ffffffff8281168252602092831c1691810191909152919050565b613a85613ac7565b506040805180820190915261ffff8083168252601083901c16602082015292915050565b60405180608001604052806004906020820280368337509192915050565b60405180604001604052806002906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715613b1d57613b1d613ae5565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613b4b57613b4b613ae5565b604052919050565b60006001600160401b03821115613b6c57613b6c613ae5565b50601f01601f191660200190565b6000613b8d613b8884613b53565b613b23565b9050828152838383011115613ba157600080fd5b828260208301376000602084830101529392505050565b600082601f830112613bc957600080fd5b610d1783833560208501613b7a565b60008060408385031215613beb57600080fd5b8235915060208301356001600160401b03811115613c0857600080fd5b613c1485828601613bb8565b9150509250929050565b6001600160e01b031981168114610de657600080fd5b600060208284031215613c4657600080fd5b8135610d1781613c1e565b60005b83811015613c6c578181015183820152602001613c54565b50506000910152565b60008151808452613c8d816020860160208601613c51565b601f01601f19169290920160200192915050565b602081526000610d176020830184613c75565b600060208284031215613cc657600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114610de657600080fd5b60008060408385031215613d0957600080fd5b8235613d1481613ce1565b946020939093013593505050565b600080600060608486031215613d3757600080fd5b8335613d4281613ce1565b92506020840135613d5281613ce1565b929592945050506040919091013590565b60008060408385031215613d7657600080fd5b50508035926020909101359150565b600060208284031215613d9757600080fd5b8135610d1781613ce1565b6020808252825182820181905260009190848201906040850190845b81811015613de35783516001600160a01b031683529284019291840191600101613dbe565b50909695505050505050565b6001600160401b0381168114610de657600080fd5b60006001600160401b03821115613e1d57613e1d613ae5565b5060051b60200190565b60008083601f840112613e3957600080fd5b5081356001600160401b03811115613e5057600080fd5b60208301915083602082850101111561329c57600080fd5b60008060008060608587031215613e7e57600080fd5b8435613e8981613def565b93506020858101356001600160401b0380821115613ea657600080fd5b818801915088601f830112613eba57600080fd5b8135613ec8613b8882613e04565b81815260059190911b8301840190848101908b831115613ee757600080fd5b938501935b82851015613f0557843582529385019390850190613eec565b975050506040880135925080831115613f1d57600080fd5b5050613f2b87828801613e27565b95989497509550505050565b8015158114610de657600080fd5b600060208284031215613f5757600080fd5b8135610d1781613f37565b600080600060608486031215613f7757600080fd5b8335613f8281613ce1565b9250602084013591506040840135613f9981613f37565b809150509250925092565b600080600060408486031215613fb957600080fd5b8335925060208401356001600160401b03811115613fd657600080fd5b613fe286828701613e27565b9497909650939450505050565b6000806040838503121561400257600080fd5b82359150602083013561401481613ce1565b809150509250929050565b6000806040838503121561403257600080fd5b823561403d81613ce1565b9150602083013561401481613f37565b6000806000806080858703121561406357600080fd5b843561406e81613ce1565b9350602085013561407e81613ce1565b92506040850135915060608501356001600160401b038111156140a057600080fd5b8501601f810187136140b157600080fd5b6140c087823560208401613b7a565b91505092959194509250565b6000602082840312156140de57600080fd5b81356001600160401b038111156140f457600080fd5b6128d184828501613bb8565b60008060006060848603121561411557600080fd5b83356001600160401b0381111561412b57600080fd5b61413786828701613bb8565b9660208601359650604090950135949350505050565b6000806040838503121561416057600080fd5b82359150602083013561401481613f37565b6000806040838503121561418557600080fd5b82356001600160401b0381111561419b57600080fd5b6141a785828601613bb8565b95602094909401359450505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561421c57888303603f1901855281518051845287015187840187905261420987850182613c75565b95880195935050908601906001016141dd565b509098975050505050505050565b6000806040838503121561423d57600080fd5b823561424881613ce1565b9150602083013561401481613ce1565b6020808252825182820181905260009190848201906040850190845b81811015613de357835183529284019291840191600101614274565b600181811c908216806142a457607f821691505b6020821081036142c457634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156142dc57600080fd5b5051919050565b9283526020830191909152604082015260600190565b60006020828403121561430b57600080fd5b8151610d1781613f37565b92835260208301919091521515604082015260600190565b9182526001600160a01b0316602082015260400190565b918252602082015260400190565b6000602080838503121561436657600080fd5b82516001600160401b0381111561437c57600080fd5b8301601f8101851361438d57600080fd5b805161439b613b8882613e04565b81815260059190911b820183019083810190878311156143ba57600080fd5b928401925b828410156143e15783516143d281613ce1565b825292840192908401906143bf565b979650505050505050565b83815282602082015260606040820152600061440b6060830184613c75565b95945050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610b2557610b2561442a565b6000600182016144655761446561442a565b5060010190565b6000825161447e818460208701613c51565b9190910192915050565b61190160f01b81526002810192909252602282015260420190565b6000602082840312156144b557600080fd5b8151610d1781613ce1565b602080825260159082015274185b1b1bdddb1a5cdd081b9bdd08195b98589b1959605a1b604082015260600190565b9283526001600160a01b03918216602084015216604082015260600190565b600082601f83011261451f57600080fd5b815161452d613b8882613b53565b81815284602083860101111561454257600080fd5b6128d1826020830160208701613c51565b60006020828403121561456557600080fd5b81516001600160401b0381111561457b57600080fd5b6128d18482850161450e565b8281526040602082015260006128d16040830184613c75565b9283526001600160a01b03919091166020830152604082015260600190565b600060208083850312156145d257600080fd5b82516001600160401b03808211156145e957600080fd5b818501915085601f8301126145fd57600080fd5b815161460b613b8882613e04565b81815260059190911b8301840190848101908883111561462a57600080fd5b8585015b838110156146a0578051858111156146465760008081fd5b86016040818c03601f190181131561465e5760008081fd5b614666613afb565b828a0151815290820151908782111561467f5760008081fd5b61468d8d8b8486010161450e565b818b01528552505091860191860161462e565b5098975050505050505050565b600081518084526020808501945080840160005b838110156146dd578151875295820195908201906001016146c1565b509495945050505050565b84815260806020820152600061470160808301866146ad565b6001600160a01b03949094166040830152506060015292915050565b8082028115828204841417610b2557610b2561442a565b8481528360208201528260408201526080606082015260006147596080830184613c75565b9695505050505050565b6001600160a01b03929092168252602082015260400190565b8381526001600160a01b038316602082015260606040820181905260009061440b908301846146ad565b6000608082840312156147b857600080fd5b604051608081016001600160401b03811182821017156147da576147da613ae5565b60405282516147e881613def565b815260208301516147f881613def565b6020820152604083015161480b81613def565b6040820152606083015161481e81613def565b60608201529392505050565b8481528360208201526080604082015260006148496080830185613c75565b905082606083015295945050505050565b634e487b7160e01b600052602160045260246000fd5b92835261ffff918216602084015216604082015260600190565b60006020828403121561489c57600080fd5b815163ffffffff81168114610d1757600080fd5b6000602082840312156148c257600080fd5b8151610d1781613def565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061475990830184613c75565b60006020828403121561491257600080fd5b8151610d1781613c1e56fe68e83002b91b0fd96d4df3566b5122221117e3ec6c2468fda594f6491f89b1c9a2646970667358221220a75d881048128ecf465ee6c33f11062c8eb77738601b6ae845428cdbacb028d864736f6c6343000811003300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001e486f726465206f662074686520556e646561643a20477561726469616e73000000000000000000000000000000000000000000000000000000000000000000064d4f525449530000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106102c85760003560e01c806301ece7cb146102cd57806301ffc9a7146102e257806306fdde0314610317578063081812fc14610339578063095ea7b31461036657806318160ddd1461038657806323b872dd146103a95780632c01a10e146103c9578063315be132146103e957806331beb605146104095780633594cb0e1461042957806335ca1c79146104495780633be795f2146104695780633eadb6db1461048957806342842e0e1461049e57806346dc94a1146104be578063477e3c73146104eb57806349dfc1e4146105005780634eba5f1e1461052057806353ca912a1461054057806356a3d732146105605780636352211e1461058057806366dfc384146105a05780636afc1334146105c05780636bda4f50146105e057806370a0823114610600578063715018a6146106205780637381f9ae1461063557806386126853146106485780638da5cb5b1461068b578063911c9874146106a0578063940cd05b146106c057806395d89b41146106e0578063a1a39af2146106f5578063a22cb46514610715578063a3d90b1614610735578063ab6f644a14610748578063af2827be14610768578063b88d4fde14610788578063c87b56dd146107a8578063ccb4807b146107c8578063cea06b03146107e8578063cefc56cf14610808578063d04c406b14610828578063d068a1811461083b578063d480924d1461085b578063d5688cdc1461087b578063d67f3ee11461089b578063d855a579146108bb578063d97de9b6146108d9578063dbc3f80b146108f9578063dc33e68114610919578063dd10819014610939578063de3efc9114610966578063e178e05114610986578063e84e2ffd146109a6578063e8a3d485146109c6578063e985e9c5146109db578063ea66aeb3146109fb578063ea6ef37114610a28578063f2fde38b14610a48578063f6aacfb114610a68578063f7888aec14610a88575b600080fd5b6102e06102db366004613bd8565b610aa8565b005b3480156102ee57600080fd5b506103026102fd366004613c34565b610ad9565b60405190151581526020015b60405180910390f35b34801561032357600080fd5b5061032c610b2b565b60405161030e9190613ca1565b34801561034557600080fd5b50610359610354366004613cb4565b610bbd565b60405161030e9190613ccd565b34801561037257600080fd5b506102e0610381366004613cf6565b610be4565b34801561039257600080fd5b5061039b610bf7565b60405190815260200161030e565b3480156103b557600080fd5b506102e06103c4366004613d22565b610c74565b3480156103d557600080fd5b506103026103e4366004613d63565b610c97565b3480156103f557600080fd5b506102e0610404366004613cb4565b610d1e565b34801561041557600080fd5b506102e0610424366004613d85565b610d96565b34801561043557600080fd5b506102e0610444366004613d85565b610dc0565b34801561045557600080fd5b506102e0610464366004613cb4565b610de9565b34801561047557600080fd5b506102e0610484366004613cb4565b610e2b565b34801561049557600080fd5b506102e0610e9f565b3480156104aa57600080fd5b506102e06104b9366004613d22565b610f0d565b3480156104ca57600080fd5b506104de6104d9366004613cb4565b610f28565b60405161030e9190613da2565b3480156104f757600080fd5b506102e0610faa565b34801561050c57600080fd5b506102e061051b366004613bd8565b610fea565b34801561052c57600080fd5b506102e061053b366004613e68565b611062565b34801561054c57600080fd5b506102e061055b366004613f45565b611316565b34801561056c57600080fd5b506102e061057b366004613f62565b611331565b34801561058c57600080fd5b5061035961059b366004613cb4565b6113eb565b3480156105ac57600080fd5b506102e06105bb366004613d85565b611469565b3480156105cc57600080fd5b506102e06105db366004613cb4565b61148f565b3480156105ec57600080fd5b506102e06105fb366004613cb4565b6114c5565b34801561060c57600080fd5b5061039b61061b366004613d85565b611502565b34801561062c57600080fd5b506102e0611580565b6102e0610643366004613fa4565b611594565b34801561065457600080fd5b50610302610663366004613fef565b6001600160a01b03166000908152601f60209081526040808320938352929052205460ff1690565b34801561069757600080fd5b506103596116c4565b3480156106ac57600080fd5b506102e06106bb366004613fef565b6116d3565b3480156106cc57600080fd5b506102e06106db366004613f45565b611717565b3480156106ec57600080fd5b5061032c61175f565b34801561070157600080fd5b5061039b610710366004613cb4565b61176e565b34801561072157600080fd5b506102e061073036600461401f565b61179f565b6102e0610743366004613bd8565b6117d4565b34801561075457600080fd5b506102e0610763366004613cb4565b611801565b34801561077457600080fd5b50610302610783366004613cb4565b611856565b34801561079457600080fd5b506102e06107a336600461404d565b611861565b3480156107b457600080fd5b5061032c6107c3366004613cb4565b611880565b3480156107d457600080fd5b506102e06107e33660046140cc565b611902565b3480156107f457600080fd5b50610302610803366004613d63565b611944565b34801561081457600080fd5b506102e0610823366004614100565b611a4e565b6102e0610836366004613d63565b611a61565b34801561084757600080fd5b506102e061085636600461414d565b611aa6565b34801561086757600080fd5b506102e0610876366004614172565b611aea565b34801561088757600080fd5b506102e0610896366004613cb4565b611bb0565b3480156108a757600080fd5b506102e06108b6366004613fa4565b611c26565b3480156108c757600080fd5b506027546001600160a01b0316610359565b3480156108e557600080fd5b5061039b6108f4366004613d85565b611d3c565b34801561090557600080fd5b5061032c610914366004613d63565b611d63565b34801561092557600080fd5b5061039b610934366004613d85565b611de7565b34801561094557600080fd5b50610959610954366004613cb4565b611e24565b60405161030e91906141b6565b34801561097257600080fd5b50610359610981366004613cb4565b611ea6565b34801561099257600080fd5b506102e06109a1366004613cb4565b611eea565b3480156109b257600080fd5b506102e06109c1366004613d85565b611f3b565b3480156109d257600080fd5b5061032c611f61565b3480156109e757600080fd5b506103026109f636600461422a565b611fdc565b348015610a0757600080fd5b50610a1b610a16366004613d85565b61201b565b60405161030e9190614258565b348015610a3457600080fd5b506102e0610a43366004613cb4565b6120ef565b348015610a5457600080fd5b506102e0610a63366004613d85565b6121c6565b348015610a7457600080fd5b50610302610a83366004613cb4565b6121fe565b348015610a9457600080fd5b5061039b610aa336600461422a565b61222f565b610ab36001836122ea565b610abc826114c5565b610ac96030546001612339565b610ad560018383612389565b5050565b60006001600160e01b031982166380ac58cd60e01b1480610b0a57506001600160e01b03198216635b5e139f60e01b145b80610b2557506301ffc9a760e01b6001600160e01b03198316145b92915050565b606060018054610b3a90614290565b80601f0160208091040260200160405190810160405280929190818152602001828054610b6690614290565b8015610bb35780601f10610b8857610100808354040283529160200191610bb3565b820191906000526020600020905b815481529060010190602001808311610b9657829003601f168201915b5050505050905090565b6000610bc8826123fc565b506000908152601a60205260409020546001600160a01b031690565b610bed81612421565b610ad58282612448565b60405163fe6e324760e01b8152600b6004820152600090731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c49063fe6e3247906024015b602060405180830381865af4158015610c4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6f91906142ca565b905090565b610c7e338261250a565b610c8781612421565b610c928383836125f7565b505050565b60405163d751a37360e01b815260009073d7703437ed73f49fb6183caf673a534ae8fd7fd79063d751a37390610cd690602a90879087906004016142e3565b602060405180830381865af4158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1791906142f9565b9392505050565b610d26612656565b6040516301d6edb360e21b815273d7703437ed73f49fb6183caf673a534ae8fd7fd79063075bb6cc90610d6390602a908590600190600401614316565b60006040518083038186803b158015610d7b57600080fd5b505af4158015610d8f573d6000803e3d6000fd5b5050505050565b610d9e612656565b602780546001600160a01b0319166001600160a01b0392909216919091179055565b610dc8612656565b602e80546001600160a01b0319166001600160a01b03831617905550565b50565b732d65c58e6106660eddbd6cbbbf25d154ba105137638fb14e3b601d610e0e846113eb565b6040518363ffffffff1660e01b8152600401610d6392919061432e565b610e34816113eb565b6001600160a01b0316336001600160a01b031614610e65576040516359dc379f60e01b815260040160405180910390fd5b604051630d03463560e31b815273fc3b49b6257d7eba30a5a1d81f99d6c896ec35689063681a31a890610d63906024908590600401614345565b610ea7612656565b60405163bbc884db60e01b81526021600482015273ffd2d5be009c0f9257523f62856639a26db108759063bbc884db906024015b60006040518083038186803b158015610ef357600080fd5b505af4158015610f07573d6000803e3d6000fd5b50505050565b610c9283838360405180602001604052806000815250611861565b60405163989fba7d60e01b815260609073fc3b49b6257d7eba30a5a1d81f99d6c896ec35689063989fba7d90610f65906024908690600401614345565b600060405180830381865af4158015610f82573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b259190810190614353565b610fb2612656565b6040516344ece89360e01b81526021600482015273ffd2d5be009c0f9257523f62856639a26db10875906344ece89390602401610edb565b610ff2612656565b60405163c6c30e7760e01b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e39063c6c30e779061102e90600390869086906004016143ec565b60006040518083038186803b15801561104657600080fd5b505af415801561105a573d6000803e3d6000fd5b505050505050565b60275482908290339086906001600160a01b03166110b55760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08195b98589b195960aa1b60448201526064015b60405180910390fd5b6001600160a01b03821660005b8251811015611104578281815181106110dd576110dd614414565b6020026020010151826110f09190614440565b9150806110fc81614453565b9150506110c2565b50600061111082612688565b905060006028547f8abec9904ffaaac97c67514e7b42ae500930baa09e317d39b633a9f7c059d08c83604051602001611149919061446c565b60405160208183030381529060405280519060200120604051602001611170929190614345565b60405160208183030381529060405280519060200120604051602001611197929190614488565b6040516020818303038152906040528051906020012090506111fa6111f488888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869392505061271a9050565b8661273e565b60005b8a518110156112cb5761122b8b828151811061121b5761121b614414565b60200260200101516106636127e7565b15611266578a818151811061124257611242614414565b602002602001015160405163115b0f0760e01b81526004016110ac91815260200190565b6112b98b828151811061127b5761127b614414565b602002602001015161128b6127e7565b6001600160a01b03166000908152601f6020908152604080832093835292905220805460ff19166001179055565b806112c381614453565b9150506111fd565b506112e160006001600160401b038d16816127f6565b506112f5338c6001600160401b03166128d9565b61130960006001600160401b038d166129d9565b5050505050505050505050565b61131e612656565b6020805460ff1916911515919091179055565b611339612656565b60405163ddffa49760e01b81526021600482015273ffd2d5be009c0f9257523f62856639a26db108759063ddffa49790602401602060405180830381865af4158015611389573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ad91906142ca565b826113b7600d5490565b6113c19190614440565b11156113e05760405163c30436e960e01b815260040160405180910390fd5b610f07838383612a11565b60405163307866fb60e01b8152600090731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c49063307866fb9061142890600b908690600401614345565b602060405180830381865af4158015611445573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2591906144a3565b611471612656565b602f80546001600160a01b0319166001600160a01b03831617905550565b6114a061149b826113eb565b612a7e565b732d65c58e6106660eddbd6cbbbf25d154ba10513763b0468662601d610e0e846113eb565b6114cf6001612ac2565b6114ec57604051633ad0c0bb60e11b815260040160405180910390fd5b6114f6338261250a565b610de681600080612b40565b604051630672195960e11b8152600090731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c490630ce432b29061153f90600b90869060040161432e565b602060405180830381865af415801561155c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2591906142ca565b611588612656565b6115926000612ba4565b565b6027548290829033906001600160a01b03166115c25760405162461bcd60e51b81526004016110ac906144c0565b600060285460008051602061491e833981519152836040516020016115e892919061432e565b6040516020818303038152906040528051906020012060405160200161160f929190614488565b60405160208183030381529060405280519060200120905061167261166c85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869392505061271a9050565b8361273e565b600061167e6002612bf4565b905061169781606001516001600160401b031689612339565b6116a460028960006127f6565b506116af33896128d9565b6116ba6002896129d9565b5050505050505050565b6000546001600160a01b031690565b732d65c58e6106660eddbd6cbbbf25d154ba1051376311841d70601d836116f9866113eb565b6040518463ffffffff1660e01b815260040161102e939291906144ef565b61171f612656565b604051636d0aa15360e11b815260036004820152811515602482015273c2dc8b9b633a6a8b00058cd0dc74732182cd58e39063da1542a690604401610d63565b606060028054610b3a90614290565b6000601e8161177c846113eb565b6001600160a01b0316815260208101919091526040016000206001015492915050565b6117ca6117ab3361201b565b6000815181106117bd576117bd614414565b6020026020010151612421565b610ad58282612c8f565b6117df6000836122ea565b6117e882611801565b6117f56030546001612339565b610ad560008383612389565b61180b6000612ac2565b61182857604051633ad0c0bb60e11b815260040160405180910390fd5b611832338261250a565b61183f8160016000612b40565b61184881612d0a565b610de657610de63382612d26565b6000610b2582612d0a565b61186b338361250a565b61187482612421565b610f0784848484612d62565b60405163d30eae4760e01b815260609073c2dc8b9b633a6a8b00058cd0dc74732182cd58e39063d30eae47906118bd906003908690600401614345565b600060405180830381865af41580156118da573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b259190810190614553565b61190a612656565b6040516316aa2cf160e11b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e390632d5459e290610d63906003908590600401614587565b60405163614ea3d560e11b815260009073d7703437ed73f49fb6183caf673a534ae8fd7fd79063c29d47aa9061198190602a908790600401614345565b602060405180830381865af415801561199e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c291906142f9565b8015610d17575060405163d751a37360e01b815273d7703437ed73f49fb6183caf673a534ae8fd7fd79063d751a37390611a0590602a90879087906004016142e3565b602060405180830381865af4158015611a22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a4691906142f9565b159392505050565b611a56612656565b610c92838383612d96565b6000611a6c82612bf4565b9050611a8581606001516001600160401b031684612339565b611a91828460006127f6565b50611a9c33846128d9565b610c9282846129d9565b611aae612656565b6040516318aea9b160e01b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e3906318aea9b19061102e9060039086908690600401614316565b611af2612656565b60028114611b765760038114611b3c576040516345f5dac360e11b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e390638bebb5869061102e906003908690600401614587565b6040516348b5a5a360e01b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e3906348b5a5a39061102e906003908690600401614587565b60405163db6a3cab60e01b815273c2dc8b9b633a6a8b00058cd0dc74732182cd58e39063db6a3cab9061102e906003908690600401614587565b611bb9816113eb565b6001600160a01b0316336001600160a01b031614611bea576040516359dc379f60e01b815260040160405180910390fd5b604051636271484f60e11b815273fc3b49b6257d7eba30a5a1d81f99d6c896ec35689063c4e2909e90610d6390602490339086906004016145a0565b6027548290829033906001600160a01b0316611c545760405162461bcd60e51b81526004016110ac906144c0565b600060285460008051602061491e83398151915283604051602001611c7a92919061432e565b60405160208183030381529060405280519060200120604051602001611ca1929190614488565b604051602081830303815290604052805190602001209050611cfe61166c85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250869392505061271a9050565b6000611d0a6001612bf4565b9050611d2381606001516001600160401b031689612dd4565b611d3060018960006127f6565b506116ba6001896129d9565b6000611d4782612e87565b506001600160a01b031660009081526010602052604090205490565b60405163977470b160e01b815260609073d7703437ed73f49fb6183caf673a534ae8fd7fd79063977470b190611da290602a90879087906004016142e3565b600060405180830381865af4158015611dbf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d179190810190614553565b60405163ae33168f60e01b8152600090731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c49063ae33168f9061153f90600b90869060040161432e565b604051633fa15fa760e21b815260609073d7703437ed73f49fb6183caf673a534ae8fd7fd79063fe857e9c90611e6190602a908690600401614345565b600060405180830381865af4158015611e7e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b2591908101906145bf565b6000732d65c58e6106660eddbd6cbbbf25d154ba10513763f1650c05601d611ecd856113eb565b6040518363ffffffff1660e01b815260040161142892919061432e565b611ef4338261250a565b611efd81612421565b611f0681612d0a565b15611f3257611f153382612eae565b6000818152600f6020526040902080546001600160a81b03191690555b610de681612f56565b611f43612656565b602d80546001600160a01b0319166001600160a01b03831617905550565b604051633571c1ef60e11b81526003600482015260609073c2dc8b9b633a6a8b00058cd0dc74732182cd58e390636ae383de90602401600060405180830381865af4158015611fb4573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610c6f9190810190614553565b60405163e4e0a72360e01b8152600090735beb03b964115906ae157be77debc55fec6d47d59063e4e0a72390610cd690601490879087906004016144ef565b6040516303c2425160e01b8152606090733b6b80eca0a8f524ac43365ac5c1c67f24806d72906303c242519061205890600f90869060040161432e565b602060405180830381865af4158015612075573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209991906142ca565b8054806020026020016040519081016040528092919081815260200182805480156120e357602002820191906000526020600020905b8154815260200190600101908083116120cf575b50505050509050919050565b604051633745024960e01b8152819073fc3b49b6257d7eba30a5a1d81f99d6c896ec35689063374502499061212b90602490339060040161432e565b602060405180830381865af4158015612148573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216c91906142ca565b1461218c573360405163377a707b60e11b81526004016110ac9190613ccd565b604051635a3f7e5160e01b815273fc3b49b6257d7eba30a5a1d81f99d6c896ec356890635a3f7e5190610d6390602490339060040161432e565b6121ce612656565b6001600160a01b0381166121f557604051630640d5fb60e51b815260040160405180910390fd5b610de681612ba4565b6000601e8161220c846113eb565b6001600160a01b0316815260208101919091526040016000205460ff1692915050565b60008061223b83611502565b905080156122da57600061224e8461201b565b60405163cc6a6bdf60e01b815290915073fc3b49b6257d7eba30a5a1d81f99d6c896ec35689063cc6a6bdf906122909060249085908a906000906004016146e8565b602060405180830381865af41580156122ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d191906142ca565b92505050610b25565b5060009392505050565b50600190565b6122f48282611944565b61231157604051633ad0c0bb60e11b815260040160405180910390fd5b61231b8282610c97565b15610ad5576040516342c3924b60e11b815260040160405180910390fd5b6123438282612f90565b61234b612fc6565b6001600160a01b03166108fc612361838561471d565b6040518115909202916000818181858888f19350505050158015610c92573d6000803e3d6000fd5b604051631fa1a2ed60e21b815273d7703437ed73f49fb6183caf673a534ae8fd7fd790637e868bb4906123c790602a90879087908790600401614734565b60006040518083038186803b1580156123df57600080fd5b505af41580156123f3573d6000803e3d6000fd5b50505050505050565b601c548111610de657604051631e97bf7b60e11b8152600481018290526024016110ac565b61242a816121fe565b15610de65760405163035857a760e41b815260040160405180910390fd5b61245181612fd5565b6040516339adbc2360e11b8152735beb03b964115906ae157be77debc55fec6d47d59063735b78469061248d90601490869086906004016145a0565b60006040518083038186803b1580156124a557600080fd5b505af41580156124b9573d6000803e3d6000fd5b5050505080826001600160a01b03166124d1836113eb565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b612513816113eb565b6001600160a01b0316826001600160a01b0316148061253f575061253f612539826113eb565b83611fdc565b806125d65750604051636e367b3f60e11b81526001600160a01b03831690735beb03b964115906ae157be77debc55fec6d47d59063dc6cf67e9061258a906014908690600401614345565b602060405180830381865af41580156125a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125cb91906144a3565b6001600160a01b0316145b610ad557818160405163a528473560e01b81526004016110ac929190614763565b6001600160a01b03821661261e57604051639b7cfcb760e01b815260040160405180910390fd5b6126278161300a565b61263081612d0a565b1561264057612640838383613044565b61264b8383836130ec565b610c92838383613142565b3361265f6116c4565b6001600160a01b031614611592573360405163d4ed9a1760e01b81526004016110ac9190613ccd565b6060600061269583613188565b60010190506000816001600160401b038111156126b4576126b4613ae5565b6040519080825280601f01601f1916602001820160405280156126de576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846126e857509392505050565b6000806000612729858561325e565b91509150612736816132a3565b509392505050565b602754604080518082019091526011815270696e76616c6964207369676e617475726560781b6020820152906001600160a01b038481169116146127955760405162461bcd60e51b81526004016110ac9190613ca1565b50604080518082019091526011815270696e76616c6964207369676e617475726560781b6020820152336001600160a01b03831614610c925760405162461bcd60e51b81526004016110ac9190613ca1565b602f546001600160a01b031690565b600061280284846133e8565b61281f57604051634f69b16b60e01b815260040160405180910390fd5b60405163ddffa49760e01b81526021600482015273ffd2d5be009c0f9257523f62856639a26db108759063ddffa49790602401602060405180830381865af415801561286f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289391906142ca565b8361289d600d5490565b6128a79190614440565b11156128c65760405163c30436e960e01b815260040160405180910390fd5b6128d1338484612a11565b949350505050565b60006128e7826103e861471d565b6128f990670de0b6b3a764000061471d565b9050806129046134de565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161292f9190613ccd565b602060405180830381865afa15801561294c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061297091906142ca565b1115610c925761297e6134de565b6001600160a01b031663a9059cbb84836040518363ffffffff1660e01b81526004016129ab929190614763565b600060405180830381600087803b1580156129c557600080fd5b505af11580156123f3573d6000803e3d6000fd5b60006129e4336134ed565b9050818184600481106129f9576129f9614414565b61ffff9092166020929092020152610c923382613500565b60205460009060ff16612a37576040516303eaac9360e01b815260040160405180910390fd5b6001600160a01b038416612a605783604051630bc2c5df60e11b81526004016110ac9190613ccd565b81612a7457612a6f84846136d1565b6128d1565b6128d18484613751565b735beb03b964115906ae157be77debc55fec6d47d5633f4e7cce601483612aa48161201b565b6040518463ffffffff1660e01b8152600401610d639392919061477c565b60405163614ea3d560e11b815260009073d7703437ed73f49fb6183caf673a534ae8fd7fd79063c29d47aa90612aff90602a908690600401614345565b602060405180830381865af4158015612b1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2591906142f9565b8115612b845760408051808201825291825260016020808401828152600096875260099091529190942091518255519201805460ff19169215159290921790915550565b50506000908152600960205260408120908155600101805460ff19169055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040805160808101825260008082526020820181905281830181905260608201529051633946d61960e21b815273ffd2d5be009c0f9257523f62856639a26db108759063e51b586490612c4e906021908690600401614345565b608060405180830381865af4158015612c6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2591906147a6565b80612cd057604051630aeeeecb60e01b8152735beb03b964115906ae157be77debc55fec6d47d590630aeeeecb9061102e90601490869033906004016144ef565b60405163b2875b1960e01b8152735beb03b964115906ae157be77debc55fec6d47d59063b2875b199061102e90601490869060040161432e565b6000908152600f6020526040902054600160a01b900460ff1690565b60405163c213e42f60e01b8152733b6b80eca0a8f524ac43365ac5c1c67f24806d729063c213e42f9061102e90600f90869086906004016145a0565b612d6e848484846137a6565b612d8b57604051637063b1a960e11b815260040160405180910390fd5b610f078484846125f7565b6040516343a4697d60e01b815273d7703437ed73f49fb6183caf673a534ae8fd7fd7906343a4697d906123c790602a9086908890879060040161482a565b612ddc6134de565b6001600160a01b03166323b872dd33612df3612fc6565b612dfd868661471d565b612e0f90670de0b6b3a764000061471d565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015612e63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9291906142f9565b6001600160a01b038116610de6576040516349e27cff60e01b815260040160405180910390fd5b604051630ba3340f60e21b8152733b6b80eca0a8f524ac43365ac5c1c67f24806d7290632e8cd03c90612eea90600f90869086906004016145a0565b60006040518083038186803b158015612f0257600080fd5b505af4158015612f16573d6000803e3d6000fd5b505060405163502bb5d160e11b8152733b6b80eca0a8f524ac43365ac5c1c67f24806d72925063a0576ba2915061102e90600f90869086906004016145a0565b60405163cf2563bd60e01b8152731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c49063cf2563bd90610d6390600b908590600401614345565b612f9a818361471d565b3414610ad557612faa818361471d565b34604051638078f8b560e01b81526004016110ac929190614345565b602d546001600160a01b031690565b33612fdf826113eb565b6001600160a01b031614610de657338160405163a528473560e01b81526004016110ac929190614763565b6040516356c7310360e11b8152735beb03b964115906ae157be77debc55fec6d47d59063ad8e620690610d63906014908590600401614345565b60405163502bb5d160e11b8152733b6b80eca0a8f524ac43365ac5c1c67f24806d729063a0576ba29061308090600f90879086906004016145a0565b60006040518083038186803b15801561309857600080fd5b505af41580156130ac573d6000803e3d6000fd5b505060405163c213e42f60e01b8152733b6b80eca0a8f524ac43365ac5c1c67f24806d72925063c213e42f91506123c790600f90869086906004016145a0565b604051630a13733160e21b8152600b60048201526001600160a01b0380851660248301528316604482015260648101829052731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c49063284dccc4906084016123c7565b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106131c75772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6904ee2d6d415b85acef8160201b83106131f1576904ee2d6d415b85acef8160201b830492506020015b662386f26fc10000831061320f57662386f26fc10000830492506010015b6305f5e1008310613227576305f5e100830492506008015b612710831061323b57612710830492506004015b6064831061324d576064830492506002015b600a8310610b255760010192915050565b60008082516041036132945760208301516040840151606085015160001a613288878285856138a8565b9450945050505061329c565b506000905060025b9250929050565b60008160048111156132b7576132b761485a565b036132bf5750565b60018160048111156132d3576132d361485a565b0361331b5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016110ac565b600281600481111561332f5761332f61485a565b0361337c5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016110ac565b60038160048111156133905761339061485a565b03610de65760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016110ac565b6000806133f3613962565b9050808411156134165760405163f60be67160e01b815260040160405180910390fd5b600083613422600d5490565b61342c9190614440565b9050600061343986612bf4565b905080604001516001600160401b0316821115613469576040516323e4615760e11b815260040160405180910390fd5b6000613474336134ed565b9050600081886004811061348a5761348a614414565b602002015161349d9061ffff1688614440565b905082602001516001600160401b03168111156134d057604051632dbcfc5560e21b8152600481018290526024016110ac565b506001979650505050505050565b602e546001600160a01b031690565b6134f5613aa9565b610b25600b8361399d565b805160208201516040516386e37b2760e01b8152731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c492639adeb2d292600b9287928692633838ced992869285926386e37b27926135579286929091600401614870565b602060405180830381865af4158015613574573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613598919061488a565b6040808a015160608b015191516386e37b2760e01b8152731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c4926386e37b27926135db92600b9290600401614870565b602060405180830381865af41580156135f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361c919061488a565b6040516001600160e01b031960e086901b168152600481019390935263ffffffff9182166024840152166044820152606401602060405180830381865af415801561366b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061368f91906148b0565b6040516001600160e01b031960e086901b16815260048101939093526001600160a01b0390911660248301526001600160401b0316604482015260640161102e565b604051634ae9f7ab60e01b8152600090731b2868f3a937a3a9e6dedb33e0804c00fc6bd6c490634ae9f7ab9061371090600b90879087906004016145a0565b602060405180830381865af415801561372d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1791906142ca565b60008061375d600d5490565b613768906001614440565b9050600061377685856136d1565b9050815b81811161379d5761378b8682612d26565b8061379581614453565b91505061377a565b50949350505050565b60006001600160a01b0384163b1561389d57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906137ea9033908990889088906004016148cd565b6020604051808303816000875af1925050508015613825575060408051601f3d908101601f1916820190925261382291810190614900565b60015b613883573d808015613853576040519150601f19603f3d011682016040523d82523d6000602084013e613858565b606091505b50805160000361387b57604051639b7cfcb760e01b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506128d1565b506001949350505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b038311156138d55750600090506003613959565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613929573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661395257600060019250925050613959565b9150600090505b94509492505050565b60405163d73ee61560e01b81526021600482015260009073ffd2d5be009c0f9257523f62856639a26db108759063d73ee61590602401610c2e565b6139a5613aa9565b6001600160a01b03821660009081526001840160205260408120546139ce90859060c01c613a4e565b905060006139e38583835b6020020151613a7d565b905060006139f3868460016139d9565b9050604051806080016040528083600060028110613a1357613a13614414565b6020908102919091015161ffff9081168352948101518516828201528351851660408301529290920151909216606090910152949350505050565b613a56613ac7565b506040805180820190915263ffffffff8281168252602092831c1691810191909152919050565b613a85613ac7565b506040805180820190915261ffff8083168252601083901c16602082015292915050565b60405180608001604052806004906020820280368337509192915050565b60405180604001604052806002906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715613b1d57613b1d613ae5565b60405290565b604051601f8201601f191681016001600160401b0381118282101715613b4b57613b4b613ae5565b604052919050565b60006001600160401b03821115613b6c57613b6c613ae5565b50601f01601f191660200190565b6000613b8d613b8884613b53565b613b23565b9050828152838383011115613ba157600080fd5b828260208301376000602084830101529392505050565b600082601f830112613bc957600080fd5b610d1783833560208501613b7a565b60008060408385031215613beb57600080fd5b8235915060208301356001600160401b03811115613c0857600080fd5b613c1485828601613bb8565b9150509250929050565b6001600160e01b031981168114610de657600080fd5b600060208284031215613c4657600080fd5b8135610d1781613c1e565b60005b83811015613c6c578181015183820152602001613c54565b50506000910152565b60008151808452613c8d816020860160208601613c51565b601f01601f19169290920160200192915050565b602081526000610d176020830184613c75565b600060208284031215613cc657600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114610de657600080fd5b60008060408385031215613d0957600080fd5b8235613d1481613ce1565b946020939093013593505050565b600080600060608486031215613d3757600080fd5b8335613d4281613ce1565b92506020840135613d5281613ce1565b929592945050506040919091013590565b60008060408385031215613d7657600080fd5b50508035926020909101359150565b600060208284031215613d9757600080fd5b8135610d1781613ce1565b6020808252825182820181905260009190848201906040850190845b81811015613de35783516001600160a01b031683529284019291840191600101613dbe565b50909695505050505050565b6001600160401b0381168114610de657600080fd5b60006001600160401b03821115613e1d57613e1d613ae5565b5060051b60200190565b60008083601f840112613e3957600080fd5b5081356001600160401b03811115613e5057600080fd5b60208301915083602082850101111561329c57600080fd5b60008060008060608587031215613e7e57600080fd5b8435613e8981613def565b93506020858101356001600160401b0380821115613ea657600080fd5b818801915088601f830112613eba57600080fd5b8135613ec8613b8882613e04565b81815260059190911b8301840190848101908b831115613ee757600080fd5b938501935b82851015613f0557843582529385019390850190613eec565b975050506040880135925080831115613f1d57600080fd5b5050613f2b87828801613e27565b95989497509550505050565b8015158114610de657600080fd5b600060208284031215613f5757600080fd5b8135610d1781613f37565b600080600060608486031215613f7757600080fd5b8335613f8281613ce1565b9250602084013591506040840135613f9981613f37565b809150509250925092565b600080600060408486031215613fb957600080fd5b8335925060208401356001600160401b03811115613fd657600080fd5b613fe286828701613e27565b9497909650939450505050565b6000806040838503121561400257600080fd5b82359150602083013561401481613ce1565b809150509250929050565b6000806040838503121561403257600080fd5b823561403d81613ce1565b9150602083013561401481613f37565b6000806000806080858703121561406357600080fd5b843561406e81613ce1565b9350602085013561407e81613ce1565b92506040850135915060608501356001600160401b038111156140a057600080fd5b8501601f810187136140b157600080fd5b6140c087823560208401613b7a565b91505092959194509250565b6000602082840312156140de57600080fd5b81356001600160401b038111156140f457600080fd5b6128d184828501613bb8565b60008060006060848603121561411557600080fd5b83356001600160401b0381111561412b57600080fd5b61413786828701613bb8565b9660208601359650604090950135949350505050565b6000806040838503121561416057600080fd5b82359150602083013561401481613f37565b6000806040838503121561418557600080fd5b82356001600160401b0381111561419b57600080fd5b6141a785828601613bb8565b95602094909401359450505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561421c57888303603f1901855281518051845287015187840187905261420987850182613c75565b95880195935050908601906001016141dd565b509098975050505050505050565b6000806040838503121561423d57600080fd5b823561424881613ce1565b9150602083013561401481613ce1565b6020808252825182820181905260009190848201906040850190845b81811015613de357835183529284019291840191600101614274565b600181811c908216806142a457607f821691505b6020821081036142c457634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156142dc57600080fd5b5051919050565b9283526020830191909152604082015260600190565b60006020828403121561430b57600080fd5b8151610d1781613f37565b92835260208301919091521515604082015260600190565b9182526001600160a01b0316602082015260400190565b918252602082015260400190565b6000602080838503121561436657600080fd5b82516001600160401b0381111561437c57600080fd5b8301601f8101851361438d57600080fd5b805161439b613b8882613e04565b81815260059190911b820183019083810190878311156143ba57600080fd5b928401925b828410156143e15783516143d281613ce1565b825292840192908401906143bf565b979650505050505050565b83815282602082015260606040820152600061440b6060830184613c75565b95945050505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610b2557610b2561442a565b6000600182016144655761446561442a565b5060010190565b6000825161447e818460208701613c51565b9190910192915050565b61190160f01b81526002810192909252602282015260420190565b6000602082840312156144b557600080fd5b8151610d1781613ce1565b602080825260159082015274185b1b1bdddb1a5cdd081b9bdd08195b98589b1959605a1b604082015260600190565b9283526001600160a01b03918216602084015216604082015260600190565b600082601f83011261451f57600080fd5b815161452d613b8882613b53565b81815284602083860101111561454257600080fd5b6128d1826020830160208701613c51565b60006020828403121561456557600080fd5b81516001600160401b0381111561457b57600080fd5b6128d18482850161450e565b8281526040602082015260006128d16040830184613c75565b9283526001600160a01b03919091166020830152604082015260600190565b600060208083850312156145d257600080fd5b82516001600160401b03808211156145e957600080fd5b818501915085601f8301126145fd57600080fd5b815161460b613b8882613e04565b81815260059190911b8301840190848101908883111561462a57600080fd5b8585015b838110156146a0578051858111156146465760008081fd5b86016040818c03601f190181131561465e5760008081fd5b614666613afb565b828a0151815290820151908782111561467f5760008081fd5b61468d8d8b8486010161450e565b818b01528552505091860191860161462e565b5098975050505050505050565b600081518084526020808501945080840160005b838110156146dd578151875295820195908201906001016146c1565b509495945050505050565b84815260806020820152600061470160808301866146ad565b6001600160a01b03949094166040830152506060015292915050565b8082028115828204841417610b2557610b2561442a565b8481528360208201528260408201526080606082015260006147596080830184613c75565b9695505050505050565b6001600160a01b03929092168252602082015260400190565b8381526001600160a01b038316602082015260606040820181905260009061440b908301846146ad565b6000608082840312156147b857600080fd5b604051608081016001600160401b03811182821017156147da576147da613ae5565b60405282516147e881613def565b815260208301516147f881613def565b6020820152604083015161480b81613def565b6040820152606083015161481e81613def565b60608201529392505050565b8481528360208201526080604082015260006148496080830185613c75565b905082606083015295945050505050565b634e487b7160e01b600052602160045260246000fd5b92835261ffff918216602084015216604082015260600190565b60006020828403121561489c57600080fd5b815163ffffffff81168114610d1757600080fd5b6000602082840312156148c257600080fd5b8151610d1781613def565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061475990830184613c75565b60006020828403121561491257600080fd5b8151610d1781613c1e56fe68e83002b91b0fd96d4df3566b5122221117e3ec6c2468fda594f6491f89b1c9a2646970667358221220a75d881048128ecf465ee6c33f11062c8eb77738601b6ae845428cdbacb028d864736f6c63430008110033

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

00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000001e486f726465206f662074686520556e646561643a20477561726469616e73000000000000000000000000000000000000000000000000000000000000000000064d4f525449530000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : invocation (string): Horde of the Undead: Guardians
Arg [1] : seal (string): MORTIS

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [3] : 486f726465206f662074686520556e646561643a20477561726469616e730000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [5] : 4d4f525449530000000000000000000000000000000000000000000000000000


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.