Contract 0x4d57B36c1555B48A63FeaB9F90d38a9b7EbC4419

 
 
Txn Hash
Method
Block
From
To
Value
0x544015a0974b2c32280f1ecff781104bd55ab7cb300842e752f1728df6d4db4cSet Approval For...160476602022-11-25 14:40:594 days 17 hrs ago0x21debc45a505ee0b93f201d298a1b11c13d14b43 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00058046 12.59392668
0xe2237e23e035857afb3f2c50de8b30bcfb3f03ea1097db9ec3a94509646bf3b7Set Approval For...159851922022-11-16 21:14:1113 days 10 hrs agoENS Name dolos777.eth IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00053086 21.87978714
0xe028252e398dd5f48fa44c8702cc36873d4193e9ce782004c91c7f7d34d41f88Set Approval For...159674532022-11-14 9:43:1115 days 22 hrs ago0x0b5dd26f44d36141d97a3bf6841e7ba63c092af9 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00067895 14.70386498
0xa2143b87b30212830ef065e442a373f0a5ec32c4feb7049b11820bd57004ed60Set Approval For...159674532022-11-14 9:43:1115 days 22 hrs ago0x0b5dd26f44d36141d97a3bf6841e7ba63c092af9 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00067771 14.70386498
0x209e54ac8c229048ebafa33f45f2591f0de434df5f12d2d3954930234679bcf0Set Approval For...159623852022-11-13 16:45:5916 days 15 hrs agoENS Name crazywhiteboy.eth IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00070221 15.23546224
0xfe15ea019b8381d9458c02f0bfb7d7f86aa8950b097405d04017c7bf7c2a97e0Safe Transfer Fr...159583482022-11-13 3:14:2317 days 4 hrs ago0x783f365bf2c7bbaad9543e60038a5faf5cf624ec IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00058685 11.30441146
0x901d19e8654c00d955c939d2eb34b852563d7d84a7e111c3e48eb7f13175ba19Set Approval For...159059772022-11-05 19:43:4724 days 12 hrs ago0x5728c284e020b732a26d2427d482c42e36223da2 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00058757 12.74824585
0xaa248ec2151ad690094eb8b4ecabfae50f0959ca948c1c648c9361fa90ebb7eaSet Approval For...159021552022-11-05 6:54:1125 days 1 hr ago0x82dc92b01c7ff54911842956083795f60f6f64f4 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00029702 12.241858
0x4a3e3dd3270eb61a77b132a4b7cd0a29bb80f8bdcb79ec1fe3920c6f31203997Set Approval For...158465812022-10-28 12:32:4732 days 19 hrs agoENS Name binaryassets.eth IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.0004105 16.92751908
0x16a740f63d65bc27612f0b8c11d87ab2b68b5b61e96545e171b6e13fc50bcec8Safe Transfer Fr...157716412022-10-18 1:15:1143 days 6 hrs ago0x84f8d977c04be4d445267889759d83715065f131 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00062104 17.77347686
0x878208fb53ee659dd44a6817586329625535dca1d436d5699ecff89e0d94d16cSafe Transfer Fr...157715372022-10-18 0:54:2343 days 7 hrs ago0x4d38d5fabdb07dfc0e37f7a7d54fafaaa2050c7c IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.0005253 15.03359762
0x725fad3eb3a6a0fd5e67dbd2ccc0e9eca94ba3a2528fac359f4fc97a7ccf548aSafe Transfer Fr...157715192022-10-18 0:50:4743 days 7 hrs ago0xc7d7280fbac3821fff0561286d2bd689630e3651 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00056047 16.04010401
0x722ac61900129db5dcf02311368d390546eaf19505e79e3041e0c0eb1e62b90cSafe Transfer Fr...157714222022-10-18 0:31:2343 days 7 hrs ago0x56133753b18a6ffb3b19dc45df6227d2bc45cefc IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00062718 17.94944189
0xbb5c62e650f1363543bc33ff5224e44470caebd0b6a8c20d39b0a2cd5b959522Safe Transfer Fr...157713912022-10-18 0:25:1143 days 7 hrs ago0x4d529b9577cdb657b6fa68db286548df4d841905 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00067004 19.17584115
0x69ae1c1552732379a7865b197d7c72c20f5a2cd3686c61d8fe2cccccdf02fb0bSet Approval For...157708742022-10-17 22:41:2343 days 9 hrs ago0xc6cc7f25ba045b8c08fb84aa1494b106fb6824a5 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00122404 26.55716442
0x17353b44182f691c49c5e602afc2f2aff8f613289ddfdc03bfa3cd264d0ab909Safe Transfer Fr...157706352022-10-17 21:53:3543 days 10 hrs ago0xab67e931e0206cc2727ef02d78aa1141331b78cf IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00092828 26.56648993
0x293ab1049d9b9cd39e2d7a77beaba8f3a7cd7b533156fa5a03612d27a7382e12Safe Transfer Fr...157706082022-10-17 21:48:1143 days 10 hrs ago0xcbdddf18cd790f68a2c8e637c41cd26eb8e50b84 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00131131 25.19729068
0x7fa1afd8969d58cbba89f5b3e8c6f17d55b287cc2bd454dd75906c5bf4b17c5dSet Approval For...157299602022-10-12 5:32:2349 days 2 hrs ago0x81216da3c0517994feb07ab57e377c76fb94dce8 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00082451 17.88886174
0x62c18c574043a4ccaf10e7a30da81128faa75b6cd3dc08e3eb659ee94f98692eSet Approval For...157292912022-10-12 3:17:3549 days 4 hrs agoENS Name niftymike.eth IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00080168 17.39353404
0x41b27a7b7fec01f75fc3afaa904f0b8dfb00956e7ee65b3740e2b06837513c9aSet Approval For...157073622022-10-09 1:49:4752 days 6 hrs agoENS Name patrikstar.eth IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00063389 26.1258891
0x41ba23333eefecef95e85964b05e054179ed59a6489048a9ef95e017569e4666Set Approval For...156982542022-10-07 19:20:3553 days 12 hrs ago0x40e3e9c905b7f7c3c877b7b6a4c92419691994db IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00058297 12.64838264
0xcfa87cf36be4ea442be68465c5d761c481c98d8a347f29ccc6883864e3a05277Set Approval For...156890062022-10-06 12:17:1154 days 19 hrs ago0xebd7c0346485d271d98f59454ba7d8a7bcb9300d IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.000586 12.71403222
0x12b389dd071b28b4fc050a2e69c5317ff3ab9e2e51d680955db818e58f2d8723Set Approval For...156862852022-10-06 3:09:4755 days 5 hrs agoENS Name maxfieldr.eth IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00038517 8.35680321
0xadf679c64119e934928c193c77e06a13534a08457081c0d30fd84cd7254e5f92Set Approval For...156579312022-10-02 4:00:3559 days 4 hrs ago0x2998c5591aa61c70107ff631cd950ac21e741de2 IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00010701 4.41049682
0x16e08bcd34fb6e51458a667ebdf20f13cfc4d3c962a25dd03040b3559789e837Safe Transfer Fr...156467092022-09-30 14:20:1160 days 17 hrs agoENS Name fortkn0x.eth IN  0x4d57b36c1555b48a63feab9f90d38a9b7ebc44190 Ether0.00058802 16.82850288
[ Download CSV Export 
View more zero value Internal Transactions in Advanced View mode
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MoonrayPresalePass

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 16 : MoonrayPresalePass.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import './MoonrayPresalePassBase.sol';

/**
 * @title Moonray Presale Pass Wrapper Contract
 *  _______                                        _______
 * (_______)                                      (_______)
 *  _  _  _  ___   ___  ____   ____ _____ _   _    _   ___ _____ ____  _____
 * | ||_|| |/ _ \ / _ \|  _ \ / ___|____ | | | |  | | (_  (____ |    \| ___ |
 * | |   | | |_| | |_| | | | | |   / ___ | |_| |  | |___) / ___ | | | | ____|
 * |_|   |_|\___/ \___/|_| |_|_|   \_____|\__  |   \_____/\_____|_|_|_|_____)
 *                                       (____/
 *  ______                       _           ______
 * (_____ \                     | |         (_____ \
 *  _____) )___ _____  ___ _____| | _____    _____) )____  ___  ___
 * |  ____/ ___) ___ |/___|____ | || ___ |  |  ____(____ |/___)/___)
 * | |   | |   | ____|___ / ___ | || ____|  | |    / ___ |___ |___ |
 * |_|   |_|   |_____|___/\_____|\_)_____)  |_|    \_____(___/(___/
 *
 * Credit to https://patorjk.com/ for text generator.
 */
contract MoonrayPresalePass is MoonrayPresalePassBase {
    constructor()
        MoonrayPresalePassBase(
            'https://gateway.pinata.cloud/ipfs/QmeGTYN27v9QW2HrHsdfdWesbFRiUnhFWrPDoCoAKqo66L/1.json',
            1,
            9000,
            0
        )
    {
        //'https://gateway.pinata.cloud/ipfs/QmeGTYN27v9QW2HrHsdfdWesbFRiUnhFWrPDoCoAKqo66L/{id}.json' is not well supported by OpenSea.
        // Implementation version: 1
    }
}

File 2 of 16 : MoonrayPresalePassBase.sol
// contracts/GameItems.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import '@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Counters.sol';
import './NFTCClaimlist.sol';
import './NFTCWhitelist.sol';

/**
 * @title Moonray Presale Passes
 * @author @NiftyMike, NFT Culture
 * @dev Mint presale passes for Moonray.game. The presale passes can be redeemed on
 * Stacks, decentralized apps and smart contracts for Bitcoin, by calling the redeem
 * function and passing your Stacks wallet address.
 */
contract MoonrayPresalePassBase is
    ERC1155Supply,
    Ownable,
    NFTCClaimlist,
    NFTCWhitelist
{
    event PassRedeemed(address indexed redeemer, string indexed stxWallet);

    uint256 public constant MAX_MINT_PER_TRANS = 99;
    uint256 public constant PRESALE_PASS_TOKEN = 1;

    uint256 public pricePerToken;
    uint256 public maxTokensForSale;
    uint256 public startingBlockNumber;

    bool public mintingActive;
    bool public burningActive;

    mapping(address => string) internal _stxWallets;

    uint256 internal _mintCounter;

    constructor(
        string memory __uri,
        uint256 __startingBlockNumber,
        uint256 __maxTokensForSale,
        uint256 __pricePerToken
    ) ERC1155(__uri) {
        startingBlockNumber = __startingBlockNumber;
        maxTokensForSale = __maxTokensForSale;
        pricePerToken = __pricePerToken;
    }

    function setMintingState(
        bool __mintingActive,
        uint256 __startingBlockNumber,
        uint256 __pricePerToken,
        bool __burningActive
    ) external onlyOwner {
        mintingActive = __mintingActive;

        if (__startingBlockNumber > 0) {
            startingBlockNumber = __startingBlockNumber;
        }

        if (__pricePerToken > 0) {
            pricePerToken = __pricePerToken;
        }

        burningActive = __burningActive;
    }

    function setNewURI(string memory newURI) external onlyOwner {
        _setURI(newURI);
    }

    function withdraw() external onlyOwner {
        payable(msg.sender).transfer(address(this).balance);
    }

    function mintPassFromClaim(bytes32[] memory claim) external payable {
        require(block.number > startingBlockNumber, 'Not started');
        require(mintingActive, 'Not active');

        bytes32[][] memory claims = new bytes32[][](1);
        claims[0] = claim;

        _mintPassFromClaim(_msgSender(), claims, 1);
    }

    function mintPassesFromWhitelist(uint256 count) external payable {
        require(block.number > startingBlockNumber, 'Not started');
        require(mintingActive, 'Not active');
        require(0 < count && count <= MAX_MINT_PER_TRANS, 'Invalid count');
        require(msg.value >= pricePerToken * count, 'Invalid price');
        require(count <= _getWhitelistAmount(_msgSender()), 'Too many');

        _mintTokens(_msgSender(), count);

        _decrementWhitelistAmount(_msgSender(), count);
    }

    function redeemPresalePass(string memory stxWallet) external {
        require(burningActive, 'Burning off');
        require(bytes(stxWallet).length == 41, 'Invalid wallet length'); // sufficient for UTF-8 encoded strings.
        require(bytes(stxWallet)[0] == 'S', 'Invalid wallet format');

        _burn(_msgSender(), PRESALE_PASS_TOKEN, 1);

        emit PassRedeemed(_msgSender(), stxWallet);
    }

    function _mintPassFromClaim(
        address minter,
        bytes32[][] memory claims,
        uint256 count
    ) internal {
        require(0 < count && count <= MAX_MINT_PER_TRANS, 'Invalid count');
        require(msg.value >= pricePerToken * count, 'Invalid price');
        require(claims.length == count, 'Mismatch claims');

        // Verify each claim passed in, make sure its valid.
        for (uint256 i = 0; i < claims.length; i++) {
            require(
                _validateClaim(
                    claims[i],
                    _generateLeaf(minter, _getNextIndex(minter) + i)
                ),
                'Claim invalid'
            );
        }

        _mintTokens(minter, count);

        _incrementClaimIndex(minter, count);
    }

    function _mintTokens(address minter, uint256 count) internal {
        require(minter != address(0), 'Bad address');
        require(_mintCounter + count <= maxTokensForSale, 'Limit exceeded');

        _mintCounter += count;
        _mint(minter, PRESALE_PASS_TOKEN, count, '');
    }
}

File 3 of 16 : ERC1155Supply.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC1155.sol";

/**
 * @dev Extension of ERC1155 that adds tracking of total supply per id.
 *
 * Useful for scenarios where Fungible and Non-fungible tokens have to be
 * clearly identified. Note: While a totalSupply of 1 might mean the
 * corresponding is an NFT, there is no guarantees that no other token with the
 * same id are not going to be minted.
 */
abstract contract ERC1155Supply is ERC1155 {
    mapping(uint256 => uint256) private _totalSupply;

    /**
     * @dev Total amount of tokens in with a given id.
     */
    function totalSupply(uint256 id) public view virtual returns (uint256) {
        return _totalSupply[id];
    }

    /**
     * @dev Indicates weither any token exist with a given id, or not.
     */
    function exists(uint256 id) public view virtual returns (bool) {
        return ERC1155Supply.totalSupply(id) > 0;
    }

    /**
     * @dev See {ERC1155-_mint}.
     */
    function _mint(
        address account,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual override {
        super._mint(account, id, amount, data);
        _totalSupply[id] += amount;
    }

    /**
     * @dev See {ERC1155-_mintBatch}.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._mintBatch(to, ids, amounts, data);
        for (uint256 i = 0; i < ids.length; ++i) {
            _totalSupply[ids[i]] += amounts[i];
        }
    }

    /**
     * @dev See {ERC1155-_burn}.
     */
    function _burn(
        address account,
        uint256 id,
        uint256 amount
    ) internal virtual override {
        super._burn(account, id, amount);
        _totalSupply[id] -= amount;
    }

    /**
     * @dev See {ERC1155-_burnBatch}.
     */
    function _burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual override {
        super._burnBatch(account, ids, amounts);
        for (uint256 i = 0; i < ids.length; ++i) {
            _totalSupply[ids[i]] -= amounts[i];
        }
    }
}

File 4 of 16 : 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 5 of 16 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 6 of 16 : NFTCClaimlist.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import '@openzeppelin/contracts/access/Ownable.sol';
import {MerkleProof} from '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol';

/**
 * @title NFTC Claimlist Implementation
 * @author @NiftyMike, NFT Culture
 * @dev "Claimlist" - an approach for whitelist minting backed by a MerkleTree.
 * Cheap to set the master claim, not that expensive to check the claim. Requires
 * off-chain generation of the MerkleTree.
 *
 * Please report bugs or security issues to @author
 * Please credit @author if you re-use this code
 */
contract NFTCClaimlist is Ownable {
    using MerkleProof for bytes32[];

    bytes32 private _masterClaim;
    mapping(address => uint256) private _nextClaimIndex;

    function setMasterClaim(bytes32 __masterClaim) external onlyOwner {
        _masterClaim = __masterClaim;
    }

    function getLeafFor(address wallet, uint256 index)
        external
        pure
        returns (bytes32)
    {
        // Both the contract and the caller need to be able to generate the
        // leaves in a perfectly identical manner, so to make this easier,
        // exposing the function directly from the contract.
        return _generateLeaf(wallet, index);
    }

    function checkClaim(
        address wallet,
        uint256 index,
        bytes32[] memory claim
    ) external view returns (bool) {
        return claim.verify(_masterClaim, _generateLeaf(wallet, index));
    }

    function getNextIndex(address wallet) external view returns (uint256) {
        return _getNextIndex(wallet);
    }

    function _getNextIndex(address wallet) internal view returns (uint256) {
        return _nextClaimIndex[wallet];
    }

    function _generateLeaf(address wallet, uint256 index)
        internal
        pure
        returns (bytes32)
    {
        return keccak256(abi.encodePacked(wallet, '_', index));
    }

    function _validateClaim(bytes32[] memory claim, bytes32 leaf)
        internal
        view
        returns (bool)
    {
        return claim.verify(_masterClaim, leaf);
    }

    function _incrementClaimIndex(address wallet, uint256 count) internal {
        _nextClaimIndex[wallet] += count;
    }
}

File 7 of 16 : NFTCWhitelist.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import '@openzeppelin/contracts/access/Ownable.sol';

/**
 * @title NFTC Whitelist Implementation
 * @author @NiftyMike, NFT Culture
 * @dev Plain vanilla implementation to support minting from a whitelist.
 * Works fine with whitelists < 100 addresses or so, but will get expensive beyond that.
 *
 * Please report bugs or security issues to @author
 * Please credit @author if you re-use this code
 */
contract NFTCWhitelist is Ownable {
    mapping(address => uint256) private _whitelist;

    function whitelistWallets(address[] memory wallets) external onlyOwner {
        require(wallets.length > 0, 'Empty list');

        uint256 idx;
        for (idx = 0; idx < wallets.length; idx++) {
            _whitelist[wallets[idx]]++;
        }
    }

    function getWhitelistAmount(address wallet)
        external
        view
        returns (uint256)
    {
        return _getWhitelistAmount(wallet);
    }

    function _getWhitelistAmount(address wallet)
        internal
        view
        returns (uint256)
    {
        return _whitelist[wallet];
    }

    function _decrementWhitelistAmount(address wallet, uint256 count) internal {
        _whitelist[wallet] -= count;
    }
}

File 8 of 16 : ERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

    // Mapping from account to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

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

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: balance query for the zero address");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
        public
        view
        virtual
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(_msgSender() != operator, "ERC1155: setting approval status for self");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC1155-isApprovedForAll}.
     */
    function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[account][operator];
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `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 memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - 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[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `account`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address account,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(account != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][account] += amount;
        emit TransferSingle(operator, address(0), account, id, amount);

        _doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * 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 _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `account`
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address account,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(account != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

        uint256 accountBalance = _balances[id][account];
        require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][account] = accountBalance - amount;
        }

        emit TransferSingle(operator, account, address(0), id, amount);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address account,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(account != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, account, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 accountBalance = _balances[id][account];
            require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][account] = accountBalance - amount;
            }
        }

        emit TransferBatch(operator, account, address(0), ids, amounts);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}

File 9 of 16 : 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 10 of 16 : 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 11 of 16 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

File 12 of 16 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    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);
    }

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 13 of 16 : 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 16 : 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 16 : 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 16 of 16 : MerkleProof.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        bytes32 computedHash = leaf;

        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];

            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }

        // Check if the computed hash (root) is equal to the provided root
        return computedHash == root;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"redeemer","type":"address"},{"indexed":true,"internalType":"string","name":"stxWallet","type":"string"}],"name":"PassRedeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[],"name":"MAX_MINT_PER_TRANS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRESALE_PASS_TOKEN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burningActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"bytes32[]","name":"claim","type":"bytes32[]"}],"name":"checkClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getLeafFor","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"getNextIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"}],"name":"getWhitelistAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTokensForSale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"claim","type":"bytes32[]"}],"name":"mintPassFromClaim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"name":"mintPassesFromWhitelist","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintingActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pricePerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"stxWallet","type":"string"}],"name":"redeemPresalePass","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"__masterClaim","type":"bytes32"}],"name":"setMasterClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"__mintingActive","type":"bool"},{"internalType":"uint256","name":"__startingBlockNumber","type":"uint256"},{"internalType":"uint256","name":"__pricePerToken","type":"uint256"},{"internalType":"bool","name":"__burningActive","type":"bool"}],"name":"setMintingState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setNewURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startingBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"wallets","type":"address[]"}],"name":"whitelistWallets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405180608001604052806057815260200162002efd6057913960016123286000836200003f816200005e565b506200004b3362000077565b600a9290925560095560085550620001ac565b805162000073906002906020840190620000c9565b5050565b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620000d7906200016f565b90600052602060002090601f016020900481019282620000fb576000855562000146565b82601f106200011657805160ff191683800117855562000146565b8280016001018555821562000146579182015b828111156200014657825182559160200191906001019062000129565b506200015492915062000158565b5090565b5b8082111562000154576000815560010162000159565b600181811c908216806200018457607f821691505b60208210811415620001a657634e487b7160e01b600052602260045260246000fd5b50919050565b612d4180620001bc6000396000f3fe6080604052600436106101e25760003560e01c8063715018a611610102578063a22cb46511610095578063e985e9c511610064578063e985e9c51461056c578063f242432a146105b5578063f2fde38b146105d5578063f4f2e691146105f557600080fd5b8063a22cb465146104ea578063bd85b0391461050a578063c2af310414610537578063e104fd1d1461055757600080fd5b80637b1b1de6116100d15780637b1b1de61461047657806384f7afc71461048c5780638da5cb5b146104ac57806397f2f5c3146104d457600080fd5b8063715018a6146104015780637380ef99146104165780637606fc12146104365780637984f95b1461045657600080fd5b80632e9f74151161017a5780634590e390116101495780634590e3901461037a5780634e1273f41461038f5780634f558e79146103bc57806370872aa5146103eb57600080fd5b80632e9f74151461030b5780632eb2c2d61461032b57806331f9c9191461034b5780633ccfd60b1461036557600080fd5b80630e709b1b116101b65780630e709b1b1461027f5780630e89341c1461029f5780631c7c2598146102cc5780632d0a913e146102eb57600080fd5b8062fdd58e146101e7578063011212661461021a57806301ffc9a71461022f57806306e0ec9d1461025f575b600080fd5b3480156101f357600080fd5b5061020761020236600461244c565b610608565b6040519081526020015b60405180910390f35b61022d61022836600461254e565b6106b1565b005b34801561023b57600080fd5b5061024f61024a366004612599565b610792565b6040519015158152602001610211565b34801561026b57600080fd5b5061022d61027a3660046125b6565b61082f565b34801561028b57600080fd5b5061022d61029a36600461262d565b61088e565b3480156102ab57600080fd5b506102bf6102ba3660046125b6565b6108f4565b60405161021191906126d2565b3480156102d857600080fd5b50600b5461024f90610100900460ff1681565b3480156102f757600080fd5b5061022d610306366004612752565b610988565b34801561031757600080fd5b5061022d610326366004612797565b610aa6565b34801561033757600080fd5b5061022d6103463660046127fd565b610b43565b34801561035757600080fd5b50600b5461024f9060ff1681565b34801561037157600080fd5b5061022d610be5565b34801561038657600080fd5b50610207606381565b34801561039b57600080fd5b506103af6103aa3660046128a7565b610c6b565b6040516102119190612946565b3480156103c857600080fd5b5061024f6103d73660046125b6565b600090815260036020526040902054151590565b3480156103f757600080fd5b50610207600a5481565b34801561040d57600080fd5b5061022d610da9565b34801561042257600080fd5b5061020761043136600461244c565b610e0f565b34801561044257600080fd5b50610207610451366004612959565b610e64565b34801561046257600080fd5b5061022d61047136600461262d565b610e82565b34801561048257600080fd5b5061020760085481565b34801561049857600080fd5b5061024f6104a7366004612974565b611034565b3480156104b857600080fd5b506004546040516001600160a01b039091168152602001610211565b3480156104e057600080fd5b5061020760095481565b3480156104f657600080fd5b5061022d6105053660046129cb565b6110a2565b34801561051657600080fd5b506102076105253660046125b6565b60009081526003602052604090205490565b34801561054357600080fd5b50610207610552366004612959565b61118d565b34801561056357600080fd5b50610207600181565b34801561057857600080fd5b5061024f6105873660046129fe565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b3480156105c157600080fd5b5061022d6105d0366004612a28565b6111ab565b3480156105e157600080fd5b5061022d6105f0366004612959565b611246565b61022d6106033660046125b6565b611325565b60006001600160a01b03831661068b5760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201527f65726f206164647265737300000000000000000000000000000000000000000060648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b600a5443116106f05760405162461bcd60e51b815260206004820152600b60248201526a139bdd081cdd185c9d195960aa1b6044820152606401610682565b600b5460ff1661072f5760405162461bcd60e51b815260206004820152600a6024820152694e6f742061637469766560b01b6044820152606401610682565b604080516001808252818301909252600091816020015b6060815260200190600190039081610746579050509050818160008151811061077157610771612a8d565b602002602001018190525061078e6107863390565b8260016114b0565b5050565b60006001600160e01b031982167fd9b67a260000000000000000000000000000000000000000000000000000000014806107f557506001600160e01b031982167f0e89341c00000000000000000000000000000000000000000000000000000000145b8061082957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6004546001600160a01b031633146108895760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610682565b600555565b6004546001600160a01b031633146108e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610682565b6108f1816116bf565b50565b60606002805461090390612aa3565b80601f016020809104026020016040519081016040528092919081815260200182805461092f90612aa3565b801561097c5780601f106109515761010080835404028352916020019161097c565b820191906000526020600020905b81548152906001019060200180831161095f57829003601f168201915b50505050509050919050565b6004546001600160a01b031633146109e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610682565b6000815111610a335760405162461bcd60e51b815260206004820152600a60248201527f456d707479206c697374000000000000000000000000000000000000000000006044820152606401610682565b60005b815181101561078e5760076000838381518110610a5557610a55612a8d565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000815480929190610a8e90612af4565b91905055508080610a9e90612af4565b915050610a36565b6004546001600160a01b03163314610b005760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610682565b600b805460ff19168515151790558215610b1a57600a8390555b8115610b265760088290555b600b80549115156101000261ff0019909216919091179055505050565b6001600160a01b038516331480610b5f5750610b5f8533610587565b610bd15760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f742060448201527f6f776e6572206e6f7220617070726f76656400000000000000000000000000006064820152608401610682565b610bde85858585856116d2565b5050505050565b6004546001600160a01b03163314610c3f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610682565b60405133904780156108fc02916000818181858888f193505050501580156108f1573d6000803e3d6000fd5b60608151835114610ce45760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e67746860448201527f206d69736d6174636800000000000000000000000000000000000000000000006064820152608401610682565b6000835167ffffffffffffffff811115610d0057610d00612476565b604051908082528060200260200182016040528015610d29578160200160208202803683370190505b50905060005b8451811015610da157610d74858281518110610d4d57610d4d612a8d565b6020026020010151858381518110610d6757610d67612a8d565b6020026020010151610608565b828281518110610d8657610d86612a8d565b6020908102919091010152610d9a81612af4565b9050610d2f565b509392505050565b6004546001600160a01b03163314610e035760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610682565b610e0d6000611945565b565b60408051606084901b6bffffffffffffffffffffffff1916602080830191909152605f60f81b6034830152603580830185905283518084039091018152605590920190925280519101206000905b9392505050565b6001600160a01b038116600090815260076020526040812054610829565b600b54610100900460ff16610ed95760405162461bcd60e51b815260206004820152600b60248201527f4275726e696e67206f66660000000000000000000000000000000000000000006044820152606401610682565b8051602914610f2a5760405162461bcd60e51b815260206004820152601560248201527f496e76616c69642077616c6c6574206c656e67746800000000000000000000006044820152606401610682565b80600081518110610f3d57610f3d612a8d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f530000000000000000000000000000000000000000000000000000000000000014610fd35760405162461bcd60e51b815260206004820152601560248201527f496e76616c69642077616c6c657420666f726d617400000000000000000000006044820152606401610682565b610fdf336001806119af565b80604051610fed9190612b0f565b6040518091039020610ffc3390565b6001600160a01b03167fcdca16f9be5e7e6bd8e0d929c9f5df55c88111eed5c00113e782d4fa3e2d8eaf60405160405180910390a350565b600061109a60055461109286866040516bffffffffffffffffffffffff19606084901b166020820152605f60f81b60348201526035810182905260009060550160405160208183030381529060405280519060200120905092915050565b8491906119e2565b949350505050565b336001600160a01b03831614156111215760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c2073746174757360448201527f20666f722073656c6600000000000000000000000000000000000000000000006064820152608401610682565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6001600160a01b038116600090815260066020526040812054610829565b6001600160a01b0385163314806111c757506111c78533610587565b6112395760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201527f20617070726f76656400000000000000000000000000000000000000000000006064820152608401610682565b610bde8585858585611a91565b6004546001600160a01b031633146112a05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610682565b6001600160a01b03811661131c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610682565b6108f181611945565b600a5443116113645760405162461bcd60e51b815260206004820152600b60248201526a139bdd081cdd185c9d195960aa1b6044820152606401610682565b600b5460ff166113a35760405162461bcd60e51b815260206004820152600a6024820152694e6f742061637469766560b01b6044820152606401610682565b8060001080156113b4575060638111155b6113f05760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a590818dbdd5b9d609a1b6044820152606401610682565b806008546113fe9190612b2b565b34101561143d5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b6044820152606401610682565b3360009081526007602052604090205481111561149c5760405162461bcd60e51b815260206004820152600860248201527f546f6f206d616e790000000000000000000000000000000000000000000000006044820152606401610682565b6114a63382611c38565b6108f13382611d22565b8060001080156114c1575060638111155b6114fd5760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a590818dbdd5b9d609a1b6044820152606401610682565b8060085461150b9190612b2b565b34101561154a5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420707269636560981b6044820152606401610682565b8082511461159a5760405162461bcd60e51b815260206004820152600f60248201527f4d69736d6174636820636c61696d7300000000000000000000000000000000006044820152606401610682565b60005b82518110156116a5576116478382815181106115bb576115bb612a8d565b602002602001015161164286846115e7896001600160a01b031660009081526006602052604090205490565b6115f19190612b4a565b6040516bffffffffffffffffffffffff19606084901b166020820152605f60f81b60348201526035810182905260009060550160405160208183030381529060405280519060200120905092915050565b611d53565b6116935760405162461bcd60e51b815260206004820152600d60248201527f436c61696d20696e76616c6964000000000000000000000000000000000000006044820152606401610682565b8061169d81612af4565b91505061159d565b506116b08382611c38565b6116ba8382611d65565b505050565b805161078e906002906020840190612397565b81518351146117495760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e6774682060448201527f6d69736d617463680000000000000000000000000000000000000000000000006064820152608401610682565b6001600160a01b0384166117ad5760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b6064820152608401610682565b3360005b84518110156118d75760008582815181106117ce576117ce612a8d565b6020026020010151905060008583815181106117ec576117ec612a8d565b602090810291909101810151600084815280835260408082206001600160a01b038e16835290935291909120549091508181101561187f5760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b6064820152608401610682565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906118bc908490612b4a565b92505081905550505050806118d090612af4565b90506117b1565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051611927929190612b62565b60405180910390a461193d818787878787611d8d565b505050505050565b600480546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6119ba838383611f42565b600082815260036020526040812080548392906119d8908490612b90565b9091555050505050565b600081815b8551811015611a86576000868281518110611a0457611a04612a8d565b60200260200101519050808311611a46576040805160208101859052908101829052606001604051602081830303815290604052805190602001209250611a73565b60408051602081018390529081018490526060016040516020818303038152906040528051906020012092505b5080611a7e81612af4565b9150506119e7565b509092149392505050565b6001600160a01b038416611af55760405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b6064820152608401610682565b33611b0e818787611b05886120ef565b610bde886120ef565b6000848152602081815260408083206001600160a01b038a16845290915290205483811015611b925760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b6064820152608401610682565b6000858152602081815260408083206001600160a01b038b8116855292528083208785039055908816825281208054869290611bcf908490612b4a565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4611c2f82888888888861213a565b50505050505050565b6001600160a01b038216611c8e5760405162461bcd60e51b815260206004820152600b60248201527f42616420616464726573730000000000000000000000000000000000000000006044820152606401610682565b60095481600d54611c9f9190612b4a565b1115611ced5760405162461bcd60e51b815260206004820152600e60248201527f4c696d69742065786365656465640000000000000000000000000000000000006044820152606401610682565b80600d6000828254611cff9190612b4a565b9250508190555061078e8260018360405180602001604052806000815250612245565b6001600160a01b03821660009081526007602052604081208054839290611d4a908490612b90565b90915550505050565b600554600090610e5d908490846119e2565b6001600160a01b03821660009081526006602052604081208054839290611d4a908490612b4a565b6001600160a01b0384163b1561193d5760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190611dd19089908990889088908890600401612ba7565b602060405180830381600087803b158015611deb57600080fd5b505af1925050508015611e1b575060408051601f3d908101601f19168201909252611e1891810190612c05565b60015b611ed157611e27612c22565b806308c379a01415611e615750611e3c612c3e565b80611e475750611e63565b8060405162461bcd60e51b815260040161068291906126d2565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e204552433131353560448201527f526563656976657220696d706c656d656e7465720000000000000000000000006064820152608401610682565b6001600160e01b0319811663bc197c8160e01b14611c2f5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b6064820152608401610682565b6001600160a01b038316611fbe5760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610682565b33611fee81856000611fcf876120ef565b611fd8876120ef565b5050604080516020810190915260009052505050565b6000838152602081815260408083206001600160a01b0388168452909152902054828110156120845760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c60448201527f616e6365000000000000000000000000000000000000000000000000000000006064820152608401610682565b6000848152602081815260408083206001600160a01b03898116808652918452828520888703905582518981529384018890529092908616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a45050505050565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061212957612129612a8d565b602090810291909101015292915050565b6001600160a01b0384163b1561193d5760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619061217e9089908990889088908890600401612cc8565b602060405180830381600087803b15801561219857600080fd5b505af19250505080156121c8575060408051601f3d908101601f191682019092526121c591810190612c05565b60015b6121d457611e27612c22565b6001600160e01b0319811663f23a6e6160e01b14611c2f5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204552433131353552656365697665722072656a656374656044820152676420746f6b656e7360c01b6064820152608401610682565b6122518484848461227a565b6000838152600360205260408120805484929061226f908490612b4a565b909155505050505050565b6001600160a01b0384166122f65760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610682565b3361230781600087611b05886120ef565b6000848152602081815260408083206001600160a01b038916845290915281208054859290612337908490612b4a565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610bde8160008787878761213a565b8280546123a390612aa3565b90600052602060002090601f0160209004810192826123c5576000855561240b565b82601f106123de57805160ff191683800117855561240b565b8280016001018555821561240b579182015b8281111561240b5782518255916020019190600101906123f0565b5061241792915061241b565b5090565b5b80821115612417576000815560010161241c565b80356001600160a01b038116811461244757600080fd5b919050565b6000806040838503121561245f57600080fd5b61246883612430565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f1916810167ffffffffffffffff811182821017156124b2576124b2612476565b6040525050565b600067ffffffffffffffff8211156124d3576124d3612476565b5060051b60200190565b600082601f8301126124ee57600080fd5b813560206124fb826124b9565b604051612508828261248c565b83815260059390931b850182019282810191508684111561252857600080fd5b8286015b84811015612543578035835291830191830161252c565b509695505050505050565b60006020828403121561256057600080fd5b813567ffffffffffffffff81111561257757600080fd5b61109a848285016124dd565b6001600160e01b0319811681146108f157600080fd5b6000602082840312156125ab57600080fd5b8135610e5d81612583565b6000602082840312156125c857600080fd5b5035919050565b600067ffffffffffffffff8311156125e9576125e9612476565b604051612600601f8501601f19166020018261248c565b80915083815284848401111561261557600080fd5b83836020830137600060208583010152509392505050565b60006020828403121561263f57600080fd5b813567ffffffffffffffff81111561265657600080fd5b8201601f8101841361266757600080fd5b61109a848235602084016125cf565b60005b83811015612691578181015183820152602001612679565b838111156126a0576000848401525b50505050565b600081518084526126be816020860160208601612676565b601f01601f19169290920160200192915050565b602081526000610e5d60208301846126a6565b600082601f8301126126f657600080fd5b81356020612703826124b9565b604051612710828261248c565b83815260059390931b850182019282810191508684111561273057600080fd5b8286015b848110156125435761274581612430565b8352918301918301612734565b60006020828403121561276457600080fd5b813567ffffffffffffffff81111561277b57600080fd5b61109a848285016126e5565b8035801515811461244757600080fd5b600080600080608085870312156127ad57600080fd5b6127b685612787565b935060208501359250604085013591506127d260608601612787565b905092959194509250565b600082601f8301126127ee57600080fd5b610e5d838335602085016125cf565b600080600080600060a0868803121561281557600080fd5b61281e86612430565b945061282c60208701612430565b9350604086013567ffffffffffffffff8082111561284957600080fd5b61285589838a016124dd565b9450606088013591508082111561286b57600080fd5b61287789838a016124dd565b9350608088013591508082111561288d57600080fd5b5061289a888289016127dd565b9150509295509295909350565b600080604083850312156128ba57600080fd5b823567ffffffffffffffff808211156128d257600080fd5b6128de868387016126e5565b935060208501359150808211156128f457600080fd5b50612901858286016124dd565b9150509250929050565b600081518084526020808501945080840160005b8381101561293b5781518752958201959082019060010161291f565b509495945050505050565b602081526000610e5d602083018461290b565b60006020828403121561296b57600080fd5b610e5d82612430565b60008060006060848603121561298957600080fd5b61299284612430565b925060208401359150604084013567ffffffffffffffff8111156129b557600080fd5b6129c1868287016124dd565b9150509250925092565b600080604083850312156129de57600080fd5b6129e783612430565b91506129f560208401612787565b90509250929050565b60008060408385031215612a1157600080fd5b612a1a83612430565b91506129f560208401612430565b600080600080600060a08688031215612a4057600080fd5b612a4986612430565b9450612a5760208701612430565b93506040860135925060608601359150608086013567ffffffffffffffff811115612a8157600080fd5b61289a888289016127dd565b634e487b7160e01b600052603260045260246000fd5b600181811c90821680612ab757607f821691505b60208210811415612ad857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6000600019821415612b0857612b08612ade565b5060010190565b60008251612b21818460208701612676565b9190910192915050565b6000816000190483118215151615612b4557612b45612ade565b500290565b60008219821115612b5d57612b5d612ade565b500190565b604081526000612b75604083018561290b565b8281036020840152612b87818561290b565b95945050505050565b600082821015612ba257612ba2612ade565b500390565b60006001600160a01b03808816835280871660208401525060a06040830152612bd360a083018661290b565b8281036060840152612be5818661290b565b90508281036080840152612bf981856126a6565b98975050505050505050565b600060208284031215612c1757600080fd5b8151610e5d81612583565b600060033d1115612c3b5760046000803e5060005160e01c5b90565b600060443d1015612c4c5790565b6040516003193d81016004833e81513d67ffffffffffffffff8160248401118184111715612c7c57505050505090565b8285019150815181811115612c945750505050505090565b843d8701016020828501011115612cae5750505050505090565b612cbd6020828601018761248c565b509095945050505050565b60006001600160a01b03808816835280871660208401525084604083015283606083015260a06080830152612d0060a08301846126a6565b97965050505050505056fea2646970667358221220d14ccea32dc5aa201a1bebe192473890c916fea68c00988f7737776bc02daaee64736f6c6343000809003368747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d654754594e323776395157324872487364666457657362465269556e6846577250446f436f414b716f36364c2f312e6a736f6e

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

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.