ETH Price: $3,415.83 (-0.16%)

Contract

0xa4fb4bfbd70Ae8C81eCe9E0FCCefFa9953e120cB
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Update Burn Rede...206575662024-09-01 18:38:5986 days ago1725215939IN
0xa4fb4bfb...953e120cB
0 ETH0.000096731.3684498
Update Burn Rede...194651992024-03-19 0:20:59253 days ago1710807659IN
0xa4fb4bfb...953e120cB
0 ETH0.0018364927.04107347
Update Burn Rede...191713052024-02-06 19:34:47294 days ago1707248087IN
0xa4fb4bfb...953e120cB
0 ETH0.0019167128.41045319
Update Burn Rede...189148762024-01-01 20:12:11330 days ago1704139931IN
0xa4fb4bfb...953e120cB
0 ETH0.0012231118.07338311
Update Burn Rede...189004822023-12-30 19:42:35332 days ago1703965355IN
0xa4fb4bfb...953e120cB
0 ETH0.0013482320.84378331
Update Burn Rede...189004762023-12-30 19:41:23332 days ago1703965283IN
0xa4fb4bfb...953e120cB
0 ETH0.0015485522.03318633
Update Burn Rede...189004682023-12-30 19:39:47332 days ago1703965187IN
0xa4fb4bfb...953e120cB
0 ETH0.0014846421.12378526
Update Burn Rede...188482842023-12-23 11:41:47339 days ago1703331707IN
0xa4fb4bfb...953e120cB
0 ETH0.0012410919.18739131
Update Burn Rede...186920982023-12-01 14:16:35361 days ago1701440195IN
0xa4fb4bfb...953e120cB
0 ETH0.002737840.61000822
Update Burn Rede...185712932023-11-14 16:19:35378 days ago1699978775IN
0xa4fb4bfb...953e120cB
0 ETH0.0039675958.85160819
Update Burn Rede...185712782023-11-14 16:16:35378 days ago1699978595IN
0xa4fb4bfb...953e120cB
0 ETH0.0039085457.9755888
Update Burn Rede...185712142023-11-14 16:03:47378 days ago1699977827IN
0xa4fb4bfb...953e120cB
0 ETH0.0033529749.73487972
Update Burn Rede...185712042023-11-14 16:01:47378 days ago1699977707IN
0xa4fb4bfb...953e120cB
0 ETH0.0033501149.69243716
Update Burn Rede...185711842023-11-14 15:57:35378 days ago1699977455IN
0xa4fb4bfb...953e120cB
0 ETH0.0031118346.15805922
Update Burn Rede...185031722023-11-05 3:36:35388 days ago1699155395IN
0xa4fb4bfb...953e120cB
0 ETH0.0009292313.78332157
Update Burn Rede...185031292023-11-05 3:27:47388 days ago1699154867IN
0xa4fb4bfb...953e120cB
0 ETH0.000795211.79534895
Update Burn Rede...185030532023-11-05 3:12:23388 days ago1699153943IN
0xa4fb4bfb...953e120cB
0 ETH0.0008598112.75369579
Update Burn Rede...185030072023-11-05 3:02:59388 days ago1699153379IN
0xa4fb4bfb...953e120cB
0 ETH0.0008799413.05225719
Update Burn Rede...185028082023-11-05 2:22:59388 days ago1699150979IN
0xa4fb4bfb...953e120cB
0 ETH0.0008923313.2359944
Update Burn Rede...184153222023-10-23 20:22:23400 days ago1698092543IN
0xa4fb4bfb...953e120cB
0 ETH0.0024333535.81044549
Update Burn Rede...183574872023-10-15 18:12:35408 days ago1697393555IN
0xa4fb4bfb...953e120cB
0 ETH0.000360825.54346892
Update Burn Rede...183574812023-10-15 18:11:23408 days ago1697393483IN
0xa4fb4bfb...953e120cB
0 ETH0.00044456.82392304
Update Burn Rede...183574752023-10-15 18:10:11408 days ago1697393411IN
0xa4fb4bfb...953e120cB
0 ETH0.00041116.31112123
Update Burn Rede...183254442023-10-11 6:33:11412 days ago1697005991IN
0xa4fb4bfb...953e120cB
0 ETH0.000479266.66246858
Update Burn Rede...183207172023-10-10 14:41:35413 days ago1696948895IN
0xa4fb4bfb...953e120cB
0 ETH0.0008590712.69182832
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC1155BurnRedeem

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 19 : ERC1155BurnRedeem.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/////////////////////////////////////////////////////////////////////////////////////
//                                                                                 //
//                                                                                 //
//                                     .%(#.                                       //
//                                      #(((#%,                                    //
//                                      (#(((((#%*                                 //
//                                      /#((((((((##*                              //
//                                      (#((((((((((##%.                           //
//                                     ,##(/*/(////((((#%*                         //
//                                   .###(//****/////(((##%,                       //
//                  (,          ,%#((((((///******/////((##%(                      //
//                *((,         ,##(///////*********////((###%*                     //
//              /((((         ,##(//////************/(((((###%                     //
//             /((((         ,##((////***************/((((###%                     //
//             (((          .###((///*****************((((####                     //
//             .            (##((//*******************((((##%*                     //
//               (#.       .###((/********************((((##%.      %.             //
//             ,%(#.       .###(/********,,,,,,,*****/(((###%#     ((%,            //
//            /%#/(/       /###(//****,,,,,,,,,,,****/((((((##%%%%#((#%.           //
//           /##(//(#.    ,###((/****,,,,,,,,,,,,,***/((/(((((((((#####%           //
//          *%##(/////((###((((/***,,,,,,,,,,,,,,,***//((((((((((####%%%/          //
//          ####(((//////(//////**,,,,,,.....,,,,,,****/(((((//((####%%%%          //
//         .####(((/((((((/////**,,,,,.......,,,,,,,,*****/////(#####%%%%          //
//         .#%###((////(((//***,,,,,,..........,,,,,,,,*****//((#####%%%%          //
//          /%%%###/////*****,,,,,,,..............,,,,,,,****/(((####%%%%          //
//           /%%###(////****,,,,,,.....        ......,,,,,,**(((####%%%%           //
//            ,#%###(///****,,,,,....            .....,,,,,***/(/(##%%(            //
//              (####(//****,,....                 ....,,,,,***/(####              //
//                (###(/***,,,...                    ...,,,,***(##/                //
//             #.   (#((/**,,,,..                    ...,,,,*((#,                  //
//               ,#(##(((//,,,,..                   ...,,,*/(((#((/                //
//                  *#(((///*,,....                ....,*//((((                    //
//                      *(///***,....            ...,***//,                        //
//                           ,//***,...       ..,,*,                               //
//                                                                                 //
//                                                                                 //
/////////////////////////////////////////////////////////////////////////////////////

import "@manifoldxyz/creator-core-solidity/contracts/core/IERC1155CreatorCore.sol";
import "@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol";
import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";

import "./IERC1155BurnRedeem.sol";

/**
 * @title Burn Redeem
 * @author manifold.xyz
 * @notice Burn Redeem shared extension for Manifold Creator contracts.
 */
contract ERC1155BurnRedeem is IERC165, IERC1155BurnRedeem, ICreatorExtensionTokenURI {
    using Strings for uint256;

    string private constant ARWEAVE_PREFIX = "https://arweave.net/";
    string private constant IPFS_PREFIX = "ipfs://";
    uint256 private constant MAX_UINT_256 = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;

    // stores mapping from tokenId to the burn redeem it represents
    // { creatorContractAddress => { tokenId => BurnRedeem } }
    mapping(address => mapping(uint256 => BurnRedeem)) private _burnRedeems;

    // { contractAddress => { tokenId => { redeemIndex } }
    mapping(address => mapping(uint256 => uint256)) private _redeemTokenIds;

    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165) returns (bool) {
        return interfaceId == type(IERC1155BurnRedeem).interfaceId ||
            interfaceId == type(IERC1155Receiver).interfaceId ||
            interfaceId == type(ICreatorExtensionTokenURI).interfaceId ||
            interfaceId == type(IERC165).interfaceId;
    }

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

    /**
     * See {IERC1155BurnRedeem-initializeBurnRedeem}.
     */
    function initializeBurnRedeem(
        address creatorContractAddress,
        uint256 index,
        BurnRedeemParameters calldata burnRedeemParameters
    ) external override creatorAdminRequired(creatorContractAddress) {
        // Revert if burnRedeem at index already exists
        require(_burnRedeems[creatorContractAddress][index].burnTokenAddress == address(0), "Burn redeem already initialized");

        // Sanity checks
        require(ERC165Checker.supportsInterface(burnRedeemParameters.burnTokenAddress, type(IERC1155CreatorCore).interfaceId), "burnToken must be ERC1155Creator");
        require(burnRedeemParameters.endDate == 0 || burnRedeemParameters.startDate < burnRedeemParameters.endDate, "startDate after endDate");
        require(burnRedeemParameters.totalSupply == 0 || burnRedeemParameters.totalSupply % burnRedeemParameters.redeemAmount == 0, "Remainder left from totalSupply");

         // Create the burn redeem
        _burnRedeems[creatorContractAddress][index] = BurnRedeem({
            redeemTokenId: MAX_UINT_256,
            burnTokenId: burnRedeemParameters.burnTokenId,
            burnTokenAddress: burnRedeemParameters.burnTokenAddress,
            startDate: burnRedeemParameters.startDate,
            endDate: burnRedeemParameters.endDate,
            burnAmount: burnRedeemParameters.burnAmount,
            redeemAmount: burnRedeemParameters.redeemAmount,
            redeemedCount: 0,
            totalSupply: burnRedeemParameters.totalSupply,
            storageProtocol: burnRedeemParameters.storageProtocol,
            location: burnRedeemParameters.location
        });
        
        emit BurnRedeemInitialized(creatorContractAddress, index, msg.sender);
    }

    /**
     * See {IERC1155BurnRedeem-updateBurnRedeem}.
     */
    function updateBurnRedeem(
        address creatorContractAddress,
        uint256 index,
        BurnRedeemParameters calldata burnRedeemParameters
    ) external override creatorAdminRequired(creatorContractAddress) {
        BurnRedeem memory burnRedeem = _burnRedeems[creatorContractAddress][index];

        // Sanity checks
        require(ERC165Checker.supportsInterface(burnRedeemParameters.burnTokenAddress, type(IERC1155CreatorCore).interfaceId), "burnToken must be ERC1155Creator");
        require(burnRedeem.burnTokenAddress != address(0), "Burn redeem not initialized");
        require(burnRedeemParameters.totalSupply == 0 || burnRedeemParameters.totalSupply % burnRedeemParameters.redeemAmount == 0, "Remainder left from totalSupply");
        require(burnRedeemParameters.endDate == 0 || burnRedeemParameters.startDate < burnRedeemParameters.endDate, "startDate after endDate");

        // Overwrite the existing burnRedeem
        _burnRedeems[creatorContractAddress][index] = BurnRedeem({
            redeemTokenId: burnRedeem.redeemTokenId,
            burnTokenId: burnRedeemParameters.burnTokenId,
            burnTokenAddress: burnRedeemParameters.burnTokenAddress,
            startDate: burnRedeemParameters.startDate,
            endDate: burnRedeemParameters.endDate,
            burnAmount: burnRedeemParameters.burnAmount,
            redeemAmount: burnRedeemParameters.redeemAmount,
            redeemedCount: burnRedeem.redeemedCount,
            totalSupply: burnRedeemParameters.totalSupply,
            storageProtocol: burnRedeemParameters.storageProtocol,
            location: burnRedeemParameters.location
        });
    }

    /**
     * See {IERC1155BurnRedeem-getBurnRedeem}.
     */
    function getBurnRedeem(address creatorContractAddress, uint256 index) external override view returns(BurnRedeem memory) {
        require(_burnRedeems[creatorContractAddress][index].burnTokenAddress != address(0), "Burn redeem not initialized");
        return _burnRedeems[creatorContractAddress][index];
    }

    /**
     * See {IERC1155BurnRedeem-isEligible}.
     */
    function isEligible(address wallet, address creatorContractAddress, uint256 index) external override view returns(uint256) {
        BurnRedeem memory burnRedeem = _burnRedeems[creatorContractAddress][index];
        uint256 burnNumberOwned = IERC1155(burnRedeem.burnTokenAddress).balanceOf(wallet, burnRedeem.burnTokenId);
        return (burnRedeem.burnAmount / burnNumberOwned) * burnRedeem.redeemAmount;
    }

    /**
     * See {ICreatorExtensionTokenURI-tokenURI}.
     */
    function tokenURI(address creatorContractAddress, uint256 tokenId) external override view returns(string memory uri) {
        uint256 tokenBurnRedeem = _redeemTokenIds[creatorContractAddress][tokenId];
        require(tokenBurnRedeem > 0, "Token does not exist");
        BurnRedeem memory burnRedeem = _burnRedeems[creatorContractAddress][tokenBurnRedeem];

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

    /**
     * @dev See {IERC1155Receiver-onERC1155Received}.
     */
    function onERC1155Received(
        address,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external override returns(bytes4) {
        _onERC1155Received(from, id, value, data);
        return this.onERC1155Received.selector;
    }

    /**
     * @dev See {IERC1155Receiver-onERC1155BatchReceived}.
     */
    function onERC1155BatchReceived(
        address,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external override returns(bytes4) {
        _onERC1155BatchReceived(from, ids, values, data);
        return this.onERC1155BatchReceived.selector;
    }

    /**
     * @notice ERC1155 token transfer callback
     * @param from      the person sending the tokens
     * @param id        the token id of the burn token
     * @param value     the number of tokens to burn
     * @param data      bytes corresponding to the targeted burn redeem action(s), formatted [address mintTo (does not repeat), address creatorContractAddress, uint256 index, uint256 amount, ...]
     */
    function _onERC1155Received(
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) private {
        // Check calldata is valid
        require(data.length % 96 == 32, "Invalid data");
        uint256 redemptionCount = (data.length - 32)/96;

        // Single value arrays used for mint calls
        address[] memory mintToAddress = new address[](1);
        mintToAddress[0] = abi.decode(data[0:32], (address));
        uint256[] memory redemptionAmount = new uint256[](1);

        uint256 amountRequired = 0;

        // Iterate over redemptions in calldata and mint redeem tokens for each
        for (uint256 i = 0; i < redemptionCount;) {
            // Read calldata
            (address creatorContractAddress, uint256 index, uint32 amount) = abi.decode(data[32+i*96:32+(i+1)*96], (address, uint256, uint32));

            (BurnRedeem storage burnRedeem, uint256 amountToBurn, uint256 amountToRedeem) = _retrieveActiveBurnRedeem(creatorContractAddress, index, id, amount);

            // Do mint if needed
            if (amountToRedeem > 0) {
                amountRequired += amountToBurn;
                redemptionAmount[0] = amountToRedeem;
                _mintRedeem(creatorContractAddress, index, burnRedeem, mintToAddress, redemptionAmount);
                emit BurnRedeemMint(creatorContractAddress, burnRedeem.redeemTokenId, amountToRedeem, msg.sender, id);
            }
            unchecked { ++i; }
        }

        require(amountRequired <= value, "Invalid value sent");
        require(amountRequired > 0, "None available");

        // Do burn
        if (amountRequired > 0) {
            uint256[] memory tokenIds = new uint256[](1);
            tokenIds[0] = id;
            uint256[] memory amounts = new uint256[](1);
            amounts[0] = amountRequired;
            IERC1155CreatorCore(msg.sender).burn(address(this), tokenIds, amounts);
        }

        // Return remaining tokens
        if (amountRequired < value) {
            IERC1155(msg.sender).safeTransferFrom(address(this), from, id, value - amountRequired, "");
        }
    }

    /**
     * @notice ERC1155 batch token transfer callbackx
     * @param ids       a list of the token ids of the burn token
     * @param values    a list of the number of tokens to burn for each id
     * @param data      bytes corresponding to the targeted burn redeem action(s), formatted [address mintTo (does not repeat), address creatorContractAddress, uint256 index, uint256 amount, ...]
     *                  note: the data parameter must be in the same order as the ids and values parameters
     */
    function _onERC1155BatchReceived(
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) private {
        // Check calldata is valid
        require(data.length % 96 == 32, "Invalid data");
        uint256 redemptionCount = (data.length - 32)/96;
        require(redemptionCount == ids.length, "Invalid data");

        // Single value arrays used for mint calls
        address[] memory mintToAddress = new address[](1);
        mintToAddress[0] = abi.decode(data[0:32], (address));
        uint256[] memory redemptionAmount = new uint256[](1);

        // Track excess values
        uint256[] memory burnedValues = new uint256[](redemptionCount);
        uint256[] memory remainingValues = new uint256[](redemptionCount);

        // Track if tokens were redeemed
        bool tokensRedeemed = false;
        bool excessValues = false;

        // Iterate over redemptions in calldata and mint redeem tokens for each
        for (uint256 i = 0; i < redemptionCount;) {
            // Read calldata
            (address creatorContractAddress, uint256 index, uint32 amount) = abi.decode(data[32+i*96:32+(i+1)*96], (address, uint256, uint32));

            (BurnRedeem storage burnRedeem, uint256 amountToBurn, uint256 amountToRedeem) = _retrieveActiveBurnRedeem(creatorContractAddress, index, ids[i], amount);

            // Do mint if needed
            if (amountToRedeem > 0) {
                // Store burned and excess values
                burnedValues[i] = amountToBurn;
                if (amountToBurn != values[i]) {
                    remainingValues[i] = values[i] - amountToBurn;
                    excessValues = true;
                }

                // Store values for mint
                redemptionAmount[0] = amountToRedeem;
                tokensRedeemed = true;

                _mintRedeem(creatorContractAddress, index, burnRedeem, mintToAddress, redemptionAmount);
                emit BurnRedeemMint(creatorContractAddress, burnRedeem.redeemTokenId, amountToRedeem, msg.sender, ids[i]);
            } else {
                // Store excess values
                remainingValues[i] = values[i];
                excessValues = true;
            }
            unchecked { ++i; }
        }

        require(tokensRedeemed, "None available");

        // Return remaining tokens
        if (excessValues) {
            for (uint256 i = 0; i < redemptionCount; i++) {
                if (remainingValues[i] > 0) {
                    IERC1155(msg.sender).safeTransferFrom(address(this), from, ids[i], remainingValues[i], "");
                }
            }
        }

        // Do burn
        IERC1155CreatorCore(msg.sender).burn(address(this), ids, burnedValues);
    }

    /**
     * Mint a redemption
     */
    function _mintRedeem(address creatorContractAddress, uint256 index, BurnRedeem storage burnRedeem, address[] memory mintToAddress, uint256[] memory redeemAmounts) private {
        if (burnRedeem.redeemTokenId == MAX_UINT_256) {
            // No token minted yet, mint new token
            string [] memory uris = new string[](1);
            uint256[] memory newTokenIds = IERC1155CreatorCore(creatorContractAddress).mintExtensionNew(mintToAddress, redeemAmounts, uris);

            burnRedeem.redeemTokenId = newTokenIds[0];
            _redeemTokenIds[creatorContractAddress][newTokenIds[0]] = index;

        } else {
            // Mint exisiting token
            uint256[] memory tokenIds = new uint256[](1);
            tokenIds[0] = burnRedeem.redeemTokenId;
            IERC1155CreatorCore(creatorContractAddress).mintExtensionExisting(mintToAddress, tokenIds, redeemAmounts);
        }
    }

    /**
     * Returns active burn redeem, amount to burn and amount of redemptions that can occur
     */
    function _retrieveActiveBurnRedeem(address creatorContractAddress, uint256 index, uint256 burnTokenId, uint256 amount) private returns(BurnRedeem storage burnRedeem, uint256 amountToBurn, uint256 amountToRedeem) {
        burnRedeem = _burnRedeems[creatorContractAddress][index];

        // Sanity checks
        require(burnRedeem.startDate == 0 || burnRedeem.startDate < block.timestamp, "Transaction before start date");
        require(burnRedeem.endDate == 0 || burnRedeem.endDate >= block.timestamp, "Transaction after end date");
        require(burnRedeem.burnTokenAddress == msg.sender && burnRedeem.burnTokenId == burnTokenId, "Token not eligible");

        if (burnRedeem.totalSupply == 0 || burnRedeem.redeemedCount < burnRedeem.totalSupply) {
            amountToRedeem = burnRedeem.redeemAmount * amount;
            amountToBurn = burnRedeem.burnAmount * amount;

            // Too many requested, consume the remaining
            if (burnRedeem.totalSupply > 0 && burnRedeem.redeemedCount + amountToRedeem > burnRedeem.totalSupply) {
                amountToRedeem = burnRedeem.totalSupply - burnRedeem.redeemedCount;
                amountToBurn = amountToRedeem / burnRedeem.redeemAmount * burnRedeem.burnAmount;
            }
            unchecked{ burnRedeem.redeemedCount += uint32(amountToRedeem); }
        }
    }
}

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

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";

import "../extensions/ICreatorExtensionTokenURI.sol";

import "./ICreatorCore.sol";

/**
 * @dev Core creator implementation
 */
abstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 {
    using Strings for uint256;
    using EnumerableSet for EnumerableSet.AddressSet;
    using AddressUpgradeable for address;

    uint256 _tokenCount = 0;

    // Track registered extensions data
    EnumerableSet.AddressSet internal _extensions;
    EnumerableSet.AddressSet internal _blacklistedExtensions;
    mapping (address => address) internal _extensionPermissions;
    mapping (address => bool) internal _extensionApproveTransfers;
    
    // For tracking which extension a token was minted by
    mapping (uint256 => address) internal _tokensExtension;

    // The baseURI for a given extension
    mapping (address => string) private _extensionBaseURI;
    mapping (address => bool) private _extensionBaseURIIdentical;

    // The prefix for any tokens with a uri configured
    mapping (address => string) private _extensionURIPrefix;

    // Mapping for individual token URIs
    mapping (uint256 => string) internal _tokenURIs;

    
    // Royalty configurations
    mapping (address => address payable[]) internal _extensionRoyaltyReceivers;
    mapping (address => uint256[]) internal _extensionRoyaltyBPS;
    mapping (uint256 => address payable[]) internal _tokenRoyaltyReceivers;
    mapping (uint256 => uint256[]) internal _tokenRoyaltyBPS;

    /**
     * External interface identifiers for royalties
     */

    /**
     *  @dev CreatorCore
     *
     *  bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6
     *
     *  => 0xbb3bafd6 = 0xbb3bafd6
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;

    /**
     *  @dev Rarible: RoyaltiesV1
     *
     *  bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
     *  bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
     *
     *  => 0xb9c4d9fb ^ 0x0ebd4c7f = 0xb7799584
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;

    /**
     *  @dev Foundation
     *
     *  bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c
     *
     *  => 0xd5a06d4c = 0xd5a06d4c
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0xd5a06d4c;

    /**
     *  @dev EIP-2981
     *
     * bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
     *
     * => 0x2a55205a = 0x2a55205a
     */
    bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;

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

    /**
     * @dev Only allows registered extensions to call the specified function
     */
    modifier extensionRequired() {
        require(_extensions.contains(msg.sender), "Must be registered extension");
        _;
    }

    /**
     * @dev Only allows non-blacklisted extensions
     */
    modifier nonBlacklistRequired(address extension) {
        require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");
        _;
    }   

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

    /**
     * @dev Register an extension
     */
    function _registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) internal {
        require(extension != address(0) && extension != address(this), "Creator: Invalid");
        require(extension.isContract(), "Creator: Extension must be a contract");
        if (!_extensions.contains(extension)) {
            _extensionBaseURI[extension] = baseURI;
            _extensionBaseURIIdentical[extension] = baseURIIdentical;
            emit ExtensionRegistered(extension, msg.sender);
            _extensions.add(extension);
        }
    }

    /**
     * @dev Unregister an extension
     */
    function _unregisterExtension(address extension) internal {
       if (_extensions.contains(extension)) {
           emit ExtensionUnregistered(extension, msg.sender);
           _extensions.remove(extension);
       }
    }

    /**
     * @dev Blacklist an extension
     */
    function _blacklistExtension(address extension) internal {
       require(extension != address(0) && extension != address(this), "Cannot blacklist yourself");
       if (_extensions.contains(extension)) {
           emit ExtensionUnregistered(extension, msg.sender);
           _extensions.remove(extension);
       }
       if (!_blacklistedExtensions.contains(extension)) {
           emit ExtensionBlacklisted(extension, msg.sender);
           _blacklistedExtensions.add(extension);
       }
    }

    /**
     * @dev Set base token uri for an extension
     */
    function _setBaseTokenURIExtension(string calldata uri, bool identical) internal {
        _extensionBaseURI[msg.sender] = uri;
        _extensionBaseURIIdentical[msg.sender] = identical;
    }

    /**
     * @dev Set token uri prefix for an extension
     */
    function _setTokenURIPrefixExtension(string calldata prefix) internal {
        _extensionURIPrefix[msg.sender] = prefix;
    }

    /**
     * @dev Set token uri for a token of an extension
     */
    function _setTokenURIExtension(uint256 tokenId, string calldata uri) internal {
        require(_tokensExtension[tokenId] == msg.sender, "Invalid token");
        _tokenURIs[tokenId] = uri;
    }

    /**
     * @dev Set base token uri for tokens with no extension
     */
    function _setBaseTokenURI(string memory uri) internal {
        _extensionBaseURI[address(0)] = uri;
    }

    /**
     * @dev Set token uri prefix for tokens with no extension
     */
    function _setTokenURIPrefix(string calldata prefix) internal {
        _extensionURIPrefix[address(0)] = prefix;
    }


    /**
     * @dev Set token uri for a token with no extension
     */
    function _setTokenURI(uint256 tokenId, string calldata uri) internal {
        require(tokenId > 0 && tokenId <= _tokenCount && _tokensExtension[tokenId] == address(0), "Invalid token");
        _tokenURIs[tokenId] = uri;
    }

    /**
     * @dev Retrieve a token's URI
     */
    function _tokenURI(uint256 tokenId) internal view returns (string memory) {
        require(tokenId > 0 && tokenId <= _tokenCount, "Invalid token");

        address extension = _tokensExtension[tokenId];
        require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");

        if (bytes(_tokenURIs[tokenId]).length != 0) {
            if (bytes(_extensionURIPrefix[extension]).length != 0) {
                return string(abi.encodePacked(_extensionURIPrefix[extension],_tokenURIs[tokenId]));
            }
            return _tokenURIs[tokenId];
        }

        if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionTokenURI).interfaceId)) {
            return ICreatorExtensionTokenURI(extension).tokenURI(address(this), tokenId);
        }

        if (!_extensionBaseURIIdentical[extension]) {
            return string(abi.encodePacked(_extensionBaseURI[extension], tokenId.toString()));
        } else {
            return _extensionBaseURI[extension];
        }
    }

    /**
     * Get token extension
     */
    function _tokenExtension(uint256 tokenId) internal view returns (address extension) {
        extension = _tokensExtension[tokenId];

        require(extension != address(0), "No extension for token");
        require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");

        return extension;
    }

    /**
     * Helper to get royalties for a token
     */
    function _getRoyalties(uint256 tokenId) view internal returns (address payable[] storage, uint256[] storage) {
        return (_getRoyaltyReceivers(tokenId), _getRoyaltyBPS(tokenId));
    }

    /**
     * Helper to get royalty receivers for a token
     */
    function _getRoyaltyReceivers(uint256 tokenId) view internal returns (address payable[] storage) {
        if (_tokenRoyaltyReceivers[tokenId].length > 0) {
            return _tokenRoyaltyReceivers[tokenId];
        } else if (_extensionRoyaltyReceivers[_tokensExtension[tokenId]].length > 0) {
            return _extensionRoyaltyReceivers[_tokensExtension[tokenId]];
        }
        return _extensionRoyaltyReceivers[address(0)];
    }

    /**
     * Helper to get royalty basis points for a token
     */
    function _getRoyaltyBPS(uint256 tokenId) view internal returns (uint256[] storage) {
        if (_tokenRoyaltyBPS[tokenId].length > 0) {
            return _tokenRoyaltyBPS[tokenId];
        } else if (_extensionRoyaltyBPS[_tokensExtension[tokenId]].length > 0) {
            return _extensionRoyaltyBPS[_tokensExtension[tokenId]];
        }
        return _extensionRoyaltyBPS[address(0)];        
    }

    function _getRoyaltyInfo(uint256 tokenId, uint256 value) view internal returns (address receiver, uint256 amount){
        address payable[] storage receivers = _getRoyaltyReceivers(tokenId);
        require(receivers.length <= 1, "More than 1 royalty receiver");
        
        if (receivers.length == 0) {
            return (address(this), 0);
        }
        return (receivers[0], _getRoyaltyBPS(tokenId)[0]*value/10000);
    }

    /**
     * Set royalties for a token
     */
    function _setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {
        require(receivers.length == basisPoints.length, "Invalid input");
        uint256 totalBasisPoints;
        for (uint i = 0; i < basisPoints.length; i++) {
            totalBasisPoints += basisPoints[i];
        }
        require(totalBasisPoints < 10000, "Invalid total royalties");
        _tokenRoyaltyReceivers[tokenId] = receivers;
        _tokenRoyaltyBPS[tokenId] = basisPoints;
        emit RoyaltiesUpdated(tokenId, receivers, basisPoints);
    }

    /**
     * Set royalties for all tokens of an extension
     */
    function _setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {
        require(receivers.length == basisPoints.length, "Invalid input");
        uint256 totalBasisPoints;
        for (uint i = 0; i < basisPoints.length; i++) {
            totalBasisPoints += basisPoints[i];
        }
        require(totalBasisPoints < 10000, "Invalid total royalties");
        _extensionRoyaltyReceivers[extension] = receivers;
        _extensionRoyaltyBPS[extension] = basisPoints;
        if (extension == address(0)) {
            emit DefaultRoyaltiesUpdated(receivers, basisPoints);
        } else {
            emit ExtensionRoyaltiesUpdated(extension, receivers, basisPoints);
        }
    }


}

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

pragma solidity ^0.8.0;

/// @author: manifold.xyz

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

}

File 4 of 19 : IERC1155CreatorCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "./CreatorCore.sol";

/**
 * @dev Core ERC1155 creator interface
 */
interface IERC1155CreatorCore is ICreatorCore {

    /**
     * @dev mint a token with no extension. Can only be called by an admin.
     *
     * @param to       - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param amounts  - Can be a single element array (all recipients get the same amount) or a multi-element array
     * @param uris     - If no elements, all tokens use the default uri.
     *                   If any element is an empty string, the corresponding token uses the default uri.
     *
     *
     * Requirements: If to is a multi-element array, then uris must be empty or single element array
     *               If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size
     *               If to is a single element array, uris must be empty or the same length as amounts
     *
     * Examples:
     *    mintBaseNew(['0x....1', '0x....2'], [1], [])
     *        Mints a single new token, and gives 1 each to '0x....1' and '0x....2'.  Token uses default uri.
     *    
     *    mintBaseNew(['0x....1', '0x....2'], [1, 2], [])
     *        Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'.  Token uses default uri.
     *    
     *    mintBaseNew(['0x....1'], [1, 2], ["", "http://token2.com"])
     *        Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second.  1st token uses default uri, second uses "http://token2.com".
     *    
     * @return Returns list of tokenIds minted
     */
    function mintBaseNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);

    /**
     * @dev batch mint existing token with no extension. Can only be called by an admin.
     *
     * @param to        - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param tokenIds  - Can be a single element array (all recipients get the same token) or a multi-element array
     * @param amounts   - Can be a single element array (all recipients get the same amount) or a multi-element array
     *
     * Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays
     *
     * Examples:
     *    mintBaseExisting(['0x....1', '0x....2'], [1], [10])
     *        Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'.
     *    
     *    mintBaseExisting(['0x....1', '0x....2'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'.
     *    
     *    mintBaseExisting(['0x....1'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'.
     *    
     *    mintBaseExisting(['0x....1', '0x....2'], [1], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'.
     *    
     */
    function mintBaseExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

    /**
     * @dev mint a token from an extension. Can only be called by a registered extension.
     *
     * @param to       - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param amounts  - Can be a single element array (all recipients get the same amount) or a multi-element array
     * @param uris     - If no elements, all tokens use the default uri.
     *                   If any element is an empty string, the corresponding token uses the default uri.
     *
     *
     * Requirements: If to is a multi-element array, then uris must be empty or single element array
     *               If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size
     *               If to is a single element array, uris must be empty or the same length as amounts
     *
     * Examples:
     *    mintExtensionNew(['0x....1', '0x....2'], [1], [])
     *        Mints a single new token, and gives 1 each to '0x....1' and '0x....2'.  Token uses default uri.
     *    
     *    mintExtensionNew(['0x....1', '0x....2'], [1, 2], [])
     *        Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'.  Token uses default uri.
     *    
     *    mintExtensionNew(['0x....1'], [1, 2], ["", "http://token2.com"])
     *        Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second.  1st token uses default uri, second uses "http://token2.com".
     *    
     * @return Returns list of tokenIds minted
     */
    function mintExtensionNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);

    /**
     * @dev batch mint existing token from extension. Can only be called by a registered extension.
     *
     * @param to        - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
     * @param tokenIds  - Can be a single element array (all recipients get the same token) or a multi-element array
     * @param amounts   - Can be a single element array (all recipients get the same amount) or a multi-element array
     *
     * Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays
     *
     * Examples:
     *    mintExtensionExisting(['0x....1', '0x....2'], [1], [10])
     *        Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'.
     *    
     *    mintExtensionExisting(['0x....1', '0x....2'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'.
     *    
     *    mintExtensionExisting(['0x....1'], [1, 2], [10, 20])
     *        Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'.
     *    
     *    mintExtensionExisting(['0x....1', '0x....2'], [1], [10, 20])
     *        Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'.
     *    
     */
    function mintExtensionExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

    /**
     * @dev burn tokens. Can only be called by token owner or approved address.
     * On burn, calls back to the registered extension's onBurn method
     */
    function burn(address account, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

    /**
     * @dev Total amount of tokens in with a given tokenId.
     */
    function totalSupply(uint256 tokenId) external view returns (uint256);
}

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

pragma solidity ^0.8.0;

/// @author: manifold.xyz

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

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

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

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

pragma solidity ^0.8.0;

/// @author: manifold.xyz

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

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

    // Track registered admins
    EnumerableSet.AddressSet private _admins;

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

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

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

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

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

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

}

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

pragma solidity ^0.8.0;

/// @author: manifold.xyz

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

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

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

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

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

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

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

}

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

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 9 of 19 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 10 of 19 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 11 of 19 : IERC1155.sol
// SPDX-License-Identifier: MIT

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 be 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 12 of 19 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 13 of 19 : Context.sol
// SPDX-License-Identifier: MIT

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 14 of 19 : ERC165.sol
// SPDX-License-Identifier: MIT

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 15 of 19 : ERC165Checker.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface,
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            _supportsERC165Interface(account, type(IERC165).interfaceId) &&
            !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
        internal
        view
        returns (bool[] memory)
    {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in _interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!_supportsERC165Interface(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     * Interface identification is specified in ERC-165.
     */
    function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
        bytes memory encodedParams = abi.encodeWithSelector(IERC165(account).supportsInterface.selector, interfaceId);
        (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams);
        if (result.length < 32) return false;
        return success && abi.decode(result, (bool));
    }
}

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

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 17 of 19 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 18 of 19 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";

/**
 * Burn Redeem interface
 */
interface IERC1155BurnRedeem is IERC1155Receiver {
    enum StorageProtocol { INVALID, NONE, ARWEAVE, IPFS }

    struct BurnRedeemParameters {
        uint256 burnTokenId;
        address burnTokenAddress;
        uint48 startDate;
        uint48 endDate;
        uint32 burnAmount;
        uint32 redeemAmount;
        uint32 totalSupply;
        StorageProtocol storageProtocol;
        string location;
    }

    struct BurnRedeem {
        uint256 redeemTokenId;
        uint256 burnTokenId;
        address burnTokenAddress;
        uint48 startDate;
        uint48 endDate;
        uint32 burnAmount;
        uint32 redeemAmount;
        uint32 redeemedCount;
        uint32 totalSupply;
        StorageProtocol storageProtocol;
        string location;
    }

    event BurnRedeemInitialized(address indexed creatorContract, uint256 indexed index, address initializer);
    event BurnRedeemMint(address indexed creatorContract, uint256 indexed tokenId, uint256 amount, address burnTokenAddress, uint256 burnTokenId);

    /**
     * @notice initialize a new burn redeem, emit initialize event, and return the newly created index
     * @param creatorContractAddress    the creator contract the burn will mint redeem tokens for
     * @param index                     the index of the burnRedeem in the mapping of creatorContractAddress' _burnRedeems
     * @param burnRedeemParameters      the parameters which will affect the minting behavior of the burn redeem
     */
    function initializeBurnRedeem(address creatorContractAddress, uint256 index, BurnRedeemParameters calldata burnRedeemParameters) external;

    /**
     * @notice update an existing burn redeem at index
     * @param creatorContractAddress    the creator contract corresponding to the burn redeem
     * @param index                     the index of the burn redeem in the list of creatorContractAddress' _burnRedeems
     * @param burnRedeemParameters      the parameters which will affect the minting behavior of the burn redeem
     */
    function updateBurnRedeem(address creatorContractAddress, uint256 index, BurnRedeemParameters calldata burnRedeemParameters) external;

    /**
     * @notice get a burn redeem corresponding to a creator contract and index
     * @param creatorContractAddress    the address of the creator contract
     * @param index                     the index of the burn redeem
     * @return                          the burn redeem object
     */
    function getBurnRedeem(address creatorContractAddress, uint256 index) external view returns(BurnRedeem memory);

    /**
     * @notice check if an wallet can participate in the provided burn redeem
     * @param wallet                    the wallet to check ownership against
     * @param creatorContractAddress    the creator contract address
     * @param index                     the index of the burn redeem for which we will mint
     * @return                          the max number of tokens the wallet can mint (0 if ineligible)
     */
    function isEligible(address wallet, address creatorContractAddress, uint256 index) external view returns(uint256);
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creatorContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"address","name":"initializer","type":"address"}],"name":"BurnRedeemInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creatorContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"burnTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"burnTokenId","type":"uint256"}],"name":"BurnRedeemMint","type":"event"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getBurnRedeem","outputs":[{"components":[{"internalType":"uint256","name":"redeemTokenId","type":"uint256"},{"internalType":"uint256","name":"burnTokenId","type":"uint256"},{"internalType":"address","name":"burnTokenAddress","type":"address"},{"internalType":"uint48","name":"startDate","type":"uint48"},{"internalType":"uint48","name":"endDate","type":"uint48"},{"internalType":"uint32","name":"burnAmount","type":"uint32"},{"internalType":"uint32","name":"redeemAmount","type":"uint32"},{"internalType":"uint32","name":"redeemedCount","type":"uint32"},{"internalType":"uint32","name":"totalSupply","type":"uint32"},{"internalType":"enum IERC1155BurnRedeem.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"string","name":"location","type":"string"}],"internalType":"struct IERC1155BurnRedeem.BurnRedeem","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"components":[{"internalType":"uint256","name":"burnTokenId","type":"uint256"},{"internalType":"address","name":"burnTokenAddress","type":"address"},{"internalType":"uint48","name":"startDate","type":"uint48"},{"internalType":"uint48","name":"endDate","type":"uint48"},{"internalType":"uint32","name":"burnAmount","type":"uint32"},{"internalType":"uint32","name":"redeemAmount","type":"uint32"},{"internalType":"uint32","name":"totalSupply","type":"uint32"},{"internalType":"enum IERC1155BurnRedeem.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"string","name":"location","type":"string"}],"internalType":"struct IERC1155BurnRedeem.BurnRedeemParameters","name":"burnRedeemParameters","type":"tuple"}],"name":"initializeBurnRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"isEligible","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"uri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"components":[{"internalType":"uint256","name":"burnTokenId","type":"uint256"},{"internalType":"address","name":"burnTokenAddress","type":"address"},{"internalType":"uint48","name":"startDate","type":"uint48"},{"internalType":"uint48","name":"endDate","type":"uint48"},{"internalType":"uint32","name":"burnAmount","type":"uint32"},{"internalType":"uint32","name":"redeemAmount","type":"uint32"},{"internalType":"uint32","name":"totalSupply","type":"uint32"},{"internalType":"enum IERC1155BurnRedeem.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"string","name":"location","type":"string"}],"internalType":"struct IERC1155BurnRedeem.BurnRedeemParameters","name":"burnRedeemParameters","type":"tuple"}],"name":"updateBurnRedeem","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080806040523461001657612b68908161001c8239f35b600080fdfe60c080604052600436101561001357600080fd5b600090813560e01c90816301ffc9a714611ccf57508063aca40825146116dd578063b058d2f814611425578063b9e8ed2814610eb6578063bc197c81146109fe578063ccd31b0c146107ac578063e9dc6375146104755763f23a6e611461007957600080fd5b346102075760a036600319011261020757610092611db8565b5061009b611dd3565b60843567ffffffffffffffff8111610471576100bb903690600401611ec1565b6100ca602060608306146123ef565b601f19810181811161045d57604051916100e383611f36565b600183526020368185013780602011610459576001600160a01b0361010785611de9565b1661011184612477565b526040519061011f82611f36565b60018252602036818401378694875b606085048110610323578888886064358082116102df578115156101518161251c565b610219575b808210610188575b60206040517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b83916101939161243a565b333b1561021557604051637921219560e11b81523060048201526001600160a01b039390931660248401526044803590840152606483015260a06084830152600060a48301528160c48183335af1801561020a576101f3575b808061015e565b6101fd8291611f22565b61020757806101ec565b80fd5b6040513d84823e3d90fd5b5080fd5b60405161022581611f36565b600181526020368183013760443561023c82612477565b52846040519161024b83611f36565b60018352602036818501378461026084612477565b52333b1561021557610298906102aa6040519485938493633db0f8ab60e01b8552306004860152606060248601526064850190612567565b83810360031901604485015290612567565b038183335af180156102d4576102c1575b50610156565b6102cd90949194611f22565b92846102bb565b6040513d87823e3d90fd5b606460405162461bcd60e51b815260206004820152601260248201527f496e76616c69642076616c75652073656e7400000000000000000000000000006044820152fd5b8060608102046060148115171561044557606081026020016020116104455760018101811161044557600181016060600183010204606014600182011517156104455760606001820102602001602011610445576001600160a01b0363ffffffff6103be6103ad6103a56060600187010260200160608702602001898961245f565b8101906124ed565b9094909116921660443584846128ac565b929190836103d9575b5050505050600160609101905061012e565b6103e6919293949b6124e0565b99878a83866103f484612477565b526103ff93866125e8565b546040805193845233602085015260443590840152917f3ea53625fcb61f620716fae8ad32375fc4f80feb23831a3c53731a8bb76d69a890606090a338808080806103c7565b602489634e487b7160e01b81526011600452fd5b8580fd5b602485634e487b7160e01b81526011600452fd5b8280fd5b5034610207576040366003190112610207576001600160a01b0380610498611db8565b1690818352600192602092848452604082206024358352845260408220549081156107685782528184526040822090825283526040812091604051906104dd82611eef565b8354825285840154858301526002840154908116604083015265ffffffffffff8160a01c16606083015260d01c6080820152600460038401549363ffffffff80861660a08501528086881c1660c0850152808660401c1660e08501528560601c1661010084015261055960ff61012085019660801c168661216a565b01604051958691849181549161056e836121df565b92838652898382169182600014610741575050600114610703575b505050610140929161059c910387611f6e565b0193845260405183810181811067ffffffffffffffff8211176106ef5760405281815291805160048110156106db576002036106625750505061064a816040516105e581611f36565b601481527f68747470733a2f2f617277656176652e6e65742f00000000000000000000000082820152935b5193604051948161062a8793518092868087019101611e48565b820161063e82518093868085019101611e48565b01038085520183611f6e565b61065e604051928284938452830190611e6b565b0390f35b939193519060048210156106c75750600314610683575b8161064a91610610565b915061064a8160405161069581611f36565b600781527f697066733a2f2f000000000000000000000000000000000000000000000000008282015293915050610679565b80634e487b7160e01b602492526021600452fd5b602483634e487b7160e01b81526021600452fd5b602483634e487b7160e01b81526041600452fd5b8652878620889350869291905b828410610729575050508201018161059c610140610589565b8054848c018601528a95508994909301928101610710565b60ff19168782015293151560051b8601909301935084925061059c91506101409050610589565b6064856040519062461bcd60e51b82526004820152601460248201527f546f6b656e20646f6573206e6f742065786973740000000000000000000000006044820152fd5b5034610207576060366003190112610207576107c6611db8565b906001600160a01b036107d7611dd3565b1681528060205260408120604435825260205260408120916004604051936107fe85611eef565b805485526001810154602086015260028101546001600160a01b038116604087015265ffffffffffff8160a01c16606087015260d01c608086015261088b60ff600383015463ffffffff811660a089015263ffffffff8160201c1660c089015263ffffffff8160401c1660e089015263ffffffff8160601c1661010089015260801c16610120870161216a565b0160405190818482549261089e846121df565b80845293600181169081156109dc575060011461099b575b506108c392500382611f6e565b61014084015260206001600160a01b0360448160408701511693838701519460405195869485937efdd58e00000000000000000000000000000000000000000000000000000000855216600484015260248301525afa91821561098f578092610956575b602061094e8563ffffffff60c0610944888360a0860151166123bc565b92015116906123c6565b604051908152f35b9091506020823d602011610987575b8161097260209383611f6e565b810103126102075750518163ffffffff610927565b3d9150610965565b604051903d90823e3d90fd5b86525060208520909185915b8183106109c05750509060206108c392820101386108b6565b60209193508060019154838588010152019101909183926109a7565b9050602092506108c394915060ff191682840152151560051b820101386108b6565b50346102075760a036600319011261020757610a18611db8565b50610a21611dd3565b67ffffffffffffffff919060443583811161047157610a44903690600401611e90565b60a05292606435818111610c0857610a60903690600401611e90565b929091608435908111610eb257610a7b903690600401611ec1565b9290610a8c602060608606146123ef565b601f19840193808511610e9e57610aa960a05160608704146123ef565b60405192610ab684611f36565b600184526020368186013781602011610e9a576001600160a01b03610ada84611de9565b16610ae485612477565b5260405196610af288611f36565b60018852602036818a0137610b09606088046124ae565b97610b16606089046124ae565b60805289958a958b5b60608b048110610cdc5750505050505050610b399061251c565b610c0c575b5050333b156102155760405192633db0f8ab60e01b84523060048501526060602485015260a051606485015260a0517f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8111610c0857610bbc849360848794859460051b809183870137840160808582030160448601520190612567565b038183335af190811561098f5750610bf9575b60206040517fbc197c81000000000000000000000000000000000000000000000000000000008152f35b610c0290611f22565b38610bcf565b8380fd5b835b606083048110610c1e5750610b3e565b610c2a8160805161249a565b51610c41575b600019811461045d57600101610c0e565b610c4e8160a0518861259b565b35610c5b8260805161249a565b5190333b15610cd857604051637921219560e11b81523060048201526001600160a01b03851660248201526044810191909152606481019190915260a06084820152600060a4820152858160c48183335af18015610ccd57610cbe575b50610c30565b610cc790611f22565b38610cb8565b6040513d88823e3d90fd5b8680fd5b6060810281810460601482151715610e865780602001602011610e8657600182018211610e865760018201606060018401020460601460018301151715610e865760606001830102602001602011610e8657610d7c8f91610d518f916103a59060606001880102602001906020018d8961245f565b90809d92949163ffffffff610d698960a0518a61259b565b359116916001600160a01b0387166128ac565b9391929091908415610e5a5750610d9487839261249a565b52610da0868b8d61259b565b358103610e2d575b5081610db389612477565b5260019b8888836001600160a01b03871693610dce946125e8565b54928460a051610ddd9261259b565b604080519283523360208401529035908201526001600160a01b0391909116907f3ea53625fcb61f620716fae8ad32375fc4f80feb23831a3c53731a8bb76d69a890606090a36001905b01610b1f565b610e44919d50610e3e868b8d61259b565b3561243a565b610e508560805161249a565b5260019b38610da8565b9d505050505050509750610e6f88858761259b565b35610e7c8960805161249a565b5260018098610e27565b60248e634e487b7160e01b81526011600452fd5b8780fd5b602487634e487b7160e01b81526011600452fd5b8480fd5b503461020757610ec536611dfd565b604092919251630935e01b60e21b81523360048201526020816024816001600160a01b0387165afa80156102d457610f049186916113f6575b50611fa8565b6001600160a01b038216845283602052604084208385526020526001600160a01b036002604086200154166113b25760208101610f50610f4b610f4683611ff3565b612219565b612007565b606082019065ffffffffffff610f6583612052565b16158015611386575b610f7790612065565b610fa460c084019163ffffffff610f8d846120b0565b16158015611356575b610f9f906120ec565b611ff3565b92610fba610fb460408301612052565b93612052565b91610fc7608083016120b0565b90610fdd610fd760a085016120b0565b916120b0565b91600460e0850135101561135257610ff9610100850185612137565b959096604051986110098a611eef565b6000198a52863560208b01526001600160a01b031660408a015265ffffffffffff16606089015265ffffffffffff16608088015263ffffffff1660a087015263ffffffff1660c08601528760e086015263ffffffff1661010085015260e001356101208401906110789161216a565b3690611083926121a8565b6101408201526001600160a01b0382168452836020526040842083855260205260408420815181556020820151600182015560408201516001600160a01b0316606083015160a01b65ffffffffffff60a01b1690608084015160d01b7fffffffffffff00000000000000000000000000000000000000000000000000001691171760028201556003810160a083015163ffffffff1681549060c085015160201b67ffffffff00000000169167ffffffffffffffff19161717815560e083015163ffffffff166111779082906bffffffff000000000000000082549160401b16906bffffffff00000000000000001916179055565b6101008301518154610120850151600481101561133e57916004939170ffffffffff000000000000000000000000196fffffffff00000000000000000000000070ff00000000000000000000000000000000610140989660801b169360601b169116171790550191015180519067ffffffffffffffff821161132a5781906111ff84546121df565b601f81116112da575b50602090601f831160011461127657879261126b575b50508160011b916000199060031b1c19161790555b7ff4d614881eb59d4bcd5ea596b177a55b560306371604a9490ca2a5c2f24df14d60206001600160a01b03604051933385521692a380f35b01519050388061121e565b848852602088209250601f198416885b8181106112c257509084600195949392106112a9575b505050811b019055611233565b015160001960f88460031b161c1916905538808061129c565b92936020600181928786015181550195019301611286565b90915083875260208720601f840160051c81019160208510611320575b90601f859493920160051c01905b8181106113125750611208565b888155849350600101611305565b90915081906112f7565b602486634e487b7160e01b81526041600452fd5b602489634e487b7160e01b81526021600452fd5b8980fd5b50610f9f63ffffffff61137d61136b866120b0565b61137760a08a016120b0565b906120c1565b16159050610f96565b50610f7761139660408501612052565b65ffffffffffff806113a786612052565b169116109050610f6e565b606460405162461bcd60e51b815260206004820152601f60248201527f4275726e2072656465656d20616c726561647920696e697469616c697a6564006044820152fd5b611418915060203d60201161141e575b6114108183611f6e565b810190611f90565b38610efe565b503d611406565b50346102075760403660031901126102075761143f611db8565b6001600160a01b0360243591606061014060405161145c81611eef565b86815286602082015286604082015286838201528660808201528660a08201528660c08201528660e0820152866101008201528661012082015201521680835282602052604083208284526020526114c56001600160a01b036002604086200154161515612371565b8252816020526040822090825260205260408120604051906114e682611eef565b805482526001810154602083015260028101546001600160a01b038116604084015265ffffffffffff8160a01c16606084015260d01c608083015261157360ff600383015463ffffffff811660a086015263ffffffff8160201c1660c086015263ffffffff8160401c1660e086015263ffffffff8160601c1661010086015260801c16610120840161216a565b604051908160048592019182549261158a846121df565b80845293600181169081156116bb575060011461167a575b506115af92500382611f6e565b610140820152604051916020835281516020840152602082015160408401526001600160a01b03604083015116606084015265ffffffffffff606083015116608084015265ffffffffffff60808301511660a084015263ffffffff60a08301511660c084015263ffffffff60c08301511660e084015263ffffffff60e08301511661010084015263ffffffff610100830151166101208401526101208201519060048210156106c75750610140839261065e9282850152015161016080840152610180830190611e6b565b86525060208520909185915b81831061169f5750509060206115af92820101386115a2565b6020919350806001915483858801015201910190918392611686565b9050602092506115af94915060ff191682840152151560051b820101386115a2565b5034610207576116ec36611dfd565b9291604051630935e01b60e21b81523360048201526020816024816001600160a01b0386165afa908115611cc4579061172b9185916113f65750611fa8565b6001600160a01b03811683528260205260408320828452602052604083206040519061175682611eef565b805482526001810154602083015260028101546001600160a01b038116604084015265ffffffffffff8160a01c16606084015260d01c60808301526117e360ff600383015463ffffffff811660a086015263ffffffff8160201c1660c086015263ffffffff8160401c1660e086015263ffffffff8160601c1661010086015260801c16610120840161216a565b6040519081866004830154926117f8846121df565b8084529360018116908115611ca25750600114611c5e575b5061181d92500382611f6e565b610140820152611835610f4b610f4660208801611ff3565b61184d6001600160a01b036040830151161515612371565b63ffffffff61185e60c087016120b0565b16158015611c3d575b611870906120ec565b65ffffffffffff61188360608701612052565b16158015611c0e575b61189590612065565b8051906118a460208701611ff3565b956118b160408201612052565b916118be60608301612052565b906118cb608084016120b0565b9063ffffffff60e06118df60a087016120b0565b92015116916118f060c086016120b0565b93600460e08701351015611c0a5761190c610100870187612137565b9790986040519d8e9161191e83611eef565b8252883560208301526001600160a01b0316906040015265ffffffffffff1660608d015265ffffffffffff1660808c015263ffffffff1660a08b015263ffffffff1660c08a015260e089015263ffffffff1661010088015260e001356101208701906119899161216a565b3690611994926121a8565b6101408501526001600160a01b03168252816020526040822090825260205260408120825181556020830151600182015560408301516001600160a01b0316606084015160a01b65ffffffffffff60a01b1690608085015160d01b7fffffffffffff00000000000000000000000000000000000000000000000000001691171760028201556003810160a084015163ffffffff1681549060c086015160201b67ffffffff00000000169167ffffffffffffffff19161717815560e084015163ffffffff16611a879082906bffffffff000000000000000082549160401b16906bffffffff00000000000000001916179055565b61010084015181546101208601516004811015611bf657916004939170ffffffffff000000000000000000000000196fffffffff00000000000000000000000070ff00000000000000000000000000000000610140989660801b169360601b169116171790550192015191825167ffffffffffffffff81116106ef57611b0d82546121df565b601f8111611bb1575b506020601f8211600114611b5157839482939492611b46575b50508160011b916000199060031b1c191617905580f35b015190503880611b2f565b8284526020842090601f198316855b818110611b9957509583600195969710611b80575b505050811b01905580f35b015160001960f88460031b161c19169055388080611b75565b9192602060018192868b015181550194019201611b60565b82845260208420601f830160051c81019160208410611bec575b601f0160051c01905b818110611be15750611b16565b848155600101611bd4565b9091508190611bcb565b602486634e487b7160e01b81526021600452fd5b8a80fd5b50611895611c1e60408701612052565b65ffffffffffff80611c3260608a01612052565b16911610905061188c565b5061187063ffffffff611c5561136b60c089016120b0565b16159050611867565b60040188525060208720909187915b818310611c8657505090602061181d9282010138611810565b6020919350806001915483858801015201910190918392611c6d565b90506020925061181d94915060ff191682840152151560051b82010138611810565b6040513d86823e3d90fd5b905034610215576020366003190112610215576004357fffffffff00000000000000000000000000000000000000000000000000000000811680910361047157602092507f69c72cf9000000000000000000000000000000000000000000000000000000008114908115611d8e575b8115611d64575b8115611d53575b5015158152f35b6301ffc9a760e01b91501438611d4c565b7fe9dc63750000000000000000000000000000000000000000000000000000000081149150611d45565b7f4e2312e00000000000000000000000000000000000000000000000000000000081149150611d3e565b600435906001600160a01b0382168203611dce57565b600080fd5b602435906001600160a01b0382168203611dce57565b35906001600160a01b0382168203611dce57565b60031991606082840112611dce576004356001600160a01b0381168103611dce5792602435926044359167ffffffffffffffff8311611dce578261012092030112611dce5760040190565b60005b838110611e5b5750506000910152565b8181015183820152602001611e4b565b90602091611e8481518092818552858086019101611e48565b601f01601f1916010190565b9181601f84011215611dce5782359167ffffffffffffffff8311611dce576020808501948460051b010111611dce57565b9181601f84011215611dce5782359167ffffffffffffffff8311611dce5760208381860195010111611dce57565b610160810190811067ffffffffffffffff821117611f0c57604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111611f0c57604052565b6040810190811067ffffffffffffffff821117611f0c57604052565b6060810190811067ffffffffffffffff821117611f0c57604052565b90601f8019910116810190811067ffffffffffffffff821117611f0c57604052565b90816020910312611dce57518015158103611dce5790565b15611faf57565b606460405162461bcd60e51b815260206004820152601660248201527f57616c6c6574206973206e6f7420616e2061646d696e000000000000000000006044820152fd5b356001600160a01b0381168103611dce5790565b1561200e57565b606460405162461bcd60e51b815260206004820152602060248201527f6275726e546f6b656e206d757374206265204552433131353543726561746f726044820152fd5b3565ffffffffffff81168103611dce5790565b1561206c57565b606460405162461bcd60e51b815260206004820152601760248201527f73746172744461746520616674657220656e64446174650000000000000000006044820152fd5b3563ffffffff81168103611dce5790565b9063ffffffff8091169182156120d657160690565b634e487b7160e01b600052601260045260246000fd5b156120f357565b606460405162461bcd60e51b815260206004820152601f60248201527f52656d61696e646572206c6566742066726f6d20746f74616c537570706c79006044820152fd5b903590601e1981360301821215611dce570180359067ffffffffffffffff8211611dce57602001918136038313611dce57565b60048210156121765752565b634e487b7160e01b600052602160045260246000fd5b67ffffffffffffffff8111611f0c57601f01601f191660200190565b9291926121b48261218c565b916121c26040519384611f6e565b829481845281830111611dce578281602093846000960137010152565b90600182811c9216801561220f575b60208310146121f957565b634e487b7160e01b600052602260045260246000fd5b91607f16916121ee565b61222281612251565b908161223f575b81612232575090565b61223c9150612328565b90565b905061224a816122df565b1590612229565b6000809160405160208101906301ffc9a760e01b80835260248201526024815261227a81611f52565b5191617530fa3d156122d8573d6122908161218c565b9061229e6040519283611f6e565b81523d6000602083013e5b8051602081106122d057826122bd57505090565b61223c9250602080918301019101611f90565b505050600090565b60606122a9565b6000809160405160208101906301ffc9a760e01b82527fffffffff0000000000000000000000000000000000000000000000000000000060248201526024815261227a81611f52565b6000809160405160208101906301ffc9a760e01b82527f7d2484400000000000000000000000000000000000000000000000000000000060248201526024815261227a81611f52565b1561237857565b606460405162461bcd60e51b815260206004820152601b60248201527f4275726e2072656465656d206e6f7420696e697469616c697a656400000000006044820152fd5b81156120d6570490565b818102929181159184041417156123d957565b634e487b7160e01b600052601160045260246000fd5b156123f657565b606460405162461bcd60e51b815260206004820152600c60248201527f496e76616c6964206461746100000000000000000000000000000000000000006044820152fd5b919082039182116123d957565b67ffffffffffffffff8111611f0c5760051b60200190565b90939293848311611dce578411611dce578101920390565b8051156124845760200190565b634e487b7160e01b600052603260045260246000fd5b80518210156124845760209160051b010190565b906124b882612447565b6124c56040519182611f6e565b82815280926124d6601f1991612447565b0190602036910137565b919082018092116123d957565b90816060910312611dce5761250181611de9565b916040602083013592013563ffffffff81168103611dce5790565b1561252357565b606460405162461bcd60e51b815260206004820152600e60248201527f4e6f6e6520617661696c61626c650000000000000000000000000000000000006044820152fd5b90815180825260208080930193019160005b828110612587575050505090565b835185529381019392810192600101612579565b91908110156124845760051b0190565b90815180825260208080930193019160005b8281106125cb575050505090565b83516001600160a01b0316855293810193928101926001016125bd565b94919392845460001981146000146127dc575060409081519461260a86611f36565b600180875260005b60208082101561262d57906060602092828b01015201612612565b50509295916001600160a01b03612681969998929598169261269488519788937f8c6e84720000000000000000000000000000000000000000000000000000000085526060600486015260648501906125ab565b6003199788858303016024860152612567565b958287030160448301528051958681526020968782019188808360051b8301019401926000915b898b8585106127ad57505050505050509080600092038183865af19485156127a25760009561270f575b506126ef85612477565b51905560005281526127048360002092612477565b516000525260002055565b9490943d8083833e6127218183611f6e565b81019085818303126104715780519067ffffffffffffffff8211610c08570181601f820112156104715780519061275782612447565b936127648a519586611f6e565b828552878086019360051b830101938411610207575086809101915b838310612792575050505093386126e5565b8251815291810191879101612780565b86513d6000823e3d90fd5b91939597509193956127ca8291601f198682030187528951611e6b565b97019301930190928a959492936126bb565b9295909394506001600160a01b039150604051926127f984611f36565b600184526020368186013761280d84612477565b5216803b15611dce576128626000809461288461287595604051988997889687957fe6c884dc0000000000000000000000000000000000000000000000000000000087526060600488015260648701906125ab565b6003199384878303016024880152612567565b91848303016044850152612567565b03925af180156128a0576128955750565b61289e90611f22565b565b6040513d6000823e3d90fd5b939091600093600093846001600160a01b03809816815260209381855260409283832090835285528282209860028a01549065ffffffffffff8260a01c168015908115612b28575b5015612ae5578160d01c8015908115612ada575b5015612a97571633149081612a89575b5015612a46576003880191825463ffffffff92838260601c169586159788159889612a39575b61294e575b505050505050505050565b85979a508395929496989b509290921c169161296a82846123c6565b9861297887861693846123c6565b9a80612a23575b6129cf575b505085546bffffffff000000000000000019169290931c84168785160190931660401b6bffffffff00000000000000001617909255506129c19050565b388080808080808080612943565b9399509197509188841c8516900390848211612a0f575092612a038193926129fe836129c1989716998a6123bc565b6123c6565b97919293943880612984565b80634e487b7160e01b602492526011600452fd5b5080612a338b89888a1c166124e0565b1161297f565b50878685871c161061293e565b60648483519062461bcd60e51b82526004820152601260248201527f546f6b656e206e6f7420656c696769626c6500000000000000000000000000006044820152fd5b905060018901541438612918565b60648786519062461bcd60e51b82526004820152601a60248201527f5472616e73616374696f6e20616674657220656e6420646174650000000000006044820152fd5b905042111538612908565b60648786519062461bcd60e51b82526004820152601d60248201527f5472616e73616374696f6e206265666f726520737461727420646174650000006044820152fd5b90504211386128f456fea26469706673582212205ed3646809ea2f6c7fc2bfead81bcca6fabc077ac5c1a82699e4e69a96baa04a64736f6c63430008110033

Deployed Bytecode

0x60c080604052600436101561001357600080fd5b600090813560e01c90816301ffc9a714611ccf57508063aca40825146116dd578063b058d2f814611425578063b9e8ed2814610eb6578063bc197c81146109fe578063ccd31b0c146107ac578063e9dc6375146104755763f23a6e611461007957600080fd5b346102075760a036600319011261020757610092611db8565b5061009b611dd3565b60843567ffffffffffffffff8111610471576100bb903690600401611ec1565b6100ca602060608306146123ef565b601f19810181811161045d57604051916100e383611f36565b600183526020368185013780602011610459576001600160a01b0361010785611de9565b1661011184612477565b526040519061011f82611f36565b60018252602036818401378694875b606085048110610323578888886064358082116102df578115156101518161251c565b610219575b808210610188575b60206040517ff23a6e61000000000000000000000000000000000000000000000000000000008152f35b83916101939161243a565b333b1561021557604051637921219560e11b81523060048201526001600160a01b039390931660248401526044803590840152606483015260a06084830152600060a48301528160c48183335af1801561020a576101f3575b808061015e565b6101fd8291611f22565b61020757806101ec565b80fd5b6040513d84823e3d90fd5b5080fd5b60405161022581611f36565b600181526020368183013760443561023c82612477565b52846040519161024b83611f36565b60018352602036818501378461026084612477565b52333b1561021557610298906102aa6040519485938493633db0f8ab60e01b8552306004860152606060248601526064850190612567565b83810360031901604485015290612567565b038183335af180156102d4576102c1575b50610156565b6102cd90949194611f22565b92846102bb565b6040513d87823e3d90fd5b606460405162461bcd60e51b815260206004820152601260248201527f496e76616c69642076616c75652073656e7400000000000000000000000000006044820152fd5b8060608102046060148115171561044557606081026020016020116104455760018101811161044557600181016060600183010204606014600182011517156104455760606001820102602001602011610445576001600160a01b0363ffffffff6103be6103ad6103a56060600187010260200160608702602001898961245f565b8101906124ed565b9094909116921660443584846128ac565b929190836103d9575b5050505050600160609101905061012e565b6103e6919293949b6124e0565b99878a83866103f484612477565b526103ff93866125e8565b546040805193845233602085015260443590840152917f3ea53625fcb61f620716fae8ad32375fc4f80feb23831a3c53731a8bb76d69a890606090a338808080806103c7565b602489634e487b7160e01b81526011600452fd5b8580fd5b602485634e487b7160e01b81526011600452fd5b8280fd5b5034610207576040366003190112610207576001600160a01b0380610498611db8565b1690818352600192602092848452604082206024358352845260408220549081156107685782528184526040822090825283526040812091604051906104dd82611eef565b8354825285840154858301526002840154908116604083015265ffffffffffff8160a01c16606083015260d01c6080820152600460038401549363ffffffff80861660a08501528086881c1660c0850152808660401c1660e08501528560601c1661010084015261055960ff61012085019660801c168661216a565b01604051958691849181549161056e836121df565b92838652898382169182600014610741575050600114610703575b505050610140929161059c910387611f6e565b0193845260405183810181811067ffffffffffffffff8211176106ef5760405281815291805160048110156106db576002036106625750505061064a816040516105e581611f36565b601481527f68747470733a2f2f617277656176652e6e65742f00000000000000000000000082820152935b5193604051948161062a8793518092868087019101611e48565b820161063e82518093868085019101611e48565b01038085520183611f6e565b61065e604051928284938452830190611e6b565b0390f35b939193519060048210156106c75750600314610683575b8161064a91610610565b915061064a8160405161069581611f36565b600781527f697066733a2f2f000000000000000000000000000000000000000000000000008282015293915050610679565b80634e487b7160e01b602492526021600452fd5b602483634e487b7160e01b81526021600452fd5b602483634e487b7160e01b81526041600452fd5b8652878620889350869291905b828410610729575050508201018161059c610140610589565b8054848c018601528a95508994909301928101610710565b60ff19168782015293151560051b8601909301935084925061059c91506101409050610589565b6064856040519062461bcd60e51b82526004820152601460248201527f546f6b656e20646f6573206e6f742065786973740000000000000000000000006044820152fd5b5034610207576060366003190112610207576107c6611db8565b906001600160a01b036107d7611dd3565b1681528060205260408120604435825260205260408120916004604051936107fe85611eef565b805485526001810154602086015260028101546001600160a01b038116604087015265ffffffffffff8160a01c16606087015260d01c608086015261088b60ff600383015463ffffffff811660a089015263ffffffff8160201c1660c089015263ffffffff8160401c1660e089015263ffffffff8160601c1661010089015260801c16610120870161216a565b0160405190818482549261089e846121df565b80845293600181169081156109dc575060011461099b575b506108c392500382611f6e565b61014084015260206001600160a01b0360448160408701511693838701519460405195869485937efdd58e00000000000000000000000000000000000000000000000000000000855216600484015260248301525afa91821561098f578092610956575b602061094e8563ffffffff60c0610944888360a0860151166123bc565b92015116906123c6565b604051908152f35b9091506020823d602011610987575b8161097260209383611f6e565b810103126102075750518163ffffffff610927565b3d9150610965565b604051903d90823e3d90fd5b86525060208520909185915b8183106109c05750509060206108c392820101386108b6565b60209193508060019154838588010152019101909183926109a7565b9050602092506108c394915060ff191682840152151560051b820101386108b6565b50346102075760a036600319011261020757610a18611db8565b50610a21611dd3565b67ffffffffffffffff919060443583811161047157610a44903690600401611e90565b60a05292606435818111610c0857610a60903690600401611e90565b929091608435908111610eb257610a7b903690600401611ec1565b9290610a8c602060608606146123ef565b601f19840193808511610e9e57610aa960a05160608704146123ef565b60405192610ab684611f36565b600184526020368186013781602011610e9a576001600160a01b03610ada84611de9565b16610ae485612477565b5260405196610af288611f36565b60018852602036818a0137610b09606088046124ae565b97610b16606089046124ae565b60805289958a958b5b60608b048110610cdc5750505050505050610b399061251c565b610c0c575b5050333b156102155760405192633db0f8ab60e01b84523060048501526060602485015260a051606485015260a0517f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8111610c0857610bbc849360848794859460051b809183870137840160808582030160448601520190612567565b038183335af190811561098f5750610bf9575b60206040517fbc197c81000000000000000000000000000000000000000000000000000000008152f35b610c0290611f22565b38610bcf565b8380fd5b835b606083048110610c1e5750610b3e565b610c2a8160805161249a565b51610c41575b600019811461045d57600101610c0e565b610c4e8160a0518861259b565b35610c5b8260805161249a565b5190333b15610cd857604051637921219560e11b81523060048201526001600160a01b03851660248201526044810191909152606481019190915260a06084820152600060a4820152858160c48183335af18015610ccd57610cbe575b50610c30565b610cc790611f22565b38610cb8565b6040513d88823e3d90fd5b8680fd5b6060810281810460601482151715610e865780602001602011610e8657600182018211610e865760018201606060018401020460601460018301151715610e865760606001830102602001602011610e8657610d7c8f91610d518f916103a59060606001880102602001906020018d8961245f565b90809d92949163ffffffff610d698960a0518a61259b565b359116916001600160a01b0387166128ac565b9391929091908415610e5a5750610d9487839261249a565b52610da0868b8d61259b565b358103610e2d575b5081610db389612477565b5260019b8888836001600160a01b03871693610dce946125e8565b54928460a051610ddd9261259b565b604080519283523360208401529035908201526001600160a01b0391909116907f3ea53625fcb61f620716fae8ad32375fc4f80feb23831a3c53731a8bb76d69a890606090a36001905b01610b1f565b610e44919d50610e3e868b8d61259b565b3561243a565b610e508560805161249a565b5260019b38610da8565b9d505050505050509750610e6f88858761259b565b35610e7c8960805161249a565b5260018098610e27565b60248e634e487b7160e01b81526011600452fd5b8780fd5b602487634e487b7160e01b81526011600452fd5b8480fd5b503461020757610ec536611dfd565b604092919251630935e01b60e21b81523360048201526020816024816001600160a01b0387165afa80156102d457610f049186916113f6575b50611fa8565b6001600160a01b038216845283602052604084208385526020526001600160a01b036002604086200154166113b25760208101610f50610f4b610f4683611ff3565b612219565b612007565b606082019065ffffffffffff610f6583612052565b16158015611386575b610f7790612065565b610fa460c084019163ffffffff610f8d846120b0565b16158015611356575b610f9f906120ec565b611ff3565b92610fba610fb460408301612052565b93612052565b91610fc7608083016120b0565b90610fdd610fd760a085016120b0565b916120b0565b91600460e0850135101561135257610ff9610100850185612137565b959096604051986110098a611eef565b6000198a52863560208b01526001600160a01b031660408a015265ffffffffffff16606089015265ffffffffffff16608088015263ffffffff1660a087015263ffffffff1660c08601528760e086015263ffffffff1661010085015260e001356101208401906110789161216a565b3690611083926121a8565b6101408201526001600160a01b0382168452836020526040842083855260205260408420815181556020820151600182015560408201516001600160a01b0316606083015160a01b65ffffffffffff60a01b1690608084015160d01b7fffffffffffff00000000000000000000000000000000000000000000000000001691171760028201556003810160a083015163ffffffff1681549060c085015160201b67ffffffff00000000169167ffffffffffffffff19161717815560e083015163ffffffff166111779082906bffffffff000000000000000082549160401b16906bffffffff00000000000000001916179055565b6101008301518154610120850151600481101561133e57916004939170ffffffffff000000000000000000000000196fffffffff00000000000000000000000070ff00000000000000000000000000000000610140989660801b169360601b169116171790550191015180519067ffffffffffffffff821161132a5781906111ff84546121df565b601f81116112da575b50602090601f831160011461127657879261126b575b50508160011b916000199060031b1c19161790555b7ff4d614881eb59d4bcd5ea596b177a55b560306371604a9490ca2a5c2f24df14d60206001600160a01b03604051933385521692a380f35b01519050388061121e565b848852602088209250601f198416885b8181106112c257509084600195949392106112a9575b505050811b019055611233565b015160001960f88460031b161c1916905538808061129c565b92936020600181928786015181550195019301611286565b90915083875260208720601f840160051c81019160208510611320575b90601f859493920160051c01905b8181106113125750611208565b888155849350600101611305565b90915081906112f7565b602486634e487b7160e01b81526041600452fd5b602489634e487b7160e01b81526021600452fd5b8980fd5b50610f9f63ffffffff61137d61136b866120b0565b61137760a08a016120b0565b906120c1565b16159050610f96565b50610f7761139660408501612052565b65ffffffffffff806113a786612052565b169116109050610f6e565b606460405162461bcd60e51b815260206004820152601f60248201527f4275726e2072656465656d20616c726561647920696e697469616c697a6564006044820152fd5b611418915060203d60201161141e575b6114108183611f6e565b810190611f90565b38610efe565b503d611406565b50346102075760403660031901126102075761143f611db8565b6001600160a01b0360243591606061014060405161145c81611eef565b86815286602082015286604082015286838201528660808201528660a08201528660c08201528660e0820152866101008201528661012082015201521680835282602052604083208284526020526114c56001600160a01b036002604086200154161515612371565b8252816020526040822090825260205260408120604051906114e682611eef565b805482526001810154602083015260028101546001600160a01b038116604084015265ffffffffffff8160a01c16606084015260d01c608083015261157360ff600383015463ffffffff811660a086015263ffffffff8160201c1660c086015263ffffffff8160401c1660e086015263ffffffff8160601c1661010086015260801c16610120840161216a565b604051908160048592019182549261158a846121df565b80845293600181169081156116bb575060011461167a575b506115af92500382611f6e565b610140820152604051916020835281516020840152602082015160408401526001600160a01b03604083015116606084015265ffffffffffff606083015116608084015265ffffffffffff60808301511660a084015263ffffffff60a08301511660c084015263ffffffff60c08301511660e084015263ffffffff60e08301511661010084015263ffffffff610100830151166101208401526101208201519060048210156106c75750610140839261065e9282850152015161016080840152610180830190611e6b565b86525060208520909185915b81831061169f5750509060206115af92820101386115a2565b6020919350806001915483858801015201910190918392611686565b9050602092506115af94915060ff191682840152151560051b820101386115a2565b5034610207576116ec36611dfd565b9291604051630935e01b60e21b81523360048201526020816024816001600160a01b0386165afa908115611cc4579061172b9185916113f65750611fa8565b6001600160a01b03811683528260205260408320828452602052604083206040519061175682611eef565b805482526001810154602083015260028101546001600160a01b038116604084015265ffffffffffff8160a01c16606084015260d01c60808301526117e360ff600383015463ffffffff811660a086015263ffffffff8160201c1660c086015263ffffffff8160401c1660e086015263ffffffff8160601c1661010086015260801c16610120840161216a565b6040519081866004830154926117f8846121df565b8084529360018116908115611ca25750600114611c5e575b5061181d92500382611f6e565b610140820152611835610f4b610f4660208801611ff3565b61184d6001600160a01b036040830151161515612371565b63ffffffff61185e60c087016120b0565b16158015611c3d575b611870906120ec565b65ffffffffffff61188360608701612052565b16158015611c0e575b61189590612065565b8051906118a460208701611ff3565b956118b160408201612052565b916118be60608301612052565b906118cb608084016120b0565b9063ffffffff60e06118df60a087016120b0565b92015116916118f060c086016120b0565b93600460e08701351015611c0a5761190c610100870187612137565b9790986040519d8e9161191e83611eef565b8252883560208301526001600160a01b0316906040015265ffffffffffff1660608d015265ffffffffffff1660808c015263ffffffff1660a08b015263ffffffff1660c08a015260e089015263ffffffff1661010088015260e001356101208701906119899161216a565b3690611994926121a8565b6101408501526001600160a01b03168252816020526040822090825260205260408120825181556020830151600182015560408301516001600160a01b0316606084015160a01b65ffffffffffff60a01b1690608085015160d01b7fffffffffffff00000000000000000000000000000000000000000000000000001691171760028201556003810160a084015163ffffffff1681549060c086015160201b67ffffffff00000000169167ffffffffffffffff19161717815560e084015163ffffffff16611a879082906bffffffff000000000000000082549160401b16906bffffffff00000000000000001916179055565b61010084015181546101208601516004811015611bf657916004939170ffffffffff000000000000000000000000196fffffffff00000000000000000000000070ff00000000000000000000000000000000610140989660801b169360601b169116171790550192015191825167ffffffffffffffff81116106ef57611b0d82546121df565b601f8111611bb1575b506020601f8211600114611b5157839482939492611b46575b50508160011b916000199060031b1c191617905580f35b015190503880611b2f565b8284526020842090601f198316855b818110611b9957509583600195969710611b80575b505050811b01905580f35b015160001960f88460031b161c19169055388080611b75565b9192602060018192868b015181550194019201611b60565b82845260208420601f830160051c81019160208410611bec575b601f0160051c01905b818110611be15750611b16565b848155600101611bd4565b9091508190611bcb565b602486634e487b7160e01b81526021600452fd5b8a80fd5b50611895611c1e60408701612052565b65ffffffffffff80611c3260608a01612052565b16911610905061188c565b5061187063ffffffff611c5561136b60c089016120b0565b16159050611867565b60040188525060208720909187915b818310611c8657505090602061181d9282010138611810565b6020919350806001915483858801015201910190918392611c6d565b90506020925061181d94915060ff191682840152151560051b82010138611810565b6040513d86823e3d90fd5b905034610215576020366003190112610215576004357fffffffff00000000000000000000000000000000000000000000000000000000811680910361047157602092507f69c72cf9000000000000000000000000000000000000000000000000000000008114908115611d8e575b8115611d64575b8115611d53575b5015158152f35b6301ffc9a760e01b91501438611d4c565b7fe9dc63750000000000000000000000000000000000000000000000000000000081149150611d45565b7f4e2312e00000000000000000000000000000000000000000000000000000000081149150611d3e565b600435906001600160a01b0382168203611dce57565b600080fd5b602435906001600160a01b0382168203611dce57565b35906001600160a01b0382168203611dce57565b60031991606082840112611dce576004356001600160a01b0381168103611dce5792602435926044359167ffffffffffffffff8311611dce578261012092030112611dce5760040190565b60005b838110611e5b5750506000910152565b8181015183820152602001611e4b565b90602091611e8481518092818552858086019101611e48565b601f01601f1916010190565b9181601f84011215611dce5782359167ffffffffffffffff8311611dce576020808501948460051b010111611dce57565b9181601f84011215611dce5782359167ffffffffffffffff8311611dce5760208381860195010111611dce57565b610160810190811067ffffffffffffffff821117611f0c57604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff8111611f0c57604052565b6040810190811067ffffffffffffffff821117611f0c57604052565b6060810190811067ffffffffffffffff821117611f0c57604052565b90601f8019910116810190811067ffffffffffffffff821117611f0c57604052565b90816020910312611dce57518015158103611dce5790565b15611faf57565b606460405162461bcd60e51b815260206004820152601660248201527f57616c6c6574206973206e6f7420616e2061646d696e000000000000000000006044820152fd5b356001600160a01b0381168103611dce5790565b1561200e57565b606460405162461bcd60e51b815260206004820152602060248201527f6275726e546f6b656e206d757374206265204552433131353543726561746f726044820152fd5b3565ffffffffffff81168103611dce5790565b1561206c57565b606460405162461bcd60e51b815260206004820152601760248201527f73746172744461746520616674657220656e64446174650000000000000000006044820152fd5b3563ffffffff81168103611dce5790565b9063ffffffff8091169182156120d657160690565b634e487b7160e01b600052601260045260246000fd5b156120f357565b606460405162461bcd60e51b815260206004820152601f60248201527f52656d61696e646572206c6566742066726f6d20746f74616c537570706c79006044820152fd5b903590601e1981360301821215611dce570180359067ffffffffffffffff8211611dce57602001918136038313611dce57565b60048210156121765752565b634e487b7160e01b600052602160045260246000fd5b67ffffffffffffffff8111611f0c57601f01601f191660200190565b9291926121b48261218c565b916121c26040519384611f6e565b829481845281830111611dce578281602093846000960137010152565b90600182811c9216801561220f575b60208310146121f957565b634e487b7160e01b600052602260045260246000fd5b91607f16916121ee565b61222281612251565b908161223f575b81612232575090565b61223c9150612328565b90565b905061224a816122df565b1590612229565b6000809160405160208101906301ffc9a760e01b80835260248201526024815261227a81611f52565b5191617530fa3d156122d8573d6122908161218c565b9061229e6040519283611f6e565b81523d6000602083013e5b8051602081106122d057826122bd57505090565b61223c9250602080918301019101611f90565b505050600090565b60606122a9565b6000809160405160208101906301ffc9a760e01b82527fffffffff0000000000000000000000000000000000000000000000000000000060248201526024815261227a81611f52565b6000809160405160208101906301ffc9a760e01b82527f7d2484400000000000000000000000000000000000000000000000000000000060248201526024815261227a81611f52565b1561237857565b606460405162461bcd60e51b815260206004820152601b60248201527f4275726e2072656465656d206e6f7420696e697469616c697a656400000000006044820152fd5b81156120d6570490565b818102929181159184041417156123d957565b634e487b7160e01b600052601160045260246000fd5b156123f657565b606460405162461bcd60e51b815260206004820152600c60248201527f496e76616c6964206461746100000000000000000000000000000000000000006044820152fd5b919082039182116123d957565b67ffffffffffffffff8111611f0c5760051b60200190565b90939293848311611dce578411611dce578101920390565b8051156124845760200190565b634e487b7160e01b600052603260045260246000fd5b80518210156124845760209160051b010190565b906124b882612447565b6124c56040519182611f6e565b82815280926124d6601f1991612447565b0190602036910137565b919082018092116123d957565b90816060910312611dce5761250181611de9565b916040602083013592013563ffffffff81168103611dce5790565b1561252357565b606460405162461bcd60e51b815260206004820152600e60248201527f4e6f6e6520617661696c61626c650000000000000000000000000000000000006044820152fd5b90815180825260208080930193019160005b828110612587575050505090565b835185529381019392810192600101612579565b91908110156124845760051b0190565b90815180825260208080930193019160005b8281106125cb575050505090565b83516001600160a01b0316855293810193928101926001016125bd565b94919392845460001981146000146127dc575060409081519461260a86611f36565b600180875260005b60208082101561262d57906060602092828b01015201612612565b50509295916001600160a01b03612681969998929598169261269488519788937f8c6e84720000000000000000000000000000000000000000000000000000000085526060600486015260648501906125ab565b6003199788858303016024860152612567565b958287030160448301528051958681526020968782019188808360051b8301019401926000915b898b8585106127ad57505050505050509080600092038183865af19485156127a25760009561270f575b506126ef85612477565b51905560005281526127048360002092612477565b516000525260002055565b9490943d8083833e6127218183611f6e565b81019085818303126104715780519067ffffffffffffffff8211610c08570181601f820112156104715780519061275782612447565b936127648a519586611f6e565b828552878086019360051b830101938411610207575086809101915b838310612792575050505093386126e5565b8251815291810191879101612780565b86513d6000823e3d90fd5b91939597509193956127ca8291601f198682030187528951611e6b565b97019301930190928a959492936126bb565b9295909394506001600160a01b039150604051926127f984611f36565b600184526020368186013761280d84612477565b5216803b15611dce576128626000809461288461287595604051988997889687957fe6c884dc0000000000000000000000000000000000000000000000000000000087526060600488015260648701906125ab565b6003199384878303016024880152612567565b91848303016044850152612567565b03925af180156128a0576128955750565b61289e90611f22565b565b6040513d6000823e3d90fd5b939091600093600093846001600160a01b03809816815260209381855260409283832090835285528282209860028a01549065ffffffffffff8260a01c168015908115612b28575b5015612ae5578160d01c8015908115612ada575b5015612a97571633149081612a89575b5015612a46576003880191825463ffffffff92838260601c169586159788159889612a39575b61294e575b505050505050505050565b85979a508395929496989b509290921c169161296a82846123c6565b9861297887861693846123c6565b9a80612a23575b6129cf575b505085546bffffffff000000000000000019169290931c84168785160190931660401b6bffffffff00000000000000001617909255506129c19050565b388080808080808080612943565b9399509197509188841c8516900390848211612a0f575092612a038193926129fe836129c1989716998a6123bc565b6123c6565b97919293943880612984565b80634e487b7160e01b602492526011600452fd5b5080612a338b89888a1c166124e0565b1161297f565b50878685871c161061293e565b60648483519062461bcd60e51b82526004820152601260248201527f546f6b656e206e6f7420656c696769626c6500000000000000000000000000006044820152fd5b905060018901541438612918565b60648786519062461bcd60e51b82526004820152601a60248201527f5472616e73616374696f6e20616674657220656e6420646174650000000000006044820152fd5b905042111538612908565b60648786519062461bcd60e51b82526004820152601d60248201527f5472616e73616374696f6e206265666f726520737461727420646174650000006044820152fd5b90504211386128f456fea26469706673582212205ed3646809ea2f6c7fc2bfead81bcca6fabc077ac5c1a82699e4e69a96baa04a64736f6c63430008110033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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