ETH Price: $2,387.58 (-1.10%)

Contract

0xCCdAC2D691b0B69a88785E7550FDe9B816004F76
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim Many175955042023-06-30 23:58:59433 days ago1688169539IN
0xCCdAC2D6...816004F76
0 ETH0.0022160316.84069595
Claim Many169274612023-03-28 17:58:47527 days ago1680026327IN
0xCCdAC2D6...816004F76
0 ETH0.0097646825.01380125
Claim Many168732402023-03-21 3:06:47535 days ago1679368007IN
0xCCdAC2D6...816004F76
0 ETH0.0020970815.93675013
Claim Many168254982023-03-14 10:09:23541 days ago1678788563IN
0xCCdAC2D6...816004F76
0 ETH0.0021229818.98693577
Claim Many166687972023-02-20 9:14:11563 days ago1676884451IN
0xCCdAC2D6...816004F76
0 ETH0.0023425421.39390275
Claim Many165082882023-01-28 22:25:35586 days ago1674944735IN
0xCCdAC2D6...816004F76
0 ETH0.0016184814.89386069
Claim Many165065892023-01-28 16:44:11586 days ago1674924251IN
0xCCdAC2D6...816004F76
0 ETH0.0037337215.2616096
Claim Many164834292023-01-25 11:06:35589 days ago1674644795IN
0xCCdAC2D6...816004F76
0 ETH0.0022480414.37948569
Claim Many164687312023-01-23 9:52:59591 days ago1674467579IN
0xCCdAC2D6...816004F76
0 ETH0.0020929714.8139342
Claim Many164578272023-01-21 21:20:23593 days ago1674336023IN
0xCCdAC2D6...816004F76
0 ETH0.0018022516.64098542
Claim Many164578182023-01-21 21:18:35593 days ago1674335915IN
0xCCdAC2D6...816004F76
0 ETH0.002047617.50900151
Claim Many164578132023-01-21 21:17:35593 days ago1674335855IN
0xCCdAC2D6...816004F76
0 ETH0.0027108117.71181977
Claim Many162162742022-12-19 4:12:47627 days ago1671423167IN
0xCCdAC2D6...816004F76
0 ETH0.0019397412.4364761
Claim Many161660382022-12-12 3:47:11634 days ago1670816831IN
0xCCdAC2D6...816004F76
0 ETH0.002477213.16765691
Claim Many161660322022-12-12 3:45:59634 days ago1670816759IN
0xCCdAC2D6...816004F76
0 ETH0.002012313.92530987
Claim Many161180162022-12-05 10:30:11640 days ago1670236211IN
0xCCdAC2D6...816004F76
0 ETH0.0018316912.31902823
Claim Many160316692022-11-23 9:01:59652 days ago1669194119IN
0xCCdAC2D6...816004F76
0 ETH0.001476813.19643864
Claim Many159887662022-11-17 9:12:11658 days ago1668676331IN
0xCCdAC2D6...816004F76
0 ETH0.0024536513.23809513
Claim Many158921492022-11-03 21:23:35672 days ago1667510615IN
0xCCdAC2D6...816004F76
0 ETH0.0031729717.09236776
Claim Many158781312022-11-01 22:22:35674 days ago1667341355IN
0xCCdAC2D6...816004F76
0 ETH0.0013129312.0820909
Claim Many158779412022-11-01 21:44:11674 days ago1667339051IN
0xCCdAC2D6...816004F76
0 ETH0.0013044810.97607793
Claim Many158462192022-10-28 11:20:11678 days ago1666956011IN
0xCCdAC2D6...816004F76
0 ETH0.001307699.49221203
Claim Many157514112022-10-15 5:25:35691 days ago1665811535IN
0xCCdAC2D6...816004F76
0 ETH0.0015678614.0101366
Claim Many157243312022-10-11 10:40:11695 days ago1665484811IN
0xCCdAC2D6...816004F76
0 ETH0.0015316924.62730316
Claim Many157243202022-10-11 10:37:59695 days ago1665484679IN
0xCCdAC2D6...816004F76
0 ETH0.0023255824.52920204
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Staking

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2022-04-14
*/

// Sources flattened with hardhat v2.8.0 https://hardhat.org

// File @openzeppelin/contracts-upgradeable/token/ERC20/[email protected]

// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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);

    /**
     * @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);
}


// File @openzeppelin/contracts-upgradeable/token/ERC20/extensions/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20MetadataUpgradeable is IERC20Upgradeable {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}


// File @openzeppelin/contracts-upgradeable/utils/[email protected]

// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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


// File @openzeppelin/contracts-upgradeable/proxy/utils/[email protected]

// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}


// File @openzeppelin/contracts-upgradeable/utils/[email protected]

// 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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}


// File @openzeppelin/contracts-upgradeable/token/ERC20/[email protected]

// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;




/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC20_init_unchained(name_, symbol_);
    }

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, _allowances[owner][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = _allowances[owner][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

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

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

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

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Spend `amount` form the allowance of `owner` toward `spender`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[45] private __gap;
}


// File @openzeppelin/contracts-upgradeable/access/[email protected]

// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}


// File @openzeppelin/contracts-upgradeable/utils/[email protected]

// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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


// File @openzeppelin/contracts-upgradeable/utils/introspection/[email protected]

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


// File @openzeppelin/contracts-upgradeable/utils/introspection/[email protected]

// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;


/**
 * @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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}


// File @openzeppelin/contracts-upgradeable/access/[email protected]

// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;





/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _msgSender());
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}


// File @openzeppelin/contracts-upgradeable/security/[email protected]

// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;


/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}


// File @openzeppelin/contracts-upgradeable/token/ERC20/extensions/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20PermitUpgradeable {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}


// File @openzeppelin/contracts-upgradeable/utils/cryptography/[email protected]

// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

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


// File @openzeppelin/contracts-upgradeable/utils/cryptography/[email protected]

// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;


/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712Upgradeable is Initializable {
    /* solhint-disable var-name-mixedcase */
    bytes32 private _HASHED_NAME;
    bytes32 private _HASHED_VERSION;
    bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    function __EIP712_init(string memory name, string memory version) internal onlyInitializing {
        __EIP712_init_unchained(name, version);
    }

    function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev The hash of the name parameter for the EIP712 domain.
     *
     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
     * are a concern.
     */
    function _EIP712NameHash() internal virtual view returns (bytes32) {
        return _HASHED_NAME;
    }

    /**
     * @dev The hash of the version parameter for the EIP712 domain.
     *
     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
     * are a concern.
     */
    function _EIP712VersionHash() internal virtual view returns (bytes32) {
        return _HASHED_VERSION;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}


// File @openzeppelin/contracts-upgradeable/utils/[email protected]

// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

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

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

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

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

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


// File @openzeppelin/contracts-upgradeable/token/ERC20/extensions/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-ERC20Permit.sol)

pragma solidity ^0.8.0;






/**
 * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * _Available since v3.4._
 */
abstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {
    using CountersUpgradeable for CountersUpgradeable.Counter;

    mapping(address => CountersUpgradeable.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private _PERMIT_TYPEHASH;

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    function __ERC20Permit_init(string memory name) internal onlyInitializing {
        __EIP712_init_unchained(name, "1");
        __ERC20Permit_init_unchained(name);
    }

    function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {
        _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");}

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));

        bytes32 hash = _hashTypedDataV4(structHash);

        address signer = ECDSAUpgradeable.recover(hash, v, r, s);
        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) public view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view override returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        CountersUpgradeable.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}


// File contracts/interfaces/IDIAMOND.sol


pragma solidity ^0.8.0;

interface IDIAMOND {
    function mint(address to, uint256 amount) external;
    function burn(address from, uint256 amount) external;
}


// File contracts/DIAMOND.sol

pragma solidity ^0.8.4;






contract DIAMOND is Initializable, ERC20Upgradeable, AccessControlUpgradeable, PausableUpgradeable, ERC20PermitUpgradeable, IDIAMOND {
    bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer {}

    function initialize() initializer public {
        __ERC20_init("DIAMOND", "DIAMOND");
        __AccessControl_init();
        __Pausable_init();
        __ERC20Permit_init("DIAMOND");

        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(PAUSER_ROLE, msg.sender);
        _grantRole(MINTER_ROLE, msg.sender);
        _grantRole(BURNER_ROLE, msg.sender);
    }

    function pause() public onlyRole(PAUSER_ROLE) {
        _pause();
    }

    function unpause() public onlyRole(PAUSER_ROLE) {
        _unpause();
    }

    function mint(address to, uint256 amount) external override onlyRole(MINTER_ROLE) {
        _mint(to, amount);
    }

    function burn(address to, uint256 amount) external override onlyRole(BURNER_ROLE) {
        _burn(to, amount);
    }

    function _beforeTokenTransfer(address from, address to, uint256 amount)
        internal
        whenNotPaused
        override
    {
        super._beforeTokenTransfer(from, to, amount);
    }
}


// File @openzeppelin/contracts/utils/cryptography/[email protected]

// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

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

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = _efficientHash(computedHash, proofElement);
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = _efficientHash(proofElement, computedHash);
            }
        }
        return computedHash;
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}


// File @openzeppelin/contracts-upgradeable/access/[email protected]

// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;


/**
 * @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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

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

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}


// File @openzeppelin/contracts-upgradeable/security/[email protected]

// OpenZeppelin Contracts v4.4.1 (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 ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}


// File @openzeppelin/contracts-upgradeable/token/ERC721/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @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
    ) external;

    /**
     * @dev Transfers `tokenId` token 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;

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

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

    /**
     * @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 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);

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


// File @openzeppelin/contracts-upgradeable/token/ERC721/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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


// File @openzeppelin/contracts-upgradeable/token/ERC721/extensions/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

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

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

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


// File contracts/interfaces/ERC721AUpgradeable.sol

// Creator: Chiru Labs

pragma solidity ^0.8.4;








error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerQueryForNonexistentToken();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 0, e.g. 0, 1, 2, 3..).
 *
 * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 *
 * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721AUpgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable for uint256;

    // Compiler will pack this into a single 256bit word.
    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Keeps track of the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
    }

    // Compiler will pack this into a single 256bit word.
    struct AddressData {
        // Realistically, 2**64-1 is more than enough.
        uint64 balance;
        // Keeps track of mint count with minimal overhead for tokenomics.
        uint64 numberMinted;
        // Keeps track of burn count with minimal overhead for tokenomics.
        uint64 numberBurned;
        // For miscellaneous variable(s) pertaining to the address
        // (e.g. number of whitelist mint slots used).
        // If there are multiple variables, please pack them into a uint64.
        uint64 aux;
    }

    // The tokenId of the next token to be minted.
    uint256 internal _currentIndex;

    // The number of tokens burned.
    uint256 internal _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 _ownershipOf implementation for details.
    mapping(uint256 => TokenOwnership) internal _ownerships;

    // Mapping owner address to address data
    mapping(address => AddressData) private _addressData;

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

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

    function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721A_init_unchained(name_, symbol_);
    }

    function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
        _currentIndex = _startTokenId();
    }

    /**
     * To change the starting tokenId, please override this function.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 1;
    }

    /**
     * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
     */
    function totalSupply() public view returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than _currentIndex - _startTokenId() times
        unchecked {
            return _currentIndex - _burnCounter - _startTokenId();
        }
    }

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

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return uint256(_addressData[owner].balance);
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return uint256(_addressData[owner].numberMinted);
    }

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

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

    /**
     * Sets the auxillary 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 {
        _addressData[owner].aux = aux;
    }

    /**
     * Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around in the collection over time.
     */
    function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
        uint256 curr = tokenId;

        unchecked {
            if (_startTokenId() <= curr && curr < _currentIndex) {
                TokenOwnership memory ownership = _ownerships[curr];
                if (!ownership.burned) {
                    if (ownership.addr != address(0)) {
                        return ownership;
                    }
                    // Invariant:
                    // There will always be an ownership that has an address and is not burned
                    // before an ownership that does not have an address and is not burned.
                    // Hence, curr will not underflow.
                    while (true) {
                        curr--;
                        ownership = _ownerships[curr];
                        if (ownership.addr != address(0)) {
                            return ownership;
                        }
                    }
                }
            }
        }
        revert OwnerQueryForNonexistentToken();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return _ownershipOf(tokenId).addr;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    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, tokenId.toString())) : '';
    }

    /**
     * @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, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return '';
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public override {
        address owner = ERC721AUpgradeable.ownerOf(tokenId);
        if (to == owner) revert ApprovalToCurrentOwner();

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

        _approve(to, tokenId, owner);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        if (operator == _msgSender()) revert ApproveToCaller();

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        _transfer(from, to, tokenId);
        if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) {
            revert TransferToNonERC721ReceiverImplementer();
        }
    }

    /**
     * @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 (`_mint`),
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return _startTokenId() <= tokenId && tokenId < _currentIndex && !_ownerships[tokenId].burned;
    }

    function _safeMint(address to, uint256 quantity) internal {
        _safeMint(to, 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.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal {
        _mint(to, quantity, _data, true);
    }

    /**
     * @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.
     */
    function _mint(
        address to,
        uint256 quantity,
        bytes memory _data,
        bool safe
    ) internal {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();

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

        // Overflows are incredibly unrealistic.
        // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
        // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
        unchecked {
            _addressData[to].balance += uint64(quantity);
            _addressData[to].numberMinted += uint64(quantity);

            _ownerships[startTokenId].addr = to;
            _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);

            uint256 updatedIndex = startTokenId;
            uint256 end = updatedIndex + quantity;

            if (safe && to.isContract()) {
                do {
                    emit Transfer(address(0), to, updatedIndex);
                    if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (updatedIndex != end);
                // Reentrancy protection
                if (_currentIndex != startTokenId) revert();
            } else {
                do {
                    emit Transfer(address(0), to, updatedIndex++);
                } while (updatedIndex != end);
            }
            _currentIndex = updatedIndex;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }


    /**
     * @dev Equivalent to _mint(to, quantity, '', false).
     */
    function _mint(address to, uint256 quantity) internal {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();

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

        // Overflows are incredibly unrealistic.
        // balance or numberMinted overflow if current value of either + quantity > 1.8e19 (2**64) - 1
        // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 1
        unchecked {
            _addressData[to].balance += uint64(quantity);
            _addressData[to].numberMinted += uint64(quantity);

            _ownerships[startTokenId].addr = to;
            _ownerships[startTokenId].startTimestamp = uint64(block.timestamp);

            uint256 updatedIndex = startTokenId;
            uint256 end = updatedIndex + quantity;

            do {
                emit Transfer(address(0), to, updatedIndex++);
            } while (updatedIndex != end);

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) private {
        TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

        if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();

        bool isApprovedOrOwner = (_msgSender() == from ||
            isApprovedForAll(from, _msgSender()) ||
            getApproved(tokenId) == _msgSender());

        if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        if (to == address(0)) revert TransferToZeroAddress();

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId, from);

        // 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 {
            _addressData[from].balance -= 1;
            _addressData[to].balance += 1;

            TokenOwnership storage currSlot = _ownerships[tokenId];
            currSlot.addr = to;
            currSlot.startTimestamp = uint64(block.timestamp);

            // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it.
            // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
            uint256 nextTokenId = tokenId + 1;
            TokenOwnership storage nextSlot = _ownerships[nextTokenId];
            if (nextSlot.addr == address(0)) {
                // This will suffice for checking _exists(nextTokenId),
                // as a burned slot cannot contain the zero address.
                if (nextTokenId != _currentIndex) {
                    nextSlot.addr = from;
                    nextSlot.startTimestamp = prevOwnership.startTimestamp;
                }
            }
        }

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

    /**
     * @dev This is 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 {
        TokenOwnership memory prevOwnership = _ownershipOf(tokenId);

        address from = prevOwnership.addr;

        if (approvalCheck) {
            bool isApprovedOrOwner = (_msgSender() == from ||
                isApprovedForAll(from, _msgSender()) ||
                getApproved(tokenId) == _msgSender());

            if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
        }

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

        // Clear approvals from the previous owner
        _approve(address(0), tokenId, from);

        // 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 {
            AddressData storage addressData = _addressData[from];
            addressData.balance -= 1;
            addressData.numberBurned += 1;

            // Keep track of who burned the token, and the timestamp of burning.
            TokenOwnership storage currSlot = _ownerships[tokenId];
            currSlot.addr = from;
            currSlot.startTimestamp = uint64(block.timestamp);
            currSlot.burned = true;

            // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it.
            // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls.
            uint256 nextTokenId = tokenId + 1;
            TokenOwnership storage nextSlot = _ownerships[nextTokenId];
            if (nextSlot.addr == address(0)) {
                // This will suffice for checking _exists(nextTokenId),
                // as a burned slot cannot contain the zero address.
                if (nextTokenId != _currentIndex) {
                    nextSlot.addr = from;
                    nextSlot.startTimestamp = prevOwnership.startTimestamp;
                }
            }
        }

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

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

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(
        address to,
        uint256 tokenId,
        address owner
    ) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }

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

    /**
     * @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 Returns the tokenIds of the address. O(totalSupply) in complexity.
    function tokensOfOwner(address owner) external view returns (uint256[] memory) {
        unchecked {
            uint256[] memory a = new uint256[](balanceOf(owner)); 
            uint256 end = _currentIndex;
            uint256 tokenIdsIdx;
            address currOwnershipAddr;
            for (uint256 i; i < end; i++) {
                TokenOwnership memory ownership = _ownerships[i];
                if (ownership.burned) {
                    continue;
                }
                if (ownership.addr != address(0)) {
                    currOwnershipAddr = ownership.addr;
                }
                if (currOwnershipAddr == owner) {
                    a[tokenIdsIdx++] = i;
                }
            }
            return a;    
        }
    }


    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[42] private __gap;
}


// File contracts/interfaces/IDiamondHeist.sol


pragma solidity ^0.8.0;


interface IDiamondHeist is IERC721Upgradeable, IERC721MetadataUpgradeable {

  // struct to store each token's traits
  struct LlamaDog {
    bool isLlama;
    uint8 body;
    uint8 hat;
    uint8 eye;
    uint8 mouth;
    uint8 clothes;
    uint8 tail;
    uint8 alphaIndex;
  }

  function getPaidTokens() external view returns (uint256);
  function getTokenTraits(uint256 tokenId) external view returns (LlamaDog memory);
  function isLlama(uint256 tokenId) external view returns(bool);
}


// File contracts/interfaces/IStaking.sol


pragma solidity ^0.8.0;

interface IStaking {
  function addManyToStaking(address account, uint16[] calldata tokenIds) external;
}


// File contracts/interfaces/ITraits.sol


pragma solidity ^0.8.0;

interface ITraits {
  function tokenURI(uint256 tokenId) external view returns (string memory);
}


// File contracts/DiamondHeist.sol


/**
       .     '     ,      '     ,     .     '   .    
      _________        _________       _________    
   _ /_|_____|_\ _  _ /_|_____|_\ _ _ /_|_____|_\ _ 
     '. \   / .'      '. \   / .'     '. \   / .'   
       '.\ /.'          '.\ /.'         '.\ /.'     
         '.'              '.'             '.'
 
 ██████╗ ██╗ █████╗ ███╗   ███╗ ██████╗ ███╗   ██╗██████╗  
 ██╔══██╗██║██╔══██╗████╗ ████║██╔═══██╗████╗  ██║██╔══██╗ 
 ██║  ██║██║███████║██╔████╔██║██║   ██║██╔██╗ ██║██║  ██║ 
 ██║  ██║██║██╔══██║██║╚██╔╝██║██║   ██║██║╚██╗██║██║  ██║ 
 ██████╔╝██║██║  ██║██║ ╚═╝ ██║╚██████╔╝██║ ╚████║██████╔╝ 
 ╚═════╝ ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝ ╚═════╝ ╚═╝  ╚═══╝╚═════╝  
           ██╗  ██╗███████╗██╗███████╗████████╗
           ██║  ██║██╔════╝██║██╔════╝╚══██╔══╝   <'l    
      __   ███████║█████╗  ██║███████╗   ██║       ll    
 (___()'`; ██╔══██║██╔══╝  ██║╚════██║   ██║       llama~
 /,    /`  ██║  ██║███████╗██║███████║   ██║       || || 
 \\"--\\   ╚═╝  ╚═╝╚══════╝╚═╝╚══════╝   ╚═╝       '' '' 

*/

pragma solidity ^0.8.0;









contract DiamondHeist is
    ERC721AUpgradeable,
    IDiamondHeist,
    OwnableUpgradeable,
    PausableUpgradeable,
    ReentrancyGuardUpgradeable
{
    event LlamaMinted(uint256 indexed tokenId);
    event DogMinted(uint256 indexed tokenId);
    event LlamaBurned(uint256 indexed tokenId);
    event DogBurned(uint256 indexed tokenId);

    // max number of tokens that can be minted - 37,500 in production
    uint256 public constant MAX_TOKENS = 37500;
    // number of tokens that can be claimed for a fee - 20% of MAX_TOKENS
    uint256 public PAID_TOKENS;

    uint256 public MINT_PRICE;

    // whitelist, 10 mints, get a discount, 1 free
    uint16 public constant MAX_COMMUNITY_AMOUNT = 5;
    uint256 public COMMUNITY_SALE_MINT_PRICE;
    bytes32 public whitelistMerkleRoot;
    mapping(address => uint256) public claimed;

    // mapping from tokenId to a struct containing the token's traits
    mapping(uint256 => LlamaDog) public tokenTraits;
    // mapping from hashed(tokenTrait) to the tokenId it's associated with
    // used to ensure there are no duplicates
    mapping(uint256 => uint256) public existingCombinations;

    // list of probabilities for each trait type
    uint8[][14] public rarities;
    // list of aliases for Walker's Alias algorithm
    uint8[][14] public aliases;

    // reference to the Staking for choosing random Dog thieves
    IStaking public staking;
    // reference to $DIAMOND for burning on mint
    IDIAMOND public diamond;
    // reference to Traits
    ITraits public traits;

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer {}

    function initialize() initializer public {
        __ERC721A_init("Diamond Heist", "DIAMONDHEIST");
        __Pausable_init();
        __Ownable_init();
        __ReentrancyGuard_init();
        _pause();

        PAID_TOKENS = 7500;
        MINT_PRICE = .06 ether;
        COMMUNITY_SALE_MINT_PRICE = .04 ether;

        // Llama/Body
        rarities[0] = [255, 61, 122, 30, 183, 224, 142, 30, 214, 173, 214, 122];
        aliases[0] = [0, 0, 0, 7, 7, 0, 5, 6, 7, 8, 8, 9];
        
        // Llama/Hat
        rarities[1] = [114, 254, 191, 152, 242, 152, 191, 229, 242, 114, 254, 76, 76, 203, 191];
        aliases[1] = [6, 0, 6, 6, 1, 6, 4, 6, 6, 6, 8, 6, 8, 10, 13];
        
        // Llama/Eye
        rarities[2] = [165, 66, 198, 255, 165, 211, 168, 165, 107, 99, 186, 175, 165];
        aliases[2] = [6, 6, 6, 0, 6, 3, 5, 6, 6, 8, 8, 10, 11];
        
        // Llama/Mouth
        rarities[3] = [140, 224, 28, 112, 112, 112, 254, 229, 160, 221, 140];
        aliases[3] = [7, 7, 7, 7, 7, 8, 0, 6, 7, 8, 9];
        
        // Llama/Clothes
        rarities[4] = [229, 254, 191, 216, 127, 152, 152, 165, 76, 114, 254, 152, 203, 76, 191];
        aliases[4] = [1, 0, 1, 2, 3, 2, 2, 4, 2, 4, 7, 4, 10, 7, 12];
        
        // Llama/Tail
        rarities[5] = [127, 255, 127, 127, 229, 102, 255, 255, 178, 51];
        aliases[5] = [7, 0, 7, 7, 7, 7, 0, 0, 7, 8];
        
        // Llama/alphaIndex
        rarities[6] = [255];
        aliases[6] = [0];
        
        // Dog/Body
        rarities[7] = [140, 254, 28, 224, 56, 181, 244, 84, 219, 28, 193];
        aliases[7] = [1, 0, 1, 1, 5, 1, 5, 5, 6, 10, 8];
        
        // Dog/Hat
        rarities[8] = [99, 165, 255, 178, 33, 232, 102, 33, 198, 232, 209, 198, 132];
        aliases[8] = [6, 6, 0, 2, 6, 6, 3, 6, 6, 6, 6, 6, 10];
        
        // Dog/Eye
        rarities[9] = [254, 30, 224, 153, 203, 30, 153, 214, 91, 91, 214, 153];
        aliases[9] = [0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 4];
        
        // Dog/Mouth
        rarities[10] = [254, 122, 61, 30, 61, 122, 142, 91, 91, 183, 244, 244];
        aliases[10] = [0, 0, 0, 0, 8, 8, 0, 9, 6, 8, 9, 9];
        
        // Dog/Clothes
        rarities[11] = [254, 107, 107, 35, 152, 198, 35, 107, 117, 132, 107, 107, 107, 107];
        aliases[11] = [0, 4, 5, 5, 0, 4, 5, 5, 5, 8, 8, 8, 9, 9];
        
        // Dog/Tail
        rarities[12] = [140, 254, 84, 84, 84, 203, 140, 196, 196, 140, 140];
        aliases[12] = [1, 0, 5, 5, 5, 1, 5, 5, 5, 5, 5];
        
        // Dog/alphaIndex
        rarities[13] = [254, 101, 153, 51];
        aliases[13] = [0, 0, 0, 1];
    }

    modifier requireContractsSet() {
        require(
            address(traits) != address(0) && address(staking) != address(0),
            "Contracts not set"
        );
        _;
    }

    function setContracts(ITraits _traits, IStaking _staking, IDIAMOND _diamond)
        external
        onlyOwner
    {
        traits = _traits;
        staking = _staking;
        diamond = _diamond;
    }

    function setWhiteListMerkleRoot(bytes32 _root) external onlyOwner {
        whitelistMerkleRoot = _root;
    }

    modifier isValidMerkleProof(bytes32[] memory proof) {
        require(
            MerkleProof.verify(
                proof,
                whitelistMerkleRoot,
                bytes32(uint256(uint160(_msgSender())))
            ),
            "INVALID_MERKLE_PROOF"
        );
        _;
    }

    /** EXTERNAL */
    /**
     * Returns the total amount of tokens minted in the contract.
     */
    function minted() external view returns (uint256) {
        return _totalMinted();
    }

    function communitySaleLeft(bytes32[] memory merkleProof)
        external
        view
        isValidMerkleProof(merkleProof)
        returns (uint256)
    {
        if (_totalMinted() >= PAID_TOKENS) return 0;
        return MAX_COMMUNITY_AMOUNT - claimed[_msgSender()];
    }

    /**
     * mint a token - 90% Llama, 10% Dog
     * The first 20% are free to claim, the remaining cost $DIAMOND
     */
    function mintGame(uint256 amount, bool stake)
        internal
        whenNotPaused
        nonReentrant
        returns (uint16[] memory tokenIds)
    {
        require(tx.origin == _msgSender(), "ONLY_EOA");
        require(_totalMinted() + amount <= MAX_TOKENS, "MINT_ENDED");
        require(amount > 0 && amount <= 15, "MINT_AMOUNT_INVALID");

        uint256 totalDiamondCost = 0;
        tokenIds = new uint16[](amount);
        
        uint16 token = uint16(_totalMinted());
        for (uint256 i = 0; i < amount; i++) {
            token++;
            generate(token, random(token));
            tokenIds[i] = token;
            totalDiamondCost += mintCost(token);
        }

        if (totalDiamondCost > 0) diamond.burn(_msgSender(), totalDiamondCost);

        _mint(stake ? address(staking) : _msgSender(), amount, "", false);
        if (stake) staking.addManyToStaking(_msgSender(), tokenIds);

        return tokenIds;
    }

    /**
     * mint a token - 90% Llama, 10% Dog
     * The first 20% are free to claim, the remaining cost $DIAMOND
     */
    function mint(uint256 amount, bool stake) external payable {
        if (_totalMinted() < PAID_TOKENS) {
            // we have to still pay in ETH, we can make a transaction that pays both in ETH and DIAMOND
            // check how many tokens should be paid in ETH, the DIAMOND will be burned in mintGame function
            require(msg.value == (amount > (PAID_TOKENS - _totalMinted()) ? (PAID_TOKENS - _totalMinted()) : amount) * MINT_PRICE, "MINT_PAID_PRICE_INVALID");
        } else {
            require(msg.value == 0, "MINT_PAID_IN_DIAMONDS");
        }
        mintGame(amount, stake);
    }

    function mintCommunitySale(
        bytes32[] memory merkleProof,
        uint256 amount,
        bool stake
    ) external payable isValidMerkleProof(merkleProof) {
        require(
            claimed[_msgSender()] + amount <= MAX_COMMUNITY_AMOUNT,
            "MINT_COMMUNITY_ENDED"
        );
        require(_totalMinted() + amount <= PAID_TOKENS, "MINT_ENDED");
        require(msg.value == COMMUNITY_SALE_MINT_PRICE * (claimed[_msgSender()] == 0 ? amount - 1 : amount), "MINT_COMMUNITY_PRICE_INVALID");
        claimed[_msgSender()] += amount;
        mintGame(amount, stake);
    }

    /**
     * 0 - 20% = eth
     * 20 - 40% = 200 DIAMONDS
     * 40 - 60% = 300 DIAMONDS
     * 60 - 80% = 400 DIAMONDS
     * 80 - 100% = 500 DIAMONDS
     * @param tokenId the ID to check the cost of to mint
     * @return the cost of the given token ID
     */
    function mintCost(uint256 tokenId) public view returns (uint256) {
        if (tokenId <= PAID_TOKENS) return 0; // 1 / 5 = PAID_TOKENS
        if (tokenId <= (MAX_TOKENS * 2) / 5) return 200 ether;
        if (tokenId <= (MAX_TOKENS * 3) / 5) return 300 ether;
        if (tokenId <= (MAX_TOKENS * 4) / 5) return 400 ether;
        return 500 ether;
    }

    function isApprovedForAll(address owner, address operator) public view override(ERC721AUpgradeable, IERC721Upgradeable) returns (bool) {
        return (address(staking) == operator || ERC721AUpgradeable.isApprovedForAll(owner, operator));
    }

    /** INTERNAL */

    /**
     * generates traits for a specific token, checking to make sure it's unique
     * @param tokenId the id of the token to generate traits for
     * @param seed a pseudorandom 256 bit number to derive traits from
     * @return t - a struct of traits for the given token ID
     */
    function generate(uint256 tokenId, uint256 seed)
        internal
        returns (LlamaDog memory t)
    {
        t = selectTraits(tokenId, seed);
        if (existingCombinations[structToHash(t)] == 0) {
            tokenTraits[tokenId] = t;
            existingCombinations[structToHash(t)] = tokenId;
            if (t.isLlama) {
                emit LlamaMinted(tokenId);
            } else {
                emit DogMinted(tokenId);
            }
            return t;
        }
        return generate(tokenId, random(seed));
    }

    /**
     * uses A.J. Walker's Alias algorithm for O(1) rarity table lookup
     * ensuring O(1) instead of O(n) reduces mint cost by more than 50%
     * probability & alias tables are generated off-chain beforehand
     * @param seed portion of the 256 bit seed to remove trait correlation
     * @param traitType the trait type to select a trait for
     * @return the ID of the randomly selected trait
     */
    function selectTrait(uint16 seed, uint8 traitType)
        internal
        view
        returns (uint8)
    {
        uint8 trait = uint8(seed) % uint8(rarities[traitType].length);
        // If a selected random trait probability is selected (biased coin) return that trait
        if (seed >> 8 <= rarities[traitType][trait]) return trait;
        return aliases[traitType][trait];
    }

    /**
     * selects the species and all of its traits based on the seed value
     * @param seed a pseudorandom 256 bit number to derive traits from
     * @return t -  a struct of randomly selected traits
     */
    function selectTraits(uint256 tokenId, uint256 seed)
        internal
        view
        returns (LlamaDog memory t)
    {
        // if tokenId < PAID_TOKENS, 2 in 10 chance of a dog, otherwise 1 in 10 chance of a dog
        t.isLlama = tokenId < PAID_TOKENS ? (seed & 0xFFFF) % 10 < 9 : (seed & 0xFFFF) % 10 < 1;
        uint8 shift = t.isLlama ? 0 : 7;

        // what happens here is that we check the 16 least signficial bits of the seed
        // and then remove them from the seed, so that the next 16 bits are used for the next trait
        // Before: EBD302F8B72AB0883F98D59C3BB7C25C61E30A77AB5F93924D234A620A32
        // After:  EBD302F8B72AB0883F98D59C3BB7C25C61E30A77AB5F93924D234A62
        // trait 1: 0A32 -> 00001010 00110010
        seed >>= 16;
        t.body = selectTrait(uint16(seed & 0xFFFF), 0 + shift);
        seed >>= 16;
        t.hat = selectTrait(uint16(seed & 0xFFFF), 1 + shift);
        seed >>= 16;
        t.eye = selectTrait(uint16(seed & 0xFFFF), 2 + shift);
        seed >>= 16;
        t.mouth = selectTrait(uint16(seed & 0xFFFF), 3 + shift);
        seed >>= 16;
        t.clothes = selectTrait(uint16(seed & 0xFFFF), 4 + shift);
        seed >>= 16;
        t.tail = selectTrait(uint16(seed & 0xFFFF), 5 + shift);
        seed >>= 16;
        t.alphaIndex = selectTrait(uint16(seed & 0xFFFF), 6 + shift);
    }

    /**
     * converts a struct to a 256 bit hash to check for uniqueness
     * @param s the struct to pack into a hash
     * @return the 256 bit hash of the struct
     */
    function structToHash(LlamaDog memory s) internal pure returns (uint256) {
        return
            uint256(
                bytes32(
                    abi.encodePacked(
                        s.isLlama,
                        s.body,
                        s.hat,
                        s.eye,
                        s.mouth,
                        s.clothes,
                        s.tail,
                        s.alphaIndex
                    )
                )
            );
    }

    /**
     * generates a pseudorandom number
     * @param seed a value ensure different outcomes for different sources in the same block
     * @return a pseudorandom value
     */
    function random(uint256 seed) internal view returns (uint256) {
        return
            uint256(
                keccak256(
                    abi.encodePacked(
                        tx.origin,
                        blockhash(block.number - 1),
                        block.timestamp,
                        seed
                    )
                )
            );
    }

    /** READ */

    function getTokenTraits(uint256 tokenId)
        external
        view
        override
        returns (LlamaDog memory)
    {
        require(
            _exists(tokenId),
            "ERC721Metadata: token traits query for nonexistent token"
        );
        return tokenTraits[tokenId];
    }

    function getPaidTokens() external view override returns (uint256) {
        return PAID_TOKENS;
    }

    /**
     * checks if a token is a Wizards
     * @param tokenId the ID of the token to check
     * @return wizard - whether or not a token is a Wizards
     */
    function isLlama(uint256 tokenId)
        external
        view
        override
        returns (bool)
    {
        IDiamondHeist.LlamaDog memory s = tokenTraits[tokenId];
        return s.isLlama;
    }

    /** ADMIN */
    /**
     * allows owner to withdraw funds from minting
     */
    function withdraw() external onlyOwner {
        payable(owner()).transfer(address(this).balance);
    }

    /**
     * updates the number of tokens for sale
     */
    function setPaidTokens(uint256 _paidTokens) external onlyOwner {
        PAID_TOKENS = _paidTokens;
    }

    /**
     * updates the mint price
     */
    function setMintPrice(uint256 _mintPrice) external onlyOwner {
        MINT_PRICE = _mintPrice;
        COMMUNITY_SALE_MINT_PRICE = _mintPrice / 4 * 3;
    }

    /**
     * enables owner to pause / unpause minting
     */
    function setPaused(bool _paused) external requireContractsSet onlyOwner {
        if (_paused) _pause();
        else _unpause();
    }

    /** RENDER */

    function tokenURI(uint256 tokenId)
        public
        view
        override(ERC721AUpgradeable, IERC721MetadataUpgradeable)
        returns (string memory)
    {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
        return traits.tokenURI(tokenId);
    }
}


// File @openzeppelin/contracts/utils/[email protected]

// 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 @openzeppelin/contracts/access/[email protected]

// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

/**
 * @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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _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 @openzeppelin/contracts/token/ERC721/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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


// File @openzeppelin/contracts/security/[email protected]

// OpenZeppelin Contracts v4.4.1 (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() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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


// File @openzeppelin/contracts/security/[email protected]

// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}


// File contracts/Staking.sol


pragma solidity ^0.8.0;






contract Staking is IStaking, Ownable, ReentrancyGuard, IERC721Receiver, Pausable {
  // maximum alpha score for a Dog
  uint8 public constant MAX_ALPHA = 8;

  // struct to store a stake's token, owner, and earning values
  struct Stake {
    uint16 tokenId;
    uint80 value;
    address owner;
  }

  uint256 private totalAlphaStaked;
  uint256 public numLlamaStaked;

  event TokenStaked(address indexed owner, uint256 indexed tokenId, bool indexed isLlama, uint256 value);
  event LlamaClaimed(uint256 indexed tokenId, bool indexed unstaked, uint256 earned);
  event DogClaimed(uint256 indexed tokenId, bool indexed unstaked, uint256 earned);

  // reference to the DiamondHeist NFT contract
  IDiamondHeist public game;
  // reference to the $DIAMOND contract for minting $DIAMOND earnings
  IDIAMOND public diamond;

  // maps tokenId to stake for llamas
  mapping(uint256 => Stake) public staking; 
  // maps alpha to all Dog stakes with that alpha
  mapping(uint256 => Stake[]) public dogStaking; 
  // tracks location of each Dog in Staking
  mapping(uint256 => uint256) public dogIndices;
  // any rewards distributed when no dogs are staked
  uint256 public unaccountedRewards = 0; 
  // amount of $DIAMOND due for each alpha point staked
  uint256 public diamondPerAlpha = 0; 

  // llama earn 100 $DIAMOND per day
  uint256 public constant DAILY_DIAMOND_RATE = 100 ether;
  // llamas must have 2 days worth of $DIAMOND to unstake or else they're still staked
  uint256 public constant MINIMUM_TO_EXIT = 2 days;
  // dogs take a 20% tax on all $DIAMOND claimed
  uint256 public constant DIAMOND_CLAIM_TAX_PERCENTAGE = 20;
  // there will only ever be (roughly) 24 million $DIAMOND earned through staking
  uint256 public constant MAXIMUM_GLOBAL_DIAMOND = 24000000 ether;

  // amount of $DIAMOND earned so far
  uint256 public totalDiamondEarned;
  // the last time $DIAMOND was claimed
  uint256 public lastClaimTimestamp;

  // emergency rescue to allow unstaking without any checks but without $DIAMOND
  bool public rescueEnabled = false;

  modifier onlyDuringDay {
    require((block.timestamp % (6*3600)) > (3*3600), "ONLY DURING DAY");
    _;
  }

  constructor() {
    _pause();
  }

  modifier requireContractsSet() {
      require(address(game) != address(0) && address(diamond) != address(0), "CONTRACTS NOT SET");
      _;
  }

  function setContracts(IDiamondHeist _diamondheist, IDIAMOND _diamond) external onlyOwner {
    game = _diamondheist;
    diamond = _diamond;
  }

  /** STAKING */

  /**
   * Stakes Llamas and Dogs
   * @param account the address of the staker
   * @param tokenIds the IDs of the Llamas and Dogs to stake
   */
  function addManyToStaking(address account, uint16[] calldata tokenIds) external override whenNotPaused nonReentrant {
    require(tx.origin == _msgSender() || _msgSender() == address(game), "Only EOA");
    require(account == tx.origin, "account to sender mismatch");

    for (uint i = 0; i < tokenIds.length; i++) {
      if (tokenIds[i] == 0) {
          continue;
      }

      if (_msgSender() != address(game)) { // dont do this step if its a mint + stake
        require(game.ownerOf(tokenIds[i]) == _msgSender(), "You don't own this token");
        game.transferFrom(_msgSender(), address(this), tokenIds[i]);
      }

      if (game.isLlama(tokenIds[i])) 
        _addLlama(account, tokenIds[i]);
      else 
        _addDog(account, tokenIds[i]);
    }
  }

  /**
   * adds a single Llamas to the Staking
   * @param account the address of the staker
   * @param tokenId the ID of the Llamas to add to the Staking
   */
  function _addLlama(address account, uint256 tokenId) internal whenNotPaused _updateEarnings {
    staking[tokenId] = Stake({
      owner: account,
      tokenId: uint16(tokenId),
      value: uint80(block.timestamp)
    });
    numLlamaStaked += 1;
    emit TokenStaked(account, tokenId, true, block.timestamp);
  }

  /**
   * Stake a Dog
   * @param account the address of the staker
   * @param tokenId the ID of the Dog to add to Staking
   */
  function _addDog(address account, uint256 tokenId) internal {
    uint256 alpha = _alphaForDog(tokenId);
    totalAlphaStaked += alpha; // Portion of earnings ranges from 8 to 5
    dogIndices[tokenId] = dogStaking[alpha].length; // Store the location of the dog in the Staking
    dogStaking[alpha].push(Stake({
      owner: account,
      tokenId: uint16(tokenId),
      value: uint80(diamondPerAlpha)
    })); // Add the dog to the Staking
    emit TokenStaked(account, tokenId, false, diamondPerAlpha);
  }

  /** CLAIMING / UNSTAKING */

  /**
   * realize $DIAMOND earnings and optionally unstake tokens from the Staking / Staking
   * to unstake a Llamas it will require it has 2 days worth of $DIAMOND unclaimed
   * @param tokenIds the IDs of the tokens to claim earnings from
   * @param unstake whether or not to unstake ALL of the tokens listed in tokenIds
   */
  function claimMany(uint16[] calldata tokenIds, bool unstake) external whenNotPaused _updateEarnings onlyDuringDay nonReentrant {
    require(tx.origin == _msgSender() || _msgSender() == address(game), "Only EOA");
    uint256 owed = 0;
    for (uint i = 0; i < tokenIds.length; i++) {
      if (game.isLlama(tokenIds[i]))
        owed += _claimLlama(tokenIds[i], unstake);
      else
        owed += _claimDog(tokenIds[i], unstake);
    }
    if (owed == 0) return;
    diamond.mint(_msgSender(), owed);
  }

  /**
   * realize $DIAMOND earnings for a single Llamas and optionally unstake it
   * if not unstaking, pay a 20% tax to the staked Dogs
   * if unstaking, there is a 50% chance all $DIAMOND is stolen
   * @param tokenId the ID of the Llamas to claim earnings from
   * @param unstake whether or not to unstake the Llamas
   * @return owed - the amount of $DIAMOND earned
   */
  function _claimLlama(uint256 tokenId, bool unstake) internal returns (uint256 owed) {
    Stake memory stake = staking[tokenId];
    require(stake.owner == _msgSender(), "Don't own the given token");
    require(!(unstake && block.timestamp - stake.value < MINIMUM_TO_EXIT), "Wait 2 days to unstake");
    if (totalDiamondEarned < MAXIMUM_GLOBAL_DIAMOND) {
      owed = (block.timestamp - stake.value) * DAILY_DIAMOND_RATE / 1 days;
    } else if (stake.value > lastClaimTimestamp) {
      // $DIAMOND production stopped already
      owed = 0;
    } else {
      // stop earning additional $DIAMOND if it's all been earned
      owed = (lastClaimTimestamp - stake.value) * DAILY_DIAMOND_RATE / 1 days;
    }
    if (unstake) {
      if (random(tokenId) & 1 == 1) { // 50% chance of all $DIAMOND stolen
        _payDogTax(owed);
        owed = 0;
      }
      delete staking[tokenId];
      numLlamaStaked -= 1;
      // Always transfer last to guard against reentrance
      game.safeTransferFrom(address(this), _msgSender(), tokenId, ""); // send back Llamas
    } else {
      _payDogTax(owed * DIAMOND_CLAIM_TAX_PERCENTAGE / 100); // percentage tax to staked dogs
      owed = owed * (100 - DIAMOND_CLAIM_TAX_PERCENTAGE) / 100; // remainder goes to Llamas owner
      staking[tokenId] = Stake({
        owner: _msgSender(),
        tokenId: uint16(tokenId),
        value: uint80(block.timestamp)
      }); // reset stake
    }
    emit LlamaClaimed(tokenId, unstake, owed);
  }

  /**
   * realize $DIAMOND earnings for a single Dog and optionally unstake it
   * Dogs earn $DIAMOND proportional to their Alpha rank
   * @param tokenId the ID of the Dog to claim earnings from
   * @param unstake whether or not to unstake the Dog
   * @return owed - the amount of $DIAMOND earned
   */
  function _claimDog(uint256 tokenId, bool unstake) internal returns (uint256 owed) {
    require(game.ownerOf(tokenId) == address(this), "Not staked");
    uint256 alpha = _alphaForDog(tokenId);
    Stake memory stake = dogStaking[alpha][dogIndices[tokenId]];
    require(stake.owner == _msgSender(), "Doesn't own token");
    owed = (alpha) * (diamondPerAlpha - stake.value); // Calculate portion of tokens based on Alpha
    if (unstake) {
      totalAlphaStaked -= alpha; // Remove Alpha from total staked
      Stake memory lastStake = dogStaking[alpha][dogStaking[alpha].length - 1];

      dogStaking[alpha][dogIndices[tokenId]] = lastStake; // Shuffle last Dog to current position
      dogIndices[lastStake.tokenId] = dogIndices[tokenId];
      dogStaking[alpha].pop(); // Remove duplicate
      delete dogIndices[tokenId]; // Delete old mapping

      // Always remove last to guard against reentrance
      game.safeTransferFrom(address(this), _msgSender(), tokenId, ""); // Send back Dog
    } else {
      dogStaking[alpha][dogIndices[tokenId]] = Stake({
        owner: _msgSender(),
        tokenId: uint16(tokenId),
        value: uint80(diamondPerAlpha)
      }); // reset stake
    }
    emit DogClaimed(tokenId, unstake, owed);
  }

  /**
   * emergency unstake tokens
   * @param tokenIds the IDs of the tokens to claim earnings from
   */
  function rescue(uint256[] calldata tokenIds) external nonReentrant {
    require(rescueEnabled, "RESCUE DISABLED");
    uint256 tokenId;
    Stake memory stake;
    Stake memory lastStake;
    uint256 alpha;
    for (uint i = 0; i < tokenIds.length; i++) {
      tokenId = tokenIds[i];
      if (game.isLlama(tokenId)) {
        stake = staking[tokenId];
        require(stake.owner == _msgSender(), "SWIPER, NO SWIPING");
        delete staking[tokenId];
        numLlamaStaked -= 1;
        game.safeTransferFrom(address(this), _msgSender(), tokenId, ""); // send back Llamas
        emit LlamaClaimed(tokenId, true, 0);
      } else {
        alpha = _alphaForDog(tokenId);
        stake = dogStaking[alpha][dogIndices[tokenId]];
        require(stake.owner == _msgSender(), "SWIPER, NO SWIPING");
        totalAlphaStaked -= alpha; // Remove Alpha from total staked

        lastStake = dogStaking[alpha][dogStaking[alpha].length - 1];
        dogStaking[alpha][dogIndices[tokenId]] = lastStake; // Shuffle last Dog to current position
        dogIndices[lastStake.tokenId] = dogIndices[tokenId];
        dogStaking[alpha].pop(); // Remove duplicate
        delete dogIndices[tokenId]; // Delete old mapping

        game.safeTransferFrom(address(this), _msgSender(), tokenId, ""); // Send back Dog
        emit DogClaimed(tokenId, true, 0);
      }
    }
  }

  /** 
   * add $DIAMOND to claimable pot for the Staking
   * @param amount $DIAMOND to add to the pot
   */
  function _payDogTax(uint256 amount) internal {
    if (totalAlphaStaked == 0) { // if there's no staked dogs
      unaccountedRewards += amount; // keep track of $DIAMOND due to dogs
      return;
    }
    // makes sure to include any unaccounted $DIAMOND 
    diamondPerAlpha += (amount + unaccountedRewards) / totalAlphaStaked;
    unaccountedRewards = 0;
  }

  /**
   * tracks $DIAMOND earnings to ensure it stops once 2.4 billion is eclipsed
   */
  modifier _updateEarnings() {
    if (totalDiamondEarned < MAXIMUM_GLOBAL_DIAMOND) {
      totalDiamondEarned += 
        (block.timestamp - lastClaimTimestamp)
        * numLlamaStaked
        * DAILY_DIAMOND_RATE / 1 days; 
      lastClaimTimestamp = block.timestamp;
    }
    _;
  }

  /** ADMIN */

  /**
   * allows owner to enable "rescue mode"
   * simplifies accounting, prioritizes tokens out in emergency
   */
  function setRescueEnabled(bool _enabled) external onlyOwner {
    rescueEnabled = _enabled;
  }

  /**
   * enables owner to pause / unpause contract
   */
  function setPaused(bool _paused) external requireContractsSet onlyOwner {
    if (_paused) _pause();
    else _unpause();
  }

  /** READ ONLY */
  /**
   * gets the alpha score for a Dog
   * @param tokenId the ID of the Dog to get the alpha score for
   * @return the alpha score of the Dog (5-8)
   */
  function _alphaForDog(uint256 tokenId) internal view returns (uint8) {
    IDiamondHeist.LlamaDog memory s = game.getTokenTraits(tokenId);
    return MAX_ALPHA - s.alphaIndex; // alpha index is 0-3
  }

  /**
   * generates a pseudorandom number
   * @param seed a value ensure different outcomes for different sources in the same block
   * @return a pseudorandom value
   */
  function random(uint256 seed) internal view returns (uint256) {
    return uint256(keccak256(abi.encodePacked(
      tx.origin,
      blockhash(block.number - 1),
      block.timestamp,
      seed
    )));
  }

  function onERC721Received(
        address,
        address from,
        uint256,
        bytes calldata
    ) external pure override returns (bytes4) {
      require(from == address(0x0), "Cannot send tokens to Staking directly");
      return IERC721Receiver.onERC721Received.selector;
    }

}


// File @openzeppelin/contracts/utils/[email protected]

// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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


// File contracts/Traits.sol


pragma solidity ^0.8.0;




contract Traits is Ownable, ITraits {
  using Strings for uint256;

  // struct to store each trait's data for metadata and rendering
  struct Trait {
    string name;
    string png;
  }

  // mapping from trait type (index) to its name
  string[9] _traitTypes = [
    "Body",
    "Hat",
    "Eye",
    "Mouth",
    "Clothes",
    "Tail",
    "Alpha"
  ];

  // storage of each traits name and base64 PNG data
  mapping(uint8 => mapping(uint8 => Trait)) public traitData;
  // mapping from alphaIndex to its score
  string[4] _alphas = [
    "8",
    "7",
    "6",
    "5"
  ];

  IDiamondHeist public diamondheist;

  string private llamaDescription;
  string private dogDescription;

  constructor() {}

  /** ADMIN */

  function setGame(address _diamondheist) external onlyOwner {
    diamondheist = IDiamondHeist(_diamondheist);
  }

  /**
   * administrative to upload the names and images associated with each trait
   * @param traitType the trait type to upload the traits for (see traitTypes for a mapping)
   * @param traits the names and base64 encoded PNGs for each trait
   */
  function uploadTraits(uint8 traitType, uint8[] calldata traitIds, Trait[] calldata traits) external onlyOwner {
    require(traitIds.length == traits.length, "Mismatched inputs");
    for (uint i = 0; i < traits.length; i++) {
      traitData[traitType][traitIds[i]] = Trait(
        traits[i].name,
        traits[i].png
      );
    }
  }

  /** RENDER */

  /**
   * generates an <image> element using base64 encoded PNGs
   * @param trait the trait storing the PNG data
   * @return the <image> element
   */
  function drawTrait(Trait memory trait) internal pure returns (string memory) {
    return string(abi.encodePacked(
      '<image x="4" y="4" width="32" height="32" image-rendering="pixelated" preserveAspectRatio="xMidYMid" xlink:href="data:image/png;base64,',
      trait.png,
      '"/>'
    ));
  }

  /**
   * generates an entire SVG by composing multiple <image> elements of PNGs
   * @param tokenId the ID of the token to generate an SVG for
   * @return a valid SVG of the Llama / Dog
   */
  function drawSVG(uint256 tokenId) public view returns (string memory) {
    IDiamondHeist.LlamaDog memory s = diamondheist.getTokenTraits(tokenId);
    uint8 shift = s.isLlama ? 0 : 7;

    string memory svgString = string(abi.encodePacked(
      drawTrait(traitData[0 + shift][s.body]),
      drawTrait(traitData[1 + shift][s.hat]),
      drawTrait(traitData[2 + shift][s.eye]),
      drawTrait(traitData[3 + shift][s.mouth]),
      drawTrait(traitData[4 + shift][s.clothes]),
      drawTrait(traitData[5 + shift][s.tail])
    ));

    return string(abi.encodePacked(
      '<svg id="diamondheist" width="100%" height="100%" version="1.1" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">',
      svgString,
      "</svg>"
    ));
  }

  /**
   * generates an attribute for the attributes array in the ERC721 metadata standard
   * @param traitType the trait type to reference as the metadata key
   * @param value the token's trait associated with the key
   * @return a JSON dictionary for the single attribute
   */
  function attributeForTypeAndValue(string memory traitType, string memory value) internal pure returns (string memory) {
    return string(abi.encodePacked(
      '{"trait_type":"',
      traitType,
      '","value":"',
      value,
      '"}'
    ));
  }

  /**
   * generates an attribute for the attributes array in the ERC721 metadata standard
   * @param traitType the trait type to reference as the metadata key
   * @param value the token's trait associated with the key
   * @return a JSON dictionary for the single attribute
   */
  function attributeForTypeAndValueNumber(string memory traitType, string memory value) internal pure returns (string memory) {
    return string(abi.encodePacked(
      '{"display_type": "number", "trait_type":"',
      traitType,
      '","value":"',
      value,
      '"}'
    ));
  }

  /**
   * generates an array composed of all the individual traits and values
   * @param tokenId the ID of the token to compose the metadata for
   * @return a JSON array of all of the attributes for given token ID
   */
  function compileAttributes(uint256 tokenId) public view returns (string memory) {
    IDiamondHeist.LlamaDog memory s = diamondheist.getTokenTraits(tokenId);
    string memory traits;
    if (s.isLlama) {
      traits = string(abi.encodePacked(
        attributeForTypeAndValue(_traitTypes[0], traitData[0][s.body].name),",",
        attributeForTypeAndValue(_traitTypes[1], traitData[1][s.hat].name),",",
        attributeForTypeAndValue(_traitTypes[2], traitData[2][s.eye].name),",",
        attributeForTypeAndValue(_traitTypes[3], traitData[3][s.mouth].name),",",
        attributeForTypeAndValue(_traitTypes[4], traitData[4][s.clothes].name),",",
        attributeForTypeAndValue(_traitTypes[5], traitData[5][s.tail].name),","
        // traitData 6 = alpha score, but not visible
      ));
    } else {
      traits = string(abi.encodePacked(
        attributeForTypeAndValue(_traitTypes[0], traitData[7][s.body].name),",",
        attributeForTypeAndValue(_traitTypes[1], traitData[8][s.hat].name),",",
        attributeForTypeAndValue(_traitTypes[2], traitData[9][s.eye].name),",",
        attributeForTypeAndValue(_traitTypes[3], traitData[10][s.mouth].name),",",
        attributeForTypeAndValue(_traitTypes[4], traitData[11][s.clothes].name),",",
        attributeForTypeAndValue(_traitTypes[5], traitData[12][s.tail].name),",",
        attributeForTypeAndValueNumber("Alpha Score", _alphas[s.alphaIndex]),","
      ));
    }
    return string(abi.encodePacked(
      '[',
      traits,
      '{"trait_type":"Generation","value":',
      tokenId <= diamondheist.getPaidTokens() ? '"Gen 0"' : '"Gen 1"',
      '},{"trait_type":"Type","value":',
      s.isLlama ? '"Llama"' : '"Dog"',
      '}]'
    ));
  }

  /**
   * generates a base64 encoded metadata response without referencing off-chain content
   * @param tokenId the ID of the token to generate the metadata for
   * @return a base64 encoded JSON dictionary of the token's metadata and SVG
   */
  function tokenURI(uint256 tokenId) public view override returns (string memory) {
    IDiamondHeist.LlamaDog memory s = diamondheist.getTokenTraits(tokenId);

    string memory metadata = string(abi.encodePacked(
      '{"name": "',
      s.isLlama ? 'Llama #' : 'Dog #',
      tokenId.toString(),
      '", "description": "',
      s.isLlama ? llamaDescription : dogDescription,
      '", "image": "data:image/svg+xml;base64,',
      base64(bytes(drawSVG(tokenId))),
      '", "attributes":',
      compileAttributes(tokenId),
      "}"
    ));

    return string(abi.encodePacked(
      "data:application/json;base64,",
      base64(bytes(metadata))
    ));
  }

  function setDescription(string memory _llama, string memory _dog) external onlyOwner {
    llamaDescription = _llama;
    dogDescription = _dog;
  }

  /** BASE 64 - Written by Brech Devos */
  
  string internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

  function base64(bytes memory data) internal pure returns (string memory) {
    if (data.length == 0) return "";
    
    // load the table into memory
    string memory table = TABLE;

    // multiply by 4/3 rounded up
    uint256 encodedLen = 4 * ((data.length + 2) / 3);

    // add some extra buffer at the end required for the writing
    string memory result = new string(encodedLen + 32);

    assembly {
      // set the actual output length
      mstore(result, encodedLen)
      
      // prepare the lookup table
      let tablePtr := add(table, 1)
      
      // input ptr
      let dataPtr := data
      let endPtr := add(dataPtr, mload(data))
      
      // result ptr, jump over length
      let resultPtr := add(result, 32)
      
      // run over the input, 3 bytes at a time
      for {} lt(dataPtr, endPtr) {}
      {
          dataPtr := add(dataPtr, 3)
          
          // read 3 bytes
          let input := mload(dataPtr)
          
          // write 4 characters
          mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F)))))
          resultPtr := add(resultPtr, 1)
          mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F)))))
          resultPtr := add(resultPtr, 1)
          mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr( 6, input), 0x3F)))))
          resultPtr := add(resultPtr, 1)
          mstore(resultPtr, shl(248, mload(add(tablePtr, and(        input,  0x3F)))))
          resultPtr := add(resultPtr, 1)
      }
      
      // padding with '='
      switch mod(mload(data), 3)
      case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
      case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
    }
    
    return result;
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"unstaked","type":"bool"},{"indexed":false,"internalType":"uint256","name":"earned","type":"uint256"}],"name":"DogClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"unstaked","type":"bool"},{"indexed":false,"internalType":"uint256","name":"earned","type":"uint256"}],"name":"LlamaClaimed","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"bool","name":"isLlama","type":"bool"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TokenStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DAILY_DIAMOND_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DIAMOND_CLAIM_TAX_PERCENTAGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAXIMUM_GLOBAL_DIAMOND","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_ALPHA","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_TO_EXIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"}],"name":"addManyToStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"},{"internalType":"bool","name":"unstake","type":"bool"}],"name":"claimMany","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"diamond","outputs":[{"internalType":"contract IDIAMOND","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"diamondPerAlpha","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"dogIndices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"dogStaking","outputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint80","name":"value","type":"uint80"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"game","outputs":[{"internalType":"contract IDiamondHeist","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastClaimTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numLlamaStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescueEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDiamondHeist","name":"_diamondheist","type":"address"},{"internalType":"contract IDIAMOND","name":"_diamond","type":"address"}],"name":"setContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setRescueEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"staking","outputs":[{"internalType":"uint16","name":"tokenId","type":"uint16"},{"internalType":"uint80","name":"value","type":"uint80"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDiamondEarned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unaccountedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60806040526000600a819055600b55600e805460ff191690553480156200002557600080fd5b5062000031336200004f565b600180556002805460ff19169055620000496200009f565b6200013d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60025460ff1615620000ea5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640160405180910390fd5b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258620001203390565b6040516001600160a01b03909116815260200160405180910390a1565b61275f806200014d6000396000f3fe608060405234801561001057600080fd5b50600436106101a95760003560e01c8063715018a6116100f9578063c3fe3e2811610097578063e61c236711610071578063e61c2367146103d5578063f0b7db4e146103e5578063f12c8abc146103f8578063f2fde38b1461040157600080fd5b8063c3fe3e281461038f578063cce327ca146103a2578063d8952a49146103c257600080fd5b8063a26c858e116100d3578063a26c858e14610357578063a7a1029014610360578063b739100514610373578063c0c472c01461038657600080fd5b8063715018a614610317578063765310081461031f5780638da5cb5b1461033257600080fd5b806337a386b9116101665780635c975abb116101405780635c975abb146102dd578063607af397146102e857806368363f78146102f15780636a3ef0571461030457600080fd5b806337a386b9146102ae57806339db714f146102b85780634297295e146102d557600080fd5b8063150b7a02146101ae57806316c38b3c146101df5780631dbb2a22146101f4578063201ef2a41461026b578063245f23a4146102855780632c6574c01461029c575b600080fd5b6101c16101bc3660046121ff565b610414565b6040516001600160e01b031990911681526020015b60405180910390f35b6101f26101ed36600461238c565b610493565b005b61023a6102023660046124f6565b60076020526000908152604090205461ffff8116906201000081046001600160501b031690600160601b90046001600160a01b031683565b6040805161ffff90941684526001600160501b0390921660208401526001600160a01b0316908201526060016101d6565b610273600881565b60405160ff90911681526020016101d6565b61028e60045481565b6040519081526020016101d6565b61028e6a13da329b6336471800000081565b61028e6202a30081565b600e546102c59060ff1681565b60405190151581526020016101d6565b61028e601481565b60025460ff166102c5565b61028e600d5481565b61023a6102ff36600461250f565b61053a565b6101f261031236600461234a565b61058d565b6101f2610b2f565b6101f261032d36600461238c565b610b65565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016101d6565b61028e600c5481565b6101f261036e3660046122f3565b610ba2565b6101f261038136600461229e565b610edc565b61028e600a5481565b60055461033f906001600160a01b031681565b61028e6103b03660046124f6565b60096020526000908152604090205481565b6101f26103d03660046123c6565b611311565b61028e68056bc75e2d6310000081565b60065461033f906001600160a01b031681565b61028e600b5481565b6101f261040f3660046121c5565b611369565b60006001600160a01b038516156104815760405162461bcd60e51b815260206004820152602660248201527f43616e6e6f742073656e6420746f6b656e7320746f205374616b696e67206469604482015265726563746c7960d01b60648201526084015b60405180910390fd5b50630a85bd0160e11b95945050505050565b6005546001600160a01b0316158015906104b757506006546001600160a01b031615155b6104f75760405162461bcd60e51b815260206004820152601160248201527010d3d395149050d514c81393d50814d155607a1b6044820152606401610478565b6000546001600160a01b031633146105215760405162461bcd60e51b81526004016104789061258e565b80156105325761052f611401565b50565b61052f611476565b6008602052816000526040600020818154811061055657600080fd5b60009182526020909120015461ffff811692506201000081046001600160501b03169150600160601b90046001600160a01b031683565b600260015414156105b05760405162461bcd60e51b8152600401610478906125c3565b6002600155600e5460ff166105f95760405162461bcd60e51b815260206004820152600f60248201526e149154d0d55148111254d050931151608a1b6044820152606401610478565b60408051606080820183526000808352602080840182905283850182905284519283018552818352820181905292810183905282805b85811015610b2257868682818110610649576106496126f0565b600554604051635d6823c960e11b815260209290920293909301356004820181905297506001600160a01b039092169163bad04792915060240160206040518083038186803b15801561069b57600080fd5b505afa1580156106af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d391906123a9565b15610838576000858152600760209081526040918290208251606081018452905461ffff811682526201000081046001600160501b031692820192909252600160601b9091046001600160a01b03169181018290529450331461076d5760405162461bcd60e51b81526020600482015260126024820152715357495045522c204e4f2053574950494e4760701b6044820152606401610478565b60008581526007602052604081208190556004805460019290610791908490612645565b90915550506005546001600160a01b031663b88d4fde3033886040518463ffffffff1660e01b81526004016107c893929190612531565b600060405180830381600087803b1580156107e257600080fd5b505af11580156107f6573d6000803e3d6000fd5b505060405160008152600192508791507fc14a2072b8b4d6afbd3aaf4473c01ada935095d579447799050f15d2d9ed287f9060200160405180910390a3610b10565b610841856114f0565b60ff166000818152600860209081526040808320898452600990925290912054815492945090918110610876576108766126f0565b600091825260209182902060408051606081018252929091015461ffff811683526201000081046001600160501b031693830193909352600160601b9092046001600160a01b0316918101829052945033146109095760405162461bcd60e51b81526020600482015260126024820152715357495045522c204e4f2053574950494e4760701b6044820152606401610478565b816003600082825461091b9190612645565b90915550506000828152600860205260409020805461093c90600190612645565b8154811061094c5761094c6126f0565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b03168382015285845260088252808420898552600990925290922054825491955085929181106109bf576109bf6126f0565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff968716179290921716179055888352600981528383205487519092168352838320919091558482526008905220805480610a4b57610a4b6126da565b6000828152602080822060001990840181018390559092019092558682526009905260408120556005546001600160a01b031663b88d4fde3033886040518463ffffffff1660e01b8152600401610aa493929190612531565b600060405180830381600087803b158015610abe57600080fd5b505af1158015610ad2573d6000803e3d6000fd5b505060405160008152600192508791507f0d572cea43328e1d4e1413c88ed43ad6f3b2110c4c8dc5b69bb45bad6fecb3b29060200160405180910390a35b80610b1a8161267f565b91505061062f565b5050600180555050505050565b6000546001600160a01b03163314610b595760405162461bcd60e51b81526004016104789061258e565b610b63600061158c565b565b6000546001600160a01b03163314610b8f5760405162461bcd60e51b81526004016104789061258e565b600e805460ff1916911515919091179055565b60025460ff1615610bc55760405162461bcd60e51b815260040161047890612564565b6a13da329b63364718000000600c541015610c32576201518068056bc75e2d63100000600454600d5442610bf99190612645565b610c039190612626565b610c0d9190612626565b610c179190612612565b600c6000828254610c2891906125fa565b909155505042600d555b612a30610c416154604261269a565b11610c805760405162461bcd60e51b815260206004820152600f60248201526e4f4e4c5920445552494e472044415960881b6044820152606401610478565b60026001541415610ca35760405162461bcd60e51b8152600401610478906125c3565b600260015532331480610cc957506005546001600160a01b0316336001600160a01b0316145b610d005760405162461bcd60e51b81526020600482015260086024820152674f6e6c7920454f4160c01b6044820152606401610478565b6000805b83811015610e53576005546001600160a01b031663bad04792868684818110610d2f57610d2f6126f0565b9050602002016020810190610d4491906124d2565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b158015610d7e57600080fd5b505afa158015610d92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db691906123a9565b15610e0057610def858583818110610dd057610dd06126f0565b9050602002016020810190610de591906124d2565b61ffff16846115dc565b610df990836125fa565b9150610e41565b610e34858583818110610e1557610e156126f0565b9050602002016020810190610e2a91906124d2565b61ffff1684611978565b610e3e90836125fa565b91505b80610e4b8161267f565b915050610d04565b5080610e5f5750610ed3565b6006546001600160a01b03166340c10f19336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b158015610eb957600080fd5b505af1158015610ecd573d6000803e3d6000fd5b50505050505b50506001805550565b60025460ff1615610eff5760405162461bcd60e51b815260040161047890612564565b60026001541415610f225760405162461bcd60e51b8152600401610478906125c3565b600260015532331480610f4857506005546001600160a01b0316336001600160a01b0316145b610f7f5760405162461bcd60e51b81526020600482015260086024820152674f6e6c7920454f4160c01b6044820152606401610478565b6001600160a01b0383163214610fd75760405162461bcd60e51b815260206004820152601a60248201527f6163636f756e7420746f2073656e646572206d69736d617463680000000000006044820152606401610478565b60005b8181101561130757828282818110610ff457610ff46126f0565b905060200201602081019061100991906124d2565b61ffff16611016576112f5565b6005546001600160a01b0316336001600160a01b0316146111d95760055433906001600160a01b0316636352211e858585818110611056576110566126f0565b905060200201602081019061106b91906124d2565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b1580156110a557600080fd5b505afa1580156110b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110dd91906121e2565b6001600160a01b0316146111335760405162461bcd60e51b815260206004820152601860248201527f596f7520646f6e2774206f776e207468697320746f6b656e00000000000000006044820152606401610478565b6005546001600160a01b03166323b872dd3330868686818110611158576111586126f0565b905060200201602081019061116d91906124d2565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015261ffff166044820152606401600060405180830381600087803b1580156111c057600080fd5b505af11580156111d4573d6000803e3d6000fd5b505050505b6005546001600160a01b031663bad047928484848181106111fc576111fc6126f0565b905060200201602081019061121191906124d2565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b15801561124b57600080fd5b505afa15801561125f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128391906123a9565b156112c1576112bc8484848481811061129e5761129e6126f0565b90506020020160208101906112b391906124d2565b61ffff16611e21565b6112f5565b6112f5848484848181106112d7576112d76126f0565b90506020020160208101906112ec91906124d2565b61ffff16611f92565b806112ff8161267f565b915050610fda565b5050600180555050565b6000546001600160a01b0316331461133b5760405162461bcd60e51b81526004016104789061258e565b600580546001600160a01b039384166001600160a01b03199182161790915560068054929093169116179055565b6000546001600160a01b031633146113935760405162461bcd60e51b81526004016104789061258e565b6001600160a01b0381166113f85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610478565b61052f8161158c565b60025460ff16156114245760405162461bcd60e51b815260040161047890612564565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586114593390565b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff166114bf5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610478565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611459565b6005546040516394e5684760e01b81526004810183905260009182916001600160a01b03909116906394e56847906024016101006040518083038186803b15801561153a57600080fd5b505afa15801561154e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157291906123ff565b90508060e001516008611585919061265c565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008281526007602090815260408083208151606081018352905461ffff811682526201000081046001600160501b031693820193909352600160601b9092046001600160a01b031690820181905233146116795760405162461bcd60e51b815260206004820152601960248201527f446f6e2774206f776e2074686520676976656e20746f6b656e000000000000006044820152606401610478565b8280156116a057506202a30081602001516001600160501b03164261169e9190612645565b105b156116e65760405162461bcd60e51b8152602060048201526016602482015275576169742032206461797320746f20756e7374616b6560501b6044820152606401610478565b6a13da329b63364718000000600c54101561173d576201518068056bc75e2d6310000082602001516001600160501b0316426117229190612645565b61172c9190612626565b6117369190612612565b915061179d565b600d5481602001516001600160501b0316111561175d576000915061179d565b6201518068056bc75e2d6310000082602001516001600160501b0316600d546117869190612645565b6117909190612626565b61179a9190612612565b91505b8215611857576117ac846120a5565b600116600114156117c5576117c0826120ff565b600091505b600084815260076020526040812081905560048054600192906117e9908490612645565b90915550506005546001600160a01b031663b88d4fde3033876040518463ffffffff1660e01b815260040161182093929190612531565b600060405180830381600087803b15801561183a57600080fd5b505af115801561184e573d6000803e3d6000fd5b50505050611934565b6118766064611867601485612626565b6118719190612612565b6120ff565b6064611883601482612645565b61188d9084612626565b6118979190612612565b915060405180606001604052808561ffff168152602001426001600160501b031681526020016118c43390565b6001600160a01b0390811690915260008681526007602090815260409182902084518154928601519590930151909316600160601b026001600160601b036001600160501b0390951662010000026001600160601b031990921661ffff9093169290921717929092169190911790555b821515847fc14a2072b8b4d6afbd3aaf4473c01ada935095d579447799050f15d2d9ed287f8460405161196991815260200190565b60405180910390a35092915050565b6005546040516331a9108f60e11b81526004810184905260009130916001600160a01b0390911690636352211e9060240160206040518083038186803b1580156119c157600080fd5b505afa1580156119d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f991906121e2565b6001600160a01b031614611a3c5760405162461bcd60e51b815260206004820152600a602482015269139bdd081cdd185ad95960b21b6044820152606401610478565b6000611a47846114f0565b60ff1660008181526008602090815260408083208884526009909252822054815493945091929091908110611a7e57611a7e6126f0565b600091825260209182902060408051606081018252929091015461ffff811683526201000081046001600160501b031693830193909352600160601b9092046001600160a01b031691810182905291503314611b105760405162461bcd60e51b81526020600482015260116024820152702237b2b9b713ba1037bbb7103a37b5b2b760791b6044820152606401610478565b80602001516001600160501b0316600b54611b2b9190612645565b611b359083612626565b92508315611d10578160036000828254611b4f9190612645565b909155505060008281526008602052604081208054611b7090600190612645565b81548110611b8057611b806126f0565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b031683820152868452600882528084208a855260099092529092205482549193508392918110611bf357611bf36126f0565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff968716179290921716179055898352600981528383205485519092168352838320919091558582526008905220805480611c7f57611c7f6126da565b6000828152602080822060001990840181018390559092019092558782526009905260408120556005546001600160a01b031663b88d4fde3033896040518463ffffffff1660e01b8152600401611cd893929190612531565b600060405180830381600087803b158015611cf257600080fd5b505af1158015611d06573d6000803e3d6000fd5b5050505050611ddc565b60405180606001604052808661ffff168152602001600b546001600160501b03168152602001611d3d3390565b6001600160a01b03169052600083815260086020908152604080832089845260099092529091205481548110611d7557611d756126f0565b6000918252602091829020835191018054928401516040909401516001600160a01b0316600160601b026001600160601b036001600160501b0390951662010000026001600160601b031990941661ffff9093169290921792909217929092169190911790555b831515857f0d572cea43328e1d4e1413c88ed43ad6f3b2110c4c8dc5b69bb45bad6fecb3b285604051611e1191815260200190565b60405180910390a3505092915050565b60025460ff1615611e445760405162461bcd60e51b815260040161047890612564565b6a13da329b63364718000000600c541015611eb1576201518068056bc75e2d63100000600454600d5442611e789190612645565b611e829190612626565b611e8c9190612626565b611e969190612612565b600c6000828254611ea791906125fa565b909155505042600d555b6040805160608101825261ffff80841682526001600160501b0342811660208085019182526001600160a01b03808916868801908152600089815260079093529682209551865493519751909116600160601b026001600160601b039790941662010000026001600160601b031990931694169390931717939093169290921790556004805460019290611f469084906125fa565b909155505060405142815260019082906001600160a01b038516907f8612e8567c2b59ea0cd07546cc5fd09fdcb85f542e6d73367c39b009ce24a0bf9060200160405180910390a45050565b6000611f9d826114f0565b60ff1690508060036000828254611fb491906125fa565b90915550506000818152600860208181526040808420805487865260098452828620819055938352815160608101835261ffff8089168252600b80546001600160501b039081168488019081526001600160a01b03808e1686890181815260018c018955978c52988b20955195909901805491519651909916600160601b026001600160601b039690921662010000026001600160601b031990911694909316939093179190911792909216179093559154915185927f8612e8567c2b59ea0cd07546cc5fd09fdcb85f542e6d73367c39b009ce24a0bf9161209891815260200190565b60405180910390a4505050565b6000326120b3600143612645565b60405160609290921b6001600160601b03191660208301524060348201524260548201526074810183905260940160408051601f19818403018152919052805160209091012092915050565b6003546121205780600a600082825461211891906125fa565b909155505050565b600354600a5461213090836125fa565b61213a9190612612565b600b600082825461214b91906125fa565b90915550506000600a5550565b60008083601f84011261216a57600080fd5b50813567ffffffffffffffff81111561218257600080fd5b6020830191508360208260051b850101111561219d57600080fd5b9250929050565b80516121af8161271b565b919050565b805160ff811681146121af57600080fd5b6000602082840312156121d757600080fd5b813561158581612706565b6000602082840312156121f457600080fd5b815161158581612706565b60008060008060006080868803121561221757600080fd5b853561222281612706565b9450602086013561223281612706565b935060408601359250606086013567ffffffffffffffff8082111561225657600080fd5b818801915088601f83011261226a57600080fd5b81358181111561227957600080fd5b89602082850101111561228b57600080fd5b9699959850939650602001949392505050565b6000806000604084860312156122b357600080fd5b83356122be81612706565b9250602084013567ffffffffffffffff8111156122da57600080fd5b6122e686828701612158565b9497909650939450505050565b60008060006040848603121561230857600080fd5b833567ffffffffffffffff81111561231f57600080fd5b61232b86828701612158565b909450925050602084013561233f8161271b565b809150509250925092565b6000806020838503121561235d57600080fd5b823567ffffffffffffffff81111561237457600080fd5b61238085828601612158565b90969095509350505050565b60006020828403121561239e57600080fd5b81356115858161271b565b6000602082840312156123bb57600080fd5b81516115858161271b565b600080604083850312156123d957600080fd5b82356123e481612706565b915060208301356123f481612706565b809150509250929050565b600061010080838503121561241357600080fd5b6040519081019067ffffffffffffffff8211818310171561244457634e487b7160e01b600052604160045260246000fd5b81604052612451846121a4565b815261245f602085016121b4565b6020820152612470604085016121b4565b6040820152612481606085016121b4565b6060820152612492608085016121b4565b60808201526124a360a085016121b4565b60a08201526124b460c085016121b4565b60c08201526124c560e085016121b4565b60e0820152949350505050565b6000602082840312156124e457600080fd5b813561ffff8116811461158557600080fd5b60006020828403121561250857600080fd5b5035919050565b6000806040838503121561252257600080fd5b50508035926020909101359150565b6001600160a01b039384168152919092166020820152604081019190915260806060820181905260009082015260a00190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000821982111561260d5761260d6126ae565b500190565b600082612621576126216126c4565b500490565b6000816000190483118215151615612640576126406126ae565b500290565b600082821015612657576126576126ae565b500390565b600060ff821660ff841680821015612676576126766126ae565b90039392505050565b6000600019821415612693576126936126ae565b5060010190565b6000826126a9576126a96126c4565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461052f57600080fd5b801515811461052f57600080fdfea26469706673582212200d3eb63a5684de9fd002c05a644079d7ad766fa3a76cd12c86277cb56ca267d364736f6c63430008070033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101a95760003560e01c8063715018a6116100f9578063c3fe3e2811610097578063e61c236711610071578063e61c2367146103d5578063f0b7db4e146103e5578063f12c8abc146103f8578063f2fde38b1461040157600080fd5b8063c3fe3e281461038f578063cce327ca146103a2578063d8952a49146103c257600080fd5b8063a26c858e116100d3578063a26c858e14610357578063a7a1029014610360578063b739100514610373578063c0c472c01461038657600080fd5b8063715018a614610317578063765310081461031f5780638da5cb5b1461033257600080fd5b806337a386b9116101665780635c975abb116101405780635c975abb146102dd578063607af397146102e857806368363f78146102f15780636a3ef0571461030457600080fd5b806337a386b9146102ae57806339db714f146102b85780634297295e146102d557600080fd5b8063150b7a02146101ae57806316c38b3c146101df5780631dbb2a22146101f4578063201ef2a41461026b578063245f23a4146102855780632c6574c01461029c575b600080fd5b6101c16101bc3660046121ff565b610414565b6040516001600160e01b031990911681526020015b60405180910390f35b6101f26101ed36600461238c565b610493565b005b61023a6102023660046124f6565b60076020526000908152604090205461ffff8116906201000081046001600160501b031690600160601b90046001600160a01b031683565b6040805161ffff90941684526001600160501b0390921660208401526001600160a01b0316908201526060016101d6565b610273600881565b60405160ff90911681526020016101d6565b61028e60045481565b6040519081526020016101d6565b61028e6a13da329b6336471800000081565b61028e6202a30081565b600e546102c59060ff1681565b60405190151581526020016101d6565b61028e601481565b60025460ff166102c5565b61028e600d5481565b61023a6102ff36600461250f565b61053a565b6101f261031236600461234a565b61058d565b6101f2610b2f565b6101f261032d36600461238c565b610b65565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016101d6565b61028e600c5481565b6101f261036e3660046122f3565b610ba2565b6101f261038136600461229e565b610edc565b61028e600a5481565b60055461033f906001600160a01b031681565b61028e6103b03660046124f6565b60096020526000908152604090205481565b6101f26103d03660046123c6565b611311565b61028e68056bc75e2d6310000081565b60065461033f906001600160a01b031681565b61028e600b5481565b6101f261040f3660046121c5565b611369565b60006001600160a01b038516156104815760405162461bcd60e51b815260206004820152602660248201527f43616e6e6f742073656e6420746f6b656e7320746f205374616b696e67206469604482015265726563746c7960d01b60648201526084015b60405180910390fd5b50630a85bd0160e11b95945050505050565b6005546001600160a01b0316158015906104b757506006546001600160a01b031615155b6104f75760405162461bcd60e51b815260206004820152601160248201527010d3d395149050d514c81393d50814d155607a1b6044820152606401610478565b6000546001600160a01b031633146105215760405162461bcd60e51b81526004016104789061258e565b80156105325761052f611401565b50565b61052f611476565b6008602052816000526040600020818154811061055657600080fd5b60009182526020909120015461ffff811692506201000081046001600160501b03169150600160601b90046001600160a01b031683565b600260015414156105b05760405162461bcd60e51b8152600401610478906125c3565b6002600155600e5460ff166105f95760405162461bcd60e51b815260206004820152600f60248201526e149154d0d55148111254d050931151608a1b6044820152606401610478565b60408051606080820183526000808352602080840182905283850182905284519283018552818352820181905292810183905282805b85811015610b2257868682818110610649576106496126f0565b600554604051635d6823c960e11b815260209290920293909301356004820181905297506001600160a01b039092169163bad04792915060240160206040518083038186803b15801561069b57600080fd5b505afa1580156106af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d391906123a9565b15610838576000858152600760209081526040918290208251606081018452905461ffff811682526201000081046001600160501b031692820192909252600160601b9091046001600160a01b03169181018290529450331461076d5760405162461bcd60e51b81526020600482015260126024820152715357495045522c204e4f2053574950494e4760701b6044820152606401610478565b60008581526007602052604081208190556004805460019290610791908490612645565b90915550506005546001600160a01b031663b88d4fde3033886040518463ffffffff1660e01b81526004016107c893929190612531565b600060405180830381600087803b1580156107e257600080fd5b505af11580156107f6573d6000803e3d6000fd5b505060405160008152600192508791507fc14a2072b8b4d6afbd3aaf4473c01ada935095d579447799050f15d2d9ed287f9060200160405180910390a3610b10565b610841856114f0565b60ff166000818152600860209081526040808320898452600990925290912054815492945090918110610876576108766126f0565b600091825260209182902060408051606081018252929091015461ffff811683526201000081046001600160501b031693830193909352600160601b9092046001600160a01b0316918101829052945033146109095760405162461bcd60e51b81526020600482015260126024820152715357495045522c204e4f2053574950494e4760701b6044820152606401610478565b816003600082825461091b9190612645565b90915550506000828152600860205260409020805461093c90600190612645565b8154811061094c5761094c6126f0565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b03168382015285845260088252808420898552600990925290922054825491955085929181106109bf576109bf6126f0565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff968716179290921716179055888352600981528383205487519092168352838320919091558482526008905220805480610a4b57610a4b6126da565b6000828152602080822060001990840181018390559092019092558682526009905260408120556005546001600160a01b031663b88d4fde3033886040518463ffffffff1660e01b8152600401610aa493929190612531565b600060405180830381600087803b158015610abe57600080fd5b505af1158015610ad2573d6000803e3d6000fd5b505060405160008152600192508791507f0d572cea43328e1d4e1413c88ed43ad6f3b2110c4c8dc5b69bb45bad6fecb3b29060200160405180910390a35b80610b1a8161267f565b91505061062f565b5050600180555050505050565b6000546001600160a01b03163314610b595760405162461bcd60e51b81526004016104789061258e565b610b63600061158c565b565b6000546001600160a01b03163314610b8f5760405162461bcd60e51b81526004016104789061258e565b600e805460ff1916911515919091179055565b60025460ff1615610bc55760405162461bcd60e51b815260040161047890612564565b6a13da329b63364718000000600c541015610c32576201518068056bc75e2d63100000600454600d5442610bf99190612645565b610c039190612626565b610c0d9190612626565b610c179190612612565b600c6000828254610c2891906125fa565b909155505042600d555b612a30610c416154604261269a565b11610c805760405162461bcd60e51b815260206004820152600f60248201526e4f4e4c5920445552494e472044415960881b6044820152606401610478565b60026001541415610ca35760405162461bcd60e51b8152600401610478906125c3565b600260015532331480610cc957506005546001600160a01b0316336001600160a01b0316145b610d005760405162461bcd60e51b81526020600482015260086024820152674f6e6c7920454f4160c01b6044820152606401610478565b6000805b83811015610e53576005546001600160a01b031663bad04792868684818110610d2f57610d2f6126f0565b9050602002016020810190610d4491906124d2565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b158015610d7e57600080fd5b505afa158015610d92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db691906123a9565b15610e0057610def858583818110610dd057610dd06126f0565b9050602002016020810190610de591906124d2565b61ffff16846115dc565b610df990836125fa565b9150610e41565b610e34858583818110610e1557610e156126f0565b9050602002016020810190610e2a91906124d2565b61ffff1684611978565b610e3e90836125fa565b91505b80610e4b8161267f565b915050610d04565b5080610e5f5750610ed3565b6006546001600160a01b03166340c10f19336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101849052604401600060405180830381600087803b158015610eb957600080fd5b505af1158015610ecd573d6000803e3d6000fd5b50505050505b50506001805550565b60025460ff1615610eff5760405162461bcd60e51b815260040161047890612564565b60026001541415610f225760405162461bcd60e51b8152600401610478906125c3565b600260015532331480610f4857506005546001600160a01b0316336001600160a01b0316145b610f7f5760405162461bcd60e51b81526020600482015260086024820152674f6e6c7920454f4160c01b6044820152606401610478565b6001600160a01b0383163214610fd75760405162461bcd60e51b815260206004820152601a60248201527f6163636f756e7420746f2073656e646572206d69736d617463680000000000006044820152606401610478565b60005b8181101561130757828282818110610ff457610ff46126f0565b905060200201602081019061100991906124d2565b61ffff16611016576112f5565b6005546001600160a01b0316336001600160a01b0316146111d95760055433906001600160a01b0316636352211e858585818110611056576110566126f0565b905060200201602081019061106b91906124d2565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b1580156110a557600080fd5b505afa1580156110b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110dd91906121e2565b6001600160a01b0316146111335760405162461bcd60e51b815260206004820152601860248201527f596f7520646f6e2774206f776e207468697320746f6b656e00000000000000006044820152606401610478565b6005546001600160a01b03166323b872dd3330868686818110611158576111586126f0565b905060200201602081019061116d91906124d2565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015261ffff166044820152606401600060405180830381600087803b1580156111c057600080fd5b505af11580156111d4573d6000803e3d6000fd5b505050505b6005546001600160a01b031663bad047928484848181106111fc576111fc6126f0565b905060200201602081019061121191906124d2565b6040516001600160e01b031960e084901b16815261ffff909116600482015260240160206040518083038186803b15801561124b57600080fd5b505afa15801561125f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128391906123a9565b156112c1576112bc8484848481811061129e5761129e6126f0565b90506020020160208101906112b391906124d2565b61ffff16611e21565b6112f5565b6112f5848484848181106112d7576112d76126f0565b90506020020160208101906112ec91906124d2565b61ffff16611f92565b806112ff8161267f565b915050610fda565b5050600180555050565b6000546001600160a01b0316331461133b5760405162461bcd60e51b81526004016104789061258e565b600580546001600160a01b039384166001600160a01b03199182161790915560068054929093169116179055565b6000546001600160a01b031633146113935760405162461bcd60e51b81526004016104789061258e565b6001600160a01b0381166113f85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610478565b61052f8161158c565b60025460ff16156114245760405162461bcd60e51b815260040161047890612564565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586114593390565b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff166114bf5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610478565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611459565b6005546040516394e5684760e01b81526004810183905260009182916001600160a01b03909116906394e56847906024016101006040518083038186803b15801561153a57600080fd5b505afa15801561154e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157291906123ff565b90508060e001516008611585919061265c565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008281526007602090815260408083208151606081018352905461ffff811682526201000081046001600160501b031693820193909352600160601b9092046001600160a01b031690820181905233146116795760405162461bcd60e51b815260206004820152601960248201527f446f6e2774206f776e2074686520676976656e20746f6b656e000000000000006044820152606401610478565b8280156116a057506202a30081602001516001600160501b03164261169e9190612645565b105b156116e65760405162461bcd60e51b8152602060048201526016602482015275576169742032206461797320746f20756e7374616b6560501b6044820152606401610478565b6a13da329b63364718000000600c54101561173d576201518068056bc75e2d6310000082602001516001600160501b0316426117229190612645565b61172c9190612626565b6117369190612612565b915061179d565b600d5481602001516001600160501b0316111561175d576000915061179d565b6201518068056bc75e2d6310000082602001516001600160501b0316600d546117869190612645565b6117909190612626565b61179a9190612612565b91505b8215611857576117ac846120a5565b600116600114156117c5576117c0826120ff565b600091505b600084815260076020526040812081905560048054600192906117e9908490612645565b90915550506005546001600160a01b031663b88d4fde3033876040518463ffffffff1660e01b815260040161182093929190612531565b600060405180830381600087803b15801561183a57600080fd5b505af115801561184e573d6000803e3d6000fd5b50505050611934565b6118766064611867601485612626565b6118719190612612565b6120ff565b6064611883601482612645565b61188d9084612626565b6118979190612612565b915060405180606001604052808561ffff168152602001426001600160501b031681526020016118c43390565b6001600160a01b0390811690915260008681526007602090815260409182902084518154928601519590930151909316600160601b026001600160601b036001600160501b0390951662010000026001600160601b031990921661ffff9093169290921717929092169190911790555b821515847fc14a2072b8b4d6afbd3aaf4473c01ada935095d579447799050f15d2d9ed287f8460405161196991815260200190565b60405180910390a35092915050565b6005546040516331a9108f60e11b81526004810184905260009130916001600160a01b0390911690636352211e9060240160206040518083038186803b1580156119c157600080fd5b505afa1580156119d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f991906121e2565b6001600160a01b031614611a3c5760405162461bcd60e51b815260206004820152600a602482015269139bdd081cdd185ad95960b21b6044820152606401610478565b6000611a47846114f0565b60ff1660008181526008602090815260408083208884526009909252822054815493945091929091908110611a7e57611a7e6126f0565b600091825260209182902060408051606081018252929091015461ffff811683526201000081046001600160501b031693830193909352600160601b9092046001600160a01b031691810182905291503314611b105760405162461bcd60e51b81526020600482015260116024820152702237b2b9b713ba1037bbb7103a37b5b2b760791b6044820152606401610478565b80602001516001600160501b0316600b54611b2b9190612645565b611b359083612626565b92508315611d10578160036000828254611b4f9190612645565b909155505060008281526008602052604081208054611b7090600190612645565b81548110611b8057611b806126f0565b6000918252602080832060408051606081018252939091015461ffff811684526201000081046001600160501b031684840152600160601b90046001600160a01b031683820152868452600882528084208a855260099092529092205482549193508392918110611bf357611bf36126f0565b60009182526020808320845192018054858301516040968701516001600160a01b0316600160601b026001600160601b036001600160501b0390921662010000026001600160601b031990931661ffff968716179290921716179055898352600981528383205485519092168352838320919091558582526008905220805480611c7f57611c7f6126da565b6000828152602080822060001990840181018390559092019092558782526009905260408120556005546001600160a01b031663b88d4fde3033896040518463ffffffff1660e01b8152600401611cd893929190612531565b600060405180830381600087803b158015611cf257600080fd5b505af1158015611d06573d6000803e3d6000fd5b5050505050611ddc565b60405180606001604052808661ffff168152602001600b546001600160501b03168152602001611d3d3390565b6001600160a01b03169052600083815260086020908152604080832089845260099092529091205481548110611d7557611d756126f0565b6000918252602091829020835191018054928401516040909401516001600160a01b0316600160601b026001600160601b036001600160501b0390951662010000026001600160601b031990941661ffff9093169290921792909217929092169190911790555b831515857f0d572cea43328e1d4e1413c88ed43ad6f3b2110c4c8dc5b69bb45bad6fecb3b285604051611e1191815260200190565b60405180910390a3505092915050565b60025460ff1615611e445760405162461bcd60e51b815260040161047890612564565b6a13da329b63364718000000600c541015611eb1576201518068056bc75e2d63100000600454600d5442611e789190612645565b611e829190612626565b611e8c9190612626565b611e969190612612565b600c6000828254611ea791906125fa565b909155505042600d555b6040805160608101825261ffff80841682526001600160501b0342811660208085019182526001600160a01b03808916868801908152600089815260079093529682209551865493519751909116600160601b026001600160601b039790941662010000026001600160601b031990931694169390931717939093169290921790556004805460019290611f469084906125fa565b909155505060405142815260019082906001600160a01b038516907f8612e8567c2b59ea0cd07546cc5fd09fdcb85f542e6d73367c39b009ce24a0bf9060200160405180910390a45050565b6000611f9d826114f0565b60ff1690508060036000828254611fb491906125fa565b90915550506000818152600860208181526040808420805487865260098452828620819055938352815160608101835261ffff8089168252600b80546001600160501b039081168488019081526001600160a01b03808e1686890181815260018c018955978c52988b20955195909901805491519651909916600160601b026001600160601b039690921662010000026001600160601b031990911694909316939093179190911792909216179093559154915185927f8612e8567c2b59ea0cd07546cc5fd09fdcb85f542e6d73367c39b009ce24a0bf9161209891815260200190565b60405180910390a4505050565b6000326120b3600143612645565b60405160609290921b6001600160601b03191660208301524060348201524260548201526074810183905260940160408051601f19818403018152919052805160209091012092915050565b6003546121205780600a600082825461211891906125fa565b909155505050565b600354600a5461213090836125fa565b61213a9190612612565b600b600082825461214b91906125fa565b90915550506000600a5550565b60008083601f84011261216a57600080fd5b50813567ffffffffffffffff81111561218257600080fd5b6020830191508360208260051b850101111561219d57600080fd5b9250929050565b80516121af8161271b565b919050565b805160ff811681146121af57600080fd5b6000602082840312156121d757600080fd5b813561158581612706565b6000602082840312156121f457600080fd5b815161158581612706565b60008060008060006080868803121561221757600080fd5b853561222281612706565b9450602086013561223281612706565b935060408601359250606086013567ffffffffffffffff8082111561225657600080fd5b818801915088601f83011261226a57600080fd5b81358181111561227957600080fd5b89602082850101111561228b57600080fd5b9699959850939650602001949392505050565b6000806000604084860312156122b357600080fd5b83356122be81612706565b9250602084013567ffffffffffffffff8111156122da57600080fd5b6122e686828701612158565b9497909650939450505050565b60008060006040848603121561230857600080fd5b833567ffffffffffffffff81111561231f57600080fd5b61232b86828701612158565b909450925050602084013561233f8161271b565b809150509250925092565b6000806020838503121561235d57600080fd5b823567ffffffffffffffff81111561237457600080fd5b61238085828601612158565b90969095509350505050565b60006020828403121561239e57600080fd5b81356115858161271b565b6000602082840312156123bb57600080fd5b81516115858161271b565b600080604083850312156123d957600080fd5b82356123e481612706565b915060208301356123f481612706565b809150509250929050565b600061010080838503121561241357600080fd5b6040519081019067ffffffffffffffff8211818310171561244457634e487b7160e01b600052604160045260246000fd5b81604052612451846121a4565b815261245f602085016121b4565b6020820152612470604085016121b4565b6040820152612481606085016121b4565b6060820152612492608085016121b4565b60808201526124a360a085016121b4565b60a08201526124b460c085016121b4565b60c08201526124c560e085016121b4565b60e0820152949350505050565b6000602082840312156124e457600080fd5b813561ffff8116811461158557600080fd5b60006020828403121561250857600080fd5b5035919050565b6000806040838503121561252257600080fd5b50508035926020909101359150565b6001600160a01b039384168152919092166020820152604081019190915260806060820181905260009082015260a00190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6000821982111561260d5761260d6126ae565b500190565b600082612621576126216126c4565b500490565b6000816000190483118215151615612640576126406126ae565b500290565b600082821015612657576126576126ae565b500390565b600060ff821660ff841680821015612676576126766126ae565b90039392505050565b6000600019821415612693576126936126ae565b5060010190565b6000826126a9576126a96126c4565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038116811461052f57600080fd5b801515811461052f57600080fdfea26469706673582212200d3eb63a5684de9fd002c05a644079d7ad766fa3a76cd12c86277cb56ca267d364736f6c63430008070033

Deployed Bytecode Sourcemap

140974:13030:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;153697:302;;;;;;:::i;:::-;;:::i;:::-;;;-1:-1:-1;;;;;;8750:33:1;;;8732:52;;8720:2;8705:18;153697:302:0;;;;;;;;152768:128;;;;;;:::i;:::-;;:::i;:::-;;141862:40;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;141862:40:0;;-1:-1:-1;;;141862:40:0;;-1:-1:-1;;;;;141862:40:0;;;;;;;15906:6:1;15894:19;;;15876:38;;-1:-1:-1;;;;;15950:35:1;;;15945:2;15930:18;;15923:63;-1:-1:-1;;;;;16022:32:1;16002:18;;;15995:60;15864:2;15849:18;141862:40:0;15678:383:1;141097:35:0;;141131:1;141097:35;;;;;16420:4:1;16408:17;;;16390:36;;16378:2;16363:18;141097:35:0;16248:184:1;141326:29:0;;;;;;;;;9404:25:1;;;9392:2;9377:18;141326:29:0;9250:185:1;142734:63:0;;142783:14;142734:63;;142486:48;;142528:6;142486:48;;143044:33;;;;;;;;;;;;8561:14:1;;8554:22;8536:41;;8524:2;8509:18;143044:33:0;8396:187:1;142589:57:0;;142644:2;142589:57;;139714:86;139785:7;;;;139714:86;;142922:33;;;;;;141959:45;;;;;;:::i;:::-;;:::i;150180:1394::-;;;;;;:::i;:::-;;:::i;133959:103::-;;;:::i;152603:97::-;;;;;;:::i;:::-;;:::i;133308:87::-;133354:7;133381:6;-1:-1:-1;;;;;133381:6:0;133308:87;;;-1:-1:-1;;;;;7121:32:1;;;7103:51;;7091:2;7076:18;133308:87:0;6957:203:1;142843:33:0;;;;;;146042:518;;;;;;:::i;:::-;;:::i;143720:787::-;;;;;;:::i;:::-;;:::i;142159:37::-;;;;;;141692:25;;;;;-1:-1:-1;;;;;141692:25:0;;;142055:45;;;;;;:::i;:::-;;;;;;;;;;;;;;143395:147;;;;;;:::i;:::-;;:::i;142339:54::-;;142384:9;142339:54;;141793:23;;;;;-1:-1:-1;;;;;141793:23:0;;;142259:34;;;;;;134217:201;;;;;;:::i;:::-;;:::i;153697:302::-;153846:6;-1:-1:-1;;;;;153871:20:0;;;153863:71;;;;-1:-1:-1;;;153863:71:0;;13154:2:1;153863:71:0;;;13136:21:1;13193:2;13173:18;;;13166:30;13232:34;13212:18;;;13205:62;-1:-1:-1;;;13283:18:1;;;13276:36;13329:19;;153863:71:0;;;;;;;;;-1:-1:-1;;;;153697:302:0;;;;;;;:::o;152768:128::-;143298:4;;-1:-1:-1;;;;;143298:4:0;143290:27;;;;:61;;-1:-1:-1;143329:7:0;;-1:-1:-1;;;;;143329:7:0;143321:30;;143290:61;143282:91;;;;-1:-1:-1;;;143282:91:0;;11763:2:1;143282:91:0;;;11745:21:1;11802:2;11782:18;;;11775:30;-1:-1:-1;;;11821:18:1;;;11814:47;11878:18;;143282:91:0;11561:341:1;143282:91:0;133354:7;133381:6;-1:-1:-1;;;;;133381:6:0;132108:10;133528:23:::1;133520:68;;;;-1:-1:-1::0;;;133520:68:0::1;;;;;;;:::i;:::-;152851:7:::2;152847:43;;;152860:8;:6;:8::i;:::-;152768:128:::0;:::o;152847:43::-:2;152880:10;:8;:10::i;141959:45::-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;141959:45:0;;;-1:-1:-1;;;;;141959:45:0;;-1:-1:-1;;;;141959:45:0;;-1:-1:-1;;;;;141959:45:0;;:::o;150180:1394::-;137631:1;138229:7;;:19;;138221:63;;;;-1:-1:-1;;;138221:63:0;;;;;;;:::i;:::-;137631:1;138362:7;:18;150262:13:::1;::::0;::::1;;150254:41;;;::::0;-1:-1:-1;;;150254:41:0;;11419:2:1;150254:41:0::1;::::0;::::1;11401:21:1::0;11458:2;11438:18;;;11431:30;-1:-1:-1;;;11477:18:1;;;11470:45;11532:18;;150254:41:0::1;11217:339:1::0;150254:41:0::1;-1:-1:-1::0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;150398:1171:0::1;150415:19:::0;;::::1;150398:1171;;;150460:8;;150469:1;150460:11;;;;;;;:::i;:::-;150484:4;::::0;:21:::1;::::0;-1:-1:-1;;;150484:21:0;;150460:11:::1;::::0;;;::::1;::::0;;;::::1;;150484:21;::::0;::::1;9404:25:1::0;;;150460:11:0;-1:-1:-1;;;;;;150484:4:0;;::::1;::::0;:12:::1;::::0;-1:-1:-1;9377:18:1;;150484:21:0::1;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;150480:1082;;;150526:16;::::0;;;:7:::1;:16;::::0;;;;;;;;150518:24;;::::1;::::0;::::1;::::0;;;;::::1;::::0;::::1;::::0;;;;::::1;-1:-1:-1::0;;;;;150518:24:0::1;::::0;;::::1;::::0;;;;-1:-1:-1;;;150518:24:0;;::::1;-1:-1:-1::0;;;;;150518:24:0::1;::::0;;;;;;;-1:-1:-1;132108:10:0;150561:27:::1;150553:58;;;::::0;-1:-1:-1;;;150553:58:0;;12109:2:1;150553:58:0::1;::::0;::::1;12091:21:1::0;12148:2;12128:18;;;12121:30;-1:-1:-1;;;12167:18:1;;;12160:48;12225:18;;150553:58:0::1;11907:342:1::0;150553:58:0::1;150629:16;::::0;;;:7:::1;:16;::::0;;;;150622:23;;;150656:14:::1;:19:::0;;150622:23;;150629:16;150656:19:::1;::::0;150622:23;;150656:19:::1;:::i;:::-;::::0;;;-1:-1:-1;;150686:4:0::1;::::0;-1:-1:-1;;;;;150686:4:0::1;:21;150716:4;132108:10:::0;150737:7:::1;150686:63;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;150785:30:0::1;::::0;;9404:25:1;;150807:4:0::1;::::0;-1:-1:-1;150798:7:0;;-1:-1:-1;150785:30:0::1;::::0;9392:2:1;9377:18;150785:30:0::1;;;;;;;150480:1082;;;150850:21;150863:7;150850:12;:21::i;:::-;150842:29;;150890:17;::::0;;;:10:::1;:17;::::0;;;;;;;150908:19;;;:10:::1;:19:::0;;;;;;;150890:38;;150842:29;;-1:-1:-1;150890:17:0;;:38;::::1;;;;;:::i;:::-;;::::0;;;::::1;::::0;;;;150882:46:::1;::::0;;::::1;::::0;::::1;::::0;;150890:38;;;::::1;150882:46:::0;::::1;::::0;::::1;::::0;;;;::::1;-1:-1:-1::0;;;;;150882:46:0::1;::::0;;::::1;::::0;;;;-1:-1:-1;;;150882:46:0;;::::1;-1:-1:-1::0;;;;;150882:46:0::1;::::0;;;;;;;-1:-1:-1;132108:10:0;150947:27:::1;150939:58;;;::::0;-1:-1:-1;;;150939:58:0;;12109:2:1;150939:58:0::1;::::0;::::1;12091:21:1::0;12148:2;12128:18;;;12121:30;-1:-1:-1;;;12167:18:1;;;12160:48;12225:18;;150939:58:0::1;11907:342:1::0;150939:58:0::1;151028:5;151008:16;;:25;;;;;;;:::i;:::-;::::0;;;-1:-1:-1;;151092:17:0::1;::::0;;;:10:::1;:17;::::0;;;;151110:24;;:28:::1;::::0;151137:1:::1;::::0;151110:28:::1;:::i;:::-;151092:47;;;;;;;;:::i;:::-;;::::0;;;::::1;::::0;;;151080:59:::1;::::0;;::::1;::::0;::::1;::::0;;151092:47;;;::::1;151080:59:::0;::::1;::::0;::::1;::::0;;;;::::1;-1:-1:-1::0;;;;;151080:59:0::1;::::0;;::::1;::::0;-1:-1:-1;;;151080:59:0;::::1;-1:-1:-1::0;;;;;151080:59:0::1;::::0;;;;151150:17;;;:10:::1;:17:::0;;;;;151168:19;;;:10:::1;:19:::0;;;;;;;151150:38;;151080:59;;-1:-1:-1;151080:59:0;;151150:17;:38;::::1;;;;;:::i;:::-;;::::0;;;::::1;::::0;;;:50;;:38;::::1;:50:::0;;;;::::1;::::0;::::1;::::0;;::::1;::::0;-1:-1:-1;;;;;151150:50:0::1;-1:-1:-1::0;;;151150:50:0::1;-1:-1:-1::0;;;;;;;;;;151150:50:0;;::::1;::::0;::::1;-1:-1:-1::0;;;;;;151150:50:0;;;::::1;::::0;;::::1;::::0;;;;::::1;;;::::0;;151283:19;;;:10:::1;:19:::0;;;;;;151262:17;;151251:29;;::::1;::::0;;;;;:51;;;;151313:17;;;:10:::1;:17:::0;;;:23;;;::::1;;;;:::i;:::-;;::::0;;;::::1;::::0;;;-1:-1:-1;;151313:23:0;;;;;;;;;;;;;;151374:19;;;:10:::1;:19:::0;;;;;151367:26;151428:4:::1;::::0;-1:-1:-1;;;;;151428:4:0::1;:21;151458:4;132108:10:::0;151479:7:::1;151428:63;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;151524:28:0::1;::::0;;9404:25:1;;151544:4:0::1;::::0;-1:-1:-1;151535:7:0;;-1:-1:-1;151524:28:0::1;::::0;9392:2:1;9377:18;151524:28:0::1;;;;;;;150480:1082;150436:3:::0;::::1;::::0;::::1;:::i;:::-;;;;150398:1171;;;-1:-1:-1::0;;137587:1:0;138541:22;;-1:-1:-1;;;;;150180:1394:0:o;133959:103::-;133354:7;133381:6;-1:-1:-1;;;;;133381:6:0;132108:10;133528:23;133520:68;;;;-1:-1:-1;;;133520:68:0;;;;;;;:::i;:::-;134024:30:::1;134051:1;134024:18;:30::i;:::-;133959:103::o:0;152603:97::-;133354:7;133381:6;-1:-1:-1;;;;;133381:6:0;132108:10;133528:23;133520:68;;;;-1:-1:-1;;;133520:68:0;;;;;;;:::i;:::-;152670:13:::1;:24:::0;;-1:-1:-1;;152670:24:0::1;::::0;::::1;;::::0;;;::::1;::::0;;152603:97::o;146042:518::-;139785:7;;;;140039:9;140031:38;;;;-1:-1:-1;;;140031:38:0;;;;;;;:::i;:::-;142783:14:::1;152201:18;;:43;152197:247;;;152384:6;142384:9;152337:14;;152306:18;;152288:15;:36;;;;:::i;:::-;152287:64;;;;:::i;:::-;:94;;;;:::i;:::-;:103;;;;:::i;:::-;152255:18;;:135;;;;;;;:::i;:::-;::::0;;;-1:-1:-1;;152421:15:0::1;152400:18;:36:::0;152197:247:::1;143154:6:::2;143123:26;143142:6;143123:15;:26;:::i;:::-;143122:39;143114:67;;;::::0;-1:-1:-1;;;143114:67:0;;15342:2:1;143114:67:0::2;::::0;::::2;15324:21:1::0;15381:2;15361:18;;;15354:30;-1:-1:-1;;;15400:18:1;;;15393:45;15455:18;;143114:67:0::2;15140:339:1::0;143114:67:0::2;137631:1:::3;138229:7;;:19;;138221:63;;;;-1:-1:-1::0;;;138221:63:0::3;;;;;;;:::i;:::-;137631:1;138362:7;:18:::0;146184:9:::4;132108:10:::0;146184:25:::4;::::0;:58:::4;;-1:-1:-1::0;146237:4:0::4;::::0;-1:-1:-1;;;;;146237:4:0::4;132108:10:::0;-1:-1:-1;;;;;146213:29:0::4;;146184:58;146176:79;;;::::0;-1:-1:-1;;;146176:79:0;;11083:2:1;146176:79:0::4;::::0;::::4;11065:21:1::0;11122:1;11102:18;;;11095:29;-1:-1:-1;;;11140:18:1;;;11133:38;11188:18;;146176:79:0::4;10881:331:1::0;146176:79:0::4;146262:12;146290:6:::0;146285:203:::4;146302:19:::0;;::::4;146285:203;;;146341:4;::::0;-1:-1:-1;;;;;146341:4:0::4;:12;146354:8:::0;;146363:1;146354:11;;::::4;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;146341:25;::::0;-1:-1:-1;;;;;;146341:25:0::4;::::0;;;;;;15659:6:1;15647:19;;;146341:25:0::4;::::0;::::4;15629:38:1::0;15602:18;;146341:25:0::4;;;;;;;;;;;;;;;;::::0;::::4;;;;;;;;;;;;::::0;::::4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;146337:143;;;146385:33;146397:8;;146406:1;146397:11;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;146385:33;;146410:7;146385:11;:33::i;:::-;146377:41;::::0;;::::4;:::i;:::-;;;146337:143;;;146449:31;146459:8;;146468:1;146459:11;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;146449:31;;146472:7;146449:9;:31::i;:::-;146441:39;::::0;;::::4;:::i;:::-;;;146337:143;146323:3:::0;::::4;::::0;::::4;:::i;:::-;;;;146285:203;;;-1:-1:-1::0;146498:9:0;146494:22:::4;;146509:7;;;146494:22;146522:7;::::0;-1:-1:-1;;;;;146522:7:0::4;:12;132108:10:::0;146522:32:::4;::::0;-1:-1:-1;;;;;;146522:32:0::4;::::0;;;;;;-1:-1:-1;;;;;8309:32:1;;;146522::0::4;::::0;::::4;8291:51:1::0;8358:18;;;8351:34;;;8264:18;;146522:32:0::4;;;;;;;;;;;;;;;;;::::0;::::4;;;;;;;;;;;;::::0;::::4;;;;;;;;;146169:391;138393:1;-1:-1:-1::0;;137587:1:0::3;138541:22:::0;;-1:-1:-1;146042:518:0:o;143720:787::-;139785:7;;;;140039:9;140031:38;;;;-1:-1:-1;;;140031:38:0;;;;;;;:::i;:::-;137631:1:::1;138229:7;;:19;;138221:63;;;;-1:-1:-1::0;;;138221:63:0::1;;;;;;;:::i;:::-;137631:1;138362:7;:18:::0;143851:9:::2;132108:10:::0;143851:25:::2;::::0;:58:::2;;-1:-1:-1::0;143904:4:0::2;::::0;-1:-1:-1;;;;;143904:4:0::2;132108:10:::0;-1:-1:-1;;;;;143880:29:0::2;;143851:58;143843:79;;;::::0;-1:-1:-1;;;143843:79:0;;11083:2:1;143843:79:0::2;::::0;::::2;11065:21:1::0;11122:1;11102:18;;;11095:29;-1:-1:-1;;;11140:18:1;;;11133:38;11188:18;;143843:79:0::2;10881:331:1::0;143843:79:0::2;-1:-1:-1::0;;;;;143937:20:0;::::2;143948:9;143937:20;143929:59;;;::::0;-1:-1:-1;;;143929:59:0;;14273:2:1;143929:59:0::2;::::0;::::2;14255:21:1::0;14312:2;14292:18;;;14285:30;14351:28;14331:18;;;14324:56;14397:18;;143929:59:0::2;14071:350:1::0;143929:59:0::2;144002:6;143997:505;144014:19:::0;;::::2;143997:505;;;144053:8;;144062:1;144053:11;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;:16;;144049:53;;144084:8;;144049:53;144140:4;::::0;-1:-1:-1;;;;;144140:4:0::2;132108:10:::0;-1:-1:-1;;;;;144116:29:0::2;;144112:247;;144209:4;::::0;132108:10;;-1:-1:-1;;;;;144209:4:0::2;:12;144222:8:::0;;144231:1;144222:11;;::::2;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;144209:25;::::0;-1:-1:-1;;;;;;144209:25:0::2;::::0;;;;;;15659:6:1;15647:19;;;144209:25:0::2;::::0;::::2;15629:38:1::0;15602:18;;144209:25:0::2;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;144209:41:0::2;;144201:78;;;::::0;-1:-1:-1;;;144201:78:0;;12801:2:1;144201:78:0::2;::::0;::::2;12783:21:1::0;12840:2;12820:18;;;12813:30;12879:26;12859:18;;;12852:54;12923:18;;144201:78:0::2;12599:348:1::0;144201:78:0::2;144290:4;::::0;-1:-1:-1;;;;;144290:4:0::2;:17;132108:10:::0;144330:4:::2;144337:8;;144346:1;144337:11;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;144290:59;::::0;-1:-1:-1;;;;;;144290:59:0::2;::::0;;;;;;-1:-1:-1;;;;;7422:15:1;;;144290:59:0::2;::::0;::::2;7404:34:1::0;7474:15;;;;7454:18;;;7447:43;7538:6;7526:19;7506:18;;;7499:47;7339:18;;144290:59:0::2;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;144112:247;144373:4;::::0;-1:-1:-1;;;;;144373:4:0::2;:12;144386:8:::0;;144395:1;144386:11;;::::2;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;144373:25;::::0;-1:-1:-1;;;;;;144373:25:0::2;::::0;;;;;;15659:6:1;15647:19;;;144373:25:0::2;::::0;::::2;15629:38:1::0;15602:18;;144373:25:0::2;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;144369:125;;;144410:31;144420:7;144429:8;;144438:1;144429:11;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;144410:31;;:9;:31::i;:::-;144369:125;;;144465:29;144473:7;144482:8;;144491:1;144482:11;;;;;;;:::i;:::-;;;;;;;;;;;;;;:::i;:::-;144465:29;;:7;:29::i;:::-;144035:3:::0;::::2;::::0;::::2;:::i;:::-;;;;143997:505;;;-1:-1:-1::0;;137587:1:0::1;138541:22:::0;;-1:-1:-1;;143720:787:0:o;143395:147::-;133354:7;133381:6;-1:-1:-1;;;;;133381:6:0;132108:10;133528:23;133520:68;;;;-1:-1:-1;;;133520:68:0;;;;;;;:::i;:::-;143491:4:::1;:20:::0;;-1:-1:-1;;;;;143491:20:0;;::::1;-1:-1:-1::0;;;;;;143491:20:0;;::::1;;::::0;;;143518:7:::1;:18:::0;;;;;::::1;::::0;::::1;;::::0;;143395:147::o;134217:201::-;133354:7;133381:6;-1:-1:-1;;;;;133381:6:0;132108:10;133528:23;133520:68;;;;-1:-1:-1;;;133520:68:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;134306:22:0;::::1;134298:73;;;::::0;-1:-1:-1;;;134298:73:0;;10676:2:1;134298:73:0::1;::::0;::::1;10658:21:1::0;10715:2;10695:18;;;10688:30;10754:34;10734:18;;;10727:62;-1:-1:-1;;;10805:18:1;;;10798:36;10851:19;;134298:73:0::1;10474:402:1::0;134298:73:0::1;134382:28;134401:8;134382:18;:28::i;140514:118::-:0;139785:7;;;;140039:9;140031:38;;;;-1:-1:-1;;;140031:38:0;;;;;;;:::i;:::-;140574:7:::1;:14:::0;;-1:-1:-1;;140574:14:0::1;140584:4;140574:14;::::0;;140604:20:::1;140611:12;132108:10:::0;;132028:98;140611:12:::1;140604:20;::::0;-1:-1:-1;;;;;7121:32:1;;;7103:51;;7091:2;7076:18;140604:20:0::1;;;;;;;140514:118::o:0;140773:120::-;139785:7;;;;140309:41;;;;-1:-1:-1;;;140309:41:0;;9981:2:1;140309:41:0;;;9963:21:1;10020:2;10000:18;;;9993:30;-1:-1:-1;;;10039:18:1;;;10032:50;10099:18;;140309:41:0;9779:344:1;140309:41:0;140832:7:::1;:15:::0;;-1:-1:-1;;140832:15:0::1;::::0;;140863:22:::1;132108:10:::0;140872:12:::1;132028:98:::0;153086:204;153196:4;;:28;;-1:-1:-1;;;153196:28:0;;;;;9404:25:1;;;153148:5:0;;;;-1:-1:-1;;;;;153196:4:0;;;;:19;;9377:18:1;;153196:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;153162:62;;153250:1;:12;;;141131:1;153238:24;;;;:::i;:::-;153231:31;153086:204;-1:-1:-1;;;153086:204:0:o;134578:191::-;134652:16;134671:6;;-1:-1:-1;;;;;134688:17:0;;;-1:-1:-1;;;;;;134688:17:0;;;;;;134721:40;;134671:6;;;;;;;134721:40;;134652:16;134721:40;134641:128;134578:191;:::o;146954:1515::-;147024:12;147066:16;;;:7;:16;;;;;;;;147045:37;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;147045:37:0;;;;;;;;-1:-1:-1;;;147045:37:0;;;-1:-1:-1;;;;;147045:37:0;;;;;;;132108:10;147097:27;147089:65;;;;-1:-1:-1;;;147089:65:0;;14628:2:1;147089:65:0;;;14610:21:1;14667:2;14647:18;;;14640:30;14706:27;14686:18;;;14679:55;14751:18;;147089:65:0;14426:349:1;147089:65:0;147171:7;:58;;;;;142528:6;147200:5;:11;;;-1:-1:-1;;;;;147182:29:0;:15;:29;;;;:::i;:::-;:47;147171:58;147169:61;147161:96;;;;-1:-1:-1;;;147161:96:0;;13922:2:1;147161:96:0;;;13904:21:1;13961:2;13941:18;;;13934:30;-1:-1:-1;;;13980:18:1;;;13973:52;14042:18;;147161:96:0;13720:346:1;147161:96:0;142783:14;147268:18;;:43;147264:410;;;147384:6;142384:9;147348:5;:11;;;-1:-1:-1;;;;;147330:29:0;:15;:29;;;;:::i;:::-;147329:52;;;;:::i;:::-;:61;;;;:::i;:::-;147322:68;;147264:410;;;147422:18;;147408:5;:11;;;-1:-1:-1;;;;;147408:32:0;;147404:270;;;147504:1;147497:8;;147404:270;;;147660:6;142384:9;147624:5;:11;;;-1:-1:-1;;;;;147603:32:0;:18;;:32;;;;:::i;:::-;147602:55;;;;:::i;:::-;:64;;;;:::i;:::-;147595:71;;147404:270;147684:7;147680:736;;;147706:15;147713:7;147706:6;:15::i;:::-;147724:1;147706:19;147729:1;147706:24;147702:123;;;147780:16;147791:4;147780:10;:16::i;:::-;147814:1;147807:8;;147702:123;147840:16;;;;:7;:16;;;;;147833:23;;;147865:14;:19;;147833:23;;147840:16;147865:19;;147833:23;;147865:19;:::i;:::-;;;;-1:-1:-1;;147952:4:0;;-1:-1:-1;;;;;147952:4:0;:21;147982:4;132108:10;148003:7;147952:63;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;147680:736;;;148058:53;148107:3;148069:35;142644:2;148069:4;:35;:::i;:::-;:41;;;;:::i;:::-;148058:10;:53::i;:::-;148206:3;148168:34;142644:2;148206:3;148168:34;:::i;:::-;148160:43;;:4;:43;:::i;:::-;:49;;;;:::i;:::-;148153:56;;148271:122;;;;;;;;148334:7;148271:122;;;;;;148367:15;-1:-1:-1;;;;;148271:122:0;;;;;148295:12;132108:10;;132028:98;148295:12;-1:-1:-1;;;;;148271:122:0;;;;;;148252:16;;;;:7;:16;;;;;;;;;:141;;;;;;;;;;;;;;;;-1:-1:-1;;;148252:141:0;-1:-1:-1;;;;;;;;;;148252:141:0;;;;;-1:-1:-1;;;;;;148252:141:0;;;;;;;;;;;;;;;;;;;;;;147680:736;148449:7;148427:36;;148440:7;148427:36;148458:4;148427:36;;;;9404:25:1;;9392:2;9377:18;;9250:185;148427:36:0;;;;;;;;147038:1431;146954:1515;;;;:::o;148790:1272::-;148887:4;;:21;;-1:-1:-1;;;148887:21:0;;;;;9404:25:1;;;148858:12:0;;148920:4;;-1:-1:-1;;;;;148887:4:0;;;;:12;;9377:18:1;;148887:21:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;148887:38:0;;148879:61;;;;-1:-1:-1;;;148879:61:0;;9642:2:1;148879:61:0;;;9624:21:1;9681:2;9661:18;;;9654:30;-1:-1:-1;;;9700:18:1;;;9693:40;9750:18;;148879:61:0;9440:334:1;148879:61:0;148947:13;148963:21;148976:7;148963:12;:21::i;:::-;148947:37;;148991:18;149012:17;;;:10;:17;;;;;;;;149030:19;;;:10;:19;;;;;;149012:38;;148947:37;;-1:-1:-1;148991:18:0;;149012:17;;149030:19;149012:38;;;;;;:::i;:::-;;;;;;;;;;148991:59;;;;;;;;149012:38;;;;148991:59;;;;;;;;;-1:-1:-1;;;;;148991:59:0;;;;;;;;-1:-1:-1;;;148991:59:0;;;-1:-1:-1;;;;;148991:59:0;;;;;;;;-1:-1:-1;132108:10:0;149065:27;149057:57;;;;-1:-1:-1;;;149057:57:0;;10330:2:1;149057:57:0;;;10312:21:1;10369:2;10349:18;;;10342:30;-1:-1:-1;;;10388:18:1;;;10381:47;10445:18;;149057:57:0;10128:341:1;149057:57:0;149157:5;:11;;;-1:-1:-1;;;;;149139:29:0;:15;;:29;;;;:::i;:::-;149128:41;;149129:5;149128:41;:::i;:::-;149121:48;;149226:7;149222:789;;;149264:5;149244:16;;:25;;;;;;;:::i;:::-;;;;-1:-1:-1;;149312:22:0;149337:17;;;:10;:17;;;;;149355:24;;:28;;149382:1;;149355:28;:::i;:::-;149337:47;;;;;;;;:::i;:::-;;;;;;;;;149312:72;;;;;;;;149337:47;;;;149312:72;;;;;;;;;-1:-1:-1;;;;;149312:72:0;;;;;-1:-1:-1;;;149312:72:0;;-1:-1:-1;;;;;149312:72:0;;;;;149395:17;;;:10;:17;;;;;149413:19;;;:10;:19;;;;;;;149395:38;;149312:72;;-1:-1:-1;149312:72:0;;149395:17;:38;;;;;;:::i;:::-;;;;;;;;;:50;;:38;;:50;;;;;;;;;;;-1:-1:-1;;;;;149395:50:0;-1:-1:-1;;;149395:50:0;-1:-1:-1;;;;;;;;;;149395:50:0;;;;;-1:-1:-1;;;;;;149395:50:0;;;;;;;;;;;;;;;;149526:19;;;:10;:19;;;;;;149505:17;;149494:29;;;;;;;;:51;;;;149554:17;;;:10;:17;;;:23;;;;;;;:::i;:::-;;;;;;;;;-1:-1:-1;;149554:23:0;;;;;;;;;;;;;;149613:19;;;:10;:19;;;;;149606:26;149722:4;;-1:-1:-1;;;;;149722:4:0;:21;149752:4;132108:10;149773:7;149722:63;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;149235:575;149222:789;;;149866:122;;;;;;;;149929:7;149866:122;;;;;;149962:15;;-1:-1:-1;;;;;149866:122:0;;;;;149890:12;132108:10;;132028:98;149890:12;-1:-1:-1;;;;;149866:122:0;;;149825:17;;;;:10;:17;;;;;;;;149843:19;;;:10;:19;;;;;;;149825:38;;;;;;;;:::i;:::-;;;;;;;;;;:163;;:38;;:163;;;;;;;;;;;-1:-1:-1;;;;;149825:163:0;-1:-1:-1;;;149825:163:0;-1:-1:-1;;;;;;;;;;149825:163:0;;;;;-1:-1:-1;;;;;;149825:163:0;;;;;;;;;;;;;;;;;;;;;;;;;149222:789;150042:7;150022:34;;150033:7;150022:34;150051:4;150022:34;;;;9404:25:1;;9392:2;9377:18;;9250:185;150022:34:0;;;;;;;;148872:1190;;148790:1272;;;;:::o;144680:323::-;139785:7;;;;140039:9;140031:38;;;;-1:-1:-1;;;140031:38:0;;;;;;;:::i;:::-;142783:14:::1;152201:18;;:43;152197:247;;;152384:6;142384:9;152337:14;;152306:18;;152288:15;:36;;;;:::i;:::-;152287:64;;;;:::i;:::-;:94;;;;:::i;:::-;:103;;;;:::i;:::-;152255:18;;:135;;;;;;;:::i;:::-;::::0;;;-1:-1:-1;;152421:15:0::1;152400:18;:36:::0;152197:247:::1;144798:109:::2;::::0;;::::2;::::0;::::2;::::0;;::::2;::::0;;::::2;::::0;;-1:-1:-1;;;;;144883:15:0::2;144798:109:::0;::::2;;::::0;;::::2;::::0;;;-1:-1:-1;;;;;144798:109:0;;::::2;::::0;;;;;;-1:-1:-1;144779:16:0;;;:7:::2;:16:::0;;;;;;:128;;;;;;;;;;::::2;-1:-1:-1::0;;;144779:128:0::2;-1:-1:-1::0;;;;;144779:128:0;;;::::2;::::0;::::2;-1:-1:-1::0;;;;;;144779:128:0;;;;::::2;::::0;;;;::::2;::::0;;;::::2;::::0;;;::::2;::::0;;144914:14:::2;:19:::0;;144779:128;;-1:-1:-1;144914:19:0::2;::::0;144779:128;;144914:19:::2;:::i;:::-;::::0;;;-1:-1:-1;;144945:52:0::2;::::0;144981:15:::2;9404:25:1::0;;144975:4:0::2;::::0;144966:7;;-1:-1:-1;;;;;144945:52:0;::::2;::::0;::::2;::::0;9392:2:1;9377:18;144945:52:0::2;;;;;;;144680:323:::0;;:::o;145145:520::-;145212:13;145228:21;145241:7;145228:12;:21::i;:::-;145212:37;;;;145276:5;145256:16;;:25;;;;;;;:::i;:::-;;;;-1:-1:-1;;145352:17:0;;;;:10;:17;;;;;;;;:24;;145330:19;;;:10;:19;;;;;:46;;;145431:17;;;145454:109;;;;;;;;;;;;;145539:15;;;-1:-1:-1;;;;;145454:109:0;;;;;;;;;-1:-1:-1;;;;;145454:109:0;;;;;;;;;145431:133;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;145431:133:0;-1:-1:-1;;;;;145431:133:0;;;;;;-1:-1:-1;;;;;;145431:133:0;;;;;;;;;;;;;;;;;;;;;;;145643:15;;145606:53;;145341:7;;145606:53;;;;9404:25:1;;9392:2;9377:18;;9250:185;145606:53:0;;;;;;;;145205:460;145145:520;;:::o;153475:216::-;153528:7;153594:9;153622:16;153637:1;153622:12;:16;:::i;:::-;153569:114;;6760:2:1;6756:15;;;;-1:-1:-1;;;;;;6752:53:1;153569:114:0;;;6740:66:1;153612:27:0;6822:12:1;;;6815:28;153648:15:0;6859:12:1;;;6852:28;6896:12;;;6889:28;;;6933:13;;153569:114:0;;;-1:-1:-1;;153569:114:0;;;;;;;;;153559:125;;153569:114;153559:125;;;;;153475:216;-1:-1:-1;;153475:216:0:o;151694:370::-;151750:16;;151746:154;;151833:6;151811:18;;:28;;;;;;;:::i;:::-;;;;-1:-1:-1;;;151694:370:0:o;151746:154::-;152013:16;;151991:18;;151982:27;;:6;:27;:::i;:::-;151981:48;;;;:::i;:::-;151962:15;;:67;;;;;;;:::i;:::-;;;;-1:-1:-1;;152057:1:0;152036:18;:22;-1:-1:-1;151694:370:0:o;14:366:1:-;76:8;86:6;140:3;133:4;125:6;121:17;117:27;107:55;;158:1;155;148:12;107:55;-1:-1:-1;181:20:1;;224:18;213:30;;210:50;;;256:1;253;246:12;210:50;293:4;285:6;281:17;269:29;;353:3;346:4;336:6;333:1;329:14;321:6;317:27;313:38;310:47;307:67;;;370:1;367;360:12;307:67;14:366;;;;;:::o;385:132::-;461:13;;483:28;461:13;483:28;:::i;:::-;385:132;;;:::o;522:160::-;599:13;;652:4;641:16;;631:27;;621:55;;672:1;669;662:12;687:247;746:6;799:2;787:9;778:7;774:23;770:32;767:52;;;815:1;812;805:12;767:52;854:9;841:23;873:31;898:5;873:31;:::i;939:251::-;1009:6;1062:2;1050:9;1041:7;1037:23;1033:32;1030:52;;;1078:1;1075;1068:12;1030:52;1110:9;1104:16;1129:31;1154:5;1129:31;:::i;1195:936::-;1292:6;1300;1308;1316;1324;1377:3;1365:9;1356:7;1352:23;1348:33;1345:53;;;1394:1;1391;1384:12;1345:53;1433:9;1420:23;1452:31;1477:5;1452:31;:::i;:::-;1502:5;-1:-1:-1;1559:2:1;1544:18;;1531:32;1572:33;1531:32;1572:33;:::i;:::-;1624:7;-1:-1:-1;1678:2:1;1663:18;;1650:32;;-1:-1:-1;1733:2:1;1718:18;;1705:32;1756:18;1786:14;;;1783:34;;;1813:1;1810;1803:12;1783:34;1851:6;1840:9;1836:22;1826:32;;1896:7;1889:4;1885:2;1881:13;1877:27;1867:55;;1918:1;1915;1908:12;1867:55;1958:2;1945:16;1984:2;1976:6;1973:14;1970:34;;;2000:1;1997;1990:12;1970:34;2045:7;2040:2;2031:6;2027:2;2023:15;2019:24;2016:37;2013:57;;;2066:1;2063;2056:12;2013:57;1195:936;;;;-1:-1:-1;1195:936:1;;-1:-1:-1;2097:2:1;2089:11;;2119:6;1195:936;-1:-1:-1;;;1195:936:1:o;2136:570::-;2230:6;2238;2246;2299:2;2287:9;2278:7;2274:23;2270:32;2267:52;;;2315:1;2312;2305:12;2267:52;2354:9;2341:23;2373:31;2398:5;2373:31;:::i;:::-;2423:5;-1:-1:-1;2479:2:1;2464:18;;2451:32;2506:18;2495:30;;2492:50;;;2538:1;2535;2528:12;2492:50;2577:69;2638:7;2629:6;2618:9;2614:22;2577:69;:::i;:::-;2136:570;;2665:8;;-1:-1:-1;2551:95:1;;-1:-1:-1;;;;2136:570:1:o;2711:564::-;2802:6;2810;2818;2871:2;2859:9;2850:7;2846:23;2842:32;2839:52;;;2887:1;2884;2877:12;2839:52;2927:9;2914:23;2960:18;2952:6;2949:30;2946:50;;;2992:1;2989;2982:12;2946:50;3031:69;3092:7;3083:6;3072:9;3068:22;3031:69;:::i;:::-;3119:8;;-1:-1:-1;3005:95:1;-1:-1:-1;;3204:2:1;3189:18;;3176:32;3217:28;3176:32;3217:28;:::i;:::-;3264:5;3254:15;;;2711:564;;;;;:::o;3280:436::-;3366:6;3374;3427:2;3415:9;3406:7;3402:23;3398:32;3395:52;;;3443:1;3440;3433:12;3395:52;3483:9;3470:23;3516:18;3508:6;3505:30;3502:50;;;3548:1;3545;3538:12;3502:50;3587:69;3648:7;3639:6;3628:9;3624:22;3587:69;:::i;:::-;3675:8;;3561:95;;-1:-1:-1;3280:436:1;-1:-1:-1;;;;3280:436:1:o;3721:241::-;3777:6;3830:2;3818:9;3809:7;3805:23;3801:32;3798:52;;;3846:1;3843;3836:12;3798:52;3885:9;3872:23;3904:28;3926:5;3904:28;:::i;3967:245::-;4034:6;4087:2;4075:9;4066:7;4062:23;4058:32;4055:52;;;4103:1;4100;4093:12;4055:52;4135:9;4129:16;4154:28;4176:5;4154:28;:::i;4217:427::-;4324:6;4332;4385:2;4373:9;4364:7;4360:23;4356:32;4353:52;;;4401:1;4398;4391:12;4353:52;4440:9;4427:23;4459:31;4484:5;4459:31;:::i;:::-;4509:5;-1:-1:-1;4566:2:1;4551:18;;4538:32;4579:33;4538:32;4579:33;:::i;:::-;4631:7;4621:17;;;4217:427;;;;;:::o;4649:1158::-;4745:6;4776:3;4820:2;4808:9;4799:7;4795:23;4791:32;4788:52;;;4836:1;4833;4826:12;4788:52;4869:2;4863:9;4899:15;;;;4944:18;4929:34;;4965:22;;;4926:62;4923:185;;;5030:10;5025:3;5021:20;5018:1;5011:31;5065:4;5062:1;5055:15;5093:4;5090:1;5083:15;4923:185;5128:10;5124:2;5117:22;5163:37;5190:9;5163:37;:::i;:::-;5155:6;5148:53;5234:47;5277:2;5266:9;5262:18;5234:47;:::i;:::-;5229:2;5221:6;5217:15;5210:72;5315:47;5358:2;5347:9;5343:18;5315:47;:::i;:::-;5310:2;5302:6;5298:15;5291:72;5396:47;5439:2;5428:9;5424:18;5396:47;:::i;:::-;5391:2;5383:6;5379:15;5372:72;5478:48;5521:3;5510:9;5506:19;5478:48;:::i;:::-;5472:3;5464:6;5460:16;5453:74;5561:48;5604:3;5593:9;5589:19;5561:48;:::i;:::-;5555:3;5547:6;5543:16;5536:74;5644:48;5687:3;5676:9;5672:19;5644:48;:::i;:::-;5638:3;5630:6;5626:16;5619:74;5727:48;5770:3;5759:9;5755:19;5727:48;:::i;:::-;5721:3;5709:16;;5702:74;5713:6;4649:1158;-1:-1:-1;;;;4649:1158:1:o;5812:272::-;5870:6;5923:2;5911:9;5902:7;5898:23;5894:32;5891:52;;;5939:1;5936;5929:12;5891:52;5978:9;5965:23;6028:6;6021:5;6017:18;6010:5;6007:29;5997:57;;6050:1;6047;6040:12;6089:180;6148:6;6201:2;6189:9;6180:7;6176:23;6172:32;6169:52;;;6217:1;6214;6207:12;6169:52;-1:-1:-1;6240:23:1;;6089:180;-1:-1:-1;6089:180:1:o;6274:248::-;6342:6;6350;6403:2;6391:9;6382:7;6378:23;6374:32;6371:52;;;6419:1;6416;6409:12;6371:52;-1:-1:-1;;6442:23:1;;;6512:2;6497:18;;;6484:32;;-1:-1:-1;6274:248:1:o;7557:555::-;-1:-1:-1;;;;;7880:15:1;;;7862:34;;7932:15;;;;7927:2;7912:18;;7905:43;7979:2;7964:18;;7957:34;;;;8027:3;8022:2;8007:18;;8000:31;;;7805:4;8047:19;;;8040:30;7842:3;8087:19;;7557:555::o;12254:340::-;12456:2;12438:21;;;12495:2;12475:18;;;12468:30;-1:-1:-1;;;12529:2:1;12514:18;;12507:46;12585:2;12570:18;;12254:340::o;13359:356::-;13561:2;13543:21;;;13580:18;;;13573:30;13639:34;13634:2;13619:18;;13612:62;13706:2;13691:18;;13359:356::o;14780:355::-;14982:2;14964:21;;;15021:2;15001:18;;;14994:30;15060:33;15055:2;15040:18;;15033:61;15126:2;15111:18;;14780:355::o;16437:128::-;16477:3;16508:1;16504:6;16501:1;16498:13;16495:39;;;16514:18;;:::i;:::-;-1:-1:-1;16550:9:1;;16437:128::o;16570:120::-;16610:1;16636;16626:35;;16641:18;;:::i;:::-;-1:-1:-1;16675:9:1;;16570:120::o;16695:168::-;16735:7;16801:1;16797;16793:6;16789:14;16786:1;16783:21;16778:1;16771:9;16764:17;16760:45;16757:71;;;16808:18;;:::i;:::-;-1:-1:-1;16848:9:1;;16695:168::o;16868:125::-;16908:4;16936:1;16933;16930:8;16927:34;;;16941:18;;:::i;:::-;-1:-1:-1;16978:9:1;;16868:125::o;16998:195::-;17036:4;17073;17070:1;17066:12;17105:4;17102:1;17098:12;17130:3;17125;17122:12;17119:38;;;17137:18;;:::i;:::-;17174:13;;;16998:195;-1:-1:-1;;;16998:195:1:o;17198:135::-;17237:3;-1:-1:-1;;17258:17:1;;17255:43;;;17278:18;;:::i;:::-;-1:-1:-1;17325:1:1;17314:13;;17198:135::o;17338:112::-;17370:1;17396;17386:35;;17401:18;;:::i;:::-;-1:-1:-1;17435:9:1;;17338:112::o;17455:127::-;17516:10;17511:3;17507:20;17504:1;17497:31;17547:4;17544:1;17537:15;17571:4;17568:1;17561:15;17587:127;17648:10;17643:3;17639:20;17636:1;17629:31;17679:4;17676:1;17669:15;17703:4;17700:1;17693:15;17719:127;17780:10;17775:3;17771:20;17768:1;17761:31;17811:4;17808:1;17801:15;17835:4;17832:1;17825:15;17851:127;17912:10;17907:3;17903:20;17900:1;17893:31;17943:4;17940:1;17933:15;17967:4;17964:1;17957:15;17983:131;-1:-1:-1;;;;;18058:31:1;;18048:42;;18038:70;;18104:1;18101;18094:12;18119:118;18205:5;18198:13;18191:21;18184:5;18181:32;18171:60;;18227:1;18224;18217:12

Swarm Source

ipfs://0d3eb63a5684de9fd002c05a644079d7ad766fa3a76cd12c86277cb56ca267d3

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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