ETH Price: $3,674.68 (+1.54%)

Contract

0xB5974Af9e88237955B1F1731F1302459769B133c
 

Overview

ETH Balance

0.0609 ETH

Eth Value

$223.79 (@ $3,674.68/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Mint183615812023-10-16 7:55:47411 days ago1697442947IN
TresCool: TCool Token
0.005 ETH0.000591015.53259415
Set Approval For...181697812023-09-19 11:52:59438 days ago1695124379IN
TresCool: TCool Token
0 ETH0.0005174211.22626748
Mint180873012023-09-07 21:42:35449 days ago1694122955IN
TresCool: TCool Token
0.01 ETH0.0029781927.879453
Set Approval For...180215652023-08-29 16:49:35458 days ago1693327775IN
TresCool: TCool Token
0 ETH0.0033802873.20586598
Set Approval For...174796862023-06-14 17:33:59534 days ago1686764039IN
TresCool: TCool Token
0 ETH0.0020855845.24929759
Mint174624102023-06-12 7:10:47537 days ago1686553847IN
TresCool: TCool Token
0.005 ETH0.0016362815.31758547
Mint170903712023-04-20 21:35:47589 days ago1682026547IN
TresCool: TCool Token
0.005 ETH0.0071153266.60788878
Mint170201972023-04-10 20:39:59599 days ago1681159199IN
TresCool: TCool Token
0.02 ETH0.0026415524.28118522
Mint170201782023-04-10 20:36:11599 days ago1681158971IN
TresCool: TCool Token
0.01 ETH0.0031153428.63628399
Mint169831372023-04-05 14:21:35605 days ago1680704495IN
TresCool: TCool Token
0.007 ETH0.0042455439.74335431
Distribute Share...168304472023-03-15 2:50:23626 days ago1678848623IN
TresCool: TCool Token
0 ETH0.0007679821.99827924
Set Approval For...167962642023-03-10 7:28:35631 days ago1678433315IN
TresCool: TCool Token
0 ETH0.0010126621.97100504
Set Approval For...167584752023-03-04 23:55:59636 days ago1677974159IN
TresCool: TCool Token
0 ETH0.0011407924.70595407
Set Approval For...167299472023-02-28 23:34:23640 days ago1677627263IN
TresCool: TCool Token
0 ETH0.0009237820.04264739
Set Approval For...166902222023-02-23 9:31:47646 days ago1677144707IN
TresCool: TCool Token
0 ETH0.0012026626.09324823
Mint166902102023-02-23 9:29:23646 days ago1677144563IN
TresCool: TCool Token
0.01 ETH0.0031555329.53955191
Mint166889382023-02-23 5:11:47646 days ago1677129107IN
TresCool: TCool Token
0.02 ETH0.0028919126.58253282
Mint166065082023-02-11 15:47:23657 days ago1676130443IN
TresCool: TCool Token
0.005 ETH0.0020490219.18135935
Mint165346952023-02-01 14:54:59668 days ago1675263299IN
TresCool: TCool Token
0.01 ETH0.0021472619.73770389
Mint165331032023-02-01 9:34:35668 days ago1675244075IN
TresCool: TCool Token
0.04 ETH0.0013503714.72765255
Mint165331012023-02-01 9:34:11668 days ago1675244051IN
TresCool: TCool Token
0.04 ETH0.0013929215.19172226
Mint165330992023-02-01 9:33:47668 days ago1675244027IN
TresCool: TCool Token
0.04 ETH0.0016950415.58089748
Mint165305172023-02-01 0:53:59668 days ago1675212839IN
TresCool: TCool Token
0.005 ETH0.002057619.26162666
Mint165277012023-01-31 15:28:11669 days ago1675178891IN
TresCool: TCool Token
0.02 ETH0.0025225327.51150826
Mint165277012023-01-31 15:28:11669 days ago1675178891IN
TresCool: TCool Token
0.02 ETH0.00294627.07969779
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
183615812023-10-16 7:55:47411 days ago1697442947
TresCool: TCool Token
0.00025 ETH
180873012023-09-07 21:42:35449 days ago1694122955
TresCool: TCool Token
0.0005 ETH
179874452023-08-24 22:10:11463 days ago1692915011
TresCool: TCool Token
0.002 ETH
179874452023-08-24 22:10:11463 days ago1692915011
TresCool: TCool Token
0.004 ETH
174624102023-06-12 7:10:47537 days ago1686553847
TresCool: TCool Token
0.00025 ETH
170903712023-04-20 21:35:47589 days ago1682026547
TresCool: TCool Token
0.00025 ETH
170201972023-04-10 20:39:59599 days ago1681159199
TresCool: TCool Token
0.001 ETH
170201782023-04-10 20:36:11599 days ago1681158971
TresCool: TCool Token
0.0005 ETH
169831372023-04-05 14:21:35605 days ago1680704495
TresCool: TCool Token
0.00035 ETH
168304472023-03-15 2:50:23626 days ago1678848623
TresCool: TCool Token
1.736595 ETH
166902102023-02-23 9:29:23646 days ago1677144563
TresCool: TCool Token
0.0005 ETH
166889382023-02-23 5:11:47646 days ago1677129107
TresCool: TCool Token
0.001 ETH
166065082023-02-11 15:47:23657 days ago1676130443
TresCool: TCool Token
0.00025 ETH
165346952023-02-01 14:54:59668 days ago1675263299
TresCool: TCool Token
0.0005 ETH
165331032023-02-01 9:34:35668 days ago1675244075
TresCool: TCool Token
0.002 ETH
165331012023-02-01 9:34:11668 days ago1675244051
TresCool: TCool Token
0.002 ETH
165330992023-02-01 9:33:47668 days ago1675244027
TresCool: TCool Token
0.002 ETH
165305172023-02-01 0:53:59668 days ago1675212839
TresCool: TCool Token
0.00025 ETH
165277012023-01-31 15:28:11669 days ago1675178891
TresCool: TCool Token
0.001 ETH
165277012023-01-31 15:28:11669 days ago1675178891
TresCool: TCool Token
0.001 ETH
165231122023-01-31 0:05:35669 days ago1675123535
TresCool: TCool Token
0.0005 ETH
165231122023-01-31 0:05:35669 days ago1675123535
TresCool: TCool Token
0.0005 ETH
165231122023-01-31 0:05:35669 days ago1675123535
TresCool: TCool Token
0.00025 ETH
165220572023-01-30 20:33:59669 days ago1675110839
TresCool: TCool Token
0.00045 ETH
165220572023-01-30 20:33:59669 days ago1675110839
TresCool: TCool Token
0.00045 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TresCool

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

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

/**
*
*      ___           ___           ___           ___                    ___           ___                    ___           ___           ___           ___ 
*     /\__\         /\  \         /\  \         /\  \                  /\  \         /\  \                  /\  \         /\  \         /\  \         /\__\
*    /:/  /        /::\  \       /::\  \       /::\  \                 \:\  \       /::\  \                /::\  \       /::\  \       /::\  \       /:/  /
*   /:/__/        /:/\:\  \     /:/\:\  \     /:/\:\  \                 \:\  \     /:/\:\  \              /:/\:\  \     /:/\:\  \     /:/\:\  \     /:/  / 
*  /::\  \ ___   /::\~\:\  \   /::\~\:\  \   /::\~\:\  \                /::\  \   /:/  \:\  \            /:/  \:\  \   /:/  \:\  \   /:/  \:\  \   /:/  /  
* /:/\:\  /\__\ /:/\:\ \:\__\ /:/\:\ \:\__\ /:/\:\ \:\__\              /:/\:\__\ /:/__/ \:\__\          /:/__/ \:\__\ /:/__/ \:\__\ /:/__/ \:\__\ /:/__/   
* \/__\:\/:/  / \:\~\:\ \/__/ \/_|::\/:/  / \:\~\:\ \/__/             /:/  \/__/ \:\  \ /:/  /          \:\  \  \/__/ \:\  \ /:/  / \:\  \ /:/  / \:\  \   
*      \::/  /   \:\ \:\__\      |:|::/  /   \:\ \:\__\              /:/  /       \:\  /:/  /            \:\  \        \:\  /:/  /   \:\  /:/  /   \:\  \  
*      /:/  /     \:\ \/__/      |:|\/__/     \:\ \/__/              \/__/         \:\/:/  /              \:\  \        \:\/:/  /     \:\/:/  /     \:\  \ 
*     /:/  /       \:\__\        |:|  |        \:\__\                               \::/  /                \:\__\        \::/  /       \::/  /       \:\__\
*     \/__/         \/__/         \|__|         \/__/                                \/__/                  \/__/         \/__/         \/__/         \/__/
*
* @title Tres Cool Contract
* @author Tres Cool (www.trescool.xyz)
* @notice This contract is uniquely designed to hardcode in perpetual carbon removal to any NFT use case that adopts this standard.
* This is dedicated to Leanne's, Whitney's, and Monty's kids, & all current and future generations. May this help revert some of the 
* damage we've done so you will always have a beautiful world. 
*/

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "erc721a/contracts/ERC721A.sol";
import "../Carbon/ERCCooldown.sol";
import "../Finance/PaymentDistributor.sol";

pragma solidity ^0.8.2;

/// @dev Implementation of the TresCoolLabs ERCCooldown class to enable Carbon Removal for each NFT mint and sale.
contract TresCool is ERC721A, ERCCooldown, Ownable, ReentrancyGuard, PaymentDistributor {
    
    /* Public Variables */

    uint256 public minCost = 0.005 ether;
    uint128 public maxSupply = 1074;
    uint128 public maxMintAmountPerTx = 2;

    /* Private Variables */

    bool private _paused = true;
    string private _baseTokenURI;
    
    /* Construction */

    constructor() ERC721A("TresCool", "TCool") ERCCooldown(1000, 500, 500) { }

    /* Setters */

    /// @notice Sets the mint price in WEI
    function setMinCost(uint256 cost) external onlyOwner {
        minCost = cost;
    }

    /// @notice Sets the max supply of the collection
    function setMaxSupply(uint128 supply) external onlyOwner {
        maxSupply = supply;
    }

    /// @notice Sets the maximum number of tokens per mint
    function setMaxMintAmountPerTx(uint128 maxMints) external onlyOwner {
        maxMintAmountPerTx = maxMints;
    }

    /// @notice Sets the Token URI for the Metadata
    function setTokenURI(string memory uri) external onlyOwner {
        _baseTokenURI = uri;
    }

    /// @notice Sets the public mint to paused or not paused
    function setPaused(bool pause) external onlyOwner {
        _paused = pause;
    }

    /* Getters */

    /// @notice Gets all required config variables
    function getSettings() external view returns(uint256, uint128, uint128, uint256, bool) {
        return (minCost, maxMintAmountPerTx, maxSupply, _totalMinted(), _paused);
    }

    /* Metadata */

    /// @dev Override to pass in metadata URI
    function _baseURI() internal view virtual override returns (string memory) {
        return _baseTokenURI;
    }

    /* Mint */

    /// @notice Public mint function that accepts a quantity and mints to the recipient.
    /// @dev Mint function with price and maxMints checks.
    function mint(address recipient, uint256 quantity) external payable nonReentrant {
        require(_paused == false, "Cannot mint while paused");
        require(msg.value >= quantity * minCost, "Must send at least the minimum cost to mint.");
        require(quantity <= maxMintAmountPerTx, "Cannot mint over maximum allowed mints per transaction");
        _mintCooldown(msg.value);
        _internalMint(recipient, quantity);
    }

    /// @notice Minting functionality for the contract owner which mints a quantity to a set address.
    /// @dev Owner mint with no checks other than those included in _internalMint().
    function ownerMint(address to, uint256 quantity) external onlyOwner nonReentrant {
        _internalMint(to, quantity);
    }

    /// @dev Internal mint function that runs basic max supply check and mints to a set address.
    function _internalMint(address to, uint256 quantity) private {
        require(_totalMinted() + quantity <= maxSupply, "Request exceeds maximum contract supply.");
        _safeMint(to, quantity);
    }

    /* Ownership */

    /// @notice Gets all the token IDs of an owner
    /// @dev Should not be called on chain. Runs a simple loop to calculate all the token IDs of a specific address.
    function tokensOfOwner(address owner) external view returns(uint256[] memory ownerTokens) {
        uint256 tokenCount = balanceOf(owner);

        if (tokenCount == 0) {
            // Return an empty array
            return new uint256[](0);
        } else {
            uint256[] memory result = new uint256[](tokenCount);
            uint256 total = totalSupply();
            uint256 resultIndex = 0;
            uint256 id;

            for (id = 0; id < total; id++) {
                if (ownerOf(id) == owner) {
                    result[resultIndex] = id;
                    resultIndex++;
                }
            }

            return result;
        }
    }

    /// @notice Prevents ownership renouncement
    /// @dev overrides the internal renounceOwnership() function and does nothing.
    function renounceOwnership() public override onlyOwner {}

    /// @notice Burn function that destroys the token with the passed in ID.
    /// @dev Will burn only if the owner of the token calls this function.
    function burn(uint256 tokenID) public {
        require(ownerOf(tokenID) == msg.sender, "Msg.sender must be the owner of the token to burn.");
        _burn(tokenID);
    }

    /* Interface Support */

    function supportsInterface(bytes4 interfaceId) public view override(ERC721A, ERCCooldown) returns (bool) {
        return super.supportsInterface(interfaceId);
    }

    /* Fallbacks */

    /// @notice Processes a cooldown upon receiving funds
    /// @dev Passes the msg.value to the ERCCoolDown class to handle a transfer cooldown. This is where funds are secured for carbon removal.
    receive() payable external {
        _transferCooldown(msg.value);
    }

    /* Carbon */

    /// @notice Adjusts the royalty based on ERC2981 as well as the mint and transfer cool rates
    /// @dev Exposses the ERCCooldown.sol _adjustCoolRates with the onlyOwner modifier to protect from unwanted adjustments.
    function adjustCoolRates(uint16 royalty, uint16 transferCoolRate, uint16 mintCoolRate) external onlyOwner {
        _adjustCoolRates(royalty, transferCoolRate, mintCoolRate);
    }

    /* Funds */

    /// @notice Adds a payee to the distribution list
    /// @dev Internal redirect to PaymentDistributor._addPayee( ... )
    function addPayee(address payee, uint16 share) public onlyOwner {
        _addPayee(payee, share);
    }

    /// @notice Updates a payee to the distribution list
    /// @dev Internal redirect to PaymentDistributor._updatePayee( ... )
    function updatePayee(address payee, uint16 share) external onlyOwner {
        _updatePayee(payee, share);
    }

    /// @notice Removes a payee from the distribution list
    /// @dev Internal redirect to PaymentDistributor._removePayee( ... )
    function removePayee(address payee) external onlyOwner {
        _removePayee(payee);
    }

    /// @notice Fund distribution function.
    /** @dev Internal redirect to PaymentDistributor._distributeShares( ... ) which 
     *  will distribute the contract ETH balance based on assigned payees. If no
     *  payees set then the balance will be sent to the owner.
     */
    function distributeShares() external onlyOwner nonReentrant {
        _distributeShares();
    }

    /// @notice ERC20 fund distribution function.
    /** @dev Internal redirect to PaymentDistributor._distributeERC20Shares( ... ) which 
     *  will distribute the contract ERC20 balance based on assigned payees. If no
     *  payees set then the balance will be sent to the owner.
     */
    function distributeERC20Shares(address tokenAddress) external onlyOwner nonReentrant {
        _distributeERC20Shares(tokenAddress);
    }
}

File 2 of 14 : PaymentDistributor.sol
// SPDX-License-Identifier: MIT

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

pragma solidity ^0.8.2;

/// @dev Implementation of the zero-out balance distribution. Distribution will see the requested balance zeroed out.
contract PaymentDistributor {

    uint16 private _shareDenominator = 10000;
    uint16[] private _shares;
    address[] private _payees;

    /// @notice Adds a payee to the distribution list
    /// @dev Ensures that both payee and share length match and also that there is no over assignment of shares.
    function _addPayee(address payee, uint16 share) internal {
        require(_payees.length == _shares.length, "Payee and shares must be the same length.");
        require(totalShares() + share <= _shareDenominator, "Cannot overassign share distribution.");
        require(_indexOfPayee(payee) == _payees.length, "Payee has already been added.");
        _payees.push(payee);
        _shares.push(share);
    }

    /// @notice Updates a payee to the distribution list
    /// @dev Ensures that both payee and share length match and also that there is no over assignment of shares.
    function _updatePayee(address payee, uint16 share) internal {
        uint payeeIndex = _indexOfPayee(payee);
        require(payeeIndex < _payees.length, "Payee has not been added yet.");
        _shares[payeeIndex] = share;
        require(totalShares() <= _shareDenominator, "Cannot overassign share distribution.");
    }

    /// @notice Removes a payee from the distribution list
    /// @dev Sets a payees shares to zero, but does not remove them from the array. Payee will be ignored in the distributeFunds function
    function _removePayee(address payee) internal {
        uint payeeIndex = _indexOfPayee(payee);
        require(payeeIndex < _payees.length, "Payee has not been added yet.");
        _shares[payeeIndex] = 0;
    }

    /// @notice Gets the index of a payee
    /// @dev Returns the index of the payee from _payees or returns _payees.length if no payee was found
    function _indexOfPayee(address payee) internal view returns (uint) {
        for (uint i=0; i < _payees.length; i++) {
            if(_payees[i] == payee) return i;
        }
        return _payees.length;
    }

    /// @notice Gets the total number of shares assigned to payees
    /// @dev Calculates total shares from shares[] array.
    function totalShares() private view returns(uint16) {
        uint16 sharesTotal = 0;
        for (uint i=0; i < _shares.length; i++) {
            sharesTotal += _shares[i];
        }
        return sharesTotal;
    }

    /// @notice Fund distribution function.
    /// @dev Uses the payees and shares array to calculate. Will send all remaining funds to the msg.sender.
    function _distributeShares() internal {

        uint currentBalance = address(this).balance;

        for (uint i=0; i < _payees.length; i++) {
            if(_shares[i] == 0) continue;
            uint share = (_shares[i] * currentBalance) / _shareDenominator;
            (bool sent,) = payable(_payees[i]).call{value : share}("");
            require(sent, "Failed to distribute to payee.");
        }

        if(address(this).balance > 0) {
            (bool sent,) = msg.sender.call{value: address(this).balance}("");
            require(sent, "Failed to distribute remaining funds.");
        }
    }

    /// @notice ERC20 fund distribution function.
    /// @dev Uses the payees and shares array to calculate. Will send all remaining funds to the msg.sender.
    function _distributeERC20Shares(address tokenAddress) internal {
        IERC20 tokenContract = IERC20(tokenAddress);
        uint currentBalance = tokenContract.balanceOf(address(this));

        for (uint i=0; i < _payees.length; i++) {
            if(_shares[i] == 0) continue;
            uint share = (_shares[i] * currentBalance) / _shareDenominator;
            tokenContract.transfer(_payees[i], share);
        }

        if(tokenContract.balanceOf(address(this)) > 0) {
            tokenContract.transfer(msg.sender, tokenContract.balanceOf(address(this)));
        }
    }
}

File 3 of 14 : ERCCooldown.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import {ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol";
import {IERCCooldown} from "./IERCCooldown.sol";

/// @title ERCCool 
/// @author TresCoolLabs
/// @notice Implement this contract without changes to enable Carbon Removal on your NFT.
/** @dev Inherit from this contract to enable Carbon Removal on your NFT. 
 *  
 * You must call _transferCooldown() and _mintCooldown() upon receiving funds and minting respectively.
 * NOTE: Call _transferCooldown(msg.value) inside of the 'receive() payable' fallback function in the parent contract.
 */
abstract contract ERCCooldown is IERCCooldown, ERC2981 {
    
    /* Variables */

    address constant private TCL_ADDRESS = 0x9a24124F19E366bdC2d0841abf4A7F6CC8FF8235;
    uint16 private _royalty = 1000;
    uint16 private _transferCoolRate = 500;
    uint16 private _mintCoolRate = 500;
    uint16 constant private _rateDenominator = 10000;

    /* Setup */

    /// @notice Initial setup.
    /// @dev Initial assignment of carbon removal grade based on rev share.
    constructor(uint16 royalty, uint16 transferCoolRate, uint16 mintCoolRate)  {
        _assignCoolRates(royalty, transferCoolRate, mintCoolRate);
    }

    /* Interfaces */

    /// @notice Interface Support for ERC2981
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC2981) returns (bool) {
        return interfaceId == type(IERCCooldown).interfaceId || super.supportsInterface(interfaceId);
    }

    /* Cool Rate */

    /// @notice Returns the assigned Transfer Cooldown Rate
    function transferCooldownRate() external view returns(uint16) {
        return _transferCoolRate;
    }

    /// @notice Returns the assigned Mint Cooldown Rate
    function mintCooldownRate() external view returns(uint16) {
        return _mintCoolRate;
    }

    /// @notice Allows adjustment of revenue and Cool Down Rate.
    /// @dev Adjusts _royalty and _coolRate if implemented.
    function _adjustCoolRates(uint16 royalty, uint16 transferCoolRate, uint16 mintCoolRate) internal {
        _assignCoolRates(royalty, transferCoolRate, mintCoolRate);
    }

    /// @notice Assigns the secondary sales royalty based on ERC2981 as well as Cool Rate.
    /// @dev Assigns _royalty and _coolRate for revenue calculations.
    function _assignCoolRates(uint16 royalty, uint16 transferCoolRate, uint16 mintCoolRate) private {
        require(royalty >= transferCoolRate, "Royalty cannot be set as less than the Cool Rate");
        require(mintCoolRate <= _rateDenominator, "Mint Cool Rate cannot be set as higher than 100%");
        _transferCoolRate = transferCoolRate;
        _mintCoolRate = mintCoolRate;
        _royalty = royalty;
        _setDefaultRoyalty(address(this), _royalty);
    }

    /* Cooldown */

    /// @notice Calculates carbon removal share based on grade and royalty values
    /// @dev Share is based on percent of sale, using _transferCoolRate and _royalty
    function _transferCooldownShare(uint256 value) private view returns(uint256) {
        return (value * _transferCoolRate) / _royalty;
    }

    /// @notice Calculates carbon removal share based on Mint Cool Rate
    /// @dev Share is based on percent of mint, using _mintCoolRate
    function _mintCooldownShare(uint256 value) private view returns(uint256) {
        return (value * _mintCoolRate) / _rateDenominator;
    }

    /// @notice Call this on a receive() function to trigger a cooldown
    /// @dev Calculates a percent based on _transferCoolRate
    function _transferCooldown(uint256 value) internal {
        uint share = _transferCooldownShare(value);
        if(value > 0) {
            (bool sent,) = payable(TCL_ADDRESS).call{value: share}("");
            require(sent, "Failed to send ETH");
        }
    }

    /// @notice Call this on a mint() function to trigger a cooldown
    /// @dev Calculates a percent based on _mintCoolRate
    function _mintCooldown(uint256 value) internal {
        uint share = _mintCooldownShare(value);
        if(value > 0) {
            (bool sent,) = payable(TCL_ADDRESS).call{value: share}("");
            require(sent, "Failed to send ETH");
        }
    }

}

File 4 of 14 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721A.sol';

/**
 * @dev Interface of ERC721 token receiver.
 */
interface ERC721A__IERC721Receiver {
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

/**
 * @title ERC721A
 *
 * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
 * Non-Fungible Token Standard, including the Metadata extension.
 * Optimized for lower gas during batch mints.
 *
 * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
 * starting from `_startTokenId()`.
 *
 * Assumptions:
 *
 * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721A is IERC721A {
    // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
    struct TokenApprovalRef {
        address value;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    // =============================================================
    //                            STORAGE
    // =============================================================

    // The next token ID to be minted.
    uint256 private _currentIndex;

    // The number of tokens burned.
    uint256 private _burnCounter;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

    // Mapping from token ID to approved address.
    mapping(uint256 => TokenApprovalRef) private _tokenApprovals;

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

    // =============================================================
    //                          CONSTRUCTOR
    // =============================================================

    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
        _currentIndex = _startTokenId();
    }

    // =============================================================
    //                   TOKEN COUNTING OPERATIONS
    // =============================================================

    /**
     * @dev Returns the starting token ID.
     * To change the starting token ID, please override this function.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

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

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

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

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

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

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

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

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

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

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

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        // The interface IDs are constants representing the first 4 bytes
        // of the XOR of all function selectors in the interface.
        // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
        // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
        return
            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
    }

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

    /**
     * @dev Returns the token collection name.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

        string memory baseURI = _baseURI();
        return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, it can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return '';
    }

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

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

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

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

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

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

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

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

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

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

    // =============================================================
    //                      APPROVAL OPERATIONS
    // =============================================================

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

        if (_msgSenderERC721A() != owner)
            if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                revert ApprovalCallerNotOwnerNorApproved();
            }

        _tokenApprovals[tokenId].value = to;
        emit Approval(owner, to, tokenId);
    }

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return _tokenApprovals[tokenId].value;
    }

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom}
     * for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

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

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

    /**
     * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
     */
    function _isSenderApprovedOrOwner(
        address approvedAddress,
        address owner,
        address msgSender
    ) private pure returns (bool result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, _BITMASK_ADDRESS)
            // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
            msgSender := and(msgSender, _BITMASK_ADDRESS)
            // `msgSender == owner || msgSender == approvedAddress`.
            result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
        }
    }

    /**
     * @dev Returns the storage slot and value for the approved address of `tokenId`.
     */
    function _getApprovedSlotAndAddress(uint256 tokenId)
        private
        view
        returns (uint256 approvedAddressSlot, address approvedAddress)
    {
        TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
        assembly {
            approvedAddressSlot := tokenApproval.slot
            approvedAddress := sload(approvedAddressSlot)
        }
    }

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

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

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

        // The nested ifs save around 20+ gas over a compound boolean condition.
        if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
            if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();

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

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

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

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

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

        emit Transfer(from, to, tokenId);
        _afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement
     * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public payable virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

    /**
     * @dev Hook that is called before a set of serially-ordered token IDs
     * are about to be transferred. This includes minting.
     * And also called before burning one token.
     *
     * `startTokenId` - the first token ID to be transferred.
     * `quantity` - the amount to be transferred.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Hook that is called after a set of serially-ordered token IDs
     * have been transferred. This includes minting.
     * And also called after one token has been burned.
     *
     * `startTokenId` - the first token ID to be transferred.
     * `quantity` - the amount to be transferred.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
     * transferred to `to`.
     * - When `from` is zero, `tokenId` has been minted for `to`.
     * - When `to` is zero, `tokenId` has been burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
     *
     * `from` - Previous owner of the given token ID.
     * `to` - Target address that will receive the token.
     * `tokenId` - Token ID to be transferred.
     * `_data` - Optional data to send along with the call.
     *
     * Returns whether the call correctly returned the expected magic value.
     */
    function _checkContractOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
            bytes4 retval
        ) {
            return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                revert TransferToNonERC721ReceiverImplementer();
            } else {
                assembly {
                    revert(add(32, reason), mload(reason))
                }
            }
        }
    }

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

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

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

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

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

            uint256 toMasked;
            uint256 end = startTokenId + quantity;

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

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

            _currentIndex = end;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * This function is intended for efficient minting only during contract creation.
     *
     * It emits only one {ConsecutiveTransfer} as defined in
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
     * instead of a sequence of {Transfer} event(s).
     *
     * Calling this function outside of contract creation WILL make your contract
     * non-compliant with the ERC721 standard.
     * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
     * {ConsecutiveTransfer} event is only permissible during contract creation.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {ConsecutiveTransfer} event.
     */
    function _mintERC2309(address to, uint256 quantity) internal virtual {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();
        if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);

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

            emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);

            _currentIndex = startTokenId + quantity;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Safely mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement
     * {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
     * - `quantity` must be greater than 0.
     *
     * See {_mint}.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal virtual {
        _mint(to, quantity);

        unchecked {
            if (to.code.length != 0) {
                uint256 end = _currentIndex;
                uint256 index = end - quantity;
                do {
                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (index < end);
                // Reentrancy protection.
                if (_currentIndex != end) revert();
            }
        }
    }

    /**
     * @dev Equivalent to `_safeMint(to, quantity, '')`.
     */
    function _safeMint(address to, uint256 quantity) internal virtual {
        _safeMint(to, quantity, '');
    }

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

    /**
     * @dev Equivalent to `_burn(tokenId, false)`.
     */
    function _burn(uint256 tokenId) internal virtual {
        _burn(tokenId, false);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        address from = address(uint160(prevOwnershipPacked));

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);

        if (approvalCheck) {
            // The nested ifs save around 20+ gas over a compound boolean condition.
            if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
                if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
        }

        _beforeTokenTransfers(from, address(0), tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

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

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

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

        emit Transfer(from, address(0), tokenId);
        _afterTokenTransfers(from, address(0), tokenId, 1);

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

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

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

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

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

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

    /**
     * @dev Returns the message sender (defaults to `msg.sender`).
     *
     * If you are writing GSN compatible contracts, you need to override this function.
     */
    function _msgSenderERC721A() internal view virtual returns (address) {
        return msg.sender;
    }

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

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

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

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

File 5 of 14 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

File 6 of 14 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 7 of 14 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

/**
 * @dev Interface of ERC721A.
 */
interface IERC721A {
    /**
     * The caller must own the token or be an approved operator.
     */
    error ApprovalCallerNotOwnerNorApproved();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    // =============================================================
    //                         TOKEN COUNTERS
    // =============================================================

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() external view returns (uint256);

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);

    // =============================================================
    //                            IERC721
    // =============================================================

    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

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

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

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

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

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

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom}
     * whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;

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

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

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

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

    // =============================================================
    //                        IERC721Metadata
    // =============================================================

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

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

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

    // =============================================================
    //                           IERC2309
    // =============================================================

    /**
     * @dev Emitted when tokens in `fromTokenId` to `toTokenId`
     * (inclusive) is transferred from `from` to `to`, as defined in the
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
     *
     * See {_mintERC2309} for more details.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 9 of 14 : IERCCooldown.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

/// @notice Interface for general carbon removal
/// @dev An interface to retrieve the transfer and mint cooldown rates to assist with carbon removal
interface IERCCooldown {
    
    /// @dev Returns the shares to be used for carbon removal during a paid transfer or purchase
    function transferCooldownRate() external view returns(uint16);

    /// @dev Returns the shares to be used for carbon removal during a mint
    function mintCooldownRate() external view returns(uint16);
}

File 10 of 14 : ERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo;

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

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: invalid receiver");

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(
        uint256 tokenId,
        address receiver,
        uint96 feeNumerator
    ) internal virtual {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}

File 11 of 14 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 13 of 14 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

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

pragma solidity ^0.8.0;

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

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"payee","type":"address"},{"internalType":"uint16","name":"share","type":"uint16"}],"name":"addPayee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"royalty","type":"uint16"},{"internalType":"uint16","name":"transferCoolRate","type":"uint16"},{"internalType":"uint16","name":"mintCoolRate","type":"uint16"}],"name":"adjustCoolRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenID","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"distributeERC20Shares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeShares","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSettings","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint128","name":"","type":"uint128"},{"internalType":"uint128","name":"","type":"uint128"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxMintAmountPerTx","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintCooldownRate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"payee","type":"address"}],"name":"removePayee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"maxMints","type":"uint128"}],"name":"setMaxMintAmountPerTx","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"supply","type":"uint128"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"cost","type":"uint256"}],"name":"setMinCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"pause","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"ownerTokens","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferCooldownRate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"payee","type":"address"},{"internalType":"uint16","name":"share","type":"uint16"}],"name":"updatePayee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080604052600a80546501f401f403e865ffffffffffff19909116179055600c805461ffff19166127101790556611c37937e08000600f557002000000000000000000000000000004326010556011805460ff191660011790553480156200006657600080fd5b506103e86101f48060405180604001604052806008815260200167151c995cd0dbdbdb60c21b815250604051806040016040528060058152602001641510dbdbdb60da1b8152508160029081620000be91906200044d565b506003620000cd82826200044d565b50506000805550620000e183838362000109565b505050620000fe620000f86200024360201b60201c565b62000247565b6001600b5562000519565b8161ffff168361ffff161015620001805760405162461bcd60e51b815260206004820152603060248201527f526f79616c74792063616e6e6f7420626520736574206173206c65737320746860448201526f616e2074686520436f6f6c205261746560801b60648201526084015b60405180910390fd5b61271061ffff82161115620001f15760405162461bcd60e51b815260206004820152603060248201527f4d696e7420436f6f6c20526174652063616e6e6f74206265207365742061732060448201526f686967686572207468616e203130302560801b606482015260840162000177565b600a805465ffffffff000019166201000061ffff8581169190910261ffff60201b191691909117640100000000848316021761ffff19169085169081179091556200023e903090620002a8565b505050565b3390565b600a80546001600160a01b038381166601000000000000818102600160301b600160d01b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6127106001600160601b0382161115620003185760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840162000177565b6001600160a01b038216620003705760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640162000177565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600855565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620003d457607f821691505b602082108103620003f557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200023e57600081815260208120601f850160051c81016020861015620004245750805b601f850160051c820191505b81811015620004455782815560010162000430565b505050505050565b81516001600160401b03811115620004695762000469620003a9565b62000481816200047a8454620003bf565b84620003fb565b602080601f831160018114620004b95760008415620004a05750858301515b600019600386901b1c1916600185901b17855562000445565b600085815260208120601f198616915b82811015620004ea57888601518255948401946001909101908401620004c9565b5085821015620005095787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b612c7180620005296000396000f3fe6080604052600436106102345760003560e01c80635f58267e1161012e57806395d89b41116100ab578063d5abeb011161006f578063d5abeb01146106da578063e0df5b6f146106fa578063e264394f1461071a578063e985e9c514610739578063f2fde38b1461075957600080fd5b806395d89b41146106525780639ce8a55b14610667578063a22cb46514610687578063b88d4fde146106a7578063c87b56dd146106ba57600080fd5b80638462151c116100f25780638462151c1461055657806385b4bb53146105835780638ac068a2146105ce5780638da5cb5b146105ee57806394354fd01461061357600080fd5b80635f58267e146104c15780636352211e146104e157806364e892111461050157806370a0823114610521578063715018a61461054157600080fd5b8063328fc0ed116101bc578063429e384611610180578063429e3846146104265780634553db641461043b578063484b973c1461046b5780635b6a9eb41461048b5780635ee5dac7146104a157600080fd5b8063328fc0ed146103a05780633ed35855146103c057806340c10f19146103e057806342842e0e146103f357806342966c681461040657600080fd5b8063095ea7b311610203578063095ea7b3146102f857806316c38b3c1461030b57806318160ddd1461032b57806323b872dd1461034e5780632a55205a1461036157600080fd5b8063014ad28e1461024957806301ffc9a71461026957806306fdde031461029e578063081812fc146102c057600080fd5b366102445761024234610779565b005b600080fd5b34801561025557600080fd5b506102426102643660046124ea565b610838565b34801561027557600080fd5b50610289610284366004612529565b61085f565b60405190151581526020015b60405180910390f35b3480156102aa57600080fd5b506102b3610870565b6040516102959190612596565b3480156102cc57600080fd5b506102e06102db3660046125a9565b610902565b6040516001600160a01b039091168152602001610295565b6102426103063660046125de565b610946565b34801561031757600080fd5b50610242610326366004612616565b6109e6565b34801561033757600080fd5b50600154600054035b604051908152602001610295565b61024261035c366004612633565b610a01565b34801561036d57600080fd5b5061038161037c36600461266f565b610b92565b604080516001600160a01b039093168352602083019190915201610295565b3480156103ac57600080fd5b506102426103bb3660046126a3565b610c3e565b3480156103cc57600080fd5b506102426103db3660046126d6565b610c50565b6102426103ee3660046125de565b610c64565b610242610401366004612633565b610dce565b34801561041257600080fd5b506102426104213660046125a9565b610de9565b34801561043257600080fd5b50610242610e6d565b34801561044757600080fd5b50600a54640100000000900461ffff165b60405161ffff9091168152602001610295565b34801561047757600080fd5b506102426104863660046125de565b610e91565b34801561049757600080fd5b50610340600f5481565b3480156104ad57600080fd5b506102426104bc3660046126f1565b610ea1565b3480156104cd57600080fd5b506102426104dc3660046126d6565b610eb4565b3480156104ed57600080fd5b506102e06104fc3660046125a9565b610ed7565b34801561050d57600080fd5b5061024261051c3660046125a9565b610ee2565b34801561052d57600080fd5b5061034061053c3660046126d6565b610eef565b34801561054d57600080fd5b50610242610f3e565b34801561056257600080fd5b506105766105713660046126d6565b610f46565b6040516102959190612734565b34801561058f57600080fd5b50610598611047565b604080519586526001600160801b039485166020870152929093169184019190915260608301521515608082015260a001610295565b3480156105da57600080fd5b506102426105e93660046124ea565b61108d565b3480156105fa57600080fd5b50600a54600160301b90046001600160a01b03166102e0565b34801561061f57600080fd5b5060105461063a90600160801b90046001600160801b031681565b6040516001600160801b039091168152602001610295565b34801561065e57600080fd5b506102b36110c0565b34801561067357600080fd5b506102426106823660046126a3565b6110cf565b34801561069357600080fd5b506102426106a2366004612778565b6110e1565b6102426106b536600461283b565b61114d565b3480156106c657600080fd5b506102b36106d53660046125a9565b611197565b3480156106e657600080fd5b5060105461063a906001600160801b031681565b34801561070657600080fd5b506102426107153660046128b7565b61121b565b34801561072657600080fd5b50600a5462010000900461ffff16610458565b34801561074557600080fd5b50610289610754366004612900565b61122f565b34801561076557600080fd5b506102426107743660046126d6565b61125d565b6000610784826112d3565b9050811561083457604051600090739a24124f19e366bdc2d0841abf4a7f6cc8ff82359083908381818185875af1925050503d80600081146107e2576040519150601f19603f3d011682016040523d82523d6000602084013e6107e7565b606091505b50509050806108325760405162461bcd60e51b815260206004820152601260248201527108cc2d2d8cac840e8de40e6cadcc8408aa8960731b60448201526064015b60405180910390fd5b505b5050565b6108406112fc565b601080546001600160801b03928316600160801b029216919091179055565b600061086a8261135e565b92915050565b60606002805461087f9061292a565b80601f01602080910402602001604051908101604052809291908181526020018280546108ab9061292a565b80156108f85780601f106108cd576101008083540402835291602001916108f8565b820191906000526020600020905b8154815290600101906020018083116108db57829003601f168201915b5050505050905090565b600061090d82611383565b61092a576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061095182610ed7565b9050336001600160a01b0382161461098a5761096d813361122f565b61098a576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6109ee6112fc565b6011805460ff1916911515919091179055565b6000610a0c826113aa565b9050836001600160a01b0316816001600160a01b031614610a3f5760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054610a6b8187335b6001600160a01b039081169116811491141790565b610a9657610a79863361122f565b610a9657604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610abd57604051633a954ecd60e21b815260040160405180910390fd5b8015610ac857600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610b5a57600184016000818152600460205260408120549003610b58576000548114610b585760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020612c1c83398151915260405160405180910390a45b505050505050565b60008281526009602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610c075750604080518082019091526008546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610c26906001600160601b031687612974565b610c30919061298b565b915196919550909350505050565b610c466112fc565b6108348282611411565b610c586112fc565b610c61816114e4565b50565b610c6c61158b565b60115460ff1615610cbf5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f74206d696e74207768696c652070617573656400000000000000006044820152606401610829565b600f54610ccc9082612974565b341015610d305760405162461bcd60e51b815260206004820152602c60248201527f4d7573742073656e64206174206c6561737420746865206d696e696d756d206360448201526b37b9ba103a379036b4b73a1760a11b6064820152608401610829565b601054600160801b90046001600160801b0316811115610db15760405162461bcd60e51b815260206004820152603660248201527f43616e6e6f74206d696e74206f766572206d6178696d756d20616c6c6f7765646044820152751036b4b73a39903832b9103a3930b739b0b1ba34b7b760511b6064820152608401610829565b610dba346115e4565b610dc482826115ef565b6108346001600b55565b6108328383836040518060200160405280600081525061114d565b33610df382610ed7565b6001600160a01b031614610e645760405162461bcd60e51b815260206004820152603260248201527f4d73672e73656e646572206d75737420626520746865206f776e6572206f66206044820152713a3432903a37b5b2b7103a3790313ab9371760711b6064820152608401610829565b610c6181611678565b610e756112fc565b610e7d61158b565b610e85611683565b610e8f6001600b55565b565b610e996112fc565b610dba61158b565b610ea96112fc565b6108328383836118ab565b610ebc6112fc565b610ec461158b565b610ecd816118b6565b610c616001600b55565b600061086a826113aa565b610eea6112fc565b600f55565b60006001600160a01b038216610f18576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b610e8f6112fc565b60606000610f5383610eef565b905080600003610f73575050604080516000815260208101909152919050565b60008167ffffffffffffffff811115610f8e57610f8e6127af565b604051908082528060200260200182016040528015610fb7578160200160208202803683370190505b5090506000610fc96001546000540390565b90506000805b8281101561103657866001600160a01b0316610fea82610ed7565b6001600160a01b031603611024578084838151811061100b5761100b6129ad565b602090810291909101015281611020816129c3565b9250505b8061102e816129c3565b915050610fcf565b509195945050505050565b50919050565b600f546010546000918291829182918291906001600160801b03600160801b82048116911661107560005490565b6011549399929850909650945060ff90911692509050565b6110956112fc565b601080546fffffffffffffffffffffffffffffffff19166001600160801b0392909216919091179055565b60606003805461087f9061292a565b6110d76112fc565b6108348282611bd2565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611158848484610a01565b6001600160a01b0383163b156111915761117484848484611d70565b611191576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b60606111a282611383565b6111bf57604051630a14c4b560e41b815260040160405180910390fd5b60006111c9611e5c565b905080516000036111e95760405180602001604052806000815250611214565b806111f384611e6b565b6040516020016112049291906129dc565b6040516020818303038152906040525b9392505050565b6112236112fc565b60126108348282612a51565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6112656112fc565b6001600160a01b0381166112ca5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610829565b610c6181611eaf565b600a5460009061ffff808216916112f291620100009091041684612974565b61086a919061298b565b600a546001600160a01b03600160301b909104163314610e8f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610829565b60006001600160e01b0319821663a737e22b60e01b148061086a575061086a82611f10565b600080548210801561086a575050600090815260046020526040902054600160e01b161590565b6000816000548110156113f85760008181526004602052604081205490600160e01b821690036113f6575b806000036112145750600019016000818152600460205260409020546113d5565b505b604051636f96cda160e11b815260040160405180910390fd5b600061141c83611f45565b600e5490915081106114705760405162461bcd60e51b815260206004820152601d60248201527f506179656520686173206e6f74206265656e206164646564207965742e0000006044820152606401610829565b81600d8281548110611484576114846129ad565b6000918252602090912060108204018054600f9092166002026101000a61ffff818102199093169383160292909217909155600c54166114c2611fac565b61ffff1611156108325760405162461bcd60e51b815260040161082990612b11565b60006114ef82611f45565b600e5490915081106115435760405162461bcd60e51b815260206004820152601d60248201527f506179656520686173206e6f74206265656e206164646564207965742e0000006044820152606401610829565b6000600d8281548110611558576115586129ad565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055505050565b6002600b54036115dd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610829565b6002600b55565b600061078482612011565b6010546001600160801b03168161160560005490565b61160f9190612b56565b111561166e5760405162461bcd60e51b815260206004820152602860248201527f526571756573742065786365656473206d6178696d756d20636f6e74726163746044820152671039bab838363c9760c11b6064820152608401610829565b6108348282612031565b610c6181600061204b565b4760005b600e548110156117fe57600d81815481106116a4576116a46129ad565b60009182526020909120601082040154600f9091166002026101000a900461ffff16156117ec57600c54600d805460009261ffff16918591859081106116ec576116ec6129ad565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff1661171e9190612974565b611728919061298b565b90506000600e838154811061173f5761173f6129ad565b60009182526020822001546040516001600160a01b039091169184919081818185875af1925050503d8060008114611793576040519150601f19603f3d011682016040523d82523d6000602084013e611798565b606091505b50509050806117e95760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f206469737472696275746520746f2070617965652e00006044820152606401610829565b50505b806117f6816129c3565b915050611687565b504715610c6157604051600090339047908381818185875af1925050503d8060008114611847576040519150601f19603f3d011682016040523d82523d6000602084013e61184c565b606091505b50509050806108345760405162461bcd60e51b815260206004820152602560248201527f4661696c656420746f20646973747269627574652072656d61696e696e6720666044820152643ab732399760d91b6064820152608401610829565b61083283838361217a565b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156118ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119239190612b69565b905060005b600e54811015611a7f57600d8181548110611945576119456129ad565b60009182526020909120601082040154600f9091166002026101000a900461ffff1615611a6d57600c54600d805460009261ffff169185918590811061198d5761198d6129ad565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff166119bf9190612974565b6119c9919061298b565b9050836001600160a01b031663a9059cbb600e84815481106119ed576119ed6129ad565b60009182526020909120015460405160e083901b6001600160e01b03191681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015611a46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6a9190612b82565b50505b80611a77816129c3565b915050611928565b506040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aeb9190612b69565b1115610832576040516370a0823160e01b81523060048201526001600160a01b0383169063a9059cbb90339083906370a0823190602401602060405180830381865afa158015611b3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b639190612b69565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611bae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111919190612b82565b600d54600e5414611c375760405162461bcd60e51b815260206004820152602960248201527f506179656520616e6420736861726573206d757374206265207468652073616d60448201526832903632b733ba341760b91b6064820152608401610829565b600c5461ffff1681611c47611fac565b611c519190612b9f565b61ffff161115611c735760405162461bcd60e51b815260040161082990612b11565b600e54611c7f83611f45565b14611ccc5760405162461bcd60e51b815260206004820152601d60248201527f50617965652068617320616c7265616479206265656e2061646465642e0000006044820152606401610829565b600e805460018082019092557fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd0180546001600160a01b0319166001600160a01b039490941693909317909255600d805492830181556000527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb560108304018054600f9093166002026101000a61ffff818102199094169290931692909202179055565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611da5903390899088908890600401612bc1565b6020604051808303816000875af1925050508015611de0575060408051601f3d908101601f19168201909252611ddd91810190612bfe565b60015b611e3e573d808015611e0e576040519150601f19603f3d011682016040523d82523d6000602084013e611e13565b606091505b508051600003611e36576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b60606012805461087f9061292a565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611e855750819003601f19909101908152919050565b600a80546001600160a01b03838116600160301b8181026601000000000000600160d01b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006001600160e01b0319821663152a902d60e11b148061086a57506301ffc9a760e01b6001600160e01b031983161461086a565b6000805b600e54811015611fa257826001600160a01b0316600e8281548110611f7057611f706129ad565b6000918252602090912001546001600160a01b031603611f905792915050565b80611f9a816129c3565b915050611f49565b5050600e54919050565b600080805b600d5481101561104157600d8181548110611fce57611fce6129ad565b90600052602060002090601091828204019190066002029054906101000a900461ffff1682611ffd9190612b9f565b915080612009816129c3565b915050611fb1565b600a54600090612710906112f290640100000000900461ffff1684612974565b6108348282604051806020016040528060008152506122a6565b6000612056836113aa565b90508060008061207486600090815260066020526040902080549091565b9150915084156120b457612089818433610a56565b6120b457612097833361122f565b6120b457604051632ce44b5f60e11b815260040160405180910390fd5b80156120bf57600082555b6001600160a01b038316600081815260056020526040902080546001600160801b030190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b85169003612144576001860160008181526004602052604081205490036121425760005481146121425760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020612c1c833981519152908390a45050600180548101905550505050565b8161ffff168361ffff1610156121eb5760405162461bcd60e51b815260206004820152603060248201527f526f79616c74792063616e6e6f7420626520736574206173206c65737320746860448201526f616e2074686520436f6f6c205261746560801b6064820152608401610829565b61271061ffff8216111561225a5760405162461bcd60e51b815260206004820152603060248201527f4d696e7420436f6f6c20526174652063616e6e6f74206265207365742061732060448201526f686967686572207468616e203130302560801b6064820152608401610829565b600a805465ffffffff000019166201000061ffff8581169190910265ffff00000000191691909117640100000000848316021761ffff1916908516908117909155610832903090612313565b6122b08383612410565b6001600160a01b0383163b15610832576000548281035b6122da6000868380600101945086611d70565b6122f7576040516368d2bf6b60e11b815260040160405180910390fd5b8181106122c757816000541461230c57600080fd5b5050505050565b6127106001600160601b03821611156123815760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610829565b6001600160a01b0382166123d75760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610829565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600855565b60008054908290036124355760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b17831790558284019083908390600080516020612c1c8339815191528180a4600183015b8181146124c05780836000600080516020612c1c833981519152600080a460010161249a565b50816000036124e157604051622e076360e81b815260040160405180910390fd5b60005550610832565b6000602082840312156124fc57600080fd5b81356001600160801b038116811461121457600080fd5b6001600160e01b031981168114610c6157600080fd5b60006020828403121561253b57600080fd5b813561121481612513565b60005b83811015612561578181015183820152602001612549565b50506000910152565b60008151808452612582816020860160208601612546565b601f01601f19169290920160200192915050565b602081526000611214602083018461256a565b6000602082840312156125bb57600080fd5b5035919050565b80356001600160a01b03811681146125d957600080fd5b919050565b600080604083850312156125f157600080fd5b6125fa836125c2565b946020939093013593505050565b8015158114610c6157600080fd5b60006020828403121561262857600080fd5b813561121481612608565b60008060006060848603121561264857600080fd5b612651846125c2565b925061265f602085016125c2565b9150604084013590509250925092565b6000806040838503121561268257600080fd5b50508035926020909101359150565b803561ffff811681146125d957600080fd5b600080604083850312156126b657600080fd5b6126bf836125c2565b91506126cd60208401612691565b90509250929050565b6000602082840312156126e857600080fd5b611214826125c2565b60008060006060848603121561270657600080fd5b61270f84612691565b925061271d60208501612691565b915061272b60408501612691565b90509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561276c57835183529284019291840191600101612750565b50909695505050505050565b6000806040838503121561278b57600080fd5b612794836125c2565b915060208301356127a481612608565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff808411156127e0576127e06127af565b604051601f8501601f19908116603f01168101908282118183101715612808576128086127af565b8160405280935085815286868601111561282157600080fd5b858560208301376000602087830101525050509392505050565b6000806000806080858703121561285157600080fd5b61285a856125c2565b9350612868602086016125c2565b925060408501359150606085013567ffffffffffffffff81111561288b57600080fd5b8501601f8101871361289c57600080fd5b6128ab878235602084016127c5565b91505092959194509250565b6000602082840312156128c957600080fd5b813567ffffffffffffffff8111156128e057600080fd5b8201601f810184136128f157600080fd5b611e54848235602084016127c5565b6000806040838503121561291357600080fd5b61291c836125c2565b91506126cd602084016125c2565b600181811c9082168061293e57607f821691505b60208210810361104157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761086a5761086a61295e565b6000826129a857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b6000600182016129d5576129d561295e565b5060010190565b600083516129ee818460208801612546565b835190830190612a02818360208801612546565b01949350505050565b601f82111561083257600081815260208120601f850160051c81016020861015612a325750805b601f850160051c820191505b81811015610b8a57828155600101612a3e565b815167ffffffffffffffff811115612a6b57612a6b6127af565b612a7f81612a79845461292a565b84612a0b565b602080601f831160018114612ab45760008415612a9c5750858301515b600019600386901b1c1916600185901b178555610b8a565b600085815260208120601f198616915b82811015612ae357888601518255948401946001909101908401612ac4565b5085821015612b015787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526025908201527f43616e6e6f74206f76657261737369676e2073686172652064697374726962756040820152643a34b7b71760d91b606082015260800190565b8082018082111561086a5761086a61295e565b600060208284031215612b7b57600080fd5b5051919050565b600060208284031215612b9457600080fd5b815161121481612608565b61ffff818116838216019080821115612bba57612bba61295e565b5092915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612bf49083018461256a565b9695505050505050565b600060208284031215612c1057600080fd5b81516112148161251356feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122083b0b74d5d00ca53250075b8e93563f7aa64656c99254eb9783f98530f009dc164736f6c63430008110033

Deployed Bytecode

0x6080604052600436106102345760003560e01c80635f58267e1161012e57806395d89b41116100ab578063d5abeb011161006f578063d5abeb01146106da578063e0df5b6f146106fa578063e264394f1461071a578063e985e9c514610739578063f2fde38b1461075957600080fd5b806395d89b41146106525780639ce8a55b14610667578063a22cb46514610687578063b88d4fde146106a7578063c87b56dd146106ba57600080fd5b80638462151c116100f25780638462151c1461055657806385b4bb53146105835780638ac068a2146105ce5780638da5cb5b146105ee57806394354fd01461061357600080fd5b80635f58267e146104c15780636352211e146104e157806364e892111461050157806370a0823114610521578063715018a61461054157600080fd5b8063328fc0ed116101bc578063429e384611610180578063429e3846146104265780634553db641461043b578063484b973c1461046b5780635b6a9eb41461048b5780635ee5dac7146104a157600080fd5b8063328fc0ed146103a05780633ed35855146103c057806340c10f19146103e057806342842e0e146103f357806342966c681461040657600080fd5b8063095ea7b311610203578063095ea7b3146102f857806316c38b3c1461030b57806318160ddd1461032b57806323b872dd1461034e5780632a55205a1461036157600080fd5b8063014ad28e1461024957806301ffc9a71461026957806306fdde031461029e578063081812fc146102c057600080fd5b366102445761024234610779565b005b600080fd5b34801561025557600080fd5b506102426102643660046124ea565b610838565b34801561027557600080fd5b50610289610284366004612529565b61085f565b60405190151581526020015b60405180910390f35b3480156102aa57600080fd5b506102b3610870565b6040516102959190612596565b3480156102cc57600080fd5b506102e06102db3660046125a9565b610902565b6040516001600160a01b039091168152602001610295565b6102426103063660046125de565b610946565b34801561031757600080fd5b50610242610326366004612616565b6109e6565b34801561033757600080fd5b50600154600054035b604051908152602001610295565b61024261035c366004612633565b610a01565b34801561036d57600080fd5b5061038161037c36600461266f565b610b92565b604080516001600160a01b039093168352602083019190915201610295565b3480156103ac57600080fd5b506102426103bb3660046126a3565b610c3e565b3480156103cc57600080fd5b506102426103db3660046126d6565b610c50565b6102426103ee3660046125de565b610c64565b610242610401366004612633565b610dce565b34801561041257600080fd5b506102426104213660046125a9565b610de9565b34801561043257600080fd5b50610242610e6d565b34801561044757600080fd5b50600a54640100000000900461ffff165b60405161ffff9091168152602001610295565b34801561047757600080fd5b506102426104863660046125de565b610e91565b34801561049757600080fd5b50610340600f5481565b3480156104ad57600080fd5b506102426104bc3660046126f1565b610ea1565b3480156104cd57600080fd5b506102426104dc3660046126d6565b610eb4565b3480156104ed57600080fd5b506102e06104fc3660046125a9565b610ed7565b34801561050d57600080fd5b5061024261051c3660046125a9565b610ee2565b34801561052d57600080fd5b5061034061053c3660046126d6565b610eef565b34801561054d57600080fd5b50610242610f3e565b34801561056257600080fd5b506105766105713660046126d6565b610f46565b6040516102959190612734565b34801561058f57600080fd5b50610598611047565b604080519586526001600160801b039485166020870152929093169184019190915260608301521515608082015260a001610295565b3480156105da57600080fd5b506102426105e93660046124ea565b61108d565b3480156105fa57600080fd5b50600a54600160301b90046001600160a01b03166102e0565b34801561061f57600080fd5b5060105461063a90600160801b90046001600160801b031681565b6040516001600160801b039091168152602001610295565b34801561065e57600080fd5b506102b36110c0565b34801561067357600080fd5b506102426106823660046126a3565b6110cf565b34801561069357600080fd5b506102426106a2366004612778565b6110e1565b6102426106b536600461283b565b61114d565b3480156106c657600080fd5b506102b36106d53660046125a9565b611197565b3480156106e657600080fd5b5060105461063a906001600160801b031681565b34801561070657600080fd5b506102426107153660046128b7565b61121b565b34801561072657600080fd5b50600a5462010000900461ffff16610458565b34801561074557600080fd5b50610289610754366004612900565b61122f565b34801561076557600080fd5b506102426107743660046126d6565b61125d565b6000610784826112d3565b9050811561083457604051600090739a24124f19e366bdc2d0841abf4a7f6cc8ff82359083908381818185875af1925050503d80600081146107e2576040519150601f19603f3d011682016040523d82523d6000602084013e6107e7565b606091505b50509050806108325760405162461bcd60e51b815260206004820152601260248201527108cc2d2d8cac840e8de40e6cadcc8408aa8960731b60448201526064015b60405180910390fd5b505b5050565b6108406112fc565b601080546001600160801b03928316600160801b029216919091179055565b600061086a8261135e565b92915050565b60606002805461087f9061292a565b80601f01602080910402602001604051908101604052809291908181526020018280546108ab9061292a565b80156108f85780601f106108cd576101008083540402835291602001916108f8565b820191906000526020600020905b8154815290600101906020018083116108db57829003601f168201915b5050505050905090565b600061090d82611383565b61092a576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b600061095182610ed7565b9050336001600160a01b0382161461098a5761096d813361122f565b61098a576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6109ee6112fc565b6011805460ff1916911515919091179055565b6000610a0c826113aa565b9050836001600160a01b0316816001600160a01b031614610a3f5760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054610a6b8187335b6001600160a01b039081169116811491141790565b610a9657610a79863361122f565b610a9657604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610abd57604051633a954ecd60e21b815260040160405180910390fd5b8015610ac857600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b84169003610b5a57600184016000818152600460205260408120549003610b58576000548114610b585760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b0316600080516020612c1c83398151915260405160405180910390a45b505050505050565b60008281526009602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610c075750604080518082019091526008546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610c26906001600160601b031687612974565b610c30919061298b565b915196919550909350505050565b610c466112fc565b6108348282611411565b610c586112fc565b610c61816114e4565b50565b610c6c61158b565b60115460ff1615610cbf5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f74206d696e74207768696c652070617573656400000000000000006044820152606401610829565b600f54610ccc9082612974565b341015610d305760405162461bcd60e51b815260206004820152602c60248201527f4d7573742073656e64206174206c6561737420746865206d696e696d756d206360448201526b37b9ba103a379036b4b73a1760a11b6064820152608401610829565b601054600160801b90046001600160801b0316811115610db15760405162461bcd60e51b815260206004820152603660248201527f43616e6e6f74206d696e74206f766572206d6178696d756d20616c6c6f7765646044820152751036b4b73a39903832b9103a3930b739b0b1ba34b7b760511b6064820152608401610829565b610dba346115e4565b610dc482826115ef565b6108346001600b55565b6108328383836040518060200160405280600081525061114d565b33610df382610ed7565b6001600160a01b031614610e645760405162461bcd60e51b815260206004820152603260248201527f4d73672e73656e646572206d75737420626520746865206f776e6572206f66206044820152713a3432903a37b5b2b7103a3790313ab9371760711b6064820152608401610829565b610c6181611678565b610e756112fc565b610e7d61158b565b610e85611683565b610e8f6001600b55565b565b610e996112fc565b610dba61158b565b610ea96112fc565b6108328383836118ab565b610ebc6112fc565b610ec461158b565b610ecd816118b6565b610c616001600b55565b600061086a826113aa565b610eea6112fc565b600f55565b60006001600160a01b038216610f18576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b610e8f6112fc565b60606000610f5383610eef565b905080600003610f73575050604080516000815260208101909152919050565b60008167ffffffffffffffff811115610f8e57610f8e6127af565b604051908082528060200260200182016040528015610fb7578160200160208202803683370190505b5090506000610fc96001546000540390565b90506000805b8281101561103657866001600160a01b0316610fea82610ed7565b6001600160a01b031603611024578084838151811061100b5761100b6129ad565b602090810291909101015281611020816129c3565b9250505b8061102e816129c3565b915050610fcf565b509195945050505050565b50919050565b600f546010546000918291829182918291906001600160801b03600160801b82048116911661107560005490565b6011549399929850909650945060ff90911692509050565b6110956112fc565b601080546fffffffffffffffffffffffffffffffff19166001600160801b0392909216919091179055565b60606003805461087f9061292a565b6110d76112fc565b6108348282611bd2565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b611158848484610a01565b6001600160a01b0383163b156111915761117484848484611d70565b611191576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b60606111a282611383565b6111bf57604051630a14c4b560e41b815260040160405180910390fd5b60006111c9611e5c565b905080516000036111e95760405180602001604052806000815250611214565b806111f384611e6b565b6040516020016112049291906129dc565b6040516020818303038152906040525b9392505050565b6112236112fc565b60126108348282612a51565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b6112656112fc565b6001600160a01b0381166112ca5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610829565b610c6181611eaf565b600a5460009061ffff808216916112f291620100009091041684612974565b61086a919061298b565b600a546001600160a01b03600160301b909104163314610e8f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610829565b60006001600160e01b0319821663a737e22b60e01b148061086a575061086a82611f10565b600080548210801561086a575050600090815260046020526040902054600160e01b161590565b6000816000548110156113f85760008181526004602052604081205490600160e01b821690036113f6575b806000036112145750600019016000818152600460205260409020546113d5565b505b604051636f96cda160e11b815260040160405180910390fd5b600061141c83611f45565b600e5490915081106114705760405162461bcd60e51b815260206004820152601d60248201527f506179656520686173206e6f74206265656e206164646564207965742e0000006044820152606401610829565b81600d8281548110611484576114846129ad565b6000918252602090912060108204018054600f9092166002026101000a61ffff818102199093169383160292909217909155600c54166114c2611fac565b61ffff1611156108325760405162461bcd60e51b815260040161082990612b11565b60006114ef82611f45565b600e5490915081106115435760405162461bcd60e51b815260206004820152601d60248201527f506179656520686173206e6f74206265656e206164646564207965742e0000006044820152606401610829565b6000600d8281548110611558576115586129ad565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055505050565b6002600b54036115dd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610829565b6002600b55565b600061078482612011565b6010546001600160801b03168161160560005490565b61160f9190612b56565b111561166e5760405162461bcd60e51b815260206004820152602860248201527f526571756573742065786365656473206d6178696d756d20636f6e74726163746044820152671039bab838363c9760c11b6064820152608401610829565b6108348282612031565b610c6181600061204b565b4760005b600e548110156117fe57600d81815481106116a4576116a46129ad565b60009182526020909120601082040154600f9091166002026101000a900461ffff16156117ec57600c54600d805460009261ffff16918591859081106116ec576116ec6129ad565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff1661171e9190612974565b611728919061298b565b90506000600e838154811061173f5761173f6129ad565b60009182526020822001546040516001600160a01b039091169184919081818185875af1925050503d8060008114611793576040519150601f19603f3d011682016040523d82523d6000602084013e611798565b606091505b50509050806117e95760405162461bcd60e51b815260206004820152601e60248201527f4661696c656420746f206469737472696275746520746f2070617965652e00006044820152606401610829565b50505b806117f6816129c3565b915050611687565b504715610c6157604051600090339047908381818185875af1925050503d8060008114611847576040519150601f19603f3d011682016040523d82523d6000602084013e61184c565b606091505b50509050806108345760405162461bcd60e51b815260206004820152602560248201527f4661696c656420746f20646973747269627574652072656d61696e696e6720666044820152643ab732399760d91b6064820152608401610829565b61083283838361217a565b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156118ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119239190612b69565b905060005b600e54811015611a7f57600d8181548110611945576119456129ad565b60009182526020909120601082040154600f9091166002026101000a900461ffff1615611a6d57600c54600d805460009261ffff169185918590811061198d5761198d6129ad565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff166119bf9190612974565b6119c9919061298b565b9050836001600160a01b031663a9059cbb600e84815481106119ed576119ed6129ad565b60009182526020909120015460405160e083901b6001600160e01b03191681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015611a46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6a9190612b82565b50505b80611a77816129c3565b915050611928565b506040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aeb9190612b69565b1115610832576040516370a0823160e01b81523060048201526001600160a01b0383169063a9059cbb90339083906370a0823190602401602060405180830381865afa158015611b3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b639190612b69565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611bae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111919190612b82565b600d54600e5414611c375760405162461bcd60e51b815260206004820152602960248201527f506179656520616e6420736861726573206d757374206265207468652073616d60448201526832903632b733ba341760b91b6064820152608401610829565b600c5461ffff1681611c47611fac565b611c519190612b9f565b61ffff161115611c735760405162461bcd60e51b815260040161082990612b11565b600e54611c7f83611f45565b14611ccc5760405162461bcd60e51b815260206004820152601d60248201527f50617965652068617320616c7265616479206265656e2061646465642e0000006044820152606401610829565b600e805460018082019092557fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd0180546001600160a01b0319166001600160a01b039490941693909317909255600d805492830181556000527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb560108304018054600f9093166002026101000a61ffff818102199094169290931692909202179055565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611da5903390899088908890600401612bc1565b6020604051808303816000875af1925050508015611de0575060408051601f3d908101601f19168201909252611ddd91810190612bfe565b60015b611e3e573d808015611e0e576040519150601f19603f3d011682016040523d82523d6000602084013e611e13565b606091505b508051600003611e36576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b60606012805461087f9061292a565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a900480611e855750819003601f19909101908152919050565b600a80546001600160a01b03838116600160301b8181026601000000000000600160d01b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006001600160e01b0319821663152a902d60e11b148061086a57506301ffc9a760e01b6001600160e01b031983161461086a565b6000805b600e54811015611fa257826001600160a01b0316600e8281548110611f7057611f706129ad565b6000918252602090912001546001600160a01b031603611f905792915050565b80611f9a816129c3565b915050611f49565b5050600e54919050565b600080805b600d5481101561104157600d8181548110611fce57611fce6129ad565b90600052602060002090601091828204019190066002029054906101000a900461ffff1682611ffd9190612b9f565b915080612009816129c3565b915050611fb1565b600a54600090612710906112f290640100000000900461ffff1684612974565b6108348282604051806020016040528060008152506122a6565b6000612056836113aa565b90508060008061207486600090815260066020526040902080549091565b9150915084156120b457612089818433610a56565b6120b457612097833361122f565b6120b457604051632ce44b5f60e11b815260040160405180910390fd5b80156120bf57600082555b6001600160a01b038316600081815260056020526040902080546001600160801b030190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b85169003612144576001860160008181526004602052604081205490036121425760005481146121425760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020612c1c833981519152908390a45050600180548101905550505050565b8161ffff168361ffff1610156121eb5760405162461bcd60e51b815260206004820152603060248201527f526f79616c74792063616e6e6f7420626520736574206173206c65737320746860448201526f616e2074686520436f6f6c205261746560801b6064820152608401610829565b61271061ffff8216111561225a5760405162461bcd60e51b815260206004820152603060248201527f4d696e7420436f6f6c20526174652063616e6e6f74206265207365742061732060448201526f686967686572207468616e203130302560801b6064820152608401610829565b600a805465ffffffff000019166201000061ffff8581169190910265ffff00000000191691909117640100000000848316021761ffff1916908516908117909155610832903090612313565b6122b08383612410565b6001600160a01b0383163b15610832576000548281035b6122da6000868380600101945086611d70565b6122f7576040516368d2bf6b60e11b815260040160405180910390fd5b8181106122c757816000541461230c57600080fd5b5050505050565b6127106001600160601b03821611156123815760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610829565b6001600160a01b0382166123d75760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610829565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600855565b60008054908290036124355760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b17831790558284019083908390600080516020612c1c8339815191528180a4600183015b8181146124c05780836000600080516020612c1c833981519152600080a460010161249a565b50816000036124e157604051622e076360e81b815260040160405180910390fd5b60005550610832565b6000602082840312156124fc57600080fd5b81356001600160801b038116811461121457600080fd5b6001600160e01b031981168114610c6157600080fd5b60006020828403121561253b57600080fd5b813561121481612513565b60005b83811015612561578181015183820152602001612549565b50506000910152565b60008151808452612582816020860160208601612546565b601f01601f19169290920160200192915050565b602081526000611214602083018461256a565b6000602082840312156125bb57600080fd5b5035919050565b80356001600160a01b03811681146125d957600080fd5b919050565b600080604083850312156125f157600080fd5b6125fa836125c2565b946020939093013593505050565b8015158114610c6157600080fd5b60006020828403121561262857600080fd5b813561121481612608565b60008060006060848603121561264857600080fd5b612651846125c2565b925061265f602085016125c2565b9150604084013590509250925092565b6000806040838503121561268257600080fd5b50508035926020909101359150565b803561ffff811681146125d957600080fd5b600080604083850312156126b657600080fd5b6126bf836125c2565b91506126cd60208401612691565b90509250929050565b6000602082840312156126e857600080fd5b611214826125c2565b60008060006060848603121561270657600080fd5b61270f84612691565b925061271d60208501612691565b915061272b60408501612691565b90509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561276c57835183529284019291840191600101612750565b50909695505050505050565b6000806040838503121561278b57600080fd5b612794836125c2565b915060208301356127a481612608565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff808411156127e0576127e06127af565b604051601f8501601f19908116603f01168101908282118183101715612808576128086127af565b8160405280935085815286868601111561282157600080fd5b858560208301376000602087830101525050509392505050565b6000806000806080858703121561285157600080fd5b61285a856125c2565b9350612868602086016125c2565b925060408501359150606085013567ffffffffffffffff81111561288b57600080fd5b8501601f8101871361289c57600080fd5b6128ab878235602084016127c5565b91505092959194509250565b6000602082840312156128c957600080fd5b813567ffffffffffffffff8111156128e057600080fd5b8201601f810184136128f157600080fd5b611e54848235602084016127c5565b6000806040838503121561291357600080fd5b61291c836125c2565b91506126cd602084016125c2565b600181811c9082168061293e57607f821691505b60208210810361104157634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761086a5761086a61295e565b6000826129a857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b6000600182016129d5576129d561295e565b5060010190565b600083516129ee818460208801612546565b835190830190612a02818360208801612546565b01949350505050565b601f82111561083257600081815260208120601f850160051c81016020861015612a325750805b601f850160051c820191505b81811015610b8a57828155600101612a3e565b815167ffffffffffffffff811115612a6b57612a6b6127af565b612a7f81612a79845461292a565b84612a0b565b602080601f831160018114612ab45760008415612a9c5750858301515b600019600386901b1c1916600185901b178555610b8a565b600085815260208120601f198616915b82811015612ae357888601518255948401946001909101908401612ac4565b5085821015612b015787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526025908201527f43616e6e6f74206f76657261737369676e2073686172652064697374726962756040820152643a34b7b71760d91b606082015260800190565b8082018082111561086a5761086a61295e565b600060208284031215612b7b57600080fd5b5051919050565b600060208284031215612b9457600080fd5b815161121481612608565b61ffff818116838216019080821115612bba57612bba61295e565b5092915050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612bf49083018461256a565b9695505050505050565b600060208284031215612c1057600080fd5b81516112148161251356feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122083b0b74d5d00ca53250075b8e93563f7aa64656c99254eb9783f98530f009dc164736f6c63430008110033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

To celebrate the auspicious occasion of ERC-Cool being deployed to the world wide web, we cordially invite you to participate in the cool-enhancing 'Mint of Intent'. Part POAP, part collective proof of concept, the Tres Cool™ 'All Area Lift Pass" is the first collection create...

Validator Index Block Amount
View All Withdrawals

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

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