APE Price: $1.18 (+4.32%)

Contract

0xA4DA5C27439DED9D36456Fd30a633B755B5e890F

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo3,842 APE

APE Value

$4,535.32 (@ $1.18/APE)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Donate70323312024-12-23 3:29:5312 mins ago1734924593IN
0xA4DA5C27...55B5e890F
69 APE0.0013448325.42069
Donate70321582024-12-23 3:26:1816 mins ago1734924378IN
0xA4DA5C27...55B5e890F
69 APE0.0013448525.42069
Upgrade70320262024-12-23 3:24:2817 mins ago1734924268IN
0xA4DA5C27...55B5e890F
14 APE0.002516825.42069
Upgrade70318952024-12-23 3:21:4920 mins ago1734924109IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Donate70315352024-12-23 3:15:2027 mins ago1734923720IN
0xA4DA5C27...55B5e890F
69 APE0.0013448525.42069
Upgrade70298642024-12-23 2:43:4858 mins ago1734921828IN
0xA4DA5C27...55B5e890F
7 APE0.0025156325.42069
Upgrade70298432024-12-23 2:43:151 hrs ago1734921795IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70297932024-12-23 2:42:221 hrs ago1734921742IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70297302024-12-23 2:41:211 hr ago1734921681IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70296152024-12-23 2:39:151 hr ago1734921555IN
0xA4DA5C27...55B5e890F
21 APE0.0025171325.42069
Upgrade70295462024-12-23 2:38:021 hr ago1734921482IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70295132024-12-23 2:37:061 hr ago1734921426IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70294752024-12-23 2:35:491 hr ago1734921349IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70294352024-12-23 2:35:011 hr ago1734921301IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70292282024-12-23 2:30:561 hr ago1734921056IN
0xA4DA5C27...55B5e890F
21 APE0.0026391525.42069
Upgrade70290402024-12-23 2:27:541 hr ago1734920874IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70288432024-12-23 2:25:041 hr ago1734920704IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70288202024-12-23 2:24:331 hr ago1734920673IN
0xA4DA5C27...55B5e890F
14 APE0.002516825.42069
Upgrade70281392024-12-23 2:13:231 hr ago1734920003IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70281022024-12-23 2:12:491 hr ago1734919969IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70279482024-12-23 2:10:591 hr ago1734919859IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70279152024-12-23 2:10:411 hr ago1734919841IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70274212024-12-23 2:04:101 hr ago1734919450IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70273842024-12-23 2:03:401 hr ago1734919420IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
Upgrade70273612024-12-23 2:02:491 hr ago1734919369IN
0xA4DA5C27...55B5e890F
7 APE0.0026376525.42069
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
OogieUpgrader

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at apescan.io on 2024-12-22
*/

// File: @openzeppelin/contracts/utils/Context.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @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/Ownable.sol


// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;


/**
 * @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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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/security/ReentrancyGuard.sol


// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

// File: @openzeppelin/contracts/token/ERC20/IERC20.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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

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

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

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @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].
     *
     * CAUTION: See Security Considerations above.
     */
    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/utils/Address.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

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

// File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;




/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

// File: @openzeppelin/contracts/finance/PaymentSplitter.sol


// OpenZeppelin Contracts (last updated v4.8.0) (finance/PaymentSplitter.sol)

pragma solidity ^0.8.0;




/**
 * @title PaymentSplitter
 * @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware
 * that the Ether will be split in this way, since it is handled transparently by the contract.
 *
 * The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each
 * account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim
 * an amount proportional to the percentage of total shares they were assigned. The distribution of shares is set at the
 * time of contract deployment and can't be updated thereafter.
 *
 * `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the
 * accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
 * function.
 *
 * NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and
 * tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you
 * to run tests before sending real value to this contract.
 */
contract PaymentSplitter is Context {
    event PayeeAdded(address account, uint256 shares);
    event PaymentReleased(address to, uint256 amount);
    event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);
    event PaymentReceived(address from, uint256 amount);

    uint256 private _totalShares;
    uint256 private _totalReleased;

    mapping(address => uint256) private _shares;
    mapping(address => uint256) private _released;
    address[] private _payees;

    mapping(IERC20 => uint256) private _erc20TotalReleased;
    mapping(IERC20 => mapping(address => uint256)) private _erc20Released;

    /**
     * @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at
     * the matching position in the `shares` array.
     *
     * All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
     * duplicates in `payees`.
     */
    constructor(address[] memory payees, uint256[] memory shares_) payable {
        require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
        require(payees.length > 0, "PaymentSplitter: no payees");

        for (uint256 i = 0; i < payees.length; i++) {
            _addPayee(payees[i], shares_[i]);
        }
    }

    /**
     * @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
     * reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
     * reliability of the events, and not the actual splitting of Ether.
     *
     * To learn more about this see the Solidity documentation for
     * https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback
     * functions].
     */
    receive() external payable virtual {
        emit PaymentReceived(_msgSender(), msg.value);
    }

    /**
     * @dev Getter for the total shares held by payees.
     */
    function totalShares() public view returns (uint256) {
        return _totalShares;
    }

    /**
     * @dev Getter for the total amount of Ether already released.
     */
    function totalReleased() public view returns (uint256) {
        return _totalReleased;
    }

    /**
     * @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20
     * contract.
     */
    function totalReleased(IERC20 token) public view returns (uint256) {
        return _erc20TotalReleased[token];
    }

    /**
     * @dev Getter for the amount of shares held by an account.
     */
    function shares(address account) public view returns (uint256) {
        return _shares[account];
    }

    /**
     * @dev Getter for the amount of Ether already released to a payee.
     */
    function released(address account) public view returns (uint256) {
        return _released[account];
    }

    /**
     * @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an
     * IERC20 contract.
     */
    function released(IERC20 token, address account) public view returns (uint256) {
        return _erc20Released[token][account];
    }

    /**
     * @dev Getter for the address of the payee number `index`.
     */
    function payee(uint256 index) public view returns (address) {
        return _payees[index];
    }

    /**
     * @dev Getter for the amount of payee's releasable Ether.
     */
    function releasable(address account) public view returns (uint256) {
        uint256 totalReceived = address(this).balance + totalReleased();
        return _pendingPayment(account, totalReceived, released(account));
    }

    /**
     * @dev Getter for the amount of payee's releasable `token` tokens. `token` should be the address of an
     * IERC20 contract.
     */
    function releasable(IERC20 token, address account) public view returns (uint256) {
        uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);
        return _pendingPayment(account, totalReceived, released(token, account));
    }

    /**
     * @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the
     * total shares and their previous withdrawals.
     */
    function release(address payable account) public virtual {
        require(_shares[account] > 0, "PaymentSplitter: account has no shares");

        uint256 payment = releasable(account);

        require(payment != 0, "PaymentSplitter: account is not due payment");

        // _totalReleased is the sum of all values in _released.
        // If "_totalReleased += payment" does not overflow, then "_released[account] += payment" cannot overflow.
        _totalReleased += payment;
        unchecked {
            _released[account] += payment;
        }

        Address.sendValue(account, payment);
        emit PaymentReleased(account, payment);
    }

    /**
     * @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their
     * percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20
     * contract.
     */
    function release(IERC20 token, address account) public virtual {
        require(_shares[account] > 0, "PaymentSplitter: account has no shares");

        uint256 payment = releasable(token, account);

        require(payment != 0, "PaymentSplitter: account is not due payment");

        // _erc20TotalReleased[token] is the sum of all values in _erc20Released[token].
        // If "_erc20TotalReleased[token] += payment" does not overflow, then "_erc20Released[token][account] += payment"
        // cannot overflow.
        _erc20TotalReleased[token] += payment;
        unchecked {
            _erc20Released[token][account] += payment;
        }

        SafeERC20.safeTransfer(token, account, payment);
        emit ERC20PaymentReleased(token, account, payment);
    }

    /**
     * @dev internal logic for computing the pending payment of an `account` given the token historical balances and
     * already released amounts.
     */
    function _pendingPayment(
        address account,
        uint256 totalReceived,
        uint256 alreadyReleased
    ) private view returns (uint256) {
        return (totalReceived * _shares[account]) / _totalShares - alreadyReleased;
    }

    /**
     * @dev Add a new payee to the contract.
     * @param account The address of the payee to add.
     * @param shares_ The number of shares owned by the payee.
     */
    function _addPayee(address account, uint256 shares_) private {
        require(account != address(0), "PaymentSplitter: account is the zero address");
        require(shares_ > 0, "PaymentSplitter: shares are 0");
        require(_shares[account] == 0, "PaymentSplitter: account already has shares");

        _payees.push(account);
        _shares[account] = shares_;
        _totalShares = _totalShares + shares_;
        emit PayeeAdded(account, shares_);
    }
}

// File: @openzeppelin/contracts/utils/introspection/IERC165.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

// File: @openzeppelin/contracts/token/ERC721/IERC721.sol


// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;


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

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

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

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

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

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

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

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

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

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

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

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

// File: @openzeppelin/contracts/token/ERC1155/IERC1155.sol


// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.20;


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

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

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

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

    /**
     * @dev Returns the value of tokens of token type `id` owned by `account`.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

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

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

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

    /**
     * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
     *
     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens
     * to an untrusted contract, when invoking {onERC1155Received} on the receiver.
     * Ensure to follow the checks-effects-interactions pattern and consider employing
     * reentrancy guards when interacting with untrusted contracts.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `value` amount.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens
     * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
     * Ensure to follow the checks-effects-interactions pattern and consider employing
     * reentrancy guards when interacting with untrusted contracts.
     *
     * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
     *
     * Requirements:
     *
     * - `ids` and `values` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external;
}

// File: @openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol


// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.20;


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

// File: @openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol


// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.20;


/**
 * @dev Interface that must be implemented by smart contracts in order to receive
 * ERC-1155 token transfers.
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC-1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

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

// File: @openzeppelin/contracts/interfaces/draft-IERC6093.sol


// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

// File: @openzeppelin/contracts/token/ERC1155/utils/ERC1155Utils.sol


// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/utils/ERC1155Utils.sol)

pragma solidity ^0.8.20;



/**
 * @dev Library that provide common ERC-1155 utility functions.
 *
 * See https://eips.ethereum.org/EIPS/eip-1155[ERC-1155].
 *
 * _Available since v5.1._
 */
library ERC1155Utils {
    /**
     * @dev Performs an acceptance check for the provided `operator` by calling {IERC1155-onERC1155Received}
     * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`).
     *
     * The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA).
     * Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept
     * the transfer.
     */
    function checkOnERC1155Received(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length > 0) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    // Tokens rejected
                    revert IERC1155Errors.ERC1155InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    // non-IERC1155Receiver implementer
                    revert IERC1155Errors.ERC1155InvalidReceiver(to);
                } else {
                    assembly ("memory-safe") {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }

    /**
     * @dev Performs a batch acceptance check for the provided `operator` by calling {IERC1155-onERC1155BatchReceived}
     * on the `to` address. The `operator` is generally the address that initiated the token transfer (i.e. `msg.sender`).
     *
     * The acceptance call is not executed and treated as a no-op if the target address doesn't contain code (i.e. an EOA).
     * Otherwise, the recipient must implement {IERC1155Receiver-onERC1155Received} and return the acceptance magic value to accept
     * the transfer.
     */
    function checkOnERC1155BatchReceived(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) internal {
        if (to.code.length > 0) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    // Tokens rejected
                    revert IERC1155Errors.ERC1155InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    // non-IERC1155Receiver implementer
                    revert IERC1155Errors.ERC1155InvalidReceiver(to);
                } else {
                    assembly ("memory-safe") {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }
}

// File: @openzeppelin/contracts/utils/introspection/ERC165.sol


// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;


/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC-165 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);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// File: @openzeppelin/contracts/utils/Comparators.sol


// OpenZeppelin Contracts (last updated v5.1.0) (utils/Comparators.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides a set of functions to compare values.
 *
 * _Available since v5.1._
 */
library Comparators {
    function lt(uint256 a, uint256 b) internal pure returns (bool) {
        return a < b;
    }

    function gt(uint256 a, uint256 b) internal pure returns (bool) {
        return a > b;
    }
}

// File: @openzeppelin/contracts/utils/SlotDerivation.sol


// OpenZeppelin Contracts (last updated v5.1.0) (utils/SlotDerivation.sol)
// This file was procedurally generated from scripts/generate/templates/SlotDerivation.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for computing storage (and transient storage) locations from namespaces and deriving slots
 * corresponding to standard patterns. The derivation method for array and mapping matches the storage layout used by
 * the solidity language / compiler.
 *
 * See https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays[Solidity docs for mappings and dynamic arrays.].
 *
 * Example usage:
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using StorageSlot for bytes32;
 *     using SlotDerivation for bytes32;
 *
 *     // Declare a namespace
 *     string private constant _NAMESPACE = "<namespace>" // eg. OpenZeppelin.Slot
 *
 *     function setValueInNamespace(uint256 key, address newValue) internal {
 *         _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value = newValue;
 *     }
 *
 *     function getValueInNamespace(uint256 key) internal view returns (address) {
 *         return _NAMESPACE.erc7201Slot().deriveMapping(key).getAddressSlot().value;
 *     }
 * }
 * ```
 *
 * TIP: Consider using this library along with {StorageSlot}.
 *
 * NOTE: This library provides a way to manipulate storage locations in a non-standard way. Tooling for checking
 * upgrade safety will ignore the slots accessed through this library.
 *
 * _Available since v5.1._
 */
library SlotDerivation {
    /**
     * @dev Derive an ERC-7201 slot from a string (namespace).
     */
    function erc7201Slot(string memory namespace) internal pure returns (bytes32 slot) {
        assembly ("memory-safe") {
            mstore(0x00, sub(keccak256(add(namespace, 0x20), mload(namespace)), 1))
            slot := and(keccak256(0x00, 0x20), not(0xff))
        }
    }

    /**
     * @dev Add an offset to a slot to get the n-th element of a structure or an array.
     */
    function offset(bytes32 slot, uint256 pos) internal pure returns (bytes32 result) {
        unchecked {
            return bytes32(uint256(slot) + pos);
        }
    }

    /**
     * @dev Derive the location of the first element in an array from the slot where the length is stored.
     */
    function deriveArray(bytes32 slot) internal pure returns (bytes32 result) {
        assembly ("memory-safe") {
            mstore(0x00, slot)
            result := keccak256(0x00, 0x20)
        }
    }

    /**
     * @dev Derive the location of a mapping element from the key.
     */
    function deriveMapping(bytes32 slot, address key) internal pure returns (bytes32 result) {
        assembly ("memory-safe") {
            mstore(0x00, and(key, shr(96, not(0))))
            mstore(0x20, slot)
            result := keccak256(0x00, 0x40)
        }
    }

    /**
     * @dev Derive the location of a mapping element from the key.
     */
    function deriveMapping(bytes32 slot, bool key) internal pure returns (bytes32 result) {
        assembly ("memory-safe") {
            mstore(0x00, iszero(iszero(key)))
            mstore(0x20, slot)
            result := keccak256(0x00, 0x40)
        }
    }

    /**
     * @dev Derive the location of a mapping element from the key.
     */
    function deriveMapping(bytes32 slot, bytes32 key) internal pure returns (bytes32 result) {
        assembly ("memory-safe") {
            mstore(0x00, key)
            mstore(0x20, slot)
            result := keccak256(0x00, 0x40)
        }
    }

    /**
     * @dev Derive the location of a mapping element from the key.
     */
    function deriveMapping(bytes32 slot, uint256 key) internal pure returns (bytes32 result) {
        assembly ("memory-safe") {
            mstore(0x00, key)
            mstore(0x20, slot)
            result := keccak256(0x00, 0x40)
        }
    }

    /**
     * @dev Derive the location of a mapping element from the key.
     */
    function deriveMapping(bytes32 slot, int256 key) internal pure returns (bytes32 result) {
        assembly ("memory-safe") {
            mstore(0x00, key)
            mstore(0x20, slot)
            result := keccak256(0x00, 0x40)
        }
    }

    /**
     * @dev Derive the location of a mapping element from the key.
     */
    function deriveMapping(bytes32 slot, string memory key) internal pure returns (bytes32 result) {
        assembly ("memory-safe") {
            let length := mload(key)
            let begin := add(key, 0x20)
            let end := add(begin, length)
            let cache := mload(end)
            mstore(end, slot)
            result := keccak256(begin, add(length, 0x20))
            mstore(end, cache)
        }
    }

    /**
     * @dev Derive the location of a mapping element from the key.
     */
    function deriveMapping(bytes32 slot, bytes memory key) internal pure returns (bytes32 result) {
        assembly ("memory-safe") {
            let length := mload(key)
            let begin := add(key, 0x20)
            let end := add(begin, length)
            let cache := mload(end)
            mstore(end, slot)
            result := keccak256(begin, add(length, 0x20))
            mstore(end, cache)
        }
    }
}

// File: @openzeppelin/contracts/utils/StorageSlot.sol


// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC-1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * TIP: Consider using this library along with {SlotDerivation}.
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct Int256Slot {
        int256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `Int256Slot` with member `value` located at `slot`.
     */
    function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        assembly ("memory-safe") {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns a `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        assembly ("memory-safe") {
            r.slot := store.slot
        }
    }
}

// File: @openzeppelin/contracts/utils/math/Math.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

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

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

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

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

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

// File: @openzeppelin/contracts/utils/Arrays.sol


// OpenZeppelin Contracts (last updated v5.1.0) (utils/Arrays.sol)
// This file was procedurally generated from scripts/generate/templates/Arrays.js.

pragma solidity ^0.8.20;





/**
 * @dev Collection of functions related to array types.
 */
library Arrays {
    using SlotDerivation for bytes32;
    using StorageSlot for bytes32;

    /**
     * @dev Sort an array of uint256 (in memory) following the provided comparator function.
     *
     * This function does the sorting "in place", meaning that it overrides the input. The object is returned for
     * convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
     *
     * NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
     * array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
     * when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
     * consume more gas than is available in a block, leading to potential DoS.
     *
     * IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
     */
    function sort(
        uint256[] memory array,
        function(uint256, uint256) pure returns (bool) comp
    ) internal pure returns (uint256[] memory) {
        _quickSort(_begin(array), _end(array), comp);
        return array;
    }

    /**
     * @dev Variant of {sort} that sorts an array of uint256 in increasing order.
     */
    function sort(uint256[] memory array) internal pure returns (uint256[] memory) {
        sort(array, Comparators.lt);
        return array;
    }

    /**
     * @dev Sort an array of address (in memory) following the provided comparator function.
     *
     * This function does the sorting "in place", meaning that it overrides the input. The object is returned for
     * convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
     *
     * NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
     * array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
     * when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
     * consume more gas than is available in a block, leading to potential DoS.
     *
     * IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
     */
    function sort(
        address[] memory array,
        function(address, address) pure returns (bool) comp
    ) internal pure returns (address[] memory) {
        sort(_castToUint256Array(array), _castToUint256Comp(comp));
        return array;
    }

    /**
     * @dev Variant of {sort} that sorts an array of address in increasing order.
     */
    function sort(address[] memory array) internal pure returns (address[] memory) {
        sort(_castToUint256Array(array), Comparators.lt);
        return array;
    }

    /**
     * @dev Sort an array of bytes32 (in memory) following the provided comparator function.
     *
     * This function does the sorting "in place", meaning that it overrides the input. The object is returned for
     * convenience, but that returned value can be discarded safely if the caller has a memory pointer to the array.
     *
     * NOTE: this function's cost is `O(n · log(n))` in average and `O(n²)` in the worst case, with n the length of the
     * array. Using it in view functions that are executed through `eth_call` is safe, but one should be very careful
     * when executing this as part of a transaction. If the array being sorted is too large, the sort operation may
     * consume more gas than is available in a block, leading to potential DoS.
     *
     * IMPORTANT: Consider memory side-effects when using custom comparator functions that access memory in an unsafe way.
     */
    function sort(
        bytes32[] memory array,
        function(bytes32, bytes32) pure returns (bool) comp
    ) internal pure returns (bytes32[] memory) {
        sort(_castToUint256Array(array), _castToUint256Comp(comp));
        return array;
    }

    /**
     * @dev Variant of {sort} that sorts an array of bytes32 in increasing order.
     */
    function sort(bytes32[] memory array) internal pure returns (bytes32[] memory) {
        sort(_castToUint256Array(array), Comparators.lt);
        return array;
    }

    /**
     * @dev Performs a quick sort of a segment of memory. The segment sorted starts at `begin` (inclusive), and stops
     * at end (exclusive). Sorting follows the `comp` comparator.
     *
     * Invariant: `begin <= end`. This is the case when initially called by {sort} and is preserved in subcalls.
     *
     * IMPORTANT: Memory locations between `begin` and `end` are not validated/zeroed. This function should
     * be used only if the limits are within a memory array.
     */
    function _quickSort(uint256 begin, uint256 end, function(uint256, uint256) pure returns (bool) comp) private pure {
        unchecked {
            if (end - begin < 0x40) return;

            // Use first element as pivot
            uint256 pivot = _mload(begin);
            // Position where the pivot should be at the end of the loop
            uint256 pos = begin;

            for (uint256 it = begin + 0x20; it < end; it += 0x20) {
                if (comp(_mload(it), pivot)) {
                    // If the value stored at the iterator's position comes before the pivot, we increment the
                    // position of the pivot and move the value there.
                    pos += 0x20;
                    _swap(pos, it);
                }
            }

            _swap(begin, pos); // Swap pivot into place
            _quickSort(begin, pos, comp); // Sort the left side of the pivot
            _quickSort(pos + 0x20, end, comp); // Sort the right side of the pivot
        }
    }

    /**
     * @dev Pointer to the memory location of the first element of `array`.
     */
    function _begin(uint256[] memory array) private pure returns (uint256 ptr) {
        assembly ("memory-safe") {
            ptr := add(array, 0x20)
        }
    }

    /**
     * @dev Pointer to the memory location of the first memory word (32bytes) after `array`. This is the memory word
     * that comes just after the last element of the array.
     */
    function _end(uint256[] memory array) private pure returns (uint256 ptr) {
        unchecked {
            return _begin(array) + array.length * 0x20;
        }
    }

    /**
     * @dev Load memory word (as a uint256) at location `ptr`.
     */
    function _mload(uint256 ptr) private pure returns (uint256 value) {
        assembly {
            value := mload(ptr)
        }
    }

    /**
     * @dev Swaps the elements memory location `ptr1` and `ptr2`.
     */
    function _swap(uint256 ptr1, uint256 ptr2) private pure {
        assembly {
            let value1 := mload(ptr1)
            let value2 := mload(ptr2)
            mstore(ptr1, value2)
            mstore(ptr2, value1)
        }
    }

    /// @dev Helper: low level cast address memory array to uint256 memory array
    function _castToUint256Array(address[] memory input) private pure returns (uint256[] memory output) {
        assembly {
            output := input
        }
    }

    /// @dev Helper: low level cast bytes32 memory array to uint256 memory array
    function _castToUint256Array(bytes32[] memory input) private pure returns (uint256[] memory output) {
        assembly {
            output := input
        }
    }

    /// @dev Helper: low level cast address comp function to uint256 comp function
    function _castToUint256Comp(
        function(address, address) pure returns (bool) input
    ) private pure returns (function(uint256, uint256) pure returns (bool) output) {
        assembly {
            output := input
        }
    }

    /// @dev Helper: low level cast bytes32 comp function to uint256 comp function
    function _castToUint256Comp(
        function(bytes32, bytes32) pure returns (bool) input
    ) private pure returns (function(uint256, uint256) pure returns (bool) output) {
        assembly {
            output := input
        }
    }

    /**
     * @dev Searches a sorted `array` and returns the first index that contains
     * a value greater or equal to `element`. If no such index exists (i.e. all
     * values in the array are strictly less than `element`), the array length is
     * returned. Time complexity O(log n).
     *
     * NOTE: The `array` is expected to be sorted in ascending order, and to
     * contain no repeated elements.
     *
     * IMPORTANT: Deprecated. This implementation behaves as {lowerBound} but lacks
     * support for repeated elements in the array. The {lowerBound} function should
     * be used instead.
     */
    function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
        uint256 low = 0;
        uint256 high = array.length;

        if (high == 0) {
            return 0;
        }

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds towards zero (it does integer division with truncation).
            if (unsafeAccess(array, mid).value > element) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }

        // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound.
        if (low > 0 && unsafeAccess(array, low - 1).value == element) {
            return low - 1;
        } else {
            return low;
        }
    }

    /**
     * @dev Searches an `array` sorted in ascending order and returns the first
     * index that contains a value greater or equal than `element`. If no such index
     * exists (i.e. all values in the array are strictly less than `element`), the array
     * length is returned. Time complexity O(log n).
     *
     * See C++'s https://en.cppreference.com/w/cpp/algorithm/lower_bound[lower_bound].
     */
    function lowerBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
        uint256 low = 0;
        uint256 high = array.length;

        if (high == 0) {
            return 0;
        }

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds towards zero (it does integer division with truncation).
            if (unsafeAccess(array, mid).value < element) {
                // this cannot overflow because mid < high
                unchecked {
                    low = mid + 1;
                }
            } else {
                high = mid;
            }
        }

        return low;
    }

    /**
     * @dev Searches an `array` sorted in ascending order and returns the first
     * index that contains a value strictly greater than `element`. If no such index
     * exists (i.e. all values in the array are strictly less than `element`), the array
     * length is returned. Time complexity O(log n).
     *
     * See C++'s https://en.cppreference.com/w/cpp/algorithm/upper_bound[upper_bound].
     */
    function upperBound(uint256[] storage array, uint256 element) internal view returns (uint256) {
        uint256 low = 0;
        uint256 high = array.length;

        if (high == 0) {
            return 0;
        }

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds towards zero (it does integer division with truncation).
            if (unsafeAccess(array, mid).value > element) {
                high = mid;
            } else {
                // this cannot overflow because mid < high
                unchecked {
                    low = mid + 1;
                }
            }
        }

        return low;
    }

    /**
     * @dev Same as {lowerBound}, but with an array in memory.
     */
    function lowerBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
        uint256 low = 0;
        uint256 high = array.length;

        if (high == 0) {
            return 0;
        }

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds towards zero (it does integer division with truncation).
            if (unsafeMemoryAccess(array, mid) < element) {
                // this cannot overflow because mid < high
                unchecked {
                    low = mid + 1;
                }
            } else {
                high = mid;
            }
        }

        return low;
    }

    /**
     * @dev Same as {upperBound}, but with an array in memory.
     */
    function upperBoundMemory(uint256[] memory array, uint256 element) internal pure returns (uint256) {
        uint256 low = 0;
        uint256 high = array.length;

        if (high == 0) {
            return 0;
        }

        while (low < high) {
            uint256 mid = Math.average(low, high);

            // Note that mid will always be strictly less than high (i.e. it will be a valid array index)
            // because Math.average rounds towards zero (it does integer division with truncation).
            if (unsafeMemoryAccess(array, mid) > element) {
                high = mid;
            } else {
                // this cannot overflow because mid < high
                unchecked {
                    low = mid + 1;
                }
            }
        }

        return low;
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) {
        bytes32 slot;
        assembly ("memory-safe") {
            slot := arr.slot
        }
        return slot.deriveArray().offset(pos).getAddressSlot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) {
        bytes32 slot;
        assembly ("memory-safe") {
            slot := arr.slot
        }
        return slot.deriveArray().offset(pos).getBytes32Slot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) {
        bytes32 slot;
        assembly ("memory-safe") {
            slot := arr.slot
        }
        return slot.deriveArray().offset(pos).getUint256Slot();
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) {
        assembly {
            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
        }
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeMemoryAccess(bytes32[] memory arr, uint256 pos) internal pure returns (bytes32 res) {
        assembly {
            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
        }
    }

    /**
     * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check.
     *
     * WARNING: Only use if you are certain `pos` is lower than the array length.
     */
    function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) {
        assembly {
            res := mload(add(add(arr, 0x20), mul(pos, 0x20)))
        }
    }

    /**
     * @dev Helper to set the length of an dynamic array. Directly writing to `.length` is forbidden.
     *
     * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
     */
    function unsafeSetLength(address[] storage array, uint256 len) internal {
        assembly ("memory-safe") {
            sstore(array.slot, len)
        }
    }

    /**
     * @dev Helper to set the length of an dynamic array. Directly writing to `.length` is forbidden.
     *
     * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
     */
    function unsafeSetLength(bytes32[] storage array, uint256 len) internal {
        assembly ("memory-safe") {
            sstore(array.slot, len)
        }
    }

    /**
     * @dev Helper to set the length of an dynamic array. Directly writing to `.length` is forbidden.
     *
     * WARNING: this does not clear elements if length is reduced, of initialize elements if length is increased.
     */
    function unsafeSetLength(uint256[] storage array, uint256 len) internal {
        assembly ("memory-safe") {
            sstore(array.slot, len)
        }
    }
}

// File: @openzeppelin/contracts/token/ERC1155/ERC1155.sol


// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.20;








/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 */
abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors {
    using Arrays for uint256[];
    using Arrays for address[];

    mapping(uint256 id => mapping(address account => uint256)) private _balances;

    mapping(address account => mapping(address operator => bool)) private _operatorApprovals;

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

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

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

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

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

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

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

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

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

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

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual {
        address sender = _msgSender();
        if (from != sender && !isApprovedForAll(from, sender)) {
            revert ERC1155MissingApprovalForAll(sender, from);
        }
        _safeTransferFrom(from, to, id, value, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) public virtual {
        address sender = _msgSender();
        if (from != sender && !isApprovedForAll(from, sender)) {
            revert ERC1155MissingApprovalForAll(sender, from);
        }
        _safeBatchTransferFrom(from, to, ids, values, data);
    }

    /**
     * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from`
     * (or `to`) is the zero address.
     *
     * Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received}
     *   or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value.
     * - `ids` and `values` must have the same length.
     *
     * NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead.
     */
    function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual {
        if (ids.length != values.length) {
            revert ERC1155InvalidArrayLength(ids.length, values.length);
        }

        address operator = _msgSender();

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids.unsafeMemoryAccess(i);
            uint256 value = values.unsafeMemoryAccess(i);

            if (from != address(0)) {
                uint256 fromBalance = _balances[id][from];
                if (fromBalance < value) {
                    revert ERC1155InsufficientBalance(from, fromBalance, value, id);
                }
                unchecked {
                    // Overflow not possible: value <= fromBalance
                    _balances[id][from] = fromBalance - value;
                }
            }

            if (to != address(0)) {
                _balances[id][to] += value;
            }
        }

        if (ids.length == 1) {
            uint256 id = ids.unsafeMemoryAccess(0);
            uint256 value = values.unsafeMemoryAccess(0);
            emit TransferSingle(operator, from, to, id, value);
        } else {
            emit TransferBatch(operator, from, to, ids, values);
        }
    }

    /**
     * @dev Version of {_update} that performs the token acceptance check by calling
     * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it
     * contains code (eg. is a smart contract at the moment of execution).
     *
     * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any
     * update to the contract state after this function would break the check-effect-interaction pattern. Consider
     * overriding {_update} instead.
     */
    function _updateWithAcceptanceCheck(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) internal virtual {
        _update(from, to, ids, values);
        if (to != address(0)) {
            address operator = _msgSender();
            if (ids.length == 1) {
                uint256 id = ids.unsafeMemoryAccess(0);
                uint256 value = values.unsafeMemoryAccess(0);
                ERC1155Utils.checkOnERC1155Received(operator, from, to, id, value, data);
            } else {
                ERC1155Utils.checkOnERC1155BatchReceived(operator, from, to, ids, values, data);
            }
        }
    }

    /**
     * @dev Transfers a `value` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `value` amount.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
        _updateWithAcceptanceCheck(from, to, ids, values, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     * - `ids` and `values` must have the same length.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory values,
        bytes memory data
    ) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        _updateWithAcceptanceCheck(from, to, ids, values, data);
    }

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

    /**
     * @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(address to, uint256 id, uint256 value, bytes memory data) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
        _updateWithAcceptanceCheck(address(0), to, ids, values, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `values` must have the same length.
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal {
        if (to == address(0)) {
            revert ERC1155InvalidReceiver(address(0));
        }
        _updateWithAcceptanceCheck(address(0), to, ids, values, data);
    }

    /**
     * @dev Destroys a `value` amount of tokens of type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `value` amount of tokens of type `id`.
     */
    function _burn(address from, uint256 id, uint256 value) internal {
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value);
        _updateWithAcceptanceCheck(from, address(0), ids, values, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `value` amount of tokens of type `id`.
     * - `ids` and `values` must have the same length.
     */
    function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal {
        if (from == address(0)) {
            revert ERC1155InvalidSender(address(0));
        }
        _updateWithAcceptanceCheck(from, address(0), ids, values, "");
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the zero address.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        if (operator == address(0)) {
            revert ERC1155InvalidOperator(address(0));
        }
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Creates an array in memory with only one value for each of the elements provided.
     */
    function _asSingletonArrays(
        uint256 element1,
        uint256 element2
    ) private pure returns (uint256[] memory array1, uint256[] memory array2) {
        assembly ("memory-safe") {
            // Load the free memory pointer
            array1 := mload(0x40)
            // Set array length to 1
            mstore(array1, 1)
            // Store the single element at the next word after the length (where content starts)
            mstore(add(array1, 0x20), element1)

            // Repeat for next array locating it right after the first array
            array2 := add(array1, 0x40)
            mstore(array2, 1)
            mstore(add(array2, 0x20), element2)

            // Update the free memory pointer by pointing after the second array
            mstore(0x40, add(array2, 0x40))
        }
    }
}

// File: @openzeppelin/contracts/utils/math/SignedMath.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

// File: @openzeppelin/contracts/utils/Strings.sol


// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;



/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
    uint8 private constant ADDRESS_LENGTH = 20;

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        uint256 localValue = value;
        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_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
     * representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

// File: @openzeppelin/contracts/interfaces/IERC2981.sol


// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.20;


/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     *
     * NOTE: ERC-2981 allows setting the royalty to 100% of the price. In that case all the price would be sent to the
     * royalty receiver and 0 tokens to the seller. Contracts dealing with royalty should consider empty transfers.
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) external view returns (address receiver, uint256 royaltyAmount);
}

// File: @openzeppelin/contracts/token/common/ERC2981.sol


// OpenZeppelin Contracts (last updated v5.1.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.20;



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

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

    /**
     * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);

    /**
     * @dev The default royalty receiver is invalid.
     */
    error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);

    /**
     * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);

    /**
     * @dev The royalty receiver for `tokenId` is invalid.
     */
    error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);

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

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) public view virtual returns (address receiver, uint256 amount) {
        RoyaltyInfo storage _royaltyInfo = _tokenRoyaltyInfo[tokenId];
        address royaltyReceiver = _royaltyInfo.receiver;
        uint96 royaltyFraction = _royaltyInfo.royaltyFraction;

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

        uint256 royaltyAmount = (salePrice * royaltyFraction) / _feeDenominator();

        return (royaltyReceiver, royaltyAmount);
    }

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

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
        }

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
        }

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

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

// File: @limitbreak/creator-token-contracts/contracts/programmable-royalties/BasicRoyalties.sol


pragma solidity ^0.8.4;


/**
 * @title BasicRoyaltiesBase
 * @author Limit Break, Inc.
 * @dev Base functionality of an NFT mix-in contract implementing the most basic form of programmable royalties.
 */
abstract contract BasicRoyaltiesBase is ERC2981 {

    event DefaultRoyaltySet(address indexed receiver, uint96 feeNumerator);
    event TokenRoyaltySet(uint256 indexed tokenId, address indexed receiver, uint96 feeNumerator);

    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual override {
        super._setDefaultRoyalty(receiver, feeNumerator);
        emit DefaultRoyaltySet(receiver, feeNumerator);
    }

    function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual override {
        super._setTokenRoyalty(tokenId, receiver, feeNumerator);
        emit TokenRoyaltySet(tokenId, receiver, feeNumerator);
    }
}

/**
 * @title BasicRoyalties
 * @author Limit Break, Inc.
 * @notice Constructable BasicRoyalties Contract implementation.
 */
abstract contract BasicRoyalties is BasicRoyaltiesBase {
    constructor(address receiver, uint96 feeNumerator) {
        _setDefaultRoyalty(receiver, feeNumerator);
    }
}

/**
 * @title BasicRoyaltiesInitializable
 * @author Limit Break, Inc.
 * @notice Initializable BasicRoyalties Contract implementation to allow for EIP-1167 clones. 
 */
abstract contract BasicRoyaltiesInitializable is BasicRoyaltiesBase {}
// File: @openzeppelin/contracts/utils/math/SafeMath.sol


// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

// File: contracts/ImmediateRoyaltySplitter.sol


pragma solidity ^0.8.0;



/**
 * @title ImmediateRoyaltySplitter
 * @dev Contract for instantly splitting received payments between multiple addresses
 */
abstract contract ImmediateRoyaltySplitter is ReentrancyGuard {
    using SafeMath for uint256;

    // Events
    event PaymentReceived(address from, uint256 amount);
    event PaymentSplit(address to, uint256 amount);
    event RoyaltySharesUpdated(
        address[] royaltyReceivers,
        uint256[] royaltyShares
    );

    // Constants
    uint256 public constant TOTAL_ROYALTY_SHARES = 10000; // 100% = 10000 (0.01% precision)

    // State variables
    address[] public royaltyReceivers;
    uint256[] public royaltyShares;

    /**
     * @dev Internal function to update royaltyShares with validations
     */
    function _updateRoyaltyShares(
        address[] memory _receivers,
        uint256[] memory _shares
    ) internal {
        require(_receivers.length == _shares.length, "Arrays length mismatch");
        require(_receivers.length > 0, "No royaltyReceivers provided");

        uint256 _totalShares;
        for (uint256 i = 0; i < _receivers.length; i++) {
            require(_receivers[i] != address(0), "Invalid receiver address");
            require(_shares[i] > 0, "Share must be greater than 0");
            _totalShares = _totalShares.add(_shares[i]);
        }

        require(
            _totalShares == TOTAL_ROYALTY_SHARES,
            "Total royaltyShares must be 10000"
        );

        royaltyReceivers = _receivers;
        royaltyShares = _shares;

        emit RoyaltySharesUpdated(_receivers, _shares);
    }

    /**
     * @dev Private function to set the royalty shares only if they are not set yet
     */
    function _initializeRoyaltyShares(
        address[] memory _receivers,
        uint256[] memory _shares
    ) internal {
        require(royaltyReceivers.length == 0, "Royalty shares already set");
        _updateRoyaltyShares(_receivers, _shares);
    }

    /**
     * @dev Fallback function to receive and immediately split payments
     */
    receive() external payable nonReentrant {
        require(msg.value > 0, "No payment received");
        emit PaymentReceived(msg.sender, msg.value);

        uint256 remaining = msg.value;
        uint256 share;
        uint256 amount;

        // Process all royaltyReceivers except the last one
        for (uint256 i = 0; i < royaltyReceivers.length - 1; i++) {
            share = royaltyShares[i];
            // Calculate payment amount using the share percentage
            amount = msg.value.mul(share).div(TOTAL_ROYALTY_SHARES);
            remaining = remaining.sub(amount);

            (bool success, ) = royaltyReceivers[i].call{value: amount}("");
            require(success, "Transfer failed");
            emit PaymentSplit(royaltyReceivers[i], amount);
        }

        // Send remaining amount to last receiver to handle rounding dust
        if (remaining > 0 && royaltyReceivers.length > 0) {
            (bool success, ) = royaltyReceivers[royaltyReceivers.length - 1]
                .call{value: remaining}("");
            require(success, "Transfer failed");
            emit PaymentSplit(
                royaltyReceivers[royaltyReceivers.length - 1],
                remaining
            );
        }
    }

    /**
     * @dev Returns the current royaltyReceivers and their royaltyShares
     */
    function getRoyaltyShares()
        external
        view
        returns (address[] memory, uint256[] memory)
    {
        return (royaltyReceivers, royaltyShares);
    }

    /**
     * @dev Allows a royalty receiver to update their wallet address
     * @param newAddress The new address to update to
     */
    function updateReceiverAddress(address newAddress) external nonReentrant {
        require(newAddress != address(0), "New address is invalid");

        bool updated = false;
        for (uint256 i = 0; i < royaltyReceivers.length; i++) {
            if (royaltyReceivers[i] == msg.sender) {
                royaltyReceivers[i] = newAddress;
                updated = true;
                break;
            }
        }

        require(updated, "Receiver address not found");
    }
}
// File: access/OwnablePermissions.sol


pragma solidity ^0.8.4;


abstract contract OwnablePermissions is Context {
    function _requireCallerIsContractOwner() internal view virtual;
}

// File: interfaces/IEOARegistry.sol


pragma solidity ^0.8.4;


interface IEOARegistry is IERC165 {
    function isVerifiedEOA(address account) external view returns (bool);
}
// File: utils/TransferPolicy.sol


pragma solidity ^0.8.4;

enum AllowlistTypes {
    Operators,
    PermittedContractReceivers
}

enum ReceiverConstraints {
    None,
    NoCode,
    EOA
}

enum CallerConstraints {
    None,
    OperatorWhitelistEnableOTC,
    OperatorWhitelistDisableOTC
}

enum StakerConstraints {
    None,
    CallerIsTxOrigin,
    EOA
}

enum TransferSecurityLevels {
    Zero,
    One,
    Two,
    Three,
    Four,
    Five,
    Six
}

struct TransferSecurityPolicy {
    CallerConstraints callerConstraints;
    ReceiverConstraints receiverConstraints;
}

struct CollectionSecurityPolicy {
    TransferSecurityLevels transferSecurityLevel;
    uint120 operatorWhitelistId;
    uint120 permittedContractReceiversId;
}

// File: interfaces/ITransferSecurityRegistry.sol


pragma solidity ^0.8.4;


interface ITransferSecurityRegistry {
    event AddedToAllowlist(AllowlistTypes indexed kind, uint256 indexed id, address indexed account);
    event CreatedAllowlist(AllowlistTypes indexed kind, uint256 indexed id, string indexed name);
    event ReassignedAllowlistOwnership(AllowlistTypes indexed kind, uint256 indexed id, address indexed newOwner);
    event RemovedFromAllowlist(AllowlistTypes indexed kind, uint256 indexed id, address indexed account);
    event SetAllowlist(AllowlistTypes indexed kind, address indexed collection, uint120 indexed id);
    event SetTransferSecurityLevel(address indexed collection, TransferSecurityLevels level);

    function createOperatorWhitelist(string calldata name) external returns (uint120);
    function createPermittedContractReceiverAllowlist(string calldata name) external returns (uint120);
    function reassignOwnershipOfOperatorWhitelist(uint120 id, address newOwner) external;
    function reassignOwnershipOfPermittedContractReceiverAllowlist(uint120 id, address newOwner) external;
    function renounceOwnershipOfOperatorWhitelist(uint120 id) external;
    function renounceOwnershipOfPermittedContractReceiverAllowlist(uint120 id) external;
    function setTransferSecurityLevelOfCollection(address collection, TransferSecurityLevels level) external;
    function setOperatorWhitelistOfCollection(address collection, uint120 id) external;
    function setPermittedContractReceiverAllowlistOfCollection(address collection, uint120 id) external;
    function addOperatorToWhitelist(uint120 id, address operator) external;
    function addPermittedContractReceiverToAllowlist(uint120 id, address receiver) external;
    function removeOperatorFromWhitelist(uint120 id, address operator) external;
    function removePermittedContractReceiverFromAllowlist(uint120 id, address receiver) external;
    function getCollectionSecurityPolicy(address collection) external view returns (CollectionSecurityPolicy memory);
    function getWhitelistedOperators(uint120 id) external view returns (address[] memory);
    function getPermittedContractReceivers(uint120 id) external view returns (address[] memory);
    function isOperatorWhitelisted(uint120 id, address operator) external view returns (bool);
    function isContractReceiverPermitted(uint120 id, address receiver) external view returns (bool);
}
// File: interfaces/ITransferValidator.sol


pragma solidity ^0.8.4;


interface ITransferValidator {
    function applyCollectionTransferPolicy(address caller, address from, address to) external view;
}
// File: interfaces/ICreatorTokenTransferValidator.sol


pragma solidity ^0.8.4;




interface ICreatorTokenTransferValidator is ITransferSecurityRegistry, ITransferValidator, IEOARegistry {}
// File: interfaces/ICreatorToken.sol


pragma solidity ^0.8.4;


interface ICreatorToken {
    event TransferValidatorUpdated(address oldValidator, address newValidator);

    function getTransferValidator() external view returns (ICreatorTokenTransferValidator);
    function getSecurityPolicy() external view returns (CollectionSecurityPolicy memory);
    function getWhitelistedOperators() external view returns (address[] memory);
    function getPermittedContractReceivers() external view returns (address[] memory);
    function isOperatorWhitelisted(address operator) external view returns (bool);
    function isContractReceiverPermitted(address receiver) external view returns (bool);
    function isTransferAllowed(address caller, address from, address to) external view returns (bool);
}

// File: utils/TransferValidation.sol


pragma solidity ^0.8.4;


/**
 * @title TransferValidation
 * @author Limit Break, Inc.
 * @notice A mix-in that can be combined with ERC-721 contracts to provide more granular hooks.
 * Openzeppelin's ERC721 contract only provides hooks for before and after transfer.  This allows
 * developers to validate or customize transfers within the context of a mint, a burn, or a transfer.
 */
abstract contract TransferValidation is Context {
    
    error ShouldNotMintToBurnAddress();

    /// @dev Inheriting contracts should call this function in the _beforeTokenTransfer function to get more granular hooks.
    function _validateBeforeTransfer(address from, address to, uint256 tokenId) internal virtual {
        bool fromZeroAddress = from == address(0);
        bool toZeroAddress = to == address(0);

        if(fromZeroAddress && toZeroAddress) {
            revert ShouldNotMintToBurnAddress();
        } else if(fromZeroAddress) {
            _preValidateMint(_msgSender(), to, tokenId, msg.value);
        } else if(toZeroAddress) {
            _preValidateBurn(_msgSender(), from, tokenId, msg.value);
        } else {
            _preValidateTransfer(_msgSender(), from, to, tokenId, msg.value);
        }
    }

    /// @dev Inheriting contracts should call this function in the _afterTokenTransfer function to get more granular hooks.
    function _validateAfterTransfer(address from, address to, uint256 tokenId) internal virtual {
        bool fromZeroAddress = from == address(0);
        bool toZeroAddress = to == address(0);

        if(fromZeroAddress && toZeroAddress) {
            revert ShouldNotMintToBurnAddress();
        } else if(fromZeroAddress) {
            _postValidateMint(_msgSender(), to, tokenId, msg.value);
        } else if(toZeroAddress) {
            _postValidateBurn(_msgSender(), from, tokenId, msg.value);
        } else {
            _postValidateTransfer(_msgSender(), from, to, tokenId, msg.value);
        }
    }

    /// @dev Optional validation hook that fires before a mint
    function _preValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a mint
    function _postValidateMint(address caller, address to, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires before a burn
    function _preValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a burn
    function _postValidateBurn(address caller, address from, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires before a transfer
    function _preValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {}

    /// @dev Optional validation hook that fires after a transfer
    function _postValidateTransfer(address caller, address from, address to, uint256 tokenId, uint256 value) internal virtual {}
}

// File: @openzeppelin/contracts/interfaces/IERC165.sol


// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;


// File: contracts/CreatorTokenBase.sol


pragma solidity ^0.8.4;






/**
 * @title CreatorTokenBase
 * @author Limit Break, Inc.
 * @notice CreatorTokenBase is an abstract contract that provides basic functionality for managing token 
 * transfer policies through an implementation of ICreatorTokenTransferValidator. This contract is intended to be used
 * as a base for creator-specific token contracts, enabling customizable transfer restrictions and security policies.
 *
 * <h4>Features:</h4>
 * <ul>Ownable: This contract can have an owner who can set and update the transfer validator.</ul>
 * <ul>TransferValidation: Implements the basic token transfer validation interface.</ul>
 * <ul>ICreatorToken: Implements the interface for creator tokens, providing view functions for token security policies.</ul>
 *
 * <h4>Benefits:</h4>
 * <ul>Provides a flexible and modular way to implement custom token transfer restrictions and security policies.</ul>
 * <ul>Allows creators to enforce policies such as whitelisted operators and permitted contract receivers.</ul>
 * <ul>Can be easily integrated into other token contracts as a base contract.</ul>
 *
 * <h4>Intended Usage:</h4>
 * <ul>Use as a base contract for creator token implementations that require advanced transfer restrictions and 
 *   security policies.</ul>
 * <ul>Set and update the ICreatorTokenTransferValidator implementation contract to enforce desired policies for the 
 *   creator token.</ul>
 */
abstract contract CreatorTokenBase is OwnablePermissions, TransferValidation, ICreatorToken {
    
    error CreatorTokenBase__InvalidTransferValidatorContract();
    error CreatorTokenBase__SetTransferValidatorFirst();

    address public constant DEFAULT_TRANSFER_VALIDATOR = address(0x0000721C310194CcfC01E523fc93C9cCcFa2A0Ac);
    TransferSecurityLevels public constant DEFAULT_TRANSFER_SECURITY_LEVEL = TransferSecurityLevels.One;
    uint120 public constant DEFAULT_OPERATOR_WHITELIST_ID = uint120(1);

    ICreatorTokenTransferValidator private transferValidator;

    /**
     * @notice Allows the contract owner to set the transfer validator to the official validator contract
     *         and set the security policy to the recommended default settings.
     * @dev    May be overridden to change the default behavior of an individual collection.
     */
    function setToDefaultSecurityPolicy() public virtual {
        _requireCallerIsContractOwner();
        setTransferValidator(DEFAULT_TRANSFER_VALIDATOR);
        ICreatorTokenTransferValidator(DEFAULT_TRANSFER_VALIDATOR).setTransferSecurityLevelOfCollection(address(this), DEFAULT_TRANSFER_SECURITY_LEVEL);
        ICreatorTokenTransferValidator(DEFAULT_TRANSFER_VALIDATOR).setOperatorWhitelistOfCollection(address(this), DEFAULT_OPERATOR_WHITELIST_ID);
    }

    /**
     * @notice Allows the contract owner to set the transfer validator to a custom validator contract
     *         and set the security policy to their own custom settings.
     */
    function setToCustomValidatorAndSecurityPolicy(
        address validator, 
        TransferSecurityLevels level, 
        uint120 operatorWhitelistId, 
        uint120 permittedContractReceiversAllowlistId) public {
        _requireCallerIsContractOwner();

        setTransferValidator(validator);

        ICreatorTokenTransferValidator(validator).
            setTransferSecurityLevelOfCollection(address(this), level);

        ICreatorTokenTransferValidator(validator).
            setOperatorWhitelistOfCollection(address(this), operatorWhitelistId);

        ICreatorTokenTransferValidator(validator).
            setPermittedContractReceiverAllowlistOfCollection(address(this), permittedContractReceiversAllowlistId);
    }

    /**
     * @notice Allows the contract owner to set the security policy to their own custom settings.
     * @dev    Reverts if the transfer validator has not been set.
     */
    function setToCustomSecurityPolicy(
        TransferSecurityLevels level, 
        uint120 operatorWhitelistId, 
        uint120 permittedContractReceiversAllowlistId) public {
        _requireCallerIsContractOwner();

        ICreatorTokenTransferValidator validator = getTransferValidator();
        if (address(validator) == address(0)) {
            revert CreatorTokenBase__SetTransferValidatorFirst();
        }

        validator.setTransferSecurityLevelOfCollection(address(this), level);
        validator.setOperatorWhitelistOfCollection(address(this), operatorWhitelistId);
        validator.setPermittedContractReceiverAllowlistOfCollection(address(this), permittedContractReceiversAllowlistId);
    }

    /**
     * @notice Sets the transfer validator for the token contract.
     *
     * @dev    Throws when provided validator contract is not the zero address and doesn't support 
     *         the ICreatorTokenTransferValidator interface. 
     * @dev    Throws when the caller is not the contract owner.
     *
     * @dev    <h4>Postconditions:</h4>
     *         1. The transferValidator address is updated.
     *         2. The `TransferValidatorUpdated` event is emitted.
     *
     * @param transferValidator_ The address of the transfer validator contract.
     */
    function setTransferValidator(address transferValidator_) public {
        _requireCallerIsContractOwner();

        bool isValidTransferValidator = false;

        if(transferValidator_.code.length > 0) {
            try IERC165(transferValidator_).supportsInterface(type(ICreatorTokenTransferValidator).interfaceId) 
                returns (bool supportsInterface) {
                isValidTransferValidator = supportsInterface;
            } catch {}
        }

        if(transferValidator_ != address(0) && !isValidTransferValidator) {
            revert CreatorTokenBase__InvalidTransferValidatorContract();
        }

        emit TransferValidatorUpdated(address(transferValidator), transferValidator_);

        transferValidator = ICreatorTokenTransferValidator(transferValidator_);
    }

    /**
     * @notice Returns the transfer validator contract address for this token contract.
     */
    function getTransferValidator() public view override returns (ICreatorTokenTransferValidator) {
        return transferValidator;
    }

    /**
     * @notice Returns the security policy for this token contract, which includes:
     *         Transfer security level, operator whitelist id, permitted contract receiver allowlist id.
     */
    function getSecurityPolicy() public view override returns (CollectionSecurityPolicy memory) {
        if (address(transferValidator) != address(0)) {
            return transferValidator.getCollectionSecurityPolicy(address(this));
        }

        return CollectionSecurityPolicy({
            transferSecurityLevel: TransferSecurityLevels.Zero,
            operatorWhitelistId: 0,
            permittedContractReceiversId: 0
        });
    }

    /**
     * @notice Returns the list of all whitelisted operators for this token contract.
     * @dev    This can be an expensive call and should only be used in view-only functions.
     */
    function getWhitelistedOperators() public view override returns (address[] memory) {
        if (address(transferValidator) != address(0)) {
            return transferValidator.getWhitelistedOperators(
                transferValidator.getCollectionSecurityPolicy(address(this)).operatorWhitelistId);
        }

        return new address[](0);
    }

    /**
     * @notice Returns the list of permitted contract receivers for this token contract.
     * @dev    This can be an expensive call and should only be used in view-only functions.
     */
    function getPermittedContractReceivers() public view override returns (address[] memory) {
        if (address(transferValidator) != address(0)) {
            return transferValidator.getPermittedContractReceivers(
                transferValidator.getCollectionSecurityPolicy(address(this)).permittedContractReceiversId);
        }

        return new address[](0);
    }

    /**
     * @notice Checks if an operator is whitelisted for this token contract.
     * @param operator The address of the operator to check.
     */
    function isOperatorWhitelisted(address operator) public view override returns (bool) {
        if (address(transferValidator) != address(0)) {
            return transferValidator.isOperatorWhitelisted(
                transferValidator.getCollectionSecurityPolicy(address(this)).operatorWhitelistId, operator);
        }

        return false;
    }

    /**
     * @notice Checks if a contract receiver is permitted for this token contract.
     * @param receiver The address of the receiver to check.
     */
    function isContractReceiverPermitted(address receiver) public view override returns (bool) {
        if (address(transferValidator) != address(0)) {
            return transferValidator.isContractReceiverPermitted(
                transferValidator.getCollectionSecurityPolicy(address(this)).permittedContractReceiversId, receiver);
        }

        return false;
    }

    /**
     * @notice Determines if a transfer is allowed based on the token contract's security policy.  Use this function
     *         to simulate whether or not a transfer made by the specified `caller` from the `from` address to the `to`
     *         address would be allowed by this token's security policy.
     *
     * @notice This function only checks the security policy restrictions and does not check whether token ownership
     *         or approvals are in place. 
     *
     * @param caller The address of the simulated caller.
     * @param from   The address of the sender.
     * @param to     The address of the receiver.
     * @return       True if the transfer is allowed, false otherwise.
     */
    function isTransferAllowed(address caller, address from, address to) public view override returns (bool) {
        if (address(transferValidator) != address(0)) {
            try transferValidator.applyCollectionTransferPolicy(caller, from, to) {
                return true;
            } catch {
                return false;
            }
        }
        return true;
    }

    /**
     * @dev Pre-validates a token transfer, reverting if the transfer is not allowed by this token's security policy.
     *      Inheriting contracts are responsible for overriding the _beforeTokenTransfer function, or its equivalent
     *      and calling _validateBeforeTransfer so that checks can be properly applied during token transfers.
     *
     * @dev Throws when the transfer doesn't comply with the collection's transfer policy, if the transferValidator is
     *      set to a non-zero address.
     *
     * @param caller  The address of the caller.
     * @param from    The address of the sender.
     * @param to      The address of the receiver.
     */
    function _preValidateTransfer(
        address caller, 
        address from, 
        address to, 
        uint256 /*tokenId*/, 
        uint256 /*value*/) internal virtual override {
        if (address(transferValidator) != address(0)) {
            transferValidator.applyCollectionTransferPolicy(caller, from, to);
        }
    }
}

// File: contracts/Rektifier.sol


pragma solidity ^0.8.23;









contract REKTIFIERS is ERC1155, Ownable, ReentrancyGuard, BasicRoyaltiesInitializable, ImmediateRoyaltySplitter, CreatorTokenBase {
    using Strings for uint256;

    // Token IDs: 1 = Rusty (700 max), 2 = 7700 (300 max), 3 = Gold (111 max)
    uint256 public constant RUSTY = 1;
    uint256 public constant SEVENTY_SEVEN_HUNDRED = 2; 
    uint256 public constant GOLD = 3;

    uint256 public constant RUSTY_MAX_SUPPLY = 700;
    uint256 public constant SEVENTY_SEVEN_HUNDRED_MAX_SUPPLY = 300;
    uint256 public constant GOLD_MAX_SUPPLY = 111;

    uint256 public rustyMinted;
    uint256 public seventySevenHundredMinted;
    uint256 public goldMinted;

    string public name = "REKTIFIERS";
    string public symbol = "REKT";

    // Mapping of addresses allowed to burn (in addition to owner)
    mapping(address => bool) public allowedBurners;

    string public baseUri;
    constructor(
        address _initialOwner,
        string memory _baseUri,
        uint96 _royaltyFeeNumerator
    ) 
        Ownable(_initialOwner)
        ERC1155(_baseUri)
        CreatorTokenBase()
    {
        baseUri = _baseUri;
        _setDefaultRoyalty(address(this), _royaltyFeeNumerator);
    }

    function _requireCallerIsContractOwner() internal view override {
        require(msg.sender == owner(), "Caller is not the contract owner");
    }

    function tokenURI(uint256 _tokenId)
        public
        view
        virtual
        returns (string memory)
    {
        return string(abi.encodePacked(baseUri, _tokenId.toString(), ".json"));
    }

    function uri(uint256 tokenId) public view override returns (string memory) {
        return string(abi.encodePacked(super.uri(tokenId), tokenId.toString(), ".json"));
    }

    // Owner can update base URI if needed
    function setURI(string memory newuri) external onlyOwner {
        _setURI(newuri);
        baseUri = newuri;
    }

    // Set royalty info
    function setDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {
        _setDefaultRoyalty(receiver, feeNumerator);
    }

    function setAllowedBurner(address burner, bool allowed) external onlyOwner {
        allowedBurners[burner] = allowed;
    }

    // Airdrop a single NFT of a given type to a wallet
    function airdropSingle(address to, uint256 tokenId) external onlyOwner nonReentrant {
        _checkSupply(tokenId, 1);
        _mint(to, tokenId, 1, "");
        _incrementCounter(tokenId, 1);
    }

    // Airdrop to multiple wallets the same type (1 per wallet)
    function airdropBatch(address[] calldata recipients, uint256 tokenId) external onlyOwner nonReentrant {
        uint256 length = recipients.length;
        _checkSupply(tokenId, length);
        for (uint256 i = 0; i < length; i++) {
            _mint(recipients[i], tokenId, 1, "");
        }
        _incrementCounter(tokenId, length);
    }

    function burn(
        address account,
        uint256 tokenId,
        uint256 amount
    ) external nonReentrant {
        require(msg.sender == owner() || allowedBurners[msg.sender], "Not allowed to burn");
        _burn(account, tokenId, amount);
    }

    function _checkSupply(uint256 tokenId, uint256 amount) internal view {
        if (tokenId == RUSTY) {
            require(rustyMinted + amount <= RUSTY_MAX_SUPPLY, "Exceeds Rusty supply");
        } else if (tokenId == SEVENTY_SEVEN_HUNDRED) {
            require(seventySevenHundredMinted + amount <= SEVENTY_SEVEN_HUNDRED_MAX_SUPPLY, "Exceeds 7700 supply");
        } else if (tokenId == GOLD) {
            require(goldMinted + amount <= GOLD_MAX_SUPPLY, "Exceeds Gold supply");
        } else {
            revert("Invalid tokenId");
        }
    }

    function _incrementCounter(uint256 tokenId, uint256 amount) internal {
        if (tokenId == RUSTY) {
            rustyMinted += amount;
        } else if (tokenId == SEVENTY_SEVEN_HUNDRED) {
            seventySevenHundredMinted += amount;
        } else if (tokenId == GOLD) {
            goldMinted += amount;
        }
    }

    // supportsInterface
    function supportsInterface(
        bytes4 interfaceId
    )
        public
        view
        virtual
        override(ERC1155, ERC2981)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    /// @notice Initializes the receivers and their shares.
    /// @param _receivers The new array of receiver addresses.
    /// @param _shares The new array of corresponding shares.
    function initializeRoyaltyShares(
        address[] memory _receivers,
        uint256[] memory _shares
    ) external onlyOwner {
        _initializeRoyaltyShares(_receivers, _shares);
    }

}

// File: contracts/OogiesUpgrade.sol


pragma solidity ^0.8.23;








contract OogieUpgrader is Ownable, ReentrancyGuard, PaymentSplitter {
    address public immutable oogieAddress = 0x214cAE51c3BAE88515aAEfd8e1867E64502B0342;
    address payable public immutable rektifierAddress = payable(0x60BECD2501a8cBE103aD62A84b008c4801eCe977);

    uint256 public priceType1 = 7 ether;
    uint256 public priceType2 = 14 ether;
    uint256 public priceType3 = 21 ether;

    uint256 public donationPrice = 69 ether;
    address[] private donors;

    mapping(uint256 => bool) public upgraded;

    uint256[] public upgradedType1; 
    uint256[] public upgradedType2;
    uint256[] public upgradedType3;

    uint256 private teamLength;

    constructor(
        address _initialOwner,
        address[] memory _payees,
        uint256[] memory _shares
    ) 
        Ownable(_initialOwner)
        PaymentSplitter(_payees, _shares)
    {
        teamLength = _payees.length;
    }

    /*///////////////////////////////////////////////////////////////
                            OWNER FUNCTIONS
    //////////////////////////////////////////////////////////////*/

    function setPriceType1(uint256 _price) external onlyOwner {
        priceType1 = _price;
    }

    function setPriceType2(uint256 _price) external onlyOwner {
        priceType2 = _price;
    }

    function setPriceType3(uint256 _price) external onlyOwner {
        priceType3 = _price;
    }

    /// @notice Modify the donation price
    function setDonationPrice(uint256 _donationPrice) external onlyOwner {
        donationPrice = _donationPrice;
    }

    function releaseAll() external onlyOwner {
        for (uint256 i = 0; i < teamLength; i++) {
            release(payable(payee(i)));
        }
    }

    // Rescue function for tokens sent by mistake
    function rescueERC20(IERC20 token, address to, uint256 amount) external onlyOwner {
        token.transfer(to, amount);
    }

    /*///////////////////////////////////////////////////////////////
                          DONATION FUNCTIONS
    //////////////////////////////////////////////////////////////*/
    
    /// @notice Allows a user to donate exactly `donationPrice` ether
    /// @dev Caller’s address is stored in an array
    function donate() external payable nonReentrant {
        require(msg.value == donationPrice, "Incorrect donation amount");
        donors.push(msg.sender);
    }

    /// @notice Read function to retrieve the entire donors array
    function getDonors() external view returns (address[] memory) {
        return donors;
    }

    /*///////////////////////////////////////////////////////////////
                          PUBLIC VIEW FUNCTIONS
    //////////////////////////////////////////////////////////////*/
    
    function areUpgraded(uint256[] calldata tokenIds) external view returns (bool[] memory) {
        bool[] memory results = new bool[](tokenIds.length);
        for (uint256 i = 0; i < tokenIds.length; i++) {
            results[i] = upgraded[tokenIds[i]];
        }
        return results;
    }

    function getUpgradedType1() external view returns (uint256[] memory) {
        return upgradedType1;
    }

    function getUpgradedType2() external view returns (uint256[] memory) {
        return upgradedType2;
    }

    function getUpgradedType3() external view returns (uint256[] memory) {
        return upgradedType3;
    }

    /*///////////////////////////////////////////////////////////////
                              UPGRADE LOGIC
    //////////////////////////////////////////////////////////////*/

    function upgrade(uint256 tokenId, uint256 rektifierType) external payable nonReentrant {
        IERC721 oogie = IERC721(oogieAddress);
        require(oogie.ownerOf(tokenId) == msg.sender, "Not the owner of the specified token");
        require(!upgraded[tokenId], "Token already upgraded");

        IERC1155 rektifier = IERC1155(rektifierAddress);
        require(rektifier.balanceOf(msg.sender, rektifierType) > 0, "Not enough ERC1155 balance");

        uint256 requiredPrice;
        if (rektifierType == 1) {
            requiredPrice = priceType1;
        } else if (rektifierType == 2) {
            requiredPrice = priceType2;
        } else if (rektifierType == 3) {
            requiredPrice = priceType3;
        } else {
            revert("Invalid rektifier type");
        }

        require(msg.value == requiredPrice, "Incorrect payment amount");

        // Burn the required rektifier
        REKTIFIERS(rektifierAddress).burn(msg.sender, rektifierType, 1);

        // Mark the token as upgraded
        upgraded[tokenId] = true;

        // Push the tokenId into the correct upgraded list
        if (rektifierType == 1) {
            upgradedType1.push(tokenId);
        } else if (rektifierType == 2) {
            upgradedType2.push(tokenId);
        } else {
            upgradedType3.push(tokenId);
        }
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_initialOwner","type":"address"},{"internalType":"address[]","name":"_payees","type":"address[]"},{"internalType":"uint256[]","name":"_shares","type":"uint256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20PaymentReleased","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"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"PayeeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","type":"event"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"areUpgraded","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"donate","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"donationPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDonors","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUpgradedType1","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUpgradedType2","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUpgradedType3","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oogieAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceType1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceType2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceType3","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rektifierAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"releasable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"releasable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"releaseAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_donationPrice","type":"uint256"}],"name":"setDonationPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPriceType1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPriceType2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPriceType3","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"rektifierType","type":"uint256"}],"name":"upgrade","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"upgraded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"upgradedType1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"upgradedType2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"upgradedType3","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60c060405273214cae51c3bae88515aaefd8e1867e64502b03426080527360becd2501a8cbe103ad62a84b008c4801ece97760a052676124fee993bc000060095567c249fdd327780000600a556801236efcbcbb340000600b556803bd913e6c1df40000600c55348015610071575f5ffd5b506040516120553803806120558339810160408190526100909161050d565b8181846001600160a01b0381166100c157604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b6100ca816101f0565b5060018055805182511461013b5760405162461bcd60e51b815260206004820152603260248201527f5061796d656e7453706c69747465723a2070617965657320616e6420736861726044820152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b60648201526084016100b8565b5f82511161018b5760405162461bcd60e51b815260206004820152601a60248201527f5061796d656e7453706c69747465723a206e6f2070617965657300000000000060448201526064016100b8565b5f5b82518110156101e0576101d88382815181106101ab576101ab6105e0565b60200260200101518383815181106101c5576101c56105e0565b602002602001015161023f60201b60201c565b60010161018d565b5050915160125550610619915050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0382166102aa5760405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b60648201526084016100b8565b5f81116102f95760405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a2073686172657320617265203000000060448201526064016100b8565b6001600160a01b0382165f90815260046020526040902054156103725760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b60648201526084016100b8565b60068054600181019091557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b0319166001600160a01b0384169081179091555f9081526004602052604090208190556002546103d99082906105f4565b600255604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac910160405180910390a15050565b80516001600160a01b0381168114610438575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b03811182821017156104795761047961043d565b604052919050565b5f6001600160401b038211156104995761049961043d565b5060051b60200190565b5f82601f8301126104b2575f5ffd5b81516104c56104c082610481565b610451565b8082825260208201915060208360051b8601019250858311156104e6575f5ffd5b602085015b838110156105035780518352602092830192016104eb565b5095945050505050565b5f5f5f6060848603121561051f575f5ffd5b61052884610422565b60208501519093506001600160401b03811115610543575f5ffd5b8401601f81018613610553575f5ffd5b80516105616104c082610481565b8082825260208201915060208360051b850101925088831115610582575f5ffd5b6020840193505b828410156105ab5761059a84610422565b825260209384019390910190610589565b6040880151909550925050506001600160401b038111156105ca575f5ffd5b6105d6868287016104a3565b9150509250925092565b634e487b7160e01b5f52603260045260245ffd5b8082018082111561061357634e487b7160e01b5f52601160045260245ffd5b92915050565b60805160a051611a0661064f5f395f818161060101528181610a630152610c0b01525f8181610273015261091a0152611a065ff3fe608060405260043610610215575f3560e01c80638da5cb5b1161011e578063d3be0c4e116100a8578063ed88c68e1161006d578063ed88c68e146106a9578063f2fde38b146106b1578063f7ea244e146106d0578063fba720721461070e578063fc96fa7d14610722575f5ffd5b8063d3be0c4e146105f0578063d5669ed614610623578063d79779b214610642578063e33b7de314610676578063e723e4b41461068a575f5ffd5b8063ac361867116100ee578063ac3618671461054a578063b2118a8d14610569578063b35c427714610588578063c45ac0501461059d578063ce7c2ac2146105bc575f5ffd5b80638da5cb5b146104ba57806396f300d4146104d65780639852595c146104f7578063a3f8eace1461052b575f5ffd5b80634c65acbe1161019f5780636df47b291161016f5780636df47b291461042a5780636f77667a14610449578063715018a61461046857806383977eae1461047c5780638b83209b1461049b575f5ffd5b80634c65acbe146103cb5780635430dd96146103e05780635be7fde8146103f55780636ce60fc614610409575f5ffd5b80633503499a116101e55780633503499a1461032c5780633a98ef3914610341578063406072a914610355578063451450ec1461039957806348b75044146103ac575f5ffd5b80631844125d1461026257806319165587146102b25780631b468bd2146102d35780631de5f910146102ff575f5ffd5b3661025e577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b5f5ffd5b34801561026d575f5ffd5b506102957f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102bd575f5ffd5b506102d16102cc36600461164d565b610736565b005b3480156102de575f5ffd5b506102f26102ed366004611668565b610821565b6040516102a991906116d9565b34801561030a575f5ffd5b5061031e61031936600461171d565b6108dd565b6040519081526020016102a9565b348015610337575f5ffd5b5061031e60095481565b34801561034c575f5ffd5b5060025461031e565b348015610360575f5ffd5b5061031e61036f366004611734565b6001600160a01b039182165f90815260086020908152604080832093909416825291909152205490565b6102d16103a736600461176b565b6108fc565b3480156103b7575f5ffd5b506102d16103c6366004611734565b610d4c565b3480156103d6575f5ffd5b5061031e600c5481565b3480156103eb575f5ffd5b5061031e600b5481565b348015610400575f5ffd5b506102d1610e58565b348015610414575f5ffd5b5061041d610e83565b6040516102a9919061178b565b348015610435575f5ffd5b506102d161044436600461171d565b610ed9565b348015610454575f5ffd5b5061031e61046336600461171d565b610ee6565b348015610473575f5ffd5b506102d1610ef5565b348015610487575f5ffd5b506102d161049636600461171d565b610f08565b3480156104a6575f5ffd5b506102956104b536600461171d565b610f15565b3480156104c5575f5ffd5b505f546001600160a01b0316610295565b3480156104e1575f5ffd5b506104ea610f43565b6040516102a991906117c2565b348015610502575f5ffd5b5061031e61051136600461164d565b6001600160a01b03165f9081526005602052604090205490565b348015610536575f5ffd5b5061031e61054536600461164d565b610fa2565b348015610555575f5ffd5b506102d161056436600461171d565b610fe8565b348015610574575f5ffd5b506102d1610583366004611802565b610ff5565b348015610593575f5ffd5b5061031e600a5481565b3480156105a8575f5ffd5b5061031e6105b7366004611734565b611073565b3480156105c7575f5ffd5b5061031e6105d636600461164d565b6001600160a01b03165f9081526004602052604090205490565b3480156105fb575f5ffd5b506102957f000000000000000000000000000000000000000000000000000000000000000081565b34801561062e575f5ffd5b5061031e61063d36600461171d565b61113a565b34801561064d575f5ffd5b5061031e61065c36600461164d565b6001600160a01b03165f9081526007602052604090205490565b348015610681575f5ffd5b5060035461031e565b348015610695575f5ffd5b506102d16106a436600461171d565b611149565b6102d1611156565b3480156106bc575f5ffd5b506102d16106cb36600461164d565b6111f9565b3480156106db575f5ffd5b506106fe6106ea36600461171d565b600e6020525f908152604090205460ff1681565b60405190151581526020016102a9565b348015610719575f5ffd5b5061041d611233565b34801561072d575f5ffd5b5061041d611287565b6001600160a01b0381165f908152600460205260409020546107735760405162461bcd60e51b815260040161076a90611840565b60405180910390fd5b5f61077d82610fa2565b9050805f0361079e5760405162461bcd60e51b815260040161076a90611886565b8060035f8282546107af91906118e5565b90915550506001600160a01b0382165f9081526005602052604090208054820190556107db82826112db565b604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a15050565b60605f8267ffffffffffffffff81111561083d5761083d6118f8565b604051908082528060200260200182016040528015610866578160200160208202803683370190505b5090505f5b838110156108d357600e5f8686848181106108885761088861190c565b9050602002013581526020019081526020015f205f9054906101000a900460ff168282815181106108bb576108bb61190c565b9115156020928302919091019091015260010161086b565b5090505b92915050565b601181815481106108ec575f80fd5b5f91825260209091200154905081565b610904611373565b6040516331a9108f60e11b8152600481018390527f00000000000000000000000000000000000000000000000000000000000000009033906001600160a01b03831690636352211e90602401602060405180830381865afa15801561096b573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061098f9190611920565b6001600160a01b0316146109f15760405162461bcd60e51b8152602060048201526024808201527f4e6f7420746865206f776e6572206f662074686520737065636966696564207460448201526337b5b2b760e11b606482015260840161076a565b5f838152600e602052604090205460ff1615610a485760405162461bcd60e51b8152602060048201526016602482015275151bdad95b88185b1c9958591e481d5c19dc9859195960521b604482015260640161076a565b604051627eeac760e11b8152336004820152602481018390527f0000000000000000000000000000000000000000000000000000000000000000905f906001600160a01b0383169062fdd58e90604401602060405180830381865afa158015610ab3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ad7919061193b565b11610b245760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656e6f75676820455243313135352062616c616e6365000000000000604482015260640161076a565b5f83600103610b365750600954610b99565b83600203610b475750600a54610b99565b83600303610b585750600b54610b99565b60405162461bcd60e51b8152602060048201526016602482015275496e76616c69642072656b746966696572207479706560501b604482015260640161076a565b803414610be85760405162461bcd60e51b815260206004820152601860248201527f496e636f7272656374207061796d656e7420616d6f756e740000000000000000604482015260640161076a565b604051637a94c56560e11b815233600482015260248101859052600160448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5298aca906064015f604051808303815f87803b158015610c54575f5ffd5b505af1158015610c66573d5f5f3e3d5ffd5b5050505f868152600e60205260409020805460ff191660019081179091558590039050610cc657600f80546001810182555f919091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac80201859055610d3c565b83600203610d0757601080546001810182555f919091527f1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae67201859055610d3c565b601180546001810182555f919091527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c68018590555b505050610d4860018055565b5050565b6001600160a01b0381165f90815260046020526040902054610d805760405162461bcd60e51b815260040161076a90611840565b5f610d8b8383611073565b9050805f03610dac5760405162461bcd60e51b815260040161076a90611886565b6001600160a01b0383165f9081526007602052604081208054839290610dd39084906118e5565b90915550506001600160a01b038084165f908152600860209081526040808320938616835292905220805482019055610e0d8383836113cc565b604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a2505050565b610e6061141e565b5f5b601254811015610e8057610e786102cc82610f15565b600101610e62565b50565b60606010805480602002602001604051908101604052809291908181526020018280548015610ecf57602002820191905f5260205f20905b815481526020019060010190808311610ebb575b5050505050905090565b610ee161141e565b600b55565b601081815481106108ec575f80fd5b610efd61141e565b610f065f61144a565b565b610f1061141e565b600c55565b5f60068281548110610f2957610f2961190c565b5f918252602090912001546001600160a01b031692915050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610ecf57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610f7b575050505050905090565b5f5f610fad60035490565b610fb790476118e5565b9050610fe18382610fdc866001600160a01b03165f9081526005602052604090205490565b611499565b9392505050565b610ff061141e565b600955565b610ffd61141e565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303815f875af1158015611049573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061106d9190611952565b50505050565b6001600160a01b0382165f9081526007602052604081205481906040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa1580156110cf573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110f3919061193b565b6110fd91906118e5565b6001600160a01b038086165f908152600860209081526040808320938816835292905220549091506111329084908390611499565b949350505050565b600f81815481106108ec575f80fd5b61115161141e565b600a55565b61115e611373565b600c5434146111af5760405162461bcd60e51b815260206004820152601960248201527f496e636f727265637420646f6e6174696f6e20616d6f756e7400000000000000604482015260640161076a565b600d80546001810182555f919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180546001600160a01b03191633179055610f0660018055565b61120161141e565b6001600160a01b03811661122a57604051631e4fbdf760e01b81525f600482015260240161076a565b610e808161144a565b60606011805480602002602001604051908101604052809291908181526020018280548015610ecf57602002820191905f5260205f2090815481526020019060010190808311610ebb575050505050905090565b6060600f805480602002602001604051908101604052809291908181526020018280548015610ecf57602002820191905f5260205f2090815481526020019060010190808311610ebb575050505050905090565b804710156112fe5760405163cd78605960e01b815230600482015260240161076a565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114611347576040519150601f19603f3d011682016040523d82523d5f602084013e61134c565b606091505b505090508061136e57604051630a12f52160e11b815260040160405180910390fd5b505050565b6002600154036113c55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161076a565b6002600155565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261136e9084906114d6565b5f546001600160a01b03163314610f065760405163118cdaa760e01b815233600482015260240161076a565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6002546001600160a01b0384165f90815260046020526040812054909183916114c29086611971565b6114cc9190611988565b61113291906119a7565b5f6114ea6001600160a01b03841683611537565b905080515f1415801561150e57508080602001905181019061150c9190611952565b155b1561136e57604051635274afe760e01b81526001600160a01b038416600482015260240161076a565b6060610fe183835f845f5f856001600160a01b0316848660405161155b91906119ba565b5f6040518083038185875af1925050503d805f8114611595576040519150601f19603f3d011682016040523d82523d5f602084013e61159a565b606091505b50915091506115aa8683836115b4565b9695505050505050565b6060826115c9576115c482611610565b610fe1565b81511580156115e057506001600160a01b0384163b155b1561160957604051639996b31560e01b81526001600160a01b038516600482015260240161076a565b5080610fe1565b8051156116205780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b0381168114610e80575f5ffd5b5f6020828403121561165d575f5ffd5b8135610fe181611639565b5f5f60208385031215611679575f5ffd5b823567ffffffffffffffff81111561168f575f5ffd5b8301601f8101851361169f575f5ffd5b803567ffffffffffffffff8111156116b5575f5ffd5b8560208260051b84010111156116c9575f5ffd5b6020919091019590945092505050565b602080825282518282018190525f918401906040840190835b8181101561171257835115158352602093840193909201916001016116f2565b509095945050505050565b5f6020828403121561172d575f5ffd5b5035919050565b5f5f60408385031215611745575f5ffd5b823561175081611639565b9150602083013561176081611639565b809150509250929050565b5f5f6040838503121561177c575f5ffd5b50508035926020909101359150565b602080825282518282018190525f918401906040840190835b818110156117125783518352602093840193909201916001016117a4565b602080825282518282018190525f918401906040840190835b818110156117125783516001600160a01b03168352602093840193909201916001016117db565b5f5f5f60608486031215611814575f5ffd5b833561181f81611639565b9250602084013561182f81611639565b929592945050506040919091013590565b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201526573686172657360d01b606082015260800190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201526a191d59481c185e5b595b9d60aa1b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b808201808211156108d7576108d76118d1565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611930575f5ffd5b8151610fe181611639565b5f6020828403121561194b575f5ffd5b5051919050565b5f60208284031215611962575f5ffd5b81518015158114610fe1575f5ffd5b80820281158282048414176108d7576108d76118d1565b5f826119a257634e487b7160e01b5f52601260045260245ffd5b500490565b818103818111156108d7576108d76118d1565b5f82518060208501845e5f92019182525091905056fea26469706673582212208bceebb7d94536400f127f2900dad3ff496596af8fc4fb174437868ca41da60d64736f6c634300081c00330000000000000000000000003303c4350259c2b8f3c560b2ec70ad3ed87a5e72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000599afdfa9e2e663bde649da2b1922a282f18f6200000000000000000000000007b26cf06d223640c1fe05e8c8057fe96c0a1737b0000000000000000000000003303c4350259c2b8f3c560b2ec70ad3ed87a5e72000000000000000000000000dbced55ef6c66192aa078587f70a6b2379e6fccc0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000f

Deployed Bytecode

0x608060405260043610610215575f3560e01c80638da5cb5b1161011e578063d3be0c4e116100a8578063ed88c68e1161006d578063ed88c68e146106a9578063f2fde38b146106b1578063f7ea244e146106d0578063fba720721461070e578063fc96fa7d14610722575f5ffd5b8063d3be0c4e146105f0578063d5669ed614610623578063d79779b214610642578063e33b7de314610676578063e723e4b41461068a575f5ffd5b8063ac361867116100ee578063ac3618671461054a578063b2118a8d14610569578063b35c427714610588578063c45ac0501461059d578063ce7c2ac2146105bc575f5ffd5b80638da5cb5b146104ba57806396f300d4146104d65780639852595c146104f7578063a3f8eace1461052b575f5ffd5b80634c65acbe1161019f5780636df47b291161016f5780636df47b291461042a5780636f77667a14610449578063715018a61461046857806383977eae1461047c5780638b83209b1461049b575f5ffd5b80634c65acbe146103cb5780635430dd96146103e05780635be7fde8146103f55780636ce60fc614610409575f5ffd5b80633503499a116101e55780633503499a1461032c5780633a98ef3914610341578063406072a914610355578063451450ec1461039957806348b75044146103ac575f5ffd5b80631844125d1461026257806319165587146102b25780631b468bd2146102d35780631de5f910146102ff575f5ffd5b3661025e577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b5f5ffd5b34801561026d575f5ffd5b506102957f000000000000000000000000214cae51c3bae88515aaefd8e1867e64502b034281565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102bd575f5ffd5b506102d16102cc36600461164d565b610736565b005b3480156102de575f5ffd5b506102f26102ed366004611668565b610821565b6040516102a991906116d9565b34801561030a575f5ffd5b5061031e61031936600461171d565b6108dd565b6040519081526020016102a9565b348015610337575f5ffd5b5061031e60095481565b34801561034c575f5ffd5b5060025461031e565b348015610360575f5ffd5b5061031e61036f366004611734565b6001600160a01b039182165f90815260086020908152604080832093909416825291909152205490565b6102d16103a736600461176b565b6108fc565b3480156103b7575f5ffd5b506102d16103c6366004611734565b610d4c565b3480156103d6575f5ffd5b5061031e600c5481565b3480156103eb575f5ffd5b5061031e600b5481565b348015610400575f5ffd5b506102d1610e58565b348015610414575f5ffd5b5061041d610e83565b6040516102a9919061178b565b348015610435575f5ffd5b506102d161044436600461171d565b610ed9565b348015610454575f5ffd5b5061031e61046336600461171d565b610ee6565b348015610473575f5ffd5b506102d1610ef5565b348015610487575f5ffd5b506102d161049636600461171d565b610f08565b3480156104a6575f5ffd5b506102956104b536600461171d565b610f15565b3480156104c5575f5ffd5b505f546001600160a01b0316610295565b3480156104e1575f5ffd5b506104ea610f43565b6040516102a991906117c2565b348015610502575f5ffd5b5061031e61051136600461164d565b6001600160a01b03165f9081526005602052604090205490565b348015610536575f5ffd5b5061031e61054536600461164d565b610fa2565b348015610555575f5ffd5b506102d161056436600461171d565b610fe8565b348015610574575f5ffd5b506102d1610583366004611802565b610ff5565b348015610593575f5ffd5b5061031e600a5481565b3480156105a8575f5ffd5b5061031e6105b7366004611734565b611073565b3480156105c7575f5ffd5b5061031e6105d636600461164d565b6001600160a01b03165f9081526004602052604090205490565b3480156105fb575f5ffd5b506102957f00000000000000000000000060becd2501a8cbe103ad62a84b008c4801ece97781565b34801561062e575f5ffd5b5061031e61063d36600461171d565b61113a565b34801561064d575f5ffd5b5061031e61065c36600461164d565b6001600160a01b03165f9081526007602052604090205490565b348015610681575f5ffd5b5060035461031e565b348015610695575f5ffd5b506102d16106a436600461171d565b611149565b6102d1611156565b3480156106bc575f5ffd5b506102d16106cb36600461164d565b6111f9565b3480156106db575f5ffd5b506106fe6106ea36600461171d565b600e6020525f908152604090205460ff1681565b60405190151581526020016102a9565b348015610719575f5ffd5b5061041d611233565b34801561072d575f5ffd5b5061041d611287565b6001600160a01b0381165f908152600460205260409020546107735760405162461bcd60e51b815260040161076a90611840565b60405180910390fd5b5f61077d82610fa2565b9050805f0361079e5760405162461bcd60e51b815260040161076a90611886565b8060035f8282546107af91906118e5565b90915550506001600160a01b0382165f9081526005602052604090208054820190556107db82826112db565b604080516001600160a01b0384168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a15050565b60605f8267ffffffffffffffff81111561083d5761083d6118f8565b604051908082528060200260200182016040528015610866578160200160208202803683370190505b5090505f5b838110156108d357600e5f8686848181106108885761088861190c565b9050602002013581526020019081526020015f205f9054906101000a900460ff168282815181106108bb576108bb61190c565b9115156020928302919091019091015260010161086b565b5090505b92915050565b601181815481106108ec575f80fd5b5f91825260209091200154905081565b610904611373565b6040516331a9108f60e11b8152600481018390527f000000000000000000000000214cae51c3bae88515aaefd8e1867e64502b03429033906001600160a01b03831690636352211e90602401602060405180830381865afa15801561096b573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061098f9190611920565b6001600160a01b0316146109f15760405162461bcd60e51b8152602060048201526024808201527f4e6f7420746865206f776e6572206f662074686520737065636966696564207460448201526337b5b2b760e11b606482015260840161076a565b5f838152600e602052604090205460ff1615610a485760405162461bcd60e51b8152602060048201526016602482015275151bdad95b88185b1c9958591e481d5c19dc9859195960521b604482015260640161076a565b604051627eeac760e11b8152336004820152602481018390527f00000000000000000000000060becd2501a8cbe103ad62a84b008c4801ece977905f906001600160a01b0383169062fdd58e90604401602060405180830381865afa158015610ab3573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ad7919061193b565b11610b245760405162461bcd60e51b815260206004820152601a60248201527f4e6f7420656e6f75676820455243313135352062616c616e6365000000000000604482015260640161076a565b5f83600103610b365750600954610b99565b83600203610b475750600a54610b99565b83600303610b585750600b54610b99565b60405162461bcd60e51b8152602060048201526016602482015275496e76616c69642072656b746966696572207479706560501b604482015260640161076a565b803414610be85760405162461bcd60e51b815260206004820152601860248201527f496e636f7272656374207061796d656e7420616d6f756e740000000000000000604482015260640161076a565b604051637a94c56560e11b815233600482015260248101859052600160448201527f00000000000000000000000060becd2501a8cbe103ad62a84b008c4801ece9776001600160a01b03169063f5298aca906064015f604051808303815f87803b158015610c54575f5ffd5b505af1158015610c66573d5f5f3e3d5ffd5b5050505f868152600e60205260409020805460ff191660019081179091558590039050610cc657600f80546001810182555f919091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac80201859055610d3c565b83600203610d0757601080546001810182555f919091527f1b6847dc741a1b0cd08d278845f9d819d87b734759afb55fe2de5cb82a9ae67201859055610d3c565b601180546001810182555f919091527f31ecc21a745e3968a04e9570e4425bc18fa8019c68028196b546d1669c200c68018590555b505050610d4860018055565b5050565b6001600160a01b0381165f90815260046020526040902054610d805760405162461bcd60e51b815260040161076a90611840565b5f610d8b8383611073565b9050805f03610dac5760405162461bcd60e51b815260040161076a90611886565b6001600160a01b0383165f9081526007602052604081208054839290610dd39084906118e5565b90915550506001600160a01b038084165f908152600860209081526040808320938616835292905220805482019055610e0d8383836113cc565b604080516001600160a01b038481168252602082018490528516917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a2505050565b610e6061141e565b5f5b601254811015610e8057610e786102cc82610f15565b600101610e62565b50565b60606010805480602002602001604051908101604052809291908181526020018280548015610ecf57602002820191905f5260205f20905b815481526020019060010190808311610ebb575b5050505050905090565b610ee161141e565b600b55565b601081815481106108ec575f80fd5b610efd61141e565b610f065f61144a565b565b610f1061141e565b600c55565b5f60068281548110610f2957610f2961190c565b5f918252602090912001546001600160a01b031692915050565b6060600d805480602002602001604051908101604052809291908181526020018280548015610ecf57602002820191905f5260205f20905b81546001600160a01b03168152600190910190602001808311610f7b575050505050905090565b5f5f610fad60035490565b610fb790476118e5565b9050610fe18382610fdc866001600160a01b03165f9081526005602052604090205490565b611499565b9392505050565b610ff061141e565b600955565b610ffd61141e565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303815f875af1158015611049573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061106d9190611952565b50505050565b6001600160a01b0382165f9081526007602052604081205481906040516370a0823160e01b81523060048201526001600160a01b038616906370a0823190602401602060405180830381865afa1580156110cf573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110f3919061193b565b6110fd91906118e5565b6001600160a01b038086165f908152600860209081526040808320938816835292905220549091506111329084908390611499565b949350505050565b600f81815481106108ec575f80fd5b61115161141e565b600a55565b61115e611373565b600c5434146111af5760405162461bcd60e51b815260206004820152601960248201527f496e636f727265637420646f6e6174696f6e20616d6f756e7400000000000000604482015260640161076a565b600d80546001810182555f919091527fd7b6990105719101dabeb77144f2a3385c8033acd3af97e9423a695e81ad1eb50180546001600160a01b03191633179055610f0660018055565b61120161141e565b6001600160a01b03811661122a57604051631e4fbdf760e01b81525f600482015260240161076a565b610e808161144a565b60606011805480602002602001604051908101604052809291908181526020018280548015610ecf57602002820191905f5260205f2090815481526020019060010190808311610ebb575050505050905090565b6060600f805480602002602001604051908101604052809291908181526020018280548015610ecf57602002820191905f5260205f2090815481526020019060010190808311610ebb575050505050905090565b804710156112fe5760405163cd78605960e01b815230600482015260240161076a565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114611347576040519150601f19603f3d011682016040523d82523d5f602084013e61134c565b606091505b505090508061136e57604051630a12f52160e11b815260040160405180910390fd5b505050565b6002600154036113c55760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161076a565b6002600155565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261136e9084906114d6565b5f546001600160a01b03163314610f065760405163118cdaa760e01b815233600482015260240161076a565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6002546001600160a01b0384165f90815260046020526040812054909183916114c29086611971565b6114cc9190611988565b61113291906119a7565b5f6114ea6001600160a01b03841683611537565b905080515f1415801561150e57508080602001905181019061150c9190611952565b155b1561136e57604051635274afe760e01b81526001600160a01b038416600482015260240161076a565b6060610fe183835f845f5f856001600160a01b0316848660405161155b91906119ba565b5f6040518083038185875af1925050503d805f8114611595576040519150601f19603f3d011682016040523d82523d5f602084013e61159a565b606091505b50915091506115aa8683836115b4565b9695505050505050565b6060826115c9576115c482611610565b610fe1565b81511580156115e057506001600160a01b0384163b155b1561160957604051639996b31560e01b81526001600160a01b038516600482015260240161076a565b5080610fe1565b8051156116205780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b0381168114610e80575f5ffd5b5f6020828403121561165d575f5ffd5b8135610fe181611639565b5f5f60208385031215611679575f5ffd5b823567ffffffffffffffff81111561168f575f5ffd5b8301601f8101851361169f575f5ffd5b803567ffffffffffffffff8111156116b5575f5ffd5b8560208260051b84010111156116c9575f5ffd5b6020919091019590945092505050565b602080825282518282018190525f918401906040840190835b8181101561171257835115158352602093840193909201916001016116f2565b509095945050505050565b5f6020828403121561172d575f5ffd5b5035919050565b5f5f60408385031215611745575f5ffd5b823561175081611639565b9150602083013561176081611639565b809150509250929050565b5f5f6040838503121561177c575f5ffd5b50508035926020909101359150565b602080825282518282018190525f918401906040840190835b818110156117125783518352602093840193909201916001016117a4565b602080825282518282018190525f918401906040840190835b818110156117125783516001600160a01b03168352602093840193909201916001016117db565b5f5f5f60608486031215611814575f5ffd5b833561181f81611639565b9250602084013561182f81611639565b929592945050506040919091013590565b60208082526026908201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060408201526573686172657360d01b606082015260800190565b6020808252602b908201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060408201526a191d59481c185e5b595b9d60aa1b606082015260800190565b634e487b7160e01b5f52601160045260245ffd5b808201808211156108d7576108d76118d1565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215611930575f5ffd5b8151610fe181611639565b5f6020828403121561194b575f5ffd5b5051919050565b5f60208284031215611962575f5ffd5b81518015158114610fe1575f5ffd5b80820281158282048414176108d7576108d76118d1565b5f826119a257634e487b7160e01b5f52601260045260245ffd5b500490565b818103818111156108d7576108d76118d1565b5f82518060208501845e5f92019182525091905056fea26469706673582212208bceebb7d94536400f127f2900dad3ff496596af8fc4fb174437868ca41da60d64736f6c634300081c0033

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

0000000000000000000000003303c4350259c2b8f3c560b2ec70ad3ed87a5e72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000599afdfa9e2e663bde649da2b1922a282f18f6200000000000000000000000007b26cf06d223640c1fe05e8c8057fe96c0a1737b0000000000000000000000003303c4350259c2b8f3c560b2ec70ad3ed87a5e72000000000000000000000000dbced55ef6c66192aa078587f70a6b2379e6fccc0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000f00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000000f

-----Decoded View---------------
Arg [0] : _initialOwner (address): 0x3303C4350259C2B8F3C560B2ec70aD3ed87A5E72
Arg [1] : _payees (address[]): 0x599AfdfA9e2e663BdE649dA2B1922a282f18F620,0x7b26cF06d223640c1fE05e8c8057fe96c0A1737B,0x3303C4350259C2B8F3C560B2ec70aD3ed87A5E72,0xdBcED55eF6C66192Aa078587F70A6b2379e6fCCC
Arg [2] : _shares (uint256[]): 15,20,50,15

-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 0000000000000000000000003303c4350259c2b8f3c560b2ec70ad3ed87a5e72
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [4] : 000000000000000000000000599afdfa9e2e663bde649da2b1922a282f18f620
Arg [5] : 0000000000000000000000007b26cf06d223640c1fe05e8c8057fe96c0a1737b
Arg [6] : 0000000000000000000000003303c4350259c2b8f3c560b2ec70ad3ed87a5e72
Arg [7] : 000000000000000000000000dbced55ef6c66192aa078587f70a6b2379e6fccc
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [9] : 000000000000000000000000000000000000000000000000000000000000000f
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000014
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000032
Arg [12] : 000000000000000000000000000000000000000000000000000000000000000f


Deployed Bytecode Sourcemap

168181:5036:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;29746:40;775:10;29746:40;;;-1:-1:-1;;;;;206:32:1;;;188:51;;29776:9:0;270:2:1;255:18;;248:34;161:18;29746:40:0;;;;;;;168181:5036;;;;;168256:82;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;457:32:1;;;439:51;;427:2;412:18;168256:82:0;;;;;;;;32267:671;;;;;;;;;;-1:-1:-1;32267:671:0;;;;;:::i;:::-;;:::i;:::-;;170993:300;;;;;;;;;;-1:-1:-1;170993:300:0;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;168790:30::-;;;;;;;;;;-1:-1:-1;168790:30:0;;;;;:::i;:::-;;:::i;:::-;;;2531:25:1;;;2519:2;2504:18;168790:30:0;2385:177:1;168457:35:0;;;;;;;;;;;;;;;;29877:91;;;;;;;;;;-1:-1:-1;29948:12:0;;29877:91;;31006:135;;;;;;;;;;-1:-1:-1;31006:135:0;;;;;:::i;:::-;-1:-1:-1;;;;;31103:21:0;;;31076:7;31103:21;;;:14;:21;;;;;;;;:30;;;;;;;;;;;;;31006:135;171837:1377;;;;;;:::i;:::-;;:::i;33206:792::-;;;;;;;;;;-1:-1:-1;33206:792:0;;;;;:::i;:::-;;:::i;168587:39::-;;;;;;;;;;;;;;;;168542:36;;;;;;;;;;;;;;;;169789:153;;;;;;;;;;;;;:::i;171417:108::-;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;169516:96::-;;;;;;;;;;-1:-1:-1;169516:96:0;;;;;:::i;:::-;;:::i;168753:30::-;;;;;;;;;;-1:-1:-1;168753:30:0;;;;;:::i;:::-;;:::i;3254:103::-;;;;;;;;;;;;;:::i;169663:118::-;;;;;;;;;;-1:-1:-1;169663:118:0;;;;;:::i;:::-;;:::i;31232:100::-;;;;;;;;;;-1:-1:-1;31232:100:0;;;;;:::i;:::-;;:::i;2579:87::-;;;;;;;;;;-1:-1:-1;2625:7:0;2652:6;-1:-1:-1;;;;;2652:6:0;2579:87;;170695:94;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;30728:109::-;;;;;;;;;;-1:-1:-1;30728:109:0;;;;;:::i;:::-;-1:-1:-1;;;;;30811:18:0;30784:7;30811:18;;;:9;:18;;;;;;;30728:109;31422:225;;;;;;;;;;-1:-1:-1;31422:225:0;;;;;:::i;:::-;;:::i;169308:96::-;;;;;;;;;;-1:-1:-1;169308:96:0;;;;;:::i;:::-;;:::i;170001:127::-;;;;;;;;;;-1:-1:-1;170001:127:0;;;;;:::i;:::-;;:::i;168499:36::-;;;;;;;;;;;;;;;;31807:260;;;;;;;;;;-1:-1:-1;31807:260:0;;;;;:::i;:::-;;:::i;30524:105::-;;;;;;;;;;-1:-1:-1;30524:105:0;;;;;:::i;:::-;-1:-1:-1;;;;;30605:16:0;30578:7;30605:16;;;:7;:16;;;;;;;30524:105;168345:103;;;;;;;;;;;;;;;168715:30;;;;;;;;;;-1:-1:-1;168715:30:0;;;;;:::i;:::-;;:::i;30314:119::-;;;;;;;;;;-1:-1:-1;30314:119:0;;;;;:::i;:::-;-1:-1:-1;;;;;30399:26:0;30372:7;30399:26;;;:19;:26;;;;;;;30314:119;30062:95;;;;;;;;;;-1:-1:-1;30135:14:0;;30062:95;;169412:96;;;;;;;;;;-1:-1:-1;169412:96:0;;;;;:::i;:::-;;:::i;170455:165::-;;;:::i;3512:220::-;;;;;;;;;;-1:-1:-1;3512:220:0;;;;;:::i;:::-;;:::i;168666:40::-;;;;;;;;;;-1:-1:-1;168666:40:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;6065:14:1;;6058:22;6040:41;;6028:2;6013:18;168666:40:0;5900:187:1;171533:108:0;;;;;;;;;;;;;:::i;171301:::-;;;;;;;;;;;;;:::i;32267:671::-;-1:-1:-1;;;;;32343:16:0;;32362:1;32343:16;;;:7;:16;;;;;;32335:71;;;;-1:-1:-1;;;32335:71:0;;;;;;;:::i;:::-;;;;;;;;;32419:15;32437:19;32448:7;32437:10;:19::i;:::-;32419:37;;32477:7;32488:1;32477:12;32469:68;;;;-1:-1:-1;;;32469:68:0;;;;;;;:::i;:::-;32750:7;32732:14;;:25;;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;;;32793:18:0;;;;;;:9;:18;;;;;:29;;;;;;32846:35;32803:7;32815;32846:17;:35::i;:::-;32897:33;;;-1:-1:-1;;;;;206:32:1;;188:51;;270:2;255:18;;248:34;;;32897:33:0;;161:18:1;32897:33:0;;;;;;;32324:614;32267:671;:::o;170993:300::-;171066:13;171092:21;171127:8;171116:27;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;171116:27:0;-1:-1:-1;171092:51:0;-1:-1:-1;171159:9:0;171154:107;171174:19;;;171154:107;;;171228:8;:21;171237:8;;171246:1;171237:11;;;;;;;:::i;:::-;;;;;;;171228:21;;;;;;;;;;;;;;;;;;;;;171215:7;171223:1;171215:10;;;;;;;;:::i;:::-;:34;;;:10;;;;;;;;;;;:34;171195:3;;171154:107;;;-1:-1:-1;171278:7:0;-1:-1:-1;170993:300:0;;;;;:::o;168790:30::-;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;168790:30:0;:::o;171837:1377::-;6435:21;:19;:21::i;:::-;171991:22:::1;::::0;-1:-1:-1;;;171991:22:0;;::::1;::::0;::::1;2531:25:1::0;;;171959:12:0::1;::::0;172017:10:::1;::::0;-1:-1:-1;;;;;171991:13:0;::::1;::::0;::::1;::::0;2504:18:1;;171991:22:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;171991:36:0::1;;171983:85;;;::::0;-1:-1:-1;;;171983:85:0;;8190:2:1;171983:85:0::1;::::0;::::1;8172:21:1::0;8229:2;8209:18;;;8202:30;8268:34;8248:18;;;8241:62;-1:-1:-1;;;8319:18:1;;;8312:34;8363:19;;171983:85:0::1;7988:400:1::0;171983:85:0::1;172088:17;::::0;;;:8:::1;:17;::::0;;;;;::::1;;172087:18;172079:53;;;::::0;-1:-1:-1;;;172079:53:0;;8595:2:1;172079:53:0::1;::::0;::::1;8577:21:1::0;8634:2;8614:18;;;8607:30;-1:-1:-1;;;8653:18:1;;;8646:52;8715:18;;172079:53:0::1;8393:346:1::0;172079:53:0::1;172211:46;::::0;-1:-1:-1;;;172211:46:0;;172231:10:::1;172211:46;::::0;::::1;188:51:1::0;255:18;;;248:34;;;172175:16:0::1;::::0;172145:18:::1;::::0;-1:-1:-1;;;;;172211:19:0;::::1;::::0;::::1;::::0;161:18:1;;172211:46:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:50;172203:89;;;::::0;-1:-1:-1;;;172203:89:0;;9135:2:1;172203:89:0::1;::::0;::::1;9117:21:1::0;9174:2;9154:18;;;9147:30;9213:28;9193:18;;;9186:56;9259:18;;172203:89:0::1;8933:350:1::0;172203:89:0::1;172305:21;172341:13;172358:1;172341:18:::0;172337:308:::1;;-1:-1:-1::0;172392:10:0::1;::::0;172337:308:::1;;;172424:13;172441:1;172424:18:::0;172420:225:::1;;-1:-1:-1::0;172475:10:0::1;::::0;172420:225:::1;;;172507:13;172524:1;172507:18:::0;172503:142:::1;;-1:-1:-1::0;172558:10:0::1;::::0;172503:142:::1;;;172601:32;::::0;-1:-1:-1;;;172601:32:0;;9490:2:1;172601:32:0::1;::::0;::::1;9472:21:1::0;9529:2;9509:18;;;9502:30;-1:-1:-1;;;9548:18:1;;;9541:52;9610:18;;172601:32:0::1;9288:346:1::0;172503:142:0::1;172678:13;172665:9;:26;172657:63;;;::::0;-1:-1:-1;;;172657:63:0;;9841:2:1;172657:63:0::1;::::0;::::1;9823:21:1::0;9880:2;9860:18;;;9853:30;9919:26;9899:18;;;9892:54;9963:18;;172657:63:0::1;9639:348:1::0;172657:63:0::1;172773;::::0;-1:-1:-1;;;172773:63:0;;172807:10:::1;172773:63;::::0;::::1;10202:51:1::0;10269:18;;;10262:34;;;172834:1:0::1;10312:18:1::0;;;10305:34;172784:16:0::1;-1:-1:-1::0;;;;;172773:33:0::1;::::0;::::1;::::0;10175:18:1;;172773:63:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1::0;;;172888:17:0::1;::::0;;;:8:::1;:17;::::0;;;;:24;;-1:-1:-1;;172888:24:0::1;172908:4;172888:24:::0;;::::1;::::0;;;172989:18;;;;-1:-1:-1;172985:222:0::1;;173024:13;:27:::0;;::::1;::::0;::::1;::::0;;-1:-1:-1;173024:27:0;;;;;::::1;::::0;;;172985:222:::1;;;173073:13;173090:1;173073:18:::0;173069:138:::1;;173108:13;:27:::0;;::::1;::::0;::::1;::::0;;-1:-1:-1;173108:27:0;;;;;::::1;::::0;;;173069:138:::1;;;173168:13;:27:::0;;::::1;::::0;::::1;::::0;;-1:-1:-1;173168:27:0;;;;;::::1;::::0;;;173069:138:::1;171924:1290;;;6479:20:::0;5873:1;6999:22;;6816:213;6479:20;171837:1377;;:::o;33206:792::-;-1:-1:-1;;;;;33288:16:0;;33307:1;33288:16;;;:7;:16;;;;;;33280:71;;;;-1:-1:-1;;;33280:71:0;;;;;;;:::i;:::-;33364:15;33382:26;33393:5;33400:7;33382:10;:26::i;:::-;33364:44;;33429:7;33440:1;33429:12;33421:68;;;;-1:-1:-1;;;33421:68:0;;;;;;;:::i;:::-;-1:-1:-1;;;;;33744:26:0;;;;;;:19;:26;;;;;:37;;33774:7;;33744:26;:37;;33774:7;;33744:37;:::i;:::-;;;;-1:-1:-1;;;;;;;33817:21:0;;;;;;;:14;:21;;;;;;;;:30;;;;;;;;;:41;;;;;;33882:47;33832:5;33839:7;33851;33882:22;:47::i;:::-;33945:45;;;-1:-1:-1;;;;;206:32:1;;;188:51;;270:2;255:18;;248:34;;;33945:45:0;;;;;161:18:1;33945:45:0;;;;;;;33269:729;33206:792;;:::o;169789:153::-;2465:13;:11;:13::i;:::-;169846:9:::1;169841:94;169865:10;;169861:1;:14;169841:94;;;169897:26;169913:8;169919:1;169913:5;:8::i;169897:26::-;169877:3;;169841:94;;;;169789:153::o:0;171417:108::-;171468:16;171504:13;171497:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;171417:108;:::o;169516:96::-;2465:13;:11;:13::i;:::-;169585:10:::1;:19:::0;169516:96::o;168753:30::-;;;;;;;;;;;;3254:103;2465:13;:11;:13::i;:::-;3319:30:::1;3346:1;3319:18;:30::i;:::-;3254:103::o:0;169663:118::-;2465:13;:11;:13::i;:::-;169743::::1;:30:::0;169663:118::o;31232:100::-;31283:7;31310;31318:5;31310:14;;;;;;;;:::i;:::-;;;;;;;;;;;-1:-1:-1;;;;;31310:14:0;;31232:100;-1:-1:-1;;31232:100:0:o;170695:94::-;170739:16;170775:6;170768:13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;170768:13:0;;;;;;;;;;;;;;;;;;;;;;170695:94;:::o;31422:225::-;31480:7;31500:21;31548:15;30135:14;;;30062:95;31548:15;31524:39;;:21;:39;:::i;:::-;31500:63;;31581:58;31597:7;31606:13;31621:17;31630:7;-1:-1:-1;;;;;30811:18:0;30784:7;30811:18;;;:9;:18;;;;;;;30728:109;31621:17;31581:15;:58::i;:::-;31574:65;31422:225;-1:-1:-1;;;31422:225:0:o;169308:96::-;2465:13;:11;:13::i;:::-;169377:10:::1;:19:::0;169308:96::o;170001:127::-;2465:13;:11;:13::i;:::-;170094:26:::1;::::0;-1:-1:-1;;;170094:26:0;;-1:-1:-1;;;;;206:32:1;;;170094:26:0::1;::::0;::::1;188:51:1::0;255:18;;;248:34;;;170094:14:0;::::1;::::0;::::1;::::0;161:18:1;;170094:26:0::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;170001:127:::0;;;:::o;31807:260::-;-1:-1:-1;;;;;30399:26:0;;31879:7;30399:26;;;:19;:26;;;;;;31879:7;;31923:30;;-1:-1:-1;;;31923:30:0;;31947:4;31923:30;;;439:51:1;-1:-1:-1;;;;;31923:15:0;;;;;412:18:1;;31923:30:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:53;;;;:::i;:::-;-1:-1:-1;;;;;31103:21:0;;;31076:7;31103:21;;;:14;:21;;;;;;;;:30;;;;;;;;;;31899:77;;-1:-1:-1;31994:65:0;;32010:7;;31899:77;;31581:15;:58::i;31994:65::-;31987:72;31807:260;-1:-1:-1;;;;31807:260:0:o;168715:30::-;;;;;;;;;;;;169412:96;2465:13;:11;:13::i;:::-;169481:10:::1;:19:::0;169412:96::o;170455:165::-;6435:21;:19;:21::i;:::-;170535:13:::1;;170522:9;:26;170514:64;;;::::0;-1:-1:-1;;;170514:64:0;;10834:2:1;170514:64:0::1;::::0;::::1;10816:21:1::0;10873:2;10853:18;;;10846:30;10912:27;10892:18;;;10885:55;10957:18;;170514:64:0::1;10632:349:1::0;170514:64:0::1;170589:6;:23:::0;;::::1;::::0;::::1;::::0;;-1:-1:-1;170589:23:0;;;;;::::1;::::0;;-1:-1:-1;;;;;;170589:23:0::1;170601:10;170589:23;::::0;;6479:20;5873:1;6999:22;;6816:213;3512:220;2465:13;:11;:13::i;:::-;-1:-1:-1;;;;;3597:22:0;::::1;3593:93;;3643:31;::::0;-1:-1:-1;;;3643:31:0;;3671:1:::1;3643:31;::::0;::::1;439:51:1::0;412:18;;3643:31:0::1;293:203:1::0;3593:93:0::1;3696:28;3715:8;3696:18;:28::i;171533:108::-:0;171584:16;171620:13;171613:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;171533:108;:::o;171301:::-;171352:16;171388:13;171381:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;171301:108;:::o;15752:340::-;15862:6;15838:21;:30;15834:111;;;15892:41;;-1:-1:-1;;;15892:41:0;;15927:4;15892:41;;;439:51:1;412:18;;15892:41:0;293:203:1;15834:111:0;15958:12;15976:9;-1:-1:-1;;;;;15976:14:0;15998:6;15976:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;15957:52;;;16025:7;16020:65;;16056:17;;-1:-1:-1;;;16056:17:0;;;;;;;;;;;16020:65;15823:269;15752:340;;:::o;6515:293::-;5917:1;6649:7;;:19;6641:63;;;;-1:-1:-1;;;6641:63:0;;11398:2:1;6641:63:0;;;11380:21:1;11437:2;11417:18;;;11410:30;11476:33;11456:18;;;11449:61;11527:18;;6641:63:0;11196:355:1;6641:63:0;5917:1;6782:7;:18;6515:293::o;21829:162::-;21939:43;;;-1:-1:-1;;;;;206:32:1;;21939:43:0;;;188:51:1;255:18;;;;248:34;;;21939:43:0;;;;;;;;;;161:18:1;;;;21939:43:0;;;;;;;;-1:-1:-1;;;;;21939:43:0;-1:-1:-1;;;21939:43:0;;;21912:71;;21932:5;;21912:19;:71::i;2744:166::-;2625:7;2652:6;-1:-1:-1;;;;;2652:6:0;775:10;2804:23;2800:103;;2851:40;;-1:-1:-1;;;2851:40:0;;775:10;2851:40;;;439:51:1;412:18;;2851:40:0;293:203:1;3892:191:0;3966:16;3985:6;;-1:-1:-1;;;;;4002:17:0;;;-1:-1:-1;;;;;;4002:17:0;;;;;;4035:40;;3985:6;;;;;;;4035:40;;3966:16;4035:40;3955:128;3892:191;:::o;34176:248::-;34386:12;;-1:-1:-1;;;;;34366:16:0;;34322:7;34366:16;;;:7;:16;;;;;;34322:7;;34401:15;;34350:32;;:13;:32;:::i;:::-;34349:49;;;;:::i;:::-;:67;;;;:::i;24640:638::-;25064:23;25090:33;-1:-1:-1;;;;;25090:27:0;;25118:4;25090:27;:33::i;:::-;25064:59;;25138:10;:17;25159:1;25138:22;;:57;;;;;25176:10;25165:30;;;;;;;;;;;;:::i;:::-;25164:31;25138:57;25134:137;;;25219:40;;-1:-1:-1;;;25219:40:0;;-1:-1:-1;;;;;457:32:1;;25219:40:0;;;439:51:1;412:18;;25219:40:0;293:203:1;16955:153:0;17030:12;17062:38;17084:6;17092:4;17098:1;17030:12;17688;17702:23;17729:6;-1:-1:-1;;;;;17729:11:0;17748:5;17755:4;17729:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;17687:73;;;;17778:55;17805:6;17813:7;17822:10;17778:26;:55::i;:::-;17771:62;17443:398;-1:-1:-1;;;;;;17443:398:0:o;18919:597::-;19067:12;19097:7;19092:417;;19121:19;19129:10;19121:7;:19::i;:::-;19092:417;;;19349:17;;:22;:49;;;;-1:-1:-1;;;;;;19375:18:0;;;:23;19349:49;19345:121;;;19426:24;;-1:-1:-1;;;19426:24:0;;-1:-1:-1;;;;;457:32:1;;19426:24:0;;;439:51:1;412:18;;19426:24:0;293:203:1;19345:121:0;-1:-1:-1;19487:10:0;19480:17;;20069:528;20202:17;;:21;20198:392;;20434:10;20428:17;20491:15;20478:10;20474:2;20470:19;20463:44;20198:392;20561:17;;-1:-1:-1;;;20561:17:0;;;;;;;;;;;501:139:1;-1:-1:-1;;;;;584:31:1;;574:42;;564:70;;630:1;627;620:12;645:263;712:6;765:2;753:9;744:7;740:23;736:32;733:52;;;781:1;778;771:12;733:52;820:9;807:23;839:39;872:5;839:39;:::i;913:610::-;999:6;1007;1060:2;1048:9;1039:7;1035:23;1031:32;1028:52;;;1076:1;1073;1066:12;1028:52;1116:9;1103:23;1149:18;1141:6;1138:30;1135:50;;;1181:1;1178;1171:12;1135:50;1204:22;;1257:4;1249:13;;1245:27;-1:-1:-1;1235:55:1;;1286:1;1283;1276:12;1235:55;1326:2;1313:16;1352:18;1344:6;1341:30;1338:50;;;1384:1;1381;1374:12;1338:50;1437:7;1432:2;1422:6;1419:1;1415:14;1411:2;1407:23;1403:32;1400:45;1397:65;;;1458:1;1455;1448:12;1397:65;1489:2;1481:11;;;;;1511:6;;-1:-1:-1;913:610:1;-1:-1:-1;;;913:610:1:o;1528:621::-;1712:2;1724:21;;;1794:13;;1697:18;;;1816:22;;;1664:4;;1895:15;;;1869:2;1854:18;;;1664:4;1938:185;1952:6;1949:1;1946:13;1938:185;;;2027:13;;2020:21;2013:29;2001:42;;2072:2;2098:15;;;;2063:12;;;;1974:1;1967:9;1938:185;;;-1:-1:-1;2140:3:1;;1528:621;-1:-1:-1;;;;;1528:621:1:o;2154:226::-;2213:6;2266:2;2254:9;2245:7;2241:23;2237:32;2234:52;;;2282:1;2279;2272:12;2234:52;-1:-1:-1;2327:23:1;;2154:226;-1:-1:-1;2154:226:1:o;2567:418::-;2649:6;2657;2710:2;2698:9;2689:7;2685:23;2681:32;2678:52;;;2726:1;2723;2716:12;2678:52;2765:9;2752:23;2784:39;2817:5;2784:39;:::i;:::-;2842:5;-1:-1:-1;2899:2:1;2884:18;;2871:32;2912:41;2871:32;2912:41;:::i;:::-;2972:7;2962:17;;;2567:418;;;;;:::o;2990:346::-;3058:6;3066;3119:2;3107:9;3098:7;3094:23;3090:32;3087:52;;;3135:1;3132;3125:12;3087:52;-1:-1:-1;;3180:23:1;;;3300:2;3285:18;;;3272:32;;-1:-1:-1;2990:346:1:o;3341:611::-;3531:2;3543:21;;;3613:13;;3516:18;;;3635:22;;;3483:4;;3714:15;;;3688:2;3673:18;;;3483:4;3757:169;3771:6;3768:1;3765:13;3757:169;;;3832:13;;3820:26;;3875:2;3901:15;;;;3866:12;;;;3793:1;3786:9;3757:169;;3957:637;4147:2;4159:21;;;4229:13;;4132:18;;;4251:22;;;4099:4;;4330:15;;;4304:2;4289:18;;;4099:4;4373:195;4387:6;4384:1;4381:13;4373:195;;;4452:13;;-1:-1:-1;;;;;4448:39:1;4436:52;;4517:2;4543:15;;;;4508:12;;;;4484:1;4402:9;4373:195;;4859:538;4950:6;4958;4966;5019:2;5007:9;4998:7;4994:23;4990:32;4987:52;;;5035:1;5032;5025:12;4987:52;5074:9;5061:23;5093:39;5126:5;5093:39;:::i;:::-;5151:5;-1:-1:-1;5208:2:1;5193:18;;5180:32;5221:41;5180:32;5221:41;:::i;:::-;4859:538;;5281:7;;-1:-1:-1;;;5361:2:1;5346:18;;;;5333:32;;4859:538::o;6092:402::-;6294:2;6276:21;;;6333:2;6313:18;;;6306:30;6372:34;6367:2;6352:18;;6345:62;-1:-1:-1;;;6438:2:1;6423:18;;6416:36;6484:3;6469:19;;6092:402::o;6499:407::-;6701:2;6683:21;;;6740:2;6720:18;;;6713:30;6779:34;6774:2;6759:18;;6752:62;-1:-1:-1;;;6845:2:1;6830:18;;6823:41;6896:3;6881:19;;6499:407::o;6911:127::-;6972:10;6967:3;6963:20;6960:1;6953:31;7003:4;7000:1;6993:15;7027:4;7024:1;7017:15;7043:125;7108:9;;;7129:10;;;7126:36;;;7142:18;;:::i;7460:127::-;7521:10;7516:3;7512:20;7509:1;7502:31;7552:4;7549:1;7542:15;7576:4;7573:1;7566:15;7592:127;7653:10;7648:3;7644:20;7641:1;7634:31;7684:4;7681:1;7674:15;7708:4;7705:1;7698:15;7724:259;7794:6;7847:2;7835:9;7826:7;7822:23;7818:32;7815:52;;;7863:1;7860;7853:12;7815:52;7895:9;7889:16;7914:39;7947:5;7914:39;:::i;8744:184::-;8814:6;8867:2;8855:9;8846:7;8842:23;8838:32;8835:52;;;8883:1;8880;8873:12;8835:52;-1:-1:-1;8906:16:1;;8744:184;-1:-1:-1;8744:184:1:o;10350:277::-;10417:6;10470:2;10458:9;10449:7;10445:23;10441:32;10438:52;;;10486:1;10483;10476:12;10438:52;10518:9;10512:16;10571:5;10564:13;10557:21;10550:5;10547:32;10537:60;;10593:1;10590;10583:12;11556:168;11629:9;;;11660;;11677:15;;;11671:22;;11657:37;11647:71;;11698:18;;:::i;11729:217::-;11769:1;11795;11785:132;;11839:10;11834:3;11830:20;11827:1;11820:31;11874:4;11871:1;11864:15;11902:4;11899:1;11892:15;11785:132;-1:-1:-1;11931:9:1;;11729:217::o;11951:128::-;12018:9;;;12039:11;;;12036:37;;;12053:18;;:::i;12084:301::-;12213:3;12251:6;12245:13;12297:6;12290:4;12282:6;12278:17;12273:3;12267:37;12359:1;12323:16;;12348:13;;;-1:-1:-1;12323:16:1;12084:301;-1:-1:-1;12084:301:1:o

Swarm Source

ipfs://8bceebb7d94536400f127f2900dad3ff496596af8fc4fb174437868ca41da60d

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
[ 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.