false
true
0

Contract Address Details

0x336a04741e3f9273baB2d68D2b5c6860b285003B

Contract Name
YieldVault
Creator
0x6f5e8b–11d74b at 0xf6fc84–248bf1
Balance
0 tPLS
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
25393880
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
YieldVault




Optimization enabled
false
Compiler version
v0.8.20+commit.a1b79de6




EVM Version




Verified at
2026-09-14T19:05:49.154850Z

Constructor Arguments

000000000000000000000000489577615c4f0e269c7bf0b270961c810a86526e00000000000000000000000060bfae5c67f32ecdcea707843bc809cd64ec0060000000000000000000000000fbc13eb54962b1ad66ae00d5965b37df2aca388b

Arg [0] (address) : 0x489577615c4f0e269c7bf0b270961c810a86526e
Arg [1] (address) : 0x60bfae5c67f32ecdcea707843bc809cd64ec0060
Arg [2] (address) : 0xfbc13eb54962b1ad66ae00d5965b37df2aca388b

              

contracts/core/YieldVault.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// @title IBidToken
/// @notice The one thing the vault needs from the BID auction token: the
///         "have you activated your account?" flag. A wallet only earns the
///         flag by spending BID (BidToken.depositBids), so staking and daily
///         revenue are gated to real participants.
interface IBidToken {
    function checkStakingStatus(address user) external view returns (bool);
}

/// @title ICommissionTree
/// @notice The upline/MLM engine. On every stake the vault pings it so it can
///         mint/allocate the 10% / 5% / 2% BBA sponsor commissions — or route
///         them to the company rotator when the staker has no sponsor.
interface ICommissionTree {
    function distributeStakingCommissions(address staker, uint256 stakedAmount) external;
}

/// @title YieldVault
/// @notice Two jobs in one contract for the Blockbids ecosystem on PulseChain:
///         1. The BBA staking vault — users lock BBA here and the commission
///            tree pays their upline.
///         2. A Web2-hybrid "claim terminal" — it holds native PLS (routed in
///            from BBACoin tax swaps + the treasury) and lets stakers claim
///            their daily revenue share against a Merkle root the backend
///            publishes each epoch.
/// @dev The daily 16.5% revenue math (90-day expiries, $500 minimums, ad
///      verifications) is impossible on-chain, so the backend computes each
///      day's allocations off-chain and the admin posts only the Merkle root.
contract YieldVault is AccessControl, ReentrancyGuard {
    using SafeERC20 for IERC20;

    // --- Immutable-ish wiring ---

    IERC20 public bbaToken;              // the token users stake
    IBidToken public bidToken;           // source of checkStakingStatus()
    ICommissionTree public commissionTree; // upline payout engine

    // --- Staking state ---

    mapping(address => uint256) public stakedBalance;
    uint256 public totalStaked; // sum of all stakes; protects users from rescueERC20

    // --- Daily revenue (Merkle) state ---

    bytes32 public dailyMerkleRoot;
    uint256 public currentEpoch;
    // epoch => user => already pulled this epoch's allocation?
    mapping(uint256 => mapping(address => bool)) public hasClaimed;

    // --- Events ---

    event Staked(address indexed user, uint256 amount);
    event Unstaked(address indexed user, uint256 amount);
    event DailyRootUpdated(uint256 indexed epoch, bytes32 newRoot);
    event RevenueClaimed(uint256 indexed epoch, address indexed user, uint256 amount);
    event BbaTokenUpdated(address indexed previous, address indexed current);
    event BidTokenUpdated(address indexed previous, address indexed current);
    event CommissionTreeUpdated(address indexed previous, address indexed current);
    event ERC20Rescued(address indexed token, address indexed to, uint256 amount);
    event NativeRescued(address indexed to, uint256 amount);

    constructor(
        address _bbaToken,
        address _bidToken,
        address _commissionTree
    ) {
        require(_bbaToken != address(0), "Vault: bba is zero");
        require(_bidToken != address(0), "Vault: bid is zero");
        require(_commissionTree != address(0), "Vault: tree is zero");

        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);

        bbaToken = IERC20(_bbaToken);
        bidToken = IBidToken(_bidToken);
        commissionTree = ICommissionTree(_commissionTree);
    }

    // ============================================================
    //                     STAKING (BBA)
    // ============================================================

    /// @notice Lock `amount` BBA in the vault and trigger upline commissions.
    /// @dev Requires the caller to have activated staking by spending BID.
    ///      Caller must approve(this, amount) on the BBA token first.
    function stake(uint256 amount) external nonReentrant {
        require(amount > 0, "Vault: amount is zero");
        require(bidToken.checkStakingStatus(msg.sender), "Vault: not activated");

        // Effects first (CEI): book the stake before any external call.
        stakedBalance[msg.sender] += amount;
        totalStaked += amount;

        // Pull the BBA. SafeERC20 reverts on a lying/false-returning token.
        bbaToken.safeTransferFrom(msg.sender, address(this), amount);

        // CRITICAL HOOK: pay the sponsor tree. Left un-caught on purpose — if
        // commissions can't be booked the whole stake reverts rather than
        // silently shorting the upline.
        commissionTree.distributeStakingCommissions(msg.sender, amount);

        emit Staked(msg.sender, amount);
    }

    /// @notice Withdraw `amount` of previously staked BBA.
    /// @dev No activation check — letting people exit is never something we
    ///      want to gate. Unstaking does not claw back paid commissions.
    function unstake(uint256 amount) external nonReentrant {
        require(amount > 0, "Vault: amount is zero");
        require(stakedBalance[msg.sender] >= amount, "Vault: insufficient stake");

        stakedBalance[msg.sender] -= amount;
        totalStaked -= amount;

        bbaToken.safeTransfer(msg.sender, amount);

        emit Unstaked(msg.sender, amount);
    }

    // ============================================================
    //              DAILY REVENUE CLAIM (native PLS)
    // ============================================================

    /// @notice Publish a new day's allocation root. Bumps the epoch so every
    ///         wallet's `hasClaimed` flag resets for the new day.
    function updateDailyRoot(bytes32 newRoot)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        currentEpoch += 1;
        dailyMerkleRoot = newRoot;
        emit DailyRootUpdated(currentEpoch, newRoot);
    }

    /// @notice Claim your allocated PLS for the current epoch.
    /// @param amount      PLS (wei) the backend allocated to msg.sender.
    /// @param merkleProof Proof that (msg.sender, amount) is in dailyMerkleRoot.
    /// @dev Leaf uses the OpenZeppelin standard-merkle-tree convention: a
    ///      double keccak256 over abi.encode(account, amount). The web2 backend
    ///      MUST build leaves the same way (the openzeppelin/merkle-tree lib
    ///      with ["address","uint256"]) or proofs will not verify.
    function claimDailyRevenue(uint256 amount, bytes32[] calldata merkleProof)
        external
        nonReentrant
    {
        require(bidToken.checkStakingStatus(msg.sender), "Vault: not activated");
        require(!hasClaimed[currentEpoch][msg.sender], "Vault: already claimed");

        bytes32 leaf = keccak256(
            bytes.concat(keccak256(abi.encode(msg.sender, amount)))
        );
        require(
            MerkleProof.verify(merkleProof, dailyMerkleRoot, leaf),
            "Vault: bad proof"
        );

        // Effects before the value transfer (CEI + nonReentrant).
        hasClaimed[currentEpoch][msg.sender] = true;

        (bool ok, ) = payable(msg.sender).call{value: amount}("");
        require(ok, "Vault: PLS transfer failed");

        emit RevenueClaimed(currentEpoch, msg.sender, amount);
    }

    // ============================================================
    //                   FUNDING & SAFETY
    // ============================================================

    /// @notice Passively receive native PLS — BBACoin tax swaps land here, and
    ///         so does treasury top-up for the daily revenue pool.
    receive() external payable {}

    /// @notice Rescue ERC20s sent here by mistake.
    /// @dev For the staking token we only let the admin pull the surplus above
    ///      totalStaked, so this can never be used to drain users' stakes.
    function rescueERC20(address token, address to, uint256 amount)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(to != address(0), "Vault: to is zero");
        if (token == address(bbaToken)) {
            uint256 surplus = bbaToken.balanceOf(address(this)) - totalStaked;
            require(amount <= surplus, "Vault: exceeds BBA surplus");
        }
        IERC20(token).safeTransfer(to, amount);
        emit ERC20Rescued(token, to, amount);
    }

    /// @notice Withdraw native PLS for migration/emergency.
    /// @dev Unstaked PLS is fully at admin discretion here; unclaimed
    ///      allocations are backend bookkeeping, not an on-chain reservation.
    function rescueNative(address to, uint256 amount)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(to != address(0), "Vault: to is zero");
        (bool ok, ) = payable(to).call{value: amount}("");
        require(ok, "Vault: PLS transfer failed");
        emit NativeRescued(to, amount);
    }

    // ============================================================
    //                        ADMIN WIRING
    // ============================================================

    function setBbaToken(address _bbaToken)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(_bbaToken != address(0), "Vault: bba is zero");
        emit BbaTokenUpdated(address(bbaToken), _bbaToken);
        bbaToken = IERC20(_bbaToken);
    }

    function setBidToken(address _bidToken)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(_bidToken != address(0), "Vault: bid is zero");
        emit BidTokenUpdated(address(bidToken), _bidToken);
        bidToken = IBidToken(_bidToken);
    }

    function setCommissionTree(address _commissionTree)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)
    {
        require(_commissionTree != address(0), "Vault: tree is zero");
        emit CommissionTreeUpdated(address(commissionTree), _commissionTree);
        commissionTree = ICommissionTree(_commissionTree);
    }
}
        

@openzeppelin/contracts/utils/cryptography/MerkleProof.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.6.0) (utils/cryptography/MerkleProof.sol)
// This file was procedurally generated from scripts/generate/templates/MerkleProof.js.

pragma solidity ^0.8.20;

import {Hashes} from "./Hashes.sol";

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the Merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates Merkle trees that are safe
 * against this attack out of the box.
 *
 * IMPORTANT: Consider memory side-effects when using custom hashing functions
 * that access memory in an unsafe way.
 *
 * NOTE: This library supports proof verification for merkle trees built using
 * custom _commutative_ hashing functions (i.e. `H(a, b) == H(b, a)`). Proving
 * leaf inclusion in trees built using non-commutative hashing functions requires
 * additional logic that is not supported by this library.
 */
library MerkleProof {
    /**
     * @dev The multiproof provided is not valid.
     */
    error MerkleProofInvalidMultiproof();

    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     *
     * This version handles proofs in memory with the default hashing function.
     */
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leaves & pre-images are assumed to be sorted.
     *
     * This version handles proofs in memory with the default hashing function.
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     *
     * This version handles proofs in memory with a custom hashing function.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf,
        function(bytes32, bytes32) view returns (bytes32) hasher
    ) internal view returns (bool) {
        return processProof(proof, leaf, hasher) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leaves & pre-images are assumed to be sorted.
     *
     * This version handles proofs in memory with a custom hashing function.
     */
    function processProof(
        bytes32[] memory proof,
        bytes32 leaf,
        function(bytes32, bytes32) view returns (bytes32) hasher
    ) internal view returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = hasher(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     *
     * This version handles proofs in calldata with the default hashing function.
     */
    function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leaves & pre-images are assumed to be sorted.
     *
     * This version handles proofs in calldata with the default hashing function.
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = Hashes.commutativeKeccak256(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     *
     * This version handles proofs in calldata with a custom hashing function.
     */
    function verifyCalldata(
        bytes32[] calldata proof,
        bytes32 root,
        bytes32 leaf,
        function(bytes32, bytes32) view returns (bytes32) hasher
    ) internal view returns (bool) {
        return processProofCalldata(proof, leaf, hasher) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leaves & pre-images are assumed to be sorted.
     *
     * This version handles proofs in calldata with a custom hashing function.
     */
    function processProofCalldata(
        bytes32[] calldata proof,
        bytes32 leaf,
        function(bytes32, bytes32) view returns (bytes32) hasher
    ) internal view returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = hasher(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * This version handles multiproofs in memory with the default hashing function.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
     * The `leaves` must be validated independently. See {processMultiProof}.
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * This version handles multiproofs in memory with the default hashing function.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     *
     * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
     * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
     * validating the leaves elsewhere.
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofFlagsLen = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proof.length != proofFlagsLen + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        if (proofFlagsLen > 0) {
            // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
            // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
            bytes32[] memory hashes = new bytes32[](proofFlagsLen);
            uint256 leafPos = 0;
            uint256 hashPos = 0;
            uint256 proofPos = 0;
            // At each step, we compute the next hash using two values:
            // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
            //   get the next hash.
            // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
            //   `proof` array.
            for (uint256 i = 0; i < proofFlagsLen; i++) {
                bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
                bytes32 b = proofFlags[i]
                    ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                    : proof[proofPos++];
                hashes[i] = Hashes.commutativeKeccak256(a, b);
            }
            if (proofPos != proof.length) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[proofFlagsLen - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * This version handles multiproofs in memory with a custom hashing function.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
     * The `leaves` must be validated independently. See {processMultiProof}.
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves,
        function(bytes32, bytes32) view returns (bytes32) hasher
    ) internal view returns (bool) {
        return processMultiProof(proof, proofFlags, leaves, hasher) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * This version handles multiproofs in memory with a custom hashing function.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     *
     * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
     * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
     * validating the leaves elsewhere.
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves,
        function(bytes32, bytes32) view returns (bytes32) hasher
    ) internal view returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofFlagsLen = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proof.length != proofFlagsLen + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        if (proofFlagsLen > 0) {
            // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
            // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
            bytes32[] memory hashes = new bytes32[](proofFlagsLen);
            uint256 leafPos = 0;
            uint256 hashPos = 0;
            uint256 proofPos = 0;
            // At each step, we compute the next hash using two values:
            // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
            //   get the next hash.
            // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
            //   `proof` array.
            for (uint256 i = 0; i < proofFlagsLen; i++) {
                bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
                bytes32 b = proofFlags[i]
                    ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                    : proof[proofPos++];
                hashes[i] = hasher(a, b);
            }
            if (proofPos != proof.length) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[proofFlagsLen - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * This version handles multiproofs in calldata with the default hashing function.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
     * The `leaves` must be validated independently. See {processMultiProofCalldata}.
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * This version handles multiproofs in calldata with the default hashing function.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     *
     * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
     * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
     * validating the leaves elsewhere.
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofFlagsLen = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proof.length != proofFlagsLen + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        if (proofFlagsLen > 0) {
            // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
            // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
            bytes32[] memory hashes = new bytes32[](proofFlagsLen);
            uint256 leafPos = 0;
            uint256 hashPos = 0;
            uint256 proofPos = 0;
            // At each step, we compute the next hash using two values:
            // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
            //   get the next hash.
            // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
            //   `proof` array.
            for (uint256 i = 0; i < proofFlagsLen; i++) {
                bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
                bytes32 b = proofFlags[i]
                    ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                    : proof[proofPos++];
                hashes[i] = Hashes.commutativeKeccak256(a, b);
            }
            if (proofPos != proof.length) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[proofFlagsLen - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * This version handles multiproofs in calldata with a custom hashing function.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     *
     * NOTE: Consider the case where `root == proof[0] && leaves.length == 0` as it will return `true`.
     * The `leaves` must be validated independently. See {processMultiProofCalldata}.
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves,
        function(bytes32, bytes32) view returns (bytes32) hasher
    ) internal view returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves, hasher) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * This version handles multiproofs in calldata with a custom hashing function.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     *
     * NOTE: The _empty set_ (i.e. the case where `proof.length == 1 && leaves.length == 0`) is considered a no-op,
     * and therefore a valid multiproof (i.e. it returns `proof[0]`). Consider disallowing this case if you're not
     * validating the leaves elsewhere.
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves,
        function(bytes32, bytes32) view returns (bytes32) hasher
    ) internal view returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofFlagsLen = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proof.length != proofFlagsLen + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        if (proofFlagsLen > 0) {
            // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
            // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
            bytes32[] memory hashes = new bytes32[](proofFlagsLen);
            uint256 leafPos = 0;
            uint256 hashPos = 0;
            uint256 proofPos = 0;
            // At each step, we compute the next hash using two values:
            // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
            //   get the next hash.
            // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
            //   `proof` array.
            for (uint256 i = 0; i < proofFlagsLen; i++) {
                bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
                bytes32 b = proofFlags[i]
                    ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                    : proof[proofPos++];
                hashes[i] = hasher(a, b);
            }
            if (proofPos != proof.length) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[proofFlagsLen - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }
}
          

@openzeppelin/contracts/utils/ReentrancyGuard.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

import {StorageSlot} from "./StorageSlot.sol";

/**
 * @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 EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * 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].
 *
 * IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced
 * by the {ReentrancyGuardTransient} variant in v6.0.
 *
 * @custom:stateless
 */
abstract contract ReentrancyGuard {
    using StorageSlot for bytes32;

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant REENTRANCY_GUARD_STORAGE =
        0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;

    // 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;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _reentrancyGuardStorageSlot().getUint256Slot().value = 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();
    }

    /**
     * @dev A `view` only version of {nonReentrant}. Use to block view functions
     * from being called, preventing reading from inconsistent contract state.
     *
     * CAUTION: This is a "view" modifier and does not change the reentrancy
     * status. Use it only on view functions. For payable or non-payable functions,
     * use the standard {nonReentrant} modifier instead.
     */
    modifier nonReentrantView() {
        _nonReentrantBeforeView();
        _;
    }

    function _nonReentrantBeforeView() private view {
        if (_reentrancyGuardEntered()) {
            revert ReentrancyGuardReentrantCall();
        }
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        _nonReentrantBeforeView();

        // Any calls to nonReentrant after this point will fail
        _reentrancyGuardStorageSlot().getUint256Slot().value = ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _reentrancyGuardStorageSlot().getUint256Slot().value = 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 _reentrancyGuardStorageSlot().getUint256Slot().value == ENTERED;
    }

    function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {
        return REENTRANCY_GUARD_STORAGE;
    }
}
          

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 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 {
        if (!_safeTransfer(token, to, value, true)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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 {
        if (!_safeTransferFrom(token, from, to, value, true)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _safeTransfer(token, to, value, false);
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _safeTransferFrom(token, from, to, value, false);
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        if (!_safeApprove(token, spender, value, false)) {
            if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));
            if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that relies on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Oppositely, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity `token.transfer(to, value)` call, 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 to The recipient of the tokens
     * @param value The amount of token to transfer
     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
     */
    function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {
        bytes4 selector = IERC20.transfer.selector;

        assembly ("memory-safe") {
            let fmp := mload(0x40)
            mstore(0x00, selector)
            mstore(0x04, and(to, shr(96, not(0))))
            mstore(0x24, value)
            success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)
            // if call success and return is true, all is good.
            // otherwise (not success or return is not true), we need to perform further checks
            if iszero(and(success, eq(mload(0x00), 1))) {
                // if the call was a failure and bubble is enabled, bubble the error
                if and(iszero(success), bubble) {
                    returndatacopy(fmp, 0x00, returndatasize())
                    revert(fmp, returndatasize())
                }
                // if the return value is not true, then the call is only successful if:
                // - the token address has code
                // - the returndata is empty
                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
            }
            mstore(0x40, fmp)
        }
    }

    /**
     * @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, 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 from The sender of the tokens
     * @param to The recipient of the tokens
     * @param value The amount of token to transfer
     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
     */
    function _safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value,
        bool bubble
    ) private returns (bool success) {
        bytes4 selector = IERC20.transferFrom.selector;

        assembly ("memory-safe") {
            let fmp := mload(0x40)
            mstore(0x00, selector)
            mstore(0x04, and(from, shr(96, not(0))))
            mstore(0x24, and(to, shr(96, not(0))))
            mstore(0x44, value)
            success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)
            // if call success and return is true, all is good.
            // otherwise (not success or return is not true), we need to perform further checks
            if iszero(and(success, eq(mload(0x00), 1))) {
                // if the call was a failure and bubble is enabled, bubble the error
                if and(iszero(success), bubble) {
                    returndatacopy(fmp, 0x00, returndatasize())
                    revert(fmp, returndatasize())
                }
                // if the return value is not true, then the call is only successful if:
                // - the token address has code
                // - the returndata is empty
                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
            }
            mstore(0x40, fmp)
            mstore(0x60, 0)
        }
    }

    /**
     * @dev Imitates a Solidity `token.approve(spender, value)` call, 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 spender The spender of the tokens
     * @param value The amount of token to transfer
     * @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
     */
    function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {
        bytes4 selector = IERC20.approve.selector;

        assembly ("memory-safe") {
            let fmp := mload(0x40)
            mstore(0x00, selector)
            mstore(0x04, and(spender, shr(96, not(0))))
            mstore(0x24, value)
            success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)
            // if call success and return is true, all is good.
            // otherwise (not success or return is not true), we need to perform further checks
            if iszero(and(success, eq(mload(0x00), 1))) {
                // if the call was a failure and bubble is enabled, bubble the error
                if and(iszero(success), bubble) {
                    returndatacopy(fmp, 0x00, returndatasize())
                    revert(fmp, returndatasize())
                }
                // if the return value is not true, then the call is only successful if:
                // - the token address has code
                // - the returndata is empty
                success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
            }
            mstore(0x40, fmp)
        }
    }
}
          

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

/**
 * @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 {
    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
          

@openzeppelin/contracts/access/AccessControl.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.6.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";

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

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /// @inheritdoc ERC165
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

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

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

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

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

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

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

        _revokeRole(role, callerConfirmation);
    }

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

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` from `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}
          

@openzeppelin/contracts/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
          

@openzeppelin/contracts/access/IAccessControl.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (access/IAccessControl.sol)

pragma solidity >=0.8.4;

/**
 * @dev External interface of AccessControl declared to support ERC-165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted to signal this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

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

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

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

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

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

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

@openzeppelin/contracts/utils/cryptography/Hashes.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/cryptography/Hashes.sol)

pragma solidity ^0.8.20;

/**
 * @dev Library of standard hash functions.
 *
 * _Available since v5.1._
 */
library Hashes {
    /**
     * @dev Commutative Keccak256 hash of a sorted pair of bytes32. Frequently used when working with merkle proofs.
     *
     * NOTE: Equivalent to the `standardNodeHash` in our https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
     */
    function commutativeKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32) {
        return a < b ? efficientKeccak256(a, b) : efficientKeccak256(b, a);
    }

    /**
     * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
     */
    function efficientKeccak256(bytes32 a, bytes32 b) internal pure returns (bytes32 value) {
        assembly ("memory-safe") {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}
          

@openzeppelin/contracts/interfaces/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)

pragma solidity >=0.4.16;

import {IERC20} from "../token/ERC20/IERC20.sol";
          

@openzeppelin/contracts/interfaces/IERC1363.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)

pragma solidity >=0.6.2;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
          

@openzeppelin/contracts/utils/StorageSlot.sol

// SPDX-License-Identifier: MIT
// 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
        }
    }
}
          

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

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

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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);
}
          

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * 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[ERC 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);
}
          

@openzeppelin/contracts/interfaces/IERC165.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)

pragma solidity >=0.4.16;

import {IERC165} from "../utils/introspection/IERC165.sol";
          

Compiler Settings

{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{},"evmVersion":"paris"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_bbaToken","internalType":"address"},{"type":"address","name":"_bidToken","internalType":"address"},{"type":"address","name":"_commissionTree","internalType":"address"}]},{"type":"error","name":"AccessControlBadConfirmation","inputs":[]},{"type":"error","name":"AccessControlUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"bytes32","name":"neededRole","internalType":"bytes32"}]},{"type":"error","name":"ReentrancyGuardReentrantCall","inputs":[]},{"type":"error","name":"SafeERC20FailedOperation","inputs":[{"type":"address","name":"token","internalType":"address"}]},{"type":"event","name":"BbaTokenUpdated","inputs":[{"type":"address","name":"previous","internalType":"address","indexed":true},{"type":"address","name":"current","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BidTokenUpdated","inputs":[{"type":"address","name":"previous","internalType":"address","indexed":true},{"type":"address","name":"current","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"CommissionTreeUpdated","inputs":[{"type":"address","name":"previous","internalType":"address","indexed":true},{"type":"address","name":"current","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"DailyRootUpdated","inputs":[{"type":"uint256","name":"epoch","internalType":"uint256","indexed":true},{"type":"bytes32","name":"newRoot","internalType":"bytes32","indexed":false}],"anonymous":false},{"type":"event","name":"ERC20Rescued","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NativeRescued","inputs":[{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RevenueClaimed","inputs":[{"type":"uint256","name":"epoch","internalType":"uint256","indexed":true},{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Staked","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Unstaked","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC20"}],"name":"bbaToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IBidToken"}],"name":"bidToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimDailyRevenue","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"bytes32[]","name":"merkleProof","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ICommissionTree"}],"name":"commissionTree","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentEpoch","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"dailyMerkleRoot","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasClaimed","inputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"callerConfirmation","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rescueERC20","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rescueNative","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBbaToken","inputs":[{"type":"address","name":"_bbaToken","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setBidToken","inputs":[{"type":"address","name":"_bidToken","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setCommissionTree","inputs":[{"type":"address","name":"_commissionTree","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stake","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"stakedBalance","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalStaked","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unstake","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateDailyRoot","inputs":[{"type":"bytes32","name":"newRoot","internalType":"bytes32"}]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

0x60806040523480156200001157600080fd5b50604051620019d8380380620019d883398101604081905262000034916200026b565b60017f9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00556001600160a01b038316620000a95760405162461bcd60e51b81526020600482015260126024820152715661756c743a20626261206973207a65726f60701b60448201526064015b60405180910390fd5b6001600160a01b038216620000f65760405162461bcd60e51b81526020600482015260126024820152715661756c743a20626964206973207a65726f60701b6044820152606401620000a0565b6001600160a01b0381166200014e5760405162461bcd60e51b815260206004820152601360248201527f5661756c743a2074726565206973207a65726f000000000000000000000000006044820152606401620000a0565b6200015b6000336200019f565b50600180546001600160a01b039485166001600160a01b031991821617909155600280549385169382169390931790925560038054919093169116179055620002b5565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000244576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620001fb3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000248565b5060005b92915050565b80516001600160a01b03811681146200026657600080fd5b919050565b6000806000606084860312156200028157600080fd5b6200028c846200024e565b92506200029c602085016200024e565b9150620002ac604085016200024e565b90509250925092565b61171380620002c56000396000f3fe60806040526004361061014f5760003560e01c8063873f6f9e116100b6578063b997d4dd1161006f578063b997d4dd146103cf578063cd3df9f9146103ef578063d547741f1461040f578063dfafd4fd1461042f578063e02068e114610467578063fbe93b781461048757600080fd5b8063873f6f9e146102ff57806391d148541461033a578063a217fddf1461035a578063a6683c651461036f578063a694fc3a1461038f578063b2118a8d146103af57600080fd5b806336568abe1161010857806336568abe14610246578063501ee12614610266578063602172671461028657806376671808146102b3578063786f8d04146102c9578063817b1cd2146102e957600080fd5b806301ffc9a71461015b5780631291f79d146101905780631875642a146101b2578063248a9ca3146101d65780632e17de78146102065780632f2ff15d1461022657600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017b61017636600461148c565b6104a7565b60405190151581526020015b60405180910390f35b34801561019c57600080fd5b506101b06101ab3660046114d2565b6104de565b005b3480156101be57600080fd5b506101c860065481565b604051908152602001610187565b3480156101e257600080fd5b506101c86101f13660046114fc565b60009081526020819052604090206001015490565b34801561021257600080fd5b506101b06102213660046114fc565b610624565b34801561023257600080fd5b506101b0610241366004611515565b610777565b34801561025257600080fd5b506101b0610261366004611515565b6107a2565b34801561027257600080fd5b506101b0610281366004611541565b6107da565b34801561029257600080fd5b506101c86102a1366004611541565b60046020526000908152604090205481565b3480156102bf57600080fd5b506101c860075481565b3480156102d557600080fd5b506101b06102e436600461155c565b61088d565b3480156102f557600080fd5b506101c860055481565b34801561030b57600080fd5b5061017b61031a366004611515565b600860209081526000928352604080842090915290825290205460ff1681565b34801561034657600080fd5b5061017b610355366004611515565b610b80565b34801561036657600080fd5b506101c8600081565b34801561037b57600080fd5b506101b061038a366004611541565b610ba9565b34801561039b57600080fd5b506101b06103aa3660046114fc565b610c5c565b3480156103bb57600080fd5b506101b06103ca3660046115db565b610e46565b3480156103db57600080fd5b506101b06103ea366004611541565b610fe7565b3480156103fb57600080fd5b506101b061040a3660046114fc565b61109b565b34801561041b57600080fd5b506101b061042a366004611515565b6110fd565b34801561043b57600080fd5b5060025461044f906001600160a01b031681565b6040516001600160a01b039091168152602001610187565b34801561047357600080fd5b5060035461044f906001600160a01b031681565b34801561049357600080fd5b5060015461044f906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b14806104d857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006104e981611122565b6001600160a01b0383166105385760405162461bcd60e51b81526020600482015260116024820152705661756c743a20746f206973207a65726f60781b60448201526064015b60405180910390fd5b6000836001600160a01b03168360405160006040518083038185875af1925050503d8060008114610585576040519150601f19603f3d011682016040523d82523d6000602084013e61058a565b606091505b50509050806105db5760405162461bcd60e51b815260206004820152601a60248201527f5661756c743a20504c53207472616e73666572206661696c6564000000000000604482015260640161052f565b836001600160a01b03167fe3eb98b7fe2a0c1d490b92af73eeae611e9b00ab3c3f70b20bd7bb43f67a0f438460405161061691815260200190565b60405180910390a250505050565b61062c61112c565b600081116106745760405162461bcd60e51b81526020600482015260156024820152745661756c743a20616d6f756e74206973207a65726f60581b604482015260640161052f565b336000908152600460205260409020548111156106d35760405162461bcd60e51b815260206004820152601960248201527f5661756c743a20696e73756666696369656e74207374616b6500000000000000604482015260640161052f565b33600090815260046020526040812080548392906106f290849061162d565b92505081905550806005600082825461070b919061162d565b9091555050600154610727906001600160a01b03163383611148565b60405181815233907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75906020015b60405180910390a261077460016000805160206116be83398151915255565b50565b60008281526020819052604090206001015461079281611122565b61079c838361117d565b50505050565b6001600160a01b03811633146107cb5760405163334bd91960e11b815260040160405180910390fd5b6107d5828261120f565b505050565b60006107e581611122565b6001600160a01b0382166108305760405162461bcd60e51b81526020600482015260126024820152715661756c743a20626964206973207a65726f60701b604482015260640161052f565b6002546040516001600160a01b038085169216907f3d95ddbd62e70d2b2604c43cb7a4f582291d1d790e813f0ea997adc4a13d3ca990600090a350600280546001600160a01b0319166001600160a01b0392909216919091179055565b61089561112c565b600254604051633e02810f60e01b81523360048201526001600160a01b0390911690633e02810f90602401602060405180830381865afa1580156108dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109019190611640565b6109445760405162461bcd60e51b815260206004820152601460248201527315985d5b1d0e881b9bdd081858dd1a5d985d195960621b604482015260640161052f565b600754600090815260086020908152604080832033845290915290205460ff16156109aa5760405162461bcd60e51b815260206004820152601660248201527515985d5b1d0e88185b1c9958591e4818db185a5b595960521b604482015260640161052f565b6040805133602082015290810184905260009060600160408051601f1981840301815282825280516020918201209083015201604051602081830303815290604052805190602001209050610a3683838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050600654915084905061127a565b610a755760405162461bcd60e51b815260206004820152601060248201526f2b30bab63a1d103130b210383937b7b360811b604482015260640161052f565b6007546000908152600860209081526040808320338085529252808320805460ff191660011790555186908381818185875af1925050503d8060008114610ad8576040519150601f19603f3d011682016040523d82523d6000602084013e610add565b606091505b5050905080610b2e5760405162461bcd60e51b815260206004820152601a60248201527f5661756c743a20504c53207472616e73666572206661696c6564000000000000604482015260640161052f565b6007546040518681523391907fb9e8470097faa00e83252475f2ee4b69007b0bb2405268ebec248676998a21b39060200160405180910390a350506107d560016000805160206116be83398151915255565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610bb481611122565b6001600160a01b038216610bff5760405162461bcd60e51b81526020600482015260126024820152715661756c743a20626261206973207a65726f60701b604482015260640161052f565b6001546040516001600160a01b038085169216907fbf98f1ee7301f79fde742c95d928a6cee1cb5b1145b8b630ae0013c7fe508ac490600090a350600180546001600160a01b0319166001600160a01b0392909216919091179055565b610c6461112c565b60008111610cac5760405162461bcd60e51b81526020600482015260156024820152745661756c743a20616d6f756e74206973207a65726f60581b604482015260640161052f565b600254604051633e02810f60e01b81523360048201526001600160a01b0390911690633e02810f90602401602060405180830381865afa158015610cf4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d189190611640565b610d5b5760405162461bcd60e51b815260206004820152601460248201527315985d5b1d0e881b9bdd081858dd1a5d985d195960621b604482015260640161052f565b3360009081526004602052604081208054839290610d7a908490611662565b925050819055508060056000828254610d939190611662565b9091555050600154610db0906001600160a01b0316333084611290565b6003546040516375e4513160e11b8152336004820152602481018390526001600160a01b039091169063ebc8a26290604401600060405180830381600087803b158015610dfc57600080fd5b505af1158015610e10573d6000803e3d6000fd5b50506040518381523392507f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9150602001610755565b6000610e5181611122565b6001600160a01b038316610e9b5760405162461bcd60e51b81526020600482015260116024820152705661756c743a20746f206973207a65726f60781b604482015260640161052f565b6001546001600160a01b0390811690851603610f80576005546001546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a0823190602401602060405180830381865afa158015610efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f229190611675565b610f2c919061162d565b905080831115610f7e5760405162461bcd60e51b815260206004820152601a60248201527f5661756c743a20657863656564732042424120737572706c7573000000000000604482015260640161052f565b505b610f946001600160a01b0385168484611148565b826001600160a01b0316846001600160a01b03167f8bbfbb5d7fcacf6fc74005cdede0635561638507f576c95f7f294c22141be2e584604051610fd991815260200190565b60405180910390a350505050565b6000610ff281611122565b6001600160a01b03821661103e5760405162461bcd60e51b81526020600482015260136024820152725661756c743a2074726565206973207a65726f60681b604482015260640161052f565b6003546040516001600160a01b038085169216907f939f6e7ad69bb30fa12cff123013a784ddc4c97df163f88ae40f6d3ee468c26590600090a350600380546001600160a01b0319166001600160a01b0392909216919091179055565b60006110a681611122565b6001600760008282546110b99190611662565b909155505060068290556007546040518381527f7aacd4b3492859035a1abddcfae7b30d61e8b299a936fd365a1db14274860a669060200160405180910390a25050565b60008281526020819052604090206001015461111881611122565b61079c838361120f565b61077481336112c6565b611134611303565b60026000805160206116be83398151915255565b6111558383836001611335565b6107d557604051635274afe760e01b81526001600160a01b038416600482015260240161052f565b60006111898383610b80565b611207576000838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556111bf3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016104d8565b5060006104d8565b600061121b8383610b80565b15611207576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45060016104d8565b600082611287858461139b565b14949350505050565b61129e8484848460016113e8565b61079c57604051635274afe760e01b81526001600160a01b038516600482015260240161052f565b6112d08282610b80565b6112ff5760405163e2517d3f60e01b81526001600160a01b03821660048201526024810183905260440161052f565b5050565b6000805160206116be8339815191525460020361133357604051633ee5aeb560e01b815260040160405180910390fd5b565b60405163a9059cbb60e01b60008181526001600160a01b038616600452602485905291602083604481808b5af19250600160005114831661138f578383151615611382573d6000823e3d81fd5b6000873b113d1516831692505b60405250949350505050565b600081815b84518110156113e0576113cc828683815181106113bf576113bf61168e565b602002602001015161145a565b9150806113d8816116a4565b9150506113a0565b509392505050565b6040516323b872dd60e01b60008181526001600160a01b038781166004528616602452604485905291602083606481808c5af19250600160005114831661144857838315161561143b573d6000823e3d81fd5b6000883b113d1516831692505b60405250600060605295945050505050565b6000818310611476576000828152602084905260409020611485565b60008381526020839052604090205b9392505050565b60006020828403121561149e57600080fd5b81356001600160e01b03198116811461148557600080fd5b80356001600160a01b03811681146114cd57600080fd5b919050565b600080604083850312156114e557600080fd5b6114ee836114b6565b946020939093013593505050565b60006020828403121561150e57600080fd5b5035919050565b6000806040838503121561152857600080fd5b82359150611538602084016114b6565b90509250929050565b60006020828403121561155357600080fd5b611485826114b6565b60008060006040848603121561157157600080fd5b83359250602084013567ffffffffffffffff8082111561159057600080fd5b818601915086601f8301126115a457600080fd5b8135818111156115b357600080fd5b8760208260051b85010111156115c857600080fd5b6020830194508093505050509250925092565b6000806000606084860312156115f057600080fd5b6115f9846114b6565b9250611607602085016114b6565b9150604084013590509250925092565b634e487b7160e01b600052601160045260246000fd5b818103818111156104d8576104d8611617565b60006020828403121561165257600080fd5b8151801515811461148557600080fd5b808201808211156104d8576104d8611617565b60006020828403121561168757600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016116b6576116b6611617565b506001019056fe9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220414d29c95333c77ea8bba53be06a949d91eac1fe5626df59a922778778ca849b64736f6c63430008140033000000000000000000000000489577615c4f0e269c7bf0b270961c810a86526e00000000000000000000000060bfae5c67f32ecdcea707843bc809cd64ec0060000000000000000000000000fbc13eb54962b1ad66ae00d5965b37df2aca388b

Deployed ByteCode

0x60806040526004361061014f5760003560e01c8063873f6f9e116100b6578063b997d4dd1161006f578063b997d4dd146103cf578063cd3df9f9146103ef578063d547741f1461040f578063dfafd4fd1461042f578063e02068e114610467578063fbe93b781461048757600080fd5b8063873f6f9e146102ff57806391d148541461033a578063a217fddf1461035a578063a6683c651461036f578063a694fc3a1461038f578063b2118a8d146103af57600080fd5b806336568abe1161010857806336568abe14610246578063501ee12614610266578063602172671461028657806376671808146102b3578063786f8d04146102c9578063817b1cd2146102e957600080fd5b806301ffc9a71461015b5780631291f79d146101905780631875642a146101b2578063248a9ca3146101d65780632e17de78146102065780632f2ff15d1461022657600080fd5b3661015657005b600080fd5b34801561016757600080fd5b5061017b61017636600461148c565b6104a7565b60405190151581526020015b60405180910390f35b34801561019c57600080fd5b506101b06101ab3660046114d2565b6104de565b005b3480156101be57600080fd5b506101c860065481565b604051908152602001610187565b3480156101e257600080fd5b506101c86101f13660046114fc565b60009081526020819052604090206001015490565b34801561021257600080fd5b506101b06102213660046114fc565b610624565b34801561023257600080fd5b506101b0610241366004611515565b610777565b34801561025257600080fd5b506101b0610261366004611515565b6107a2565b34801561027257600080fd5b506101b0610281366004611541565b6107da565b34801561029257600080fd5b506101c86102a1366004611541565b60046020526000908152604090205481565b3480156102bf57600080fd5b506101c860075481565b3480156102d557600080fd5b506101b06102e436600461155c565b61088d565b3480156102f557600080fd5b506101c860055481565b34801561030b57600080fd5b5061017b61031a366004611515565b600860209081526000928352604080842090915290825290205460ff1681565b34801561034657600080fd5b5061017b610355366004611515565b610b80565b34801561036657600080fd5b506101c8600081565b34801561037b57600080fd5b506101b061038a366004611541565b610ba9565b34801561039b57600080fd5b506101b06103aa3660046114fc565b610c5c565b3480156103bb57600080fd5b506101b06103ca3660046115db565b610e46565b3480156103db57600080fd5b506101b06103ea366004611541565b610fe7565b3480156103fb57600080fd5b506101b061040a3660046114fc565b61109b565b34801561041b57600080fd5b506101b061042a366004611515565b6110fd565b34801561043b57600080fd5b5060025461044f906001600160a01b031681565b6040516001600160a01b039091168152602001610187565b34801561047357600080fd5b5060035461044f906001600160a01b031681565b34801561049357600080fd5b5060015461044f906001600160a01b031681565b60006001600160e01b03198216637965db0b60e01b14806104d857506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006104e981611122565b6001600160a01b0383166105385760405162461bcd60e51b81526020600482015260116024820152705661756c743a20746f206973207a65726f60781b60448201526064015b60405180910390fd5b6000836001600160a01b03168360405160006040518083038185875af1925050503d8060008114610585576040519150601f19603f3d011682016040523d82523d6000602084013e61058a565b606091505b50509050806105db5760405162461bcd60e51b815260206004820152601a60248201527f5661756c743a20504c53207472616e73666572206661696c6564000000000000604482015260640161052f565b836001600160a01b03167fe3eb98b7fe2a0c1d490b92af73eeae611e9b00ab3c3f70b20bd7bb43f67a0f438460405161061691815260200190565b60405180910390a250505050565b61062c61112c565b600081116106745760405162461bcd60e51b81526020600482015260156024820152745661756c743a20616d6f756e74206973207a65726f60581b604482015260640161052f565b336000908152600460205260409020548111156106d35760405162461bcd60e51b815260206004820152601960248201527f5661756c743a20696e73756666696369656e74207374616b6500000000000000604482015260640161052f565b33600090815260046020526040812080548392906106f290849061162d565b92505081905550806005600082825461070b919061162d565b9091555050600154610727906001600160a01b03163383611148565b60405181815233907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75906020015b60405180910390a261077460016000805160206116be83398151915255565b50565b60008281526020819052604090206001015461079281611122565b61079c838361117d565b50505050565b6001600160a01b03811633146107cb5760405163334bd91960e11b815260040160405180910390fd5b6107d5828261120f565b505050565b60006107e581611122565b6001600160a01b0382166108305760405162461bcd60e51b81526020600482015260126024820152715661756c743a20626964206973207a65726f60701b604482015260640161052f565b6002546040516001600160a01b038085169216907f3d95ddbd62e70d2b2604c43cb7a4f582291d1d790e813f0ea997adc4a13d3ca990600090a350600280546001600160a01b0319166001600160a01b0392909216919091179055565b61089561112c565b600254604051633e02810f60e01b81523360048201526001600160a01b0390911690633e02810f90602401602060405180830381865afa1580156108dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109019190611640565b6109445760405162461bcd60e51b815260206004820152601460248201527315985d5b1d0e881b9bdd081858dd1a5d985d195960621b604482015260640161052f565b600754600090815260086020908152604080832033845290915290205460ff16156109aa5760405162461bcd60e51b815260206004820152601660248201527515985d5b1d0e88185b1c9958591e4818db185a5b595960521b604482015260640161052f565b6040805133602082015290810184905260009060600160408051601f1981840301815282825280516020918201209083015201604051602081830303815290604052805190602001209050610a3683838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050600654915084905061127a565b610a755760405162461bcd60e51b815260206004820152601060248201526f2b30bab63a1d103130b210383937b7b360811b604482015260640161052f565b6007546000908152600860209081526040808320338085529252808320805460ff191660011790555186908381818185875af1925050503d8060008114610ad8576040519150601f19603f3d011682016040523d82523d6000602084013e610add565b606091505b5050905080610b2e5760405162461bcd60e51b815260206004820152601a60248201527f5661756c743a20504c53207472616e73666572206661696c6564000000000000604482015260640161052f565b6007546040518681523391907fb9e8470097faa00e83252475f2ee4b69007b0bb2405268ebec248676998a21b39060200160405180910390a350506107d560016000805160206116be83398151915255565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000610bb481611122565b6001600160a01b038216610bff5760405162461bcd60e51b81526020600482015260126024820152715661756c743a20626261206973207a65726f60701b604482015260640161052f565b6001546040516001600160a01b038085169216907fbf98f1ee7301f79fde742c95d928a6cee1cb5b1145b8b630ae0013c7fe508ac490600090a350600180546001600160a01b0319166001600160a01b0392909216919091179055565b610c6461112c565b60008111610cac5760405162461bcd60e51b81526020600482015260156024820152745661756c743a20616d6f756e74206973207a65726f60581b604482015260640161052f565b600254604051633e02810f60e01b81523360048201526001600160a01b0390911690633e02810f90602401602060405180830381865afa158015610cf4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d189190611640565b610d5b5760405162461bcd60e51b815260206004820152601460248201527315985d5b1d0e881b9bdd081858dd1a5d985d195960621b604482015260640161052f565b3360009081526004602052604081208054839290610d7a908490611662565b925050819055508060056000828254610d939190611662565b9091555050600154610db0906001600160a01b0316333084611290565b6003546040516375e4513160e11b8152336004820152602481018390526001600160a01b039091169063ebc8a26290604401600060405180830381600087803b158015610dfc57600080fd5b505af1158015610e10573d6000803e3d6000fd5b50506040518381523392507f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d9150602001610755565b6000610e5181611122565b6001600160a01b038316610e9b5760405162461bcd60e51b81526020600482015260116024820152705661756c743a20746f206973207a65726f60781b604482015260640161052f565b6001546001600160a01b0390811690851603610f80576005546001546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a0823190602401602060405180830381865afa158015610efe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f229190611675565b610f2c919061162d565b905080831115610f7e5760405162461bcd60e51b815260206004820152601a60248201527f5661756c743a20657863656564732042424120737572706c7573000000000000604482015260640161052f565b505b610f946001600160a01b0385168484611148565b826001600160a01b0316846001600160a01b03167f8bbfbb5d7fcacf6fc74005cdede0635561638507f576c95f7f294c22141be2e584604051610fd991815260200190565b60405180910390a350505050565b6000610ff281611122565b6001600160a01b03821661103e5760405162461bcd60e51b81526020600482015260136024820152725661756c743a2074726565206973207a65726f60681b604482015260640161052f565b6003546040516001600160a01b038085169216907f939f6e7ad69bb30fa12cff123013a784ddc4c97df163f88ae40f6d3ee468c26590600090a350600380546001600160a01b0319166001600160a01b0392909216919091179055565b60006110a681611122565b6001600760008282546110b99190611662565b909155505060068290556007546040518381527f7aacd4b3492859035a1abddcfae7b30d61e8b299a936fd365a1db14274860a669060200160405180910390a25050565b60008281526020819052604090206001015461111881611122565b61079c838361120f565b61077481336112c6565b611134611303565b60026000805160206116be83398151915255565b6111558383836001611335565b6107d557604051635274afe760e01b81526001600160a01b038416600482015260240161052f565b60006111898383610b80565b611207576000838152602081815260408083206001600160a01b03861684529091529020805460ff191660011790556111bf3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45060016104d8565b5060006104d8565b600061121b8383610b80565b15611207576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45060016104d8565b600082611287858461139b565b14949350505050565b61129e8484848460016113e8565b61079c57604051635274afe760e01b81526001600160a01b038516600482015260240161052f565b6112d08282610b80565b6112ff5760405163e2517d3f60e01b81526001600160a01b03821660048201526024810183905260440161052f565b5050565b6000805160206116be8339815191525460020361133357604051633ee5aeb560e01b815260040160405180910390fd5b565b60405163a9059cbb60e01b60008181526001600160a01b038616600452602485905291602083604481808b5af19250600160005114831661138f578383151615611382573d6000823e3d81fd5b6000873b113d1516831692505b60405250949350505050565b600081815b84518110156113e0576113cc828683815181106113bf576113bf61168e565b602002602001015161145a565b9150806113d8816116a4565b9150506113a0565b509392505050565b6040516323b872dd60e01b60008181526001600160a01b038781166004528616602452604485905291602083606481808c5af19250600160005114831661144857838315161561143b573d6000823e3d81fd5b6000883b113d1516831692505b60405250600060605295945050505050565b6000818310611476576000828152602084905260409020611485565b60008381526020839052604090205b9392505050565b60006020828403121561149e57600080fd5b81356001600160e01b03198116811461148557600080fd5b80356001600160a01b03811681146114cd57600080fd5b919050565b600080604083850312156114e557600080fd5b6114ee836114b6565b946020939093013593505050565b60006020828403121561150e57600080fd5b5035919050565b6000806040838503121561152857600080fd5b82359150611538602084016114b6565b90509250929050565b60006020828403121561155357600080fd5b611485826114b6565b60008060006040848603121561157157600080fd5b83359250602084013567ffffffffffffffff8082111561159057600080fd5b818601915086601f8301126115a457600080fd5b8135818111156115b357600080fd5b8760208260051b85010111156115c857600080fd5b6020830194508093505050509250925092565b6000806000606084860312156115f057600080fd5b6115f9846114b6565b9250611607602085016114b6565b9150604084013590509250925092565b634e487b7160e01b600052601160045260246000fd5b818103818111156104d8576104d8611617565b60006020828403121561165257600080fd5b8151801515811461148557600080fd5b808201808211156104d8576104d8611617565b60006020828403121561168757600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000600182016116b6576116b6611617565b506001019056fe9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a2646970667358221220414d29c95333c77ea8bba53be06a949d91eac1fe5626df59a922778778ca849b64736f6c63430008140033