ETH Price: $2,400.30 (+2.61%)

Token

ERC20 ***
 

Overview

Max Total Supply

9 ERC20 ***

Holders

9

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Balance
1 ERC20 ***
0x3af4A49C8E2FcaF33Fd3389543B80D320FCC9091
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x665E09ce...BbADeE933
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
MaverickV2Reward

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 5500 runs

Other Settings:
paris EvmVersion
File 1 of 37 : MaverickV2Reward.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {Time} from "@openzeppelin/contracts/utils/types/Time.sol";
import {SafeCast as Cast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";

import {ONE} from "@maverick/v2-common/contracts/libraries/Constants.sol";
import {Math} from "@maverick/v2-common/contracts/libraries/Math.sol";
import {Multicall} from "@maverick/v2-common/contracts/base/Multicall.sol";
import {Nft} from "@maverick/v2-supplemental/contracts/positionbase/Nft.sol";
import {INft} from "@maverick/v2-supplemental/contracts/positionbase/INft.sol";

import {IMaverickV2Reward} from "./interfaces/IMaverickV2Reward.sol";
import {RewardAccounting} from "./rewardbase/RewardAccounting.sol";
import {MaverickV2RewardVault, IMaverickV2RewardVault} from "./MaverickV2RewardVault.sol";
import {IMaverickV2VotingEscrow} from "./interfaces/IMaverickV2VotingEscrow.sol";

/**
 * @notice This reward contract is used to reward users who stake their
 * `stakingToken` in this contract. The `stakingToken` can be any token with an
 * ERC-20 interface including BoostedPosition LP tokens.
 *
 * @notice Incentive providers can permissionlessly add incentives to this
 * contract that will be disbursed to stakers pro rata over a given duration that
 * the incentive provider specifies as they add incentives.
 *
 * Incentives can be denominated in one of 5 possible reward tokens that the
 * reward contract creator specifies on contract creation.
 *
 * @notice The contract creator also has the option of specifying veTokens
 * associated with each of the up-to-5 reward tokens.  When incentivizing a
 * rewardToken that has a veToken specified, the staking users will receive a
 * boost to their rewards depending on 1) how much ve tokens they own and 2) how
 * long they stake their rewards disbursement.
 */
contract MaverickV2Reward is Nft, RewardAccounting, IMaverickV2Reward, Multicall, ReentrancyGuard {
    using SafeERC20 for IERC20;
    using Cast for uint256;

    uint256 internal constant FOUR_YEARS = 1460 days;
    uint256 internal constant BASE_STAKING_FACTOR = 0.2e18;
    uint256 internal constant STAKING_FACTOR_SLOPE = 0.8e18;
    uint256 internal constant BASE_PRORATA_FACTOR = 0.75e18;
    uint256 internal constant PRORATA_FACTOR_SLOPE = 0.25e18;

    /// @inheritdoc IMaverickV2Reward
    uint256 public constant UNBOOSTED_MIN_TIME_GAP = 13 weeks;

    /// @inheritdoc IMaverickV2Reward
    IERC20 public immutable stakingToken;

    IERC20 private immutable rewardToken0;
    IERC20 private immutable rewardToken1;
    IERC20 private immutable rewardToken2;
    IERC20 private immutable rewardToken3;
    IERC20 private immutable rewardToken4;
    IMaverickV2VotingEscrow private immutable veToken0;
    IMaverickV2VotingEscrow private immutable veToken1;
    IMaverickV2VotingEscrow private immutable veToken2;
    IMaverickV2VotingEscrow private immutable veToken3;
    IMaverickV2VotingEscrow private immutable veToken4;

    /// @inheritdoc IMaverickV2Reward
    uint256 public constant MAX_DURATION = 40 days;
    /// @inheritdoc IMaverickV2Reward
    uint256 public constant MIN_DURATION = 3 days;

    struct RewardData {
        // Timestamp of when the rewards finish
        uint64 finishAt;
        // Minimum of last updated time and reward finish time
        uint64 updatedAt;
        // Reward to be paid out per second
        uint128 rewardRate;
        // Reward amount escrowed for staked users up to current time. this
        // value is incremented on each action as by the amount of reward
        // globally accumulated since the last action.  when a user collects
        // reward, this amount is decremented.
        uint128 escrowedReward;
        // Accumulator of the amount of this reward token not taken as part of
        // getReward boosting.  this amount gets pushed to the associated ve
        // contract as an incentive for the ve holders.
        uint128 unboostedAmount;
        // Timestamp of last time unboosted reward was pushed to ve contract as
        // incentive
        uint256 lastUnboostedPushTimestamp;
        // Sum of (reward rate * dt * 1e18 / total supply)
        uint256 rewardPerTokenStored;
        // User tokenId => rewardPerTokenStored
        mapping(uint256 tokenId => uint256) userRewardPerTokenPaid;
        // User tokenId => rewards to be claimed
        mapping(uint256 tokenId => uint128) rewards;
    }
    RewardData[5] public rewardData;

    uint256 public immutable rewardTokenCount;
    IMaverickV2RewardVault public immutable vault;

    constructor(
        string memory name_,
        string memory symbol_,
        IERC20 _stakingToken,
        IERC20[] memory rewardTokens,
        IMaverickV2VotingEscrow[] memory veTokens
    ) Nft(name_, symbol_) {
        stakingToken = _stakingToken;
        vault = new MaverickV2RewardVault(_stakingToken);
        rewardTokenCount = rewardTokens.length;
        if (rewardTokenCount > 0) {
            rewardToken0 = rewardTokens[0];
            veToken0 = veTokens[0];
        }
        if (rewardTokenCount > 1) {
            rewardToken1 = rewardTokens[1];
            veToken1 = veTokens[1];
        }
        if (rewardTokenCount > 2) {
            rewardToken2 = rewardTokens[2];
            veToken2 = veTokens[2];
        }
        if (rewardTokenCount > 3) {
            rewardToken3 = rewardTokens[3];
            veToken3 = veTokens[3];
        }
        if (rewardTokenCount > 4) {
            rewardToken4 = rewardTokens[4];
            veToken4 = veTokens[4];
        }
    }

    modifier checkAmount(uint256 amount) {
        if (amount == 0) revert RewardZeroAmount();
        _;
    }

    /////////////////////////////////////
    /// Stake Management Functions
    /////////////////////////////////////

    /// @inheritdoc IMaverickV2Reward
    function mint(address recipient) public returns (uint256 tokenId) {
        tokenId = _mint(recipient);
    }

    /// @inheritdoc IMaverickV2Reward
    function mintToSender() public returns (uint256 tokenId) {
        tokenId = _mint(msg.sender);
    }

    /// @inheritdoc IMaverickV2Reward
    function stake(uint256 tokenId) public returns (uint256 amount, uint256 stakedTokenId) {
        // reverts if token is not owned
        stakedTokenId = tokenId;
        if (stakedTokenId == 0) {
            if (tokenOfOwnerByIndexExists(msg.sender, 0)) {
                stakedTokenId = tokenOfOwnerByIndex(msg.sender, 0);
            } else {
                stakedTokenId = mint(msg.sender);
            }
        }
        amount = _stake(stakedTokenId);
    }

    /// @inheritdoc IMaverickV2Reward
    function transferAndStake(uint256 tokenId, uint256 _amount) public returns (uint256 amount, uint256 stakedTokenId) {
        stakingToken.safeTransferFrom(msg.sender, address(vault), _amount);
        return stake(tokenId);
    }

    /// @inheritdoc IMaverickV2Reward
    function unstakeToOwner(uint256 tokenId, uint256 amount) public onlyTokenIdAuthorizedUser(tokenId) {
        address owner = ownerOf(tokenId);
        _unstake(tokenId, owner, amount);
    }

    /// @inheritdoc IMaverickV2Reward
    function unstake(uint256 tokenId, address recipient, uint256 amount) public onlyTokenIdAuthorizedUser(tokenId) {
        _unstake(tokenId, recipient, amount);
    }

    /// @inheritdoc IMaverickV2Reward
    function getRewardToOwner(
        uint256 tokenId,
        uint8 rewardTokenIndex,
        uint256 stakeDuration
    ) external onlyTokenIdAuthorizedUser(tokenId) returns (RewardOutput memory) {
        address owner = ownerOf(tokenId);
        return _getReward(tokenId, owner, rewardTokenIndex, stakeDuration, type(uint256).max);
    }

    /// @inheritdoc IMaverickV2Reward
    function getRewardToOwnerForExistingVeLockup(
        uint256 tokenId,
        uint8 rewardTokenIndex,
        uint256 stakeDuration,
        uint256 lockupId
    ) external onlyTokenIdAuthorizedUser(tokenId) returns (RewardOutput memory) {
        address owner = ownerOf(tokenId);
        return _getReward(tokenId, owner, rewardTokenIndex, stakeDuration, lockupId);
    }

    /// @inheritdoc IMaverickV2Reward
    function getReward(
        uint256 tokenId,
        address recipient,
        uint8 rewardTokenIndex,
        uint256 stakeDuration
    ) external onlyTokenIdAuthorizedUser(tokenId) returns (RewardOutput memory) {
        return _getReward(tokenId, recipient, rewardTokenIndex, stakeDuration, type(uint256).max);
    }

    /////////////////////////////////////
    /// Admin Functions
    /////////////////////////////////////

    /// @inheritdoc IMaverickV2Reward
    function pushUnboostedToVe(
        uint8 rewardTokenIndex
    ) public returns (uint128 amount, uint48 timepoint, uint256 batchIndex) {
        IMaverickV2VotingEscrow ve = veTokenByIndex(rewardTokenIndex);
        IERC20 token = rewardTokenByIndex(rewardTokenIndex);
        RewardData storage data = rewardData[rewardTokenIndex];
        amount = data.unboostedAmount;
        if (amount == 0) revert RewardZeroAmount();
        if (block.timestamp <= data.lastUnboostedPushTimestamp + UNBOOSTED_MIN_TIME_GAP) {
            // revert if not enough time has passed; will not revert if this is
            // the first call and last timestamp is zero.
            revert RewardUnboostedTimePeriodNotMet(
                block.timestamp,
                data.lastUnboostedPushTimestamp + UNBOOSTED_MIN_TIME_GAP
            );
        }

        data.unboostedAmount = 0;
        data.lastUnboostedPushTimestamp = block.timestamp;

        token.forceApprove(address(ve), amount);

        timepoint = Time.timestamp();
        batchIndex = ve.createIncentiveBatch(amount, timepoint, ve.MAX_STAKE_DURATION().toUint128(), token);
    }

    /////////////////////////////////////
    /// View Functions
    /////////////////////////////////////

    /// @inheritdoc IMaverickV2Reward
    function rewardInfo() public view returns (RewardInfo[] memory info) {
        uint256 length = rewardTokenCount;
        info = new RewardInfo[](length);
        for (uint8 i; i < length; i++) {
            RewardData storage data = rewardData[i];
            info[i] = RewardInfo({
                finishAt: data.finishAt,
                updatedAt: data.updatedAt,
                rewardRate: data.rewardRate,
                rewardPerTokenStored: data.rewardPerTokenStored,
                rewardToken: rewardTokenByIndex(i),
                veRewardToken: veTokenByIndex(i),
                unboostedAmount: data.unboostedAmount,
                escrowedReward: data.escrowedReward,
                lastUnboostedPushTimestamp: data.lastUnboostedPushTimestamp
            });
        }
    }

    /// @inheritdoc IMaverickV2Reward
    function contractInfo() external view returns (RewardInfo[] memory info, ContractInfo memory _contractInfo) {
        info = rewardInfo();
        _contractInfo.name = name();
        _contractInfo.symbol = symbol();
        _contractInfo.totalSupply = stakeTotalSupply();
        _contractInfo.stakingToken = stakingToken;
    }

    /// @inheritdoc IMaverickV2Reward
    function earned(uint256 tokenId) public view returns (EarnedInfo[] memory earnedInfo) {
        uint256 length = rewardTokenCount;
        earnedInfo = new EarnedInfo[](length);
        for (uint8 i; i < length; i++) {
            RewardData storage data = rewardData[i];
            earnedInfo[i] = EarnedInfo({earned: _earned(tokenId, data), rewardToken: rewardTokenByIndex(i)});
        }
    }

    /// @inheritdoc IMaverickV2Reward
    function earned(uint256 tokenId, IERC20 rewardTokenAddress) public view returns (uint256) {
        uint256 rewardTokenIndex = tokenIndex(rewardTokenAddress);
        RewardData storage data = rewardData[rewardTokenIndex];
        return _earned(tokenId, data);
    }

    function _earned(uint256 tokenId, RewardData storage data) internal view returns (uint256) {
        return
            data.rewards[tokenId] +
            Math.mulFloor(
                stakeBalanceOf(tokenId),
                Math.clip(data.rewardPerTokenStored + _deltaRewardPerToken(data), data.userRewardPerTokenPaid[tokenId])
            );
    }

    /// @inheritdoc IMaverickV2Reward
    function tokenIndex(IERC20 rewardToken) public view returns (uint8 rewardTokenIndex) {
        if (rewardToken == rewardToken0) return 0;
        if (rewardToken == rewardToken1) return 1;
        if (rewardToken == rewardToken2) return 2;
        if (rewardToken == rewardToken3) return 3;
        if (rewardToken == rewardToken4) return 4;
        revert RewardNotValidRewardToken(rewardToken);
    }

    /// @inheritdoc IMaverickV2Reward
    function rewardTokenByIndex(uint8 index) public view returns (IERC20 output) {
        if (index >= rewardTokenCount) revert RewardNotValidIndex(index);
        if (index == 0) return rewardToken0;
        if (index == 1) return rewardToken1;
        if (index == 2) return rewardToken2;
        if (index == 3) return rewardToken3;
        return rewardToken4;
    }

    /// @inheritdoc IMaverickV2Reward
    function veTokenByIndex(uint8 index) public view returns (IMaverickV2VotingEscrow output) {
        if (index >= rewardTokenCount) revert RewardNotValidIndex(index);
        if (index == 0) return veToken0;
        if (index == 1) return veToken1;
        if (index == 2) return veToken2;
        if (index == 3) return veToken3;
        return veToken4;
    }

    /// @inheritdoc IMaverickV2Reward
    function tokenList(bool includeStakingToken) public view returns (IERC20[] memory tokens) {
        uint256 length = includeStakingToken ? rewardTokenCount + 1 : rewardTokenCount;
        tokens = new IERC20[](length);
        if (rewardTokenCount > 0) tokens[0] = rewardToken0;
        if (rewardTokenCount > 1) tokens[1] = rewardToken1;
        if (rewardTokenCount > 2) tokens[2] = rewardToken2;
        if (rewardTokenCount > 3) tokens[3] = rewardToken3;
        if (rewardTokenCount > 4) tokens[4] = rewardToken4;
        if (includeStakingToken) tokens[rewardTokenCount] = stakingToken;
    }

    /**
     * @notice Updates the global reward state for a given reward token.
     * @dev Each time a user stakes or unstakes or a incentivizer adds
     * incentives, this function must be called in order to checkpoint the
     * rewards state before the new stake/unstake/notify occurs.
     */
    function _updateGlobalReward(RewardData storage data) internal {
        uint256 reward = _deltaRewardPerToken(data);
        if (reward != 0) {
            data.rewardPerTokenStored += reward;
            // round up to ensure enough reward is set aside
            data.escrowedReward += Math.mulCeil(reward, stakeTotalSupply()).toUint128();
        }
        data.updatedAt = _lastTimeRewardApplicable(data.finishAt).toUint64();
    }

    /**
     * @notice Updates the reward state associated with an tokenId.  Also
     * updates the global reward state.
     * @dev This function checkpoints the data for a user before they
     * stake/unstake.
     */
    function _updateReward(uint256 tokenId, RewardData storage data) internal {
        _updateGlobalReward(data);
        uint256 reward = _deltaEarned(tokenId, data);
        if (reward != 0) data.rewards[tokenId] += reward.toUint128();
        data.userRewardPerTokenPaid[tokenId] = data.rewardPerTokenStored;
    }

    /**
     * @notice Amount an tokenId has earned since that tokenId last did a
     * stake/unstake.
     * @dev `deltaEarned = balance * (rewardPerToken - userRewardPerTokenPaid)`
     */
    function _deltaEarned(uint256 tokenId, RewardData storage data) internal view returns (uint256) {
        return
            Math.mulFloor(
                stakeBalanceOf(tokenId),
                Math.clip(data.rewardPerTokenStored, data.userRewardPerTokenPaid[tokenId])
            );
    }

    /**
     * @notice Amount of new rewards accrued to tokens since last checkpoint.
     */
    function _deltaRewardPerToken(RewardData storage data) internal view returns (uint256) {
        uint256 timeDiff = Math.clip(_lastTimeRewardApplicable(data.finishAt), data.updatedAt);
        if (timeDiff == 0 || stakeTotalSupply() == 0 || data.rewardRate == 0) {
            return 0;
        }
        return Math.mulDivFloor(data.rewardRate, timeDiff * ONE, stakeTotalSupply());
    }

    /**
     * @notice The smaller of: 1) time of end of reward period and 2) current
     * block timestamp.
     */
    function _lastTimeRewardApplicable(uint256 dataFinishAt) internal view returns (uint256) {
        return Math.min(dataFinishAt, block.timestamp);
    }

    /**
     * @notice Update all rewards.
     */
    function _updateAllRewards(uint256 tokenId) internal {
        for (uint8 i; i < rewardTokenCount; i++) {
            RewardData storage data = rewardData[i];

            _updateReward(tokenId, data);
        }
    }

    /////////////////////////////////////
    /// Internal User Functions
    /////////////////////////////////////

    function _stake(uint256 tokenId) internal nonReentrant returns (uint256 amount) {
        _requireOwned(tokenId);
        _updateAllRewards(tokenId);
        amount = Math.clip(stakingToken.balanceOf(address(vault)), stakeTotalSupply());
        if (amount != 0) _mintStake(tokenId, amount);
    }

    /**
     * @notice Functions using this function must check that sender has access
     * to the tokenId for this to be / safely called.
     */
    function _unstake(uint256 tokenId, address recipient, uint256 amount) internal nonReentrant checkAmount(amount) {
        _updateAllRewards(tokenId);
        _burnStake(tokenId, amount);
        vault.withdraw(recipient, amount);
    }

    /// @inheritdoc IMaverickV2Reward
    function boostedAmount(
        uint256 tokenId,
        IMaverickV2VotingEscrow veToken,
        uint256 rawAmount,
        uint256 stakeDuration
    ) public view returns (uint256 earnedAmount, bool asVe) {
        if (address(veToken) != address(0)) {
            address owner = ownerOf(tokenId);
            uint256 userVeProRata = Math.divFloor(veToken.balanceOf(owner), veToken.totalSupply());
            uint256 userRewardProRata = Math.divFloor(stakeBalanceOf(tokenId), stakeTotalSupply());
            // pro rata ratio can be bigger than one: need min operation
            uint256 proRataFactor = Math.min(
                ONE,
                BASE_PRORATA_FACTOR + Math.mulDivFloor(PRORATA_FACTOR_SLOPE, userVeProRata, userRewardProRata)
            );
            uint256 stakeFactor = Math.min(
                ONE,
                BASE_STAKING_FACTOR + Math.mulDivFloor(STAKING_FACTOR_SLOPE, stakeDuration, FOUR_YEARS)
            );

            earnedAmount = Math.mulFloor(Math.mulFloor(rawAmount, stakeFactor), proRataFactor);
            // if duration is non-zero, this reward is collected as ve
            asVe = stakeDuration > 0;
        } else {
            earnedAmount = rawAmount;
        }
    }

    /**
     * @notice Internal function for computing the boost and then
     * transferring/staking the resulting rewards.  Can not be safely called
     * without checking that the caller has permissions to access the tokenId.
     */
    function _boostAndPay(
        uint256 tokenId,
        address recipient,
        IERC20 rewardToken,
        IMaverickV2VotingEscrow veToken,
        uint256 rawAmount,
        uint256 stakeDuration,
        uint256 lockupId
    ) internal returns (RewardOutput memory rewardOutput) {
        (rewardOutput.amount, rewardOutput.asVe) = boostedAmount(tokenId, veToken, rawAmount, stakeDuration);
        if (rewardOutput.asVe) {
            rewardToken.forceApprove(address(veToken), rewardOutput.amount);
            rewardOutput.veContract = veToken;
            if (lockupId == type(uint256).max) {
                veToken.stake(rewardOutput.amount.toUint128(), stakeDuration, recipient);
            } else {
                veToken.extendForAccount(recipient, lockupId, stakeDuration, rewardOutput.amount.toUint128());
            }
        } else {
            rewardToken.safeTransfer(recipient, rewardOutput.amount);
        }
    }

    /**
     * @notice Internal getReward function.  Can not be safely called without
     * checking that the caller has permissions to access the account.
     */
    function _getReward(
        uint256 tokenId,
        address recipient,
        uint8 rewardTokenIndex,
        uint256 stakeDuration,
        uint256 lockupId
    ) internal nonReentrant returns (RewardOutput memory rewardOutput) {
        RewardData storage data = rewardData[rewardTokenIndex];
        _updateReward(tokenId, data);
        uint128 reward = data.rewards[tokenId];
        if (reward != 0) {
            data.rewards[tokenId] = 0;
            data.escrowedReward -= reward;
            rewardOutput = _boostAndPay(
                tokenId,
                recipient,
                rewardTokenByIndex(rewardTokenIndex),
                veTokenByIndex(rewardTokenIndex),
                reward,
                stakeDuration,
                lockupId
            );
            if (reward > rewardOutput.amount) {
                // set aside unboosted amount; unsafe cast is okay given conditional
                data.unboostedAmount += uint128(reward - rewardOutput.amount);
            }
            emit GetReward(
                msg.sender,
                tokenId,
                recipient,
                rewardTokenIndex,
                stakeDuration,
                rewardTokenByIndex(rewardTokenIndex),
                rewardOutput,
                lockupId
            );
        }
    }

    /////////////////////////////////////
    /// Add Reward
    /////////////////////////////////////

    /// @inheritdoc IMaverickV2Reward
    function notifyRewardAmount(IERC20 rewardToken, uint256 duration) public nonReentrant returns (uint256) {
        if (duration < MIN_DURATION) revert RewardDurationOutOfBounds(duration, MIN_DURATION, MAX_DURATION);
        if (duration > MAX_DURATION) revert RewardDurationOutOfBounds(duration, MIN_DURATION, MAX_DURATION);
        return _notifyRewardAmount(rewardToken, duration);
    }

    /// @inheritdoc IMaverickV2Reward
    function transferAndNotifyRewardAmount(
        IERC20 rewardToken,
        uint256 duration,
        uint256 amount
    ) public returns (uint256) {
        rewardToken.safeTransferFrom(msg.sender, address(this), amount);
        return notifyRewardAmount(rewardToken, duration);
    }

    /**
     * @notice Called by reward depositor to recompute the reward rate.  If
     * notifier sends more than remaining amount, then notifier sets the rate.
     * Else, we extend the duration at the current rate.
     */
    function _notifyRewardAmount(IERC20 rewardToken, uint256 duration) internal returns (uint256) {
        uint8 rewardTokenIndex = tokenIndex(rewardToken);
        RewardData storage data = rewardData[rewardTokenIndex];
        _updateGlobalReward(data);
        uint256 remainingRewards = Math.clip(
            rewardTokenByIndex(rewardTokenIndex).balanceOf(address(this)),
            data.escrowedReward
        );
        uint256 timeRemaining = Math.clip(data.finishAt, block.timestamp);

        // timeRemaining * data.rewardRate is the amount of rewards on the
        // contract before the new amount was added. we are checking to see if
        // the reamaining rewards is bigger than twice this value.  in this
        // case, the new notifier has brought more rewards than were already on
        // contract and they get to set the new rewards rate.
        if (remainingRewards > timeRemaining * data.rewardRate * 2 || data.rewardRate == 0) {
            // if notifying new amount is bigger than, notifier gets to set the rate
            data.rewardRate = (remainingRewards / duration).toUint128();
        } else {
            // if notifier doesn't bring enough, we extend the duration at the
            // same rate
            duration = remainingRewards / data.rewardRate;
        }

        data.finishAt = (block.timestamp + duration).toUint64();
        // unsafe case is ok given safe cast in previous statement
        data.updatedAt = uint64(block.timestamp);
        emit NotifyRewardAmount(msg.sender, rewardToken, remainingRewards, duration, data.rewardRate);
        return duration;
    }

    /////////////////////////////////////
    /// Required Overrides
    /////////////////////////////////////

    function tokenURI(uint256 tokenId) public view virtual override(Nft, INft) returns (string memory) {
        return super.tokenURI(tokenId);
    }

    function name() public view override(INft, Nft) returns (string memory) {
        return super.name();
    }

    function symbol() public view override(INft, Nft) returns (string memory) {
        return super.symbol();
    }
}

File 2 of 37 : IMulticall.sol
// SPDX-License-Identifier: GPL-2.0-or-later
// As the copyright holder of this work, Ubiquity Labs retains
// the right to distribute, use, and modify this code under any license of
// their choosing, in addition to the terms of the GPL-v2 or later.
pragma solidity ^0.8.25;

interface IMulticall {
    function multicall(bytes[] calldata data) external returns (bytes[] memory results);
}

File 3 of 37 : Multicall.sol
// SPDX-License-Identifier: GPL-2.0-or-later
// As the copyright holder of this work, Ubiquity Labs retains
// the right to distribute, use, and modify this code under any license of
// their choosing, in addition to the terms of the GPL-v2 or later.
pragma solidity ^0.8.25;
import {IMulticall} from "./IMulticall.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";

// Modified from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/6ba452dea4258afe77726293435f10baf2bed265/contracts/utils/Multicall.sol

/*
 * @notice Multicall
 */
abstract contract Multicall is IMulticall {
    /**
     * @notice This function allows multiple calls to different contract functions
     * in a single transaction.
     * @param data An array of encoded function call data.
     * @return results An array of the results of the function calls.
     */
    function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), data[i]);
        }
    }
}

File 4 of 37 : Constants.sol
// SPDX-License-Identifier: GPL-2.0-or-later
// As the copyright holder of this work, Ubiquity Labs retains
// the right to distribute, use, and modify this code under any license of
// their choosing, in addition to the terms of the GPL-v2 or later.
pragma solidity ^0.8.25;

// factory contraints on pools
uint8 constant MAX_PROTOCOL_FEE_RATIO_D3 = 0.25e3; // 25%
uint256 constant MAX_PROTOCOL_LENDING_FEE_RATE_D18 = 0.02e18; // 2%
uint64 constant MAX_POOL_FEE_D18 = 0.9e18; // 90%
uint64 constant MIN_LOOKBACK = 1 seconds;
uint64 constant MAX_TICK_SPACING = 10_000;

// pool constraints
uint8 constant NUMBER_OF_KINDS = 4;
int32 constant NUMBER_OF_KINDS_32 = int32(int8(NUMBER_OF_KINDS));
uint256 constant MAX_TICK = 322_378; // max price 1e14 in D18 scale
int32 constant MAX_TICK_32 = int32(int256(MAX_TICK));
int32 constant MIN_TICK_32 = int32(-int256(MAX_TICK));
uint256 constant MAX_BINS_TO_MERGE = 3;
uint128 constant MINIMUM_LIQUIDITY = 1e8;

// accessor named constants
uint8 constant ALL_KINDS_MASK = 0xF; // 0b1111
uint8 constant PERMISSIONED_LIQUIDITY_MASK = 0x10; // 0b010000
uint8 constant PERMISSIONED_SWAP_MASK = 0x20; // 0b100000
uint8 constant OPTIONS_MASK = ALL_KINDS_MASK | PERMISSIONED_LIQUIDITY_MASK | PERMISSIONED_SWAP_MASK; // 0b111111

// named values
address constant MERGED_LP_BALANCE_ADDRESS = address(0);
uint256 constant MERGED_LP_BALANCE_SUBACCOUNT = 0;
uint128 constant ONE = 1e18;
uint128 constant ONE_SQUARED = 1e36;
int256 constant INT256_ONE = 1e18;
uint256 constant ONE_D8 = 1e8;
uint256 constant ONE_D3 = 1e3;
int40 constant INT_ONE_D8 = 1e8;
int40 constant HALF_TICK_D8 = 0.5e8;
uint8 constant DEFAULT_DECIMALS = 18;
uint256 constant DEFAULT_SCALE = 1;
bytes constant EMPTY_PRICE_BREAKS = hex"010000000000000000000000";

File 5 of 37 : Math.sol
// SPDX-License-Identifier: GPL-2.0-or-later
// As the copyright holder of this work, Ubiquity Labs retains
// the right to distribute, use, and modify this code under any license of
// their choosing, in addition to the terms of the GPL-v2 or later.
pragma solidity ^0.8.25;

import {Math as OzMath} from "@openzeppelin/contracts/utils/math/Math.sol";

import {ONE, DEFAULT_SCALE, DEFAULT_DECIMALS, INT_ONE_D8, ONE_SQUARED} from "./Constants.sol";

/**
 * @notice Math functions.
 */
library Math {
    /**
     * @notice Returns the lesser of two values.
     * @param x First uint256 value.
     * @param y Second uint256 value.
     */
    function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
        assembly ("memory-safe") {
            z := xor(x, mul(xor(x, y), lt(y, x)))
        }
    }

    /**
     * @notice Returns the lesser of two uint128 values.
     * @param x First uint128 value.
     * @param y Second uint128 value.
     */
    function min128(uint128 x, uint128 y) internal pure returns (uint128 z) {
        assembly ("memory-safe") {
            z := xor(x, mul(xor(x, y), lt(y, x)))
        }
    }

    /**
     * @notice Returns the lesser of two int256 values.
     * @param x First int256 value.
     * @param y Second int256 value.
     */
    function min(int256 x, int256 y) internal pure returns (int256 z) {
        assembly ("memory-safe") {
            z := xor(x, mul(xor(x, y), slt(y, x)))
        }
    }

    /**
     * @notice Returns the greater of two uint256 values.
     * @param x First uint256 value.
     * @param y Second uint256 value.
     */
    function max(uint256 x, uint256 y) internal pure returns (uint256 z) {
        assembly ("memory-safe") {
            z := xor(x, mul(xor(x, y), gt(y, x)))
        }
    }

    /**
     * @notice Returns the greater of two int256 values.
     * @param x First int256 value.
     * @param y Second int256 value.
     */
    function max(int256 x, int256 y) internal pure returns (int256 z) {
        assembly ("memory-safe") {
            z := xor(x, mul(xor(x, y), sgt(y, x)))
        }
    }

    /**
     * @notice Returns the greater of two uint128 values.
     * @param x First uint128 value.
     * @param y Second uint128 value.
     */
    function max128(uint128 x, uint128 y) internal pure returns (uint128 z) {
        assembly ("memory-safe") {
            z := xor(x, mul(xor(x, y), gt(y, x)))
        }
    }

    /**
     * @notice Thresholds a value to be within the specified bounds.
     * @param value The value to bound.
     * @param lowerLimit The minimum allowable value.
     * @param upperLimit The maximum allowable value.
     */
    function boundValue(
        uint256 value,
        uint256 lowerLimit,
        uint256 upperLimit
    ) internal pure returns (uint256 outputValue) {
        outputValue = min(max(value, lowerLimit), upperLimit);
    }

    /**
     * @notice Returns the difference between two uint128 values or zero if the result would be negative.
     * @param x The minuend.
     * @param y The subtrahend.
     */
    function clip128(uint128 x, uint128 y) internal pure returns (uint128) {
        unchecked {
            return x < y ? 0 : x - y;
        }
    }

    /**
     * @notice Returns the difference between two uint256 values or zero if the result would be negative.
     * @param x The minuend.
     * @param y The subtrahend.
     */
    function clip(uint256 x, uint256 y) internal pure returns (uint256) {
        unchecked {
            return x < y ? 0 : x - y;
        }
    }

    /**
     * @notice Divides one uint256 by another, rounding down to the nearest
     * integer.
     * @param x The dividend.
     * @param y The divisor.
     */
    function divFloor(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivFloor(x, ONE, y);
    }

    /**
     * @notice Divides one uint256 by another, rounding up to the nearest integer.
     * @param x The dividend.
     * @param y The divisor.
     */
    function divCeil(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivCeil(x, ONE, y);
    }

    /**
     * @notice Multiplies two uint256 values and then divides by ONE, rounding down.
     * @param x The multiplicand.
     * @param y The multiplier.
     */
    function mulFloor(uint256 x, uint256 y) internal pure returns (uint256) {
        return OzMath.mulDiv(x, y, ONE);
    }

    /**
     * @notice Multiplies two uint256 values and then divides by ONE, rounding up.
     * @param x The multiplicand.
     * @param y The multiplier.
     */
    function mulCeil(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivCeil(x, y, ONE);
    }

    /**
     * @notice Calculates the multiplicative inverse of a uint256, rounding down.
     * @param x The value to invert.
     */
    function invFloor(uint256 x) internal pure returns (uint256) {
        unchecked {
            return ONE_SQUARED / x;
        }
    }

    /**
     * @notice Calculates the multiplicative inverse of a uint256, rounding up.
     * @param denominator The value to invert.
     */
    function invCeil(uint256 denominator) internal pure returns (uint256 z) {
        assembly ("memory-safe") {
            // divide z - 1 by the denominator and add 1.
            z := add(div(sub(ONE_SQUARED, 1), denominator), 1)
        }
    }

    /**
     * @notice Multiplies two uint256 values and divides by a third, rounding down.
     * @param x The multiplicand.
     * @param y The multiplier.
     * @param k The divisor.
     */
    function mulDivFloor(uint256 x, uint256 y, uint256 k) internal pure returns (uint256 result) {
        result = OzMath.mulDiv(x, y, max(1, k));
    }

    /**
     * @notice Multiplies two uint256 values and divides by a third, rounding up if there's a remainder.
     * @param x The multiplicand.
     * @param y The multiplier.
     * @param k The divisor.
     */
    function mulDivCeil(uint256 x, uint256 y, uint256 k) internal pure returns (uint256 result) {
        result = mulDivFloor(x, y, k);
        if (mulmod(x, y, max(1, k)) != 0) result = result + 1;
    }

    /**
     * @notice Multiplies two uint256 values and divides by a third, rounding
     * down. Will revert if `x * y` is larger than `type(uint256).max`.
     * @param x The first operand for multiplication.
     * @param y The second operand for multiplication.
     * @param denominator The divisor after multiplication.
     */
    function mulDivDown(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 z) {
        assembly ("memory-safe") {
            // Store x * y in z for now.
            z := mul(x, y)
            if iszero(denominator) {
                denominator := 1
            }

            if iszero(or(iszero(x), eq(div(z, x), y))) {
                revert(0, 0)
            }

            // Divide z by the denominator.
            z := div(z, denominator)
        }
    }

    /**
     * @notice Multiplies two uint256 values and divides by a third, rounding
     * up. Will revert if `x * y` is larger than `type(uint256).max`.
     * @param x The first operand for multiplication.
     * @param y The second operand for multiplication.
     * @param denominator The divisor after multiplication.
     */
    function mulDivUp(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 z) {
        assembly ("memory-safe") {
            // Store x * y in z for now.
            z := mul(x, y)
            if iszero(denominator) {
                denominator := 1
            }

            if iszero(or(iszero(x), eq(div(z, x), y))) {
                revert(0, 0)
            }

            // First, divide z - 1 by the denominator and add 1.
            // We allow z - 1 to underflow if z is 0, because we multiply the
            // end result by 0 if z is zero, ensuring we return 0 if z is zero.
            z := mul(iszero(iszero(z)), add(div(sub(z, 1), denominator), 1))
        }
    }

    /**
     * @notice Multiplies a uint256 by another and divides by a constant,
     * rounding down. Will revert if `x * y` is larger than
     * `type(uint256).max`.
     * @param x The multiplicand.
     * @param y The multiplier.
     */
    function mulDown(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivDown(x, y, ONE);
    }

    /**
     * @notice Divides a uint256 by another, rounding down the result. Will
     * revert if `x * 1e18` is larger than `type(uint256).max`.
     * @param x The dividend.
     * @param y The divisor.
     */
    function divDown(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivDown(x, ONE, y);
    }

    /**
     * @notice Divides a uint256 by another, rounding up the result. Will
     * revert if `x * 1e18` is larger than `type(uint256).max`.
     * @param x The dividend.
     * @param y The divisor.
     */
    function divUp(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivUp(x, ONE, y);
    }

    /**
     * @notice Scales a number based on a difference in decimals from a default.
     * @param decimals The new decimal precision.
     */
    function scale(uint8 decimals) internal pure returns (uint256) {
        unchecked {
            if (decimals == DEFAULT_DECIMALS) {
                return DEFAULT_SCALE;
            } else {
                return 10 ** (DEFAULT_DECIMALS - decimals);
            }
        }
    }

    /**
     * @notice Adjusts a scaled amount to the token decimal scale.
     * @param amount The scaled amount.
     * @param scaleFactor The scaling factor to adjust by.
     * @param ceil Whether to round up (true) or down (false).
     */
    function ammScaleToTokenScale(uint256 amount, uint256 scaleFactor, bool ceil) internal pure returns (uint256 z) {
        unchecked {
            if (scaleFactor == DEFAULT_SCALE || amount == 0) {
                return amount;
            } else {
                if (!ceil) return amount / scaleFactor;
                assembly ("memory-safe") {
                    z := add(div(sub(amount, 1), scaleFactor), 1)
                }
            }
        }
    }

    /**
     * @notice Adjusts a token amount to the D18 AMM scale.
     * @param amount The amount in token scale.
     * @param scaleFactor The scale factor for adjustment.
     */
    function tokenScaleToAmmScale(uint256 amount, uint256 scaleFactor) internal pure returns (uint256) {
        if (scaleFactor == DEFAULT_SCALE) {
            return amount;
        } else {
            return amount * scaleFactor;
        }
    }

    /**
     * @notice Returns the absolute value of a signed 32-bit integer.
     * @param x The integer to take the absolute value of.
     */
    function abs32(int32 x) internal pure returns (uint32) {
        unchecked {
            return uint32(x < 0 ? -x : x);
        }
    }

    /**
     * @notice Returns the absolute value of a signed 256-bit integer.
     * @param x The integer to take the absolute value of.
     */
    function abs(int256 x) internal pure returns (uint256) {
        unchecked {
            return uint256(x < 0 ? -x : x);
        }
    }

    /**
     * @notice Calculates the integer square root of a uint256 rounded down.
     * @param x The number to take the square root of.
     */
    function sqrt(uint256 x) internal pure returns (uint256 z) {
        // from https://github.com/transmissions11/solmate/blob/e8f96f25d48fe702117ce76c79228ca4f20206cb/src/utils/FixedPointMathLib.sol
        assembly ("memory-safe") {
            let y := x
            z := 181

            if iszero(lt(y, 0x10000000000000000000000000000000000)) {
                y := shr(128, y)
                z := shl(64, z)
            }
            if iszero(lt(y, 0x1000000000000000000)) {
                y := shr(64, y)
                z := shl(32, z)
            }
            if iszero(lt(y, 0x10000000000)) {
                y := shr(32, y)
                z := shl(16, z)
            }
            if iszero(lt(y, 0x1000000)) {
                y := shr(16, y)
                z := shl(8, z)
            }

            z := shr(18, mul(z, add(y, 65536)))

            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))

            z := sub(z, lt(div(x, z), z))
        }
    }

    /**
     * @notice Computes the floor of a D8-scaled number as an int32, ignoring
     * potential overflow in the cast.
     * @param val The D8-scaled number.
     */
    function floorD8Unchecked(int256 val) internal pure returns (int32) {
        int32 val32;
        bool check;
        unchecked {
            val32 = int32(val / INT_ONE_D8);
            check = (val < 0 && val % INT_ONE_D8 != 0);
        }
        return check ? val32 - 1 : val32;
    }
}

File 6 of 37 : IMaverickV2Reward.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

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

import {INft} from "@maverick/v2-supplemental/contracts/positionbase/INft.sol";
import {IMulticall} from "@maverick/v2-common/contracts/base/IMulticall.sol";

import {IMaverickV2VotingEscrow} from "./IMaverickV2VotingEscrow.sol";
import {IMaverickV2RewardVault} from "./IMaverickV2RewardVault.sol";
import {IRewardAccounting} from "../rewardbase/IRewardAccounting.sol";

interface IMaverickV2Reward is INft, IMulticall, IRewardAccounting {
    event NotifyRewardAmount(
        address sender,
        IERC20 rewardTokenAddress,
        uint256 amount,
        uint256 duration,
        uint256 rewardRate
    );
    event GetReward(
        address sender,
        uint256 tokenId,
        address recipient,
        uint8 rewardTokenIndex,
        uint256 stakeDuration,
        IERC20 rewardTokenAddress,
        RewardOutput rewardOutput,
        uint256 lockupId
    );
    event UnStake(
        address sender,
        uint256 tokenId,
        uint256 amount,
        address recipient,
        uint256 userBalance,
        uint256 totalSupply
    );
    event Stake(
        address sender,
        address supplier,
        uint256 amount,
        uint256 tokenId,
        uint256 userBalance,
        uint256 totalSupply
    );
    event AddRewardToken(IERC20 rewardTokenAddress, uint8 rewardTokenIndex);
    event RemoveRewardToken(IERC20 rewardTokenAddress, uint8 rewardTokenIndex);
    event ApproveRewardGetter(uint256 tokenId, address getter);

    error RewardDurationOutOfBounds(uint256 duration, uint256 minDuration, uint256 maxDuration);
    error RewardZeroAmount();
    error RewardNotValidRewardToken(IERC20 rewardTokenAddress);
    error RewardNotValidIndex(uint8 index);
    error RewardTokenCannotBeStakingToken(IERC20 stakingToken);
    error RewardTransferNotSupported();
    error RewardNotApprovedGetter(uint256 tokenId, address approved, address getter);
    error RewardUnboostedTimePeriodNotMet(uint256 timestamp, uint256 minTimestamp);

    struct RewardInfo {
        // Timestamp of when the rewards finish
        uint256 finishAt;
        // Minimum of last updated time and reward finish time
        uint256 updatedAt;
        // Reward to be paid out per second
        uint256 rewardRate;
        // Escrowed rewards
        uint256 escrowedReward;
        // Sum of (reward rate * dt * 1e18 / total supply)
        uint256 rewardPerTokenStored;
        // Reward Token to be emitted
        IERC20 rewardToken;
        // ve locking contract
        IMaverickV2VotingEscrow veRewardToken;
        // amount available to push to ve as incentive
        uint128 unboostedAmount;
        // timestamp of unboosted push
        uint256 lastUnboostedPushTimestamp;
    }

    struct ContractInfo {
        // Reward Name
        string name;
        // Reward Symbol
        string symbol;
        // total supply staked
        uint256 totalSupply;
        // staking token
        IERC20 stakingToken;
    }

    struct EarnedInfo {
        // earned
        uint256 earned;
        // reward token
        IERC20 rewardToken;
    }

    struct RewardOutput {
        uint256 amount;
        bool asVe;
        IMaverickV2VotingEscrow veContract;
    }

    // solhint-disable-next-line func-name-mixedcase
    function MAX_DURATION() external view returns (uint256);

    // solhint-disable-next-line func-name-mixedcase
    function MIN_DURATION() external view returns (uint256);

    /**
     * @notice This function retrieves the minimum time gap in seconds that
     * must have elasped between calls to `pushUnboostedToVe()`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function UNBOOSTED_MIN_TIME_GAP() external view returns (uint256);

    /**
     * @notice This function retrieves the address of the token used for
     * staking in this reward contract.
     * @return The address of the staking token (IERC20).
     */
    function stakingToken() external view returns (IERC20);

    /**
     * @notice This function retrieves the address of the MaverickV2RewardVault
     * contract associated with this reward contract.
     * @return The address of the IMaverickV2RewardVault contract.
     */
    function vault() external view returns (IMaverickV2RewardVault);

    /**
     * @notice This function retrieves information about all available reward tokens for this reward contract.
     * @return info An array of RewardInfo structs containing details about each reward token.
     */
    function rewardInfo() external view returns (RewardInfo[] memory info);

    /**
     * @notice This function retrieves information about all available reward
     * tokens and overall contract details for this reward contract.
     * @return info An array of RewardInfo structs containing details about each reward token.
     * @return _contractInfo A ContractInfo struct containing overall contract details.
     */
    function contractInfo() external view returns (RewardInfo[] memory info, ContractInfo memory _contractInfo);

    /**
     * @notice This function calculates the total amount of all earned rewards
     * for a specific tokenId across all reward tokens.
     * @param tokenId The address of the tokenId for which to calculate earned rewards.
     * @return earnedInfo An array of EarnedInfo structs containing details about earned rewards for each supported token.
     */
    function earned(uint256 tokenId) external view returns (EarnedInfo[] memory earnedInfo);

    /**
     * @notice This function calculates the total amount of earned rewards for
     * a specific tokenId for a particular reward token.
     * @param tokenId The address of the tokenId for which to calculate earned rewards.
     * @param rewardTokenAddress The address of the specific reward token.
     * @return amount The total amount of earned rewards for the specified token.
     */
    function earned(uint256 tokenId, IERC20 rewardTokenAddress) external view returns (uint256);

    /**
     * @notice This function retrieves the internal index associated with a specific reward token address.
     * @param  rewardToken The address of the reward token to get the index for.
     * @return rewardTokenIndex The internal index of the token within the reward contract (uint8).
     */
    function tokenIndex(IERC20 rewardToken) external view returns (uint8 rewardTokenIndex);

    /**
     * @notice This function retrieves the total number of supported reward tokens in this reward contract.
     * @return count The total number of reward tokens (uint256).
     */
    function rewardTokenCount() external view returns (uint256);

    /**
     * @notice This function transfers a specified amount of reward tokens from
     * the caller to distribute them over a defined duration. The caller will
     * need to approve this rewards contract to make the transfer on the
     * caller's behalf. See `notifyRewardAmount` for details of how the
     * duration is set by the rewards contract.
     * @param rewardToken The address of the reward token to transfer.
     * @param duration The duration (in seconds) over which to distribute the rewards.
     * @param amount The amount of reward tokens to transfer.
     * @return _duration The duration in seconds that the incentives will be distributed over.
     */
    function transferAndNotifyRewardAmount(
        IERC20 rewardToken,
        uint256 duration,
        uint256 amount
    ) external returns (uint256 _duration);

    /**
     * @notice This function notifies the vault to distribute a previously
     * transferred amount of reward tokens over a defined duration. (Assumes
     * tokens are already in the contract).
     * @dev The duration of the distribution may not be the same as the input
     * duration.  If this notify amount is less than the amount already pending
     * disbursement, then this new amount will be distributed as the same rate
     * as the existing rate and that will dictate the duration.  Alternatively,
     * if the amount is more than the pending disbursement, then the input
     * duration will be honored and all pending disbursement tokens will also be
     * distributed at this newly set rate.
     * @param rewardToken The address of the reward token to distribute.
     * @param duration The duration (in seconds) over which to distribute the rewards.
     * @return _duration The duration in seconds that the incentives will be distributed over.
     */
    function notifyRewardAmount(IERC20 rewardToken, uint256 duration) external returns (uint256 _duration);

    /**
     * @notice This function transfers a specified amount of staking tokens
     * from the caller to the staking `vault()` and stakes them on the
     * recipient's behalf.  The user has to approve this reward contract to
     * transfer the staking token on their behalf for this function not to
     * revert.
     * @param tokenId Nft tokenId to stake for the staked tokens.
     * @param _amount The amount of staking tokens to transfer and stake.
     * @return amount The amount of staking tokens staked.  May differ from
     * input if there were unstaked tokens in the vault prior to this call.
     * @return stakedTokenId TokenId where liquidity was staked to.  This may
     * differ from the input tokenIf if the input `tokenId=0`.
     */
    function transferAndStake(
        uint256 tokenId,
        uint256 _amount
    ) external returns (uint256 amount, uint256 stakedTokenId);

    /**
     * @notice This function stakes the staking tokens to the specified
     * tokenId. If `tokenId=0` is passed in, then this function will look up
     * the caller's tokenIds and stake to the zero-index tokenId.  If the user
     * does not yet have a staking NFT tokenId, this function will mint one for
     * the sender and stake to that newly-minted tokenId.
     *
     * @dev The amount staked is derived by looking at the new balance on
     * the `vault()`. So, for staking to yield a non-zero balance, the user
     * will need to have transfered the `stakingToken()` to the `vault()` prior
     * to calling `stake`.  Note, tokens sent to the reward contract instead
     * of the vault will not be stakable and instead will be eligible to be
     * disbursed as rewards to stakers.  This is an advanced usage function.
     * If in doubt about the mechanics of staking, use `transferAndStake()`
     * instead.
     * @param tokenId The address of the tokenId whose tokens to stake.
     * @return amount The amount of staking tokens staked (uint256).
     * @return stakedTokenId TokenId where liquidity was staked to.  This may
     * differ from the input tokenIf if the input `tokenId=0`.
     */
    function stake(uint256 tokenId) external returns (uint256 amount, uint256 stakedTokenId);

    /**
     * @notice This function initiates unstaking of a specified amount of
     * staking tokens for the caller and sends them to a recipient.
     * @param tokenId The address of the tokenId whose tokens to unstake.
     * @param amount The amount of staking tokens to unstake (uint256).
     */
    function unstakeToOwner(uint256 tokenId, uint256 amount) external;

    /**
     * @notice This function initiates unstaking of a specified amount of
     * staking tokens on behalf of a specific tokenId and sends them to a recipient.
     * @dev To unstakeFrom, the caller must have an approval allowance of at
     * least `amount`.  Approvals follow the ERC-721 approval interface.
     * @param tokenId The address of the tokenId whose tokens to unstake.
     * @param recipient The address to which the unstaked tokens will be sent.
     * @param amount The amount of staking tokens to unstake (uint256).
     */
    function unstake(uint256 tokenId, address recipient, uint256 amount) external;

    /**
     * @notice This function retrieves the claimable reward for a specific
     * reward token and stake duration for the caller.
     * @param tokenId The address of the tokenId whose reward to claim.
     * @param rewardTokenIndex The internal index of the reward token.
     * @param stakeDuration The duration (in seconds) for which the rewards were staked.
     * @return rewardOutput A RewardOutput struct containing details about the claimable reward.
     */
    function getRewardToOwner(
        uint256 tokenId,
        uint8 rewardTokenIndex,
        uint256 stakeDuration
    ) external returns (RewardOutput memory rewardOutput);

    /**
     * @notice This function retrieves the claimable reward for a specific
     * reward token, stake duration, and lockup ID for the caller.
     * @param tokenId The address of the tokenId whose reward to claim.
     * @param rewardTokenIndex The internal index of the reward token.
     * @param stakeDuration The duration (in seconds) for which the rewards were staked.
     * @param lockupId The unique identifier for the specific lockup (optional).
     * @return rewardOutput A RewardOutput struct containing details about the claimable reward.
     */
    function getRewardToOwnerForExistingVeLockup(
        uint256 tokenId,
        uint8 rewardTokenIndex,
        uint256 stakeDuration,
        uint256 lockupId
    ) external returns (RewardOutput memory);

    /**
     * @notice This function retrieves the claimable reward for a specific
     * reward token and stake duration for a specified tokenId and sends it to
     * a recipient.  If the reward is staked in the corresponding veToken, a
     * new lockup in the ve token will be created.
     * @param tokenId The address of the tokenId whose reward to claim.
     * @param recipient The address to which the claimed reward will be sent.
     * @param rewardTokenIndex The internal index of the reward token.
     * @param stakeDuration The duration (in seconds) for which the rewards
     * will be staked in the ve contract.
     * @return rewardOutput A RewardOutput struct containing details about the claimable reward.
     */
    function getReward(
        uint256 tokenId,
        address recipient,
        uint8 rewardTokenIndex,
        uint256 stakeDuration
    ) external returns (RewardOutput memory);

    /**
     * @notice This function retrieves a list of all supported tokens in the reward contract.
     * @param includeStakingToken A flag indicating whether to include the staking token in the list.
     * @return tokens An array of IERC20 token addresses.
     */
    function tokenList(bool includeStakingToken) external view returns (IERC20[] memory tokens);

    /**
     * @notice This function retrieves the veToken contract associated with a
     * specific index within the reward contract.
     * @param index The index of the veToken to retrieve.
     * @return output The IMaverickV2VotingEscrow contract associated with the index.
     */
    function veTokenByIndex(uint8 index) external view returns (IMaverickV2VotingEscrow output);

    /**
     * @notice This function retrieves the reward token contract associated
     * with a specific index within the reward contract.
     * @param index The index of the reward token to retrieve.
     * @return output The IERC20 contract associated with the index.
     */
    function rewardTokenByIndex(uint8 index) external view returns (IERC20 output);

    /**
     * @notice This function calculates the boosted amount an tokenId would
     * receive based on their veToken balance and stake duration.
     * @param tokenId The address of the tokenId for which to calculate the boosted amount.
     * @param veToken The IMaverickV2VotingEscrow contract representing the veToken used for boosting.
     * @param rawAmount The raw (unboosted) amount.
     * @param stakeDuration The duration (in seconds) for which the rewards would be staked.
     * @return earnedAmount The boosted amount the tokenId would receive (uint256).
     * @return asVe A boolean indicating whether the boosted amount is
     * staked in the veToken (true) or is disbursed without ve staking required (false).
     */
    function boostedAmount(
        uint256 tokenId,
        IMaverickV2VotingEscrow veToken,
        uint256 rawAmount,
        uint256 stakeDuration
    ) external view returns (uint256 earnedAmount, bool asVe);

    /**
     * @notice This function is used to push unboosted rewards to the veToken
     * contract.  This unboosted reward amount is then distributed to the
     * veToken holders. This function will revert if less than
     * `UNBOOSTED_MIN_TIME_GAP()` seconds have passed since the last call.
     * @param rewardTokenIndex The internal index of the reward token.
     * @return amount The amount of unboosted rewards pushed (uint128).
     * @return timepoint The timestamp associated with the pushed rewards (uint48).
     * @return batchIndex The batch index for the pushed rewards (uint256).
     */
    function pushUnboostedToVe(
        uint8 rewardTokenIndex
    ) external returns (uint128 amount, uint48 timepoint, uint256 batchIndex);

    /**
     * @notice Mints an NFT stake to a user.  This NFT will not possesses any
     * assets until a user `stake`s asset to the NFT tokenId as part of a
     * separate call.
     * @param recipient The address that owns the output NFT
     */
    function mint(address recipient) external returns (uint256 tokenId);

    /**
     * @notice Mints an NFT stake to caller.  This NFT will not possesses any
     * assets until a user `stake`s asset to the NFT tokenId as part of a
     * separate call.
     */
    function mintToSender() external returns (uint256 tokenId);
}

File 7 of 37 : IMaverickV2RewardVault.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

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

interface IMaverickV2RewardVault {
    error RewardVaultUnauthorizedAccount(address caller, address owner);

    /**
     * @notice This function allows the owner of the reward vault to withdraw a
     * specified amount of staking tokens to a recipient address.  If non-owner
     * calls this function, it will revert.
     * @param recipient The address to which the withdrawn staking tokens will be sent.
     * @param amount The amount of staking tokens to withdraw.
     */
    function withdraw(address recipient, uint256 amount) external;

    /**
     * @notice This function retrieves the address of the owner of the reward
     * vault contract.
     */
    function owner() external view returns (address);

    /**
     * @notice This function retrieves the address of the ERC20 token used for
     * staking within the reward vault.
     */
    function stakingToken() external view returns (IERC20);
}

File 8 of 37 : IMaverickV2VotingEscrow.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

import {IVotes} from "@openzeppelin/contracts/governance/utils/IVotes.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {IERC6372} from "@openzeppelin/contracts/interfaces/IERC6372.sol";

import {IHistoricalBalance} from "../votingescrowbase/IHistoricalBalance.sol";

interface IMaverickV2VotingEscrowBase is IVotes, IHistoricalBalance {
    error VotingEscrowTransferNotSupported();
    error VotingEscrowInvalidAddress(address);
    error VotingEscrowInvalidAmount(uint256);
    error VotingEscrowInvalidDuration(uint256 duration, uint256 minDuration, uint256 maxDuration);
    error VotingEscrowInvalidEndTime(uint256 newEnd, uint256 oldEnd);
    error VotingEscrowStakeStillLocked(uint256 currentTime, uint256 endTime);
    error VotingEscrowStakeAlreadyRedeemed();
    error VotingEscrowNotApprovedExtender(address account, address extender, uint256 lockupId);
    error VotingEscrowIncentiveAlreadyClaimed(address account, uint256 batchIndex);
    error VotingEscrowNoIncentivesToClaim(address account, uint256 batchIndex);
    error VotingEscrowInvalidExtendIncentiveToken(IERC20 incentiveToken);
    error VotingEscrowNoSupplyAtTimepoint();
    error VotingEscrowIncentiveTimepointInFuture(uint256 timestamp, uint256 claimTimepoint);

    event Stake(address indexed user, uint256 lockupId, Lockup);
    event Unstake(address indexed user, uint256 lockupId, Lockup);
    event ExtenderApproval(address staker, address extender, uint256 lockupId, bool newState);
    event ClaimIncentiveBatch(uint256 batchIndex, address account, uint256 claimAmount);
    event CreateNewIncentiveBatch(
        address user,
        uint256 amount,
        uint256 timepoint,
        uint256 stakeDuration,
        IERC20 incentiveToken
    );

    struct Lockup {
        uint128 amount;
        uint128 end;
        uint256 votes;
    }

    struct ClaimInformation {
        bool timepointInPast;
        bool hasClaimed;
        uint128 claimAmount;
    }

    struct BatchInformation {
        uint128 totalIncentives;
        uint128 stakeDuration;
        uint48 claimTimepoint;
        IERC20 incentiveToken;
    }

    struct TokenIncentiveTotals {
        uint128 totalIncentives;
        uint128 claimedIncentives;
    }

    // solhint-disable-next-line func-name-mixedcase
    function MIN_STAKE_DURATION() external returns (uint256 duration);

    // solhint-disable-next-line func-name-mixedcase
    function MAX_STAKE_DURATION() external returns (uint256 duration);

    // solhint-disable-next-line func-name-mixedcase
    function YEAR_BASE() external returns (uint256);

    /**
     * @notice This function retrieves the address of the ERC20 token used as the base token for staking and rewards.
     * @return baseToken The address of the IERC20 base token contract.
     */
    function baseToken() external returns (IERC20);

    /**
     * @notice This function retrieves the starting timestamp. This may be used
     * for reward calculations or other time-based logic.
     */
    function startTimestamp() external returns (uint256 timestamp);

    /**
     * @notice This function retrieves the details of a specific lockup for a given staker and lockup index.
     * @param staker The address of the staker for which to retrieve the lockup details.
     * @param index The index of the lockup within the staker's lockup history.
     * @return lockup A Lockup struct containing details about the lockup (see struct definition for details).
     */
    function getLockup(address staker, uint256 index) external view returns (Lockup memory lockup);

    /**
     * @notice This function retrieves the total number of lockups associated with a specific staker.
     * @param staker The address of the staker for which to retrieve the lockup count.
     * @return count The total number of lockups for the staker.
     */
    function lockupCount(address staker) external view returns (uint256 count);

    /**
     * @notice This function simulates a lockup scenario, providing details about the resulting lockup structure for a specified amount and duration.
     * @param amount The amount of tokens to be locked.
     * @param duration The duration of the lockup period.
     * @return lockup A Lockup struct containing details about the simulated lockup (see struct definition for details).
     */
    function previewVotes(uint128 amount, uint256 duration) external view returns (Lockup memory lockup);

    /**
     * @notice This function grants approval for a designated extender contract to manage a specific lockup on behalf of the staker.
     * @param extender The address of the extender contract to be approved.
     * @param lockupId The ID of the lockup for which to grant approval.
     */
    function approveExtender(address extender, uint256 lockupId) external;

    /**
     * @notice This function revokes approval previously granted to an extender contract for managing a specific lockup.
     * @param extender The address of the extender contract whose approval is being revoked.
     * @param lockupId The ID of the lockup for which to revoke approval.
     */
    function revokeExtender(address extender, uint256 lockupId) external;

    /**
     * @notice This function checks whether a specific account has been approved by a staker to manage a particular lockup through an extender contract.
     * @param account The address of the account to check for approval (may be the extender or another account).
     * @param extender The address of the extender contract for which to check approval.
     * @param lockupId The ID of the lockup to verify approval for.
     * @return isApproved True if the account is approved for the lockup, False otherwise (bool).
     */
    function isApprovedExtender(address account, address extender, uint256 lockupId) external view returns (bool);

    /**
     * @notice This function extends the lockup period for the caller (msg.sender) for a specified lockup ID, adding a new duration and amount.
     * @param lockupId The ID of the lockup to be extended.
     * @param duration The additional duration to extend the lockup by.
     * @param amount The additional amount of tokens to be locked.
     * @return newLockup A Lockup struct containing details about the newly extended lockup (see struct definition for details).
     */
    function extendForSender(
        uint256 lockupId,
        uint256 duration,
        uint128 amount
    ) external returns (Lockup memory newLockup);

    /**
     * @notice This function extends the lockup period for a specified account, adding a new duration and amount. The caller (msg.sender) must be authorized to manage the lockup through an extender contract.
     * @param account The address of the account whose lockup is being extended.
     * @param lockupId The ID of the lockup to be extended.
     * @param duration The additional duration to extend the lockup by.
     * @param amount The additional amount of tokens to be locked.
     * @return newLockup A Lockup struct containing details about the newly extended lockup (see struct definition for details).
     */
    function extendForAccount(
        address account,
        uint256 lockupId,
        uint256 duration,
        uint128 amount
    ) external returns (Lockup memory newLockup);

    /**
     * @notice This function merges multiple lockups associated with the caller
     * (msg.sender) into a single new lockup.
     * @param lockupIds An array containing the IDs of the lockups to be merged.
     * @return newLockup A Lockup struct containing details about the newly merged lockup (see struct definition for details).
     */
    function merge(uint256[] memory lockupIds) external returns (Lockup memory newLockup);

    /**
     * @notice This function unstakes the specified lockup ID for the caller (msg.sender), returning the details of the unstaked lockup.
     * @param lockupId The ID of the lockup to be unstaked.
     * @param to The address to which the unstaked tokens should be sent (optional, defaults to msg.sender).
     * @return lockup A Lockup struct containing details about the unstaked lockup (see struct definition for details).
     */
    function unstake(uint256 lockupId, address to) external returns (Lockup memory lockup);

    /**
     * @notice This function is a simplified version of `unstake` that automatically sends the unstaked tokens to the caller (msg.sender).
     * @param lockupId The ID of the lockup to be unstaked.
     * @return lockup A Lockup struct containing details about the unstaked lockup (see struct definition for details).
     */
    function unstakeToSender(uint256 lockupId) external returns (Lockup memory lockup);

    /**
     * @notice This function stakes a specified amount of tokens for the caller
     * (msg.sender) for a defined duration.
     * @param amount The amount of tokens to be staked.
     * @param duration The duration of the lockup period.
     * @return lockup A Lockup struct containing details about the newly
     * created lockup (see struct definition for details).
     */
    function stakeToSender(uint128 amount, uint256 duration) external returns (Lockup memory lockup);

    /**
     * @notice This function stakes a specified amount of tokens for a defined
     * duration, allowing the caller (msg.sender) to specify an optional
     * recipient for the staked tokens.
     * @param amount The amount of tokens to be staked.
     * @param duration The duration of the lockup period.
     * @param to The address to which the staked tokens will be credited (optional, defaults to msg.sender).
     * @return lockup A Lockup struct containing details about the newly
     * created lockup (see struct definition for details).
     */
    function stake(uint128 amount, uint256 duration, address to) external returns (Lockup memory);

    /**
     * @notice This function retrieves the total incentive information for a specific ERC-20 token.
     * @param token The address of the ERC20 token for which to retrieve incentive totals.
     * @return totals A TokenIncentiveTotals struct containing details about
     * the token's incentives (see struct definition for details).
     */
    function incentiveTotals(IERC20 token) external view returns (TokenIncentiveTotals memory);

    /**
     * @notice This function retrieves the total number of created incentive batches.
     * @return count The total number of incentive batches.
     */
    function incentiveBatchCount() external view returns (uint256);

    /**
     * @notice This function retrieves claim information for a specific account and incentive batch index.
     * @param account The address of the account for which to retrieve claim information.
     * @param batchIndex The index of the incentive batch for which to retrieve
     * claim information.
     * @return claimInformation A ClaimInformation struct containing details about the
     * account's claims for the specified batch (see struct definition for
     * details).
     * @return batchInformation A BatchInformation struct containing details about the
     * specified batch (see struct definition for details).
     */
    function claimAndBatchInformation(
        address account,
        uint256 batchIndex
    ) external view returns (ClaimInformation memory claimInformation, BatchInformation memory batchInformation);

    /**
     * @notice This function retrieves batch information for a incentive batch index.
     * @param batchIndex The index of the incentive batch for which to retrieve
     * claim information.
     * @return info A BatchInformation struct containing details about the
     * specified batch (see struct definition for details).
     */
    function incentiveBatchInformation(uint256 batchIndex) external view returns (BatchInformation memory info);

    /**
     * @notice This function allows claiming rewards from a specific incentive
     * batch while simultaneously extending a lockup with the claimed tokens.
     * @param batchIndex The index of the incentive batch from which to claim rewards.
     * @param lockupId The ID of the lockup to be extended with the claimed tokens.
     * @return lockup A Lockup struct containing details about the updated
     * lockup after extension (see struct definition for details).
     * @return claimAmount The amount of tokens claimed from the incentive batch.
     */
    function claimFromIncentiveBatchAndExtend(
        uint256 batchIndex,
        uint256 lockupId
    ) external returns (Lockup memory lockup, uint128 claimAmount);

    /**
     * @notice This function allows claiming rewards from a specific incentive
     * batch, without extending any lockups.
     * @param batchIndex The index of the incentive batch from which to claim rewards.
     * @return lockup A Lockup struct containing details about the user's
     * lockup that might have been affected by the claim (see struct definition
     * for details).
     * @return claimAmount The amount of tokens claimed from the incentive batch.
     */
    function claimFromIncentiveBatch(uint256 batchIndex) external returns (Lockup memory lockup, uint128 claimAmount);

    /**
     * @notice This function creates a new incentive batch for a specified amount
     * of incentive tokens, timepoint, stake duration, and associated ERC-20
     * token. An incentive batch is a reward of incentives put up by the
     * caller at a certain timepoint.  The incentive batch is claimable by ve
     * holders after the timepoint has passed.  The ve holders will receive
     * their incentive pro rata of their vote balance (`pastbalanceOf`) at that
     * timepoint.  The incentivizer can specify that users have to stake the
     * resulting incentive for a given `stakeDuration` number of seconds.
     * `stakeDuration` can either be zero, meaning that no staking is required
     * on redemption, or can be a number between `MIN_STAKE_DURATION()` and
     * `MAX_STAKE_DURATION()`.
     * @param amount The total amount of incentive tokens to be distributed in the batch.
     * @param timepoint The timepoint at which the incentive batch starts accruing rewards.
     * @param stakeDuration The duration of the lockup period required to be
     * eligible for the incentive batch rewards.
     * @param incentiveToken The address of the ERC20 token used for the incentive rewards.
     * @return index The index of the newly created incentive batch.
     */
    function createIncentiveBatch(
        uint128 amount,
        uint48 timepoint,
        uint128 stakeDuration,
        IERC20 incentiveToken
    ) external returns (uint256 index);
}

interface IMaverickV2VotingEscrow is IMaverickV2VotingEscrowBase, IERC20Metadata, IERC6372 {}

File 9 of 37 : MaverickV2RewardVault.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IMaverickV2RewardVault} from "./interfaces/IMaverickV2RewardVault.sol";

/**
 * @notice Vault contract with owner-only withdraw function.  Used by the
 * Reward contract to segregate staking funds from incentive rewards funds.
 */
contract MaverickV2RewardVault is IMaverickV2RewardVault {
    using SafeERC20 for IERC20;

    /// @inheritdoc IMaverickV2RewardVault
    address public immutable owner;

    /// @inheritdoc IMaverickV2RewardVault
    IERC20 public immutable stakingToken;

    constructor(IERC20 _stakingToken) {
        owner = msg.sender;
        stakingToken = _stakingToken;
    }

    /// @inheritdoc IMaverickV2RewardVault
    function withdraw(address recipient, uint256 amount) public {
        if (owner != msg.sender) {
            revert RewardVaultUnauthorizedAccount(msg.sender, owner);
        }
        stakingToken.safeTransfer(recipient, amount);
    }
}

File 10 of 37 : IRewardAccounting.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

interface IRewardAccounting {
    error InsufficientBalance(uint256 tokenId, uint256 currentBalance, uint256 value);

    /**
     * @notice Balance of stake for a given `tokenId` account.
     */
    function stakeBalanceOf(uint256 tokenId) external view returns (uint256 balance);

    /**
     * @notice Sum of all balances across all tokenIds.
     */
    function stakeTotalSupply() external view returns (uint256 supply);
}

File 11 of 37 : RewardAccounting.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

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

/**
 * @notice Provides ERC20-like functions for minting, burning, balance tracking
 * and total supply.  Tracking is based on a tokenId user index instead of an
 * address.
 */
abstract contract RewardAccounting is IRewardAccounting {
    mapping(uint256 account => uint256) private _stakeBalances;

    uint256 private _stakeTotalSupply;

    /// @inheritdoc IRewardAccounting
    function stakeBalanceOf(uint256 tokenId) public view returns (uint256 balance) {
        balance = _stakeBalances[tokenId];
    }

    /// @inheritdoc IRewardAccounting
    function stakeTotalSupply() public view returns (uint256 supply) {
        supply = _stakeTotalSupply;
    }

    /**
     * @notice Mint to staking account for a tokenId account.
     */
    function _mintStake(uint256 tokenId, uint256 value) internal {
        // checked; will revert if supply overflows.
        _stakeTotalSupply += value;
        unchecked {
            // unchecked; totalsupply will overflow before balance for a given
            // account does.
            _stakeBalances[tokenId] += value;
        }
    }

    /**
     * @notice Burn from staking account for a tokenId account.
     */
    function _burnStake(uint256 tokenId, uint256 value) internal {
        uint256 currentBalance = _stakeBalances[tokenId];
        if (value > currentBalance) revert InsufficientBalance(tokenId, currentBalance, value);
        unchecked {
            _stakeTotalSupply -= value;
            _stakeBalances[tokenId] = currentBalance - value;
        }
    }
}

File 12 of 37 : IHistoricalBalance.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

interface IHistoricalBalance {
    /**
     * @notice This function retrieves the historical balance of an account at
     * a specific point in time.
     * @param account The address of the account for which to retrieve the
     * historical balance.
     * @param timepoint The timepoint (block number or timestamp depending on
     * implementation) at which to query the balance (uint256).
     * @return balance The balance of the account at the specified timepoint.
     */
    function getPastBalanceOf(address account, uint256 timepoint) external view returns (uint256 balance);
}

File 13 of 37 : INft.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

import {IERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

interface INft is IERC721Enumerable {
    /**
     * @notice Check if an NFT exists for a given owner and index.
     */
    function tokenOfOwnerByIndexExists(address owner, uint256 index) external view returns (bool);

    /**
     * @notice Return Id of the next token minted.
     */
    function nextTokenId() external view returns (uint256 nextTokenId_);

    /**
     * @notice Check if the caller has access to a specific NFT by tokenId.
     */
    function checkAuthorized(address spender, uint256 tokenId) external view returns (address owner);

    /**
     * @notice List of tokenIds by owner.
     */
    function tokenIdsOfOwner(address owner) external view returns (uint256[] memory tokenIds);

    /**
     * @notice Get the token URI for a given tokenId.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
}

File 14 of 37 : Nft.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.25;

import {ERC721, IERC165} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {ERC721Enumerable} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";

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

/**
 * @notice Extensions to ECR-721 to support an image contract and owner
 * enumeration.
 */
abstract contract Nft is ERC721Enumerable, INft {
    uint256 private _nextTokenId = 1;

    constructor(string memory __name, string memory __symbol) ERC721(__name, __symbol) {}

    /**
     * @notice Internal function to mint a new NFT and assign it to the
     * specified address.
     * @param to The address to which the NFT will be minted.
     * @return tokenId The ID of the newly minted NFT.
     */
    function _mint(address to) internal returns (uint256 tokenId) {
        super._mint(to, _nextTokenId);
        tokenId = _nextTokenId++;
    }

    /**
     * @notice Modifier to restrict access to functions to the owner of a
     * specific NFT by its tokenId.
     */
    modifier onlyTokenIdAuthorizedUser(uint256 tokenId) {
        checkAuthorized(msg.sender, tokenId);
        _;
    }

    /// @inheritdoc INft
    function nextTokenId() public view returns (uint256 nextTokenId_) {
        return _nextTokenId;
    }

    /// @inheritdoc INft
    function tokenOfOwnerByIndexExists(address ownerToCheck, uint256 index) public view returns (bool exists) {
        return index < balanceOf(ownerToCheck);
    }

    /// @inheritdoc INft
    function tokenIdsOfOwner(address owner) public view returns (uint256[] memory tokenIds) {
        uint256 tokenCount = balanceOf(owner);
        tokenIds = new uint256[](tokenCount);
        for (uint256 k; k < tokenCount; k++) {
            tokenIds[k] = tokenOfOwnerByIndex(owner, k);
        }
    }

    /// @inheritdoc INft
    function checkAuthorized(address spender, uint256 tokenId) public view returns (address owner) {
        owner = ownerOf(tokenId);
        _checkAuthorized(owner, spender, tokenId);
    }

    // ************************************************************
    // The following functions are overrides required by Solidity.

    function _update(address to, uint256 tokenId, address auth) internal override(ERC721Enumerable) returns (address) {
        return super._update(to, tokenId, auth);
    }

    function _increaseBalance(address account, uint128 value) internal override(ERC721Enumerable) {
        super._increaseBalance(account, value);
    }

    function name() public view virtual override(INft, ERC721) returns (string memory) {
        return super.name();
    }

    function symbol() public view virtual override(INft, ERC721) returns (string memory) {
        return super.symbol();
    }

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

    function tokenURI(uint256 tokenId) public view virtual override(INft, ERC721) returns (string memory) {
        return super.tokenURI(tokenId);
    }
}

File 15 of 37 : IVotes.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (governance/utils/IVotes.sol)
pragma solidity ^0.8.20;

/**
 * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.
 */
interface IVotes {
    /**
     * @dev The signature used has expired.
     */
    error VotesExpiredSignature(uint256 expiry);

    /**
     * @dev Emitted when an account changes their delegate.
     */
    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

    /**
     * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of voting units.
     */
    event DelegateVotesChanged(address indexed delegate, uint256 previousVotes, uint256 newVotes);

    /**
     * @dev Returns the current amount of votes that `account` has.
     */
    function getVotes(address account) external view returns (uint256);

    /**
     * @dev Returns the amount of votes that `account` had at a specific moment in the past. If the `clock()` is
     * configured to use block numbers, this will return the value at the end of the corresponding block.
     */
    function getPastVotes(address account, uint256 timepoint) external view returns (uint256);

    /**
     * @dev Returns the total supply of votes available at a specific moment in the past. If the `clock()` is
     * configured to use block numbers, this will return the value at the end of the corresponding block.
     *
     * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.
     * Votes that have not been delegated are still part of total supply, even though they would not participate in a
     * vote.
     */
    function getPastTotalSupply(uint256 timepoint) external view returns (uint256);

    /**
     * @dev Returns the delegate that `account` has chosen.
     */
    function delegates(address account) external view returns (address);

    /**
     * @dev Delegates votes from the sender to `delegatee`.
     */
    function delegate(address delegatee) external;

    /**
     * @dev Delegates votes from signer to `delegatee`.
     */
    function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;
}

File 16 of 37 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 17 of 37 : IERC6372.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC6372.sol)

pragma solidity ^0.8.20;

interface IERC6372 {
    /**
     * @dev Clock used for flagging checkpoints. Can be overridden to implement timestamp based checkpoints (and voting).
     */
    function clock() external view returns (uint48);

    /**
     * @dev Description of the clock
     */
    // solhint-disable-next-line func-name-mixedcase
    function CLOCK_MODE() external view returns (string memory);
}

File 18 of 37 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

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

File 19 of 37 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

File 20 of 37 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

File 21 of 37 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

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

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

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

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

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

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

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

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

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

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

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

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

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

File 22 of 37 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.20;

import {IERC721} from "./IERC721.sol";
import {IERC721Receiver} from "./IERC721Receiver.sol";
import {IERC721Metadata} from "./extensions/IERC721Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {Strings} from "../../utils/Strings.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {IERC721Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors {
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    mapping(uint256 tokenId => address) private _owners;

    mapping(address owner => uint256) private _balances;

    mapping(uint256 tokenId => address) private _tokenApprovals;

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual returns (string memory) {
        _requireOwned(tokenId);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : "";
    }

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

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual {
        _approve(to, tokenId, _msgSender());
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual returns (address) {
        _requireOwned(tokenId);

        return _getApproved(tokenId);
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
        // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
        address previousOwner = _update(to, tokenId, _msgSender());
        if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
        transferFrom(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     *
     * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
     * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
     * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
     * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.
     */
    function _getApproved(uint256 tokenId) internal view virtual returns (address) {
        return _tokenApprovals[tokenId];
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
     * particular (ignoring whether it is owned by `owner`).
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
        return
            spender != address(0) &&
            (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
    }

    /**
     * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
     * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
     * the `spender` for the specific `tokenId`.
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
        if (!_isAuthorized(owner, spender, tokenId)) {
            if (owner == address(0)) {
                revert ERC721NonexistentToken(tokenId);
            } else {
                revert ERC721InsufficientApproval(spender, tokenId);
            }
        }
    }

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
     * a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
     *
     * WARNING: Increasing an account's balance using this function tends to be paired with an override of the
     * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
     * remain consistent with one another.
     */
    function _increaseBalance(address account, uint128 value) internal virtual {
        unchecked {
            _balances[account] += value;
        }
    }

    /**
     * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
     * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that
     * `auth` is either the owner of the token, or approved to operate on the token (by the owner).
     *
     * Emits a {Transfer} event.
     *
     * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.
     */
    function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
        address from = _ownerOf(tokenId);

        // Perform (optional) operator check
        if (auth != address(0)) {
            _checkAuthorized(from, auth, tokenId);
        }

        // Execute the update
        if (from != address(0)) {
            // Clear approval. No need to re-authorize or emit the Approval event
            _approve(address(0), tokenId, address(0), false);

            unchecked {
                _balances[from] -= 1;
            }
        }

        if (to != address(0)) {
            unchecked {
                _balances[to] += 1;
            }
        }

        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        return from;
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner != address(0)) {
            revert ERC721InvalidSender(address(0));
        }
    }

    /**
     * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
        _mint(to, tokenId);
        _checkOnERC721Received(address(0), to, tokenId, data);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal {
        address previousOwner = _update(address(0), tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        } else if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
     * are aware of the ERC721 standard to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is like {safeTransferFrom} in the sense that it invokes
     * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `tokenId` token must exist and be owned by `from`.
     * - `to` cannot be the zero address.
     * - `from` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId) internal {
        _safeTransfer(from, to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
     * either the owner of the token, or approved to operate on all tokens held by this owner.
     *
     * Emits an {Approval} event.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address to, uint256 tokenId, address auth) internal {
        _approve(to, tokenId, auth, true);
    }

    /**
     * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
     * emitted in the context of transfers.
     */
    function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
        // Avoid reading the owner unless necessary
        if (emitEvent || auth != address(0)) {
            address owner = _requireOwned(tokenId);

            // We do not use _isAuthorized because single-token approvals should not be able to call approve
            if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
                revert ERC721InvalidApprover(auth);
            }

            if (emitEvent) {
                emit Approval(owner, to, tokenId);
            }
        }

        _tokenApprovals[tokenId] = to;
    }

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

    /**
     * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
     * Returns the owner.
     *
     * Overrides to ownership logic should be done to {_ownerOf}.
     */
    function _requireOwned(uint256 tokenId) internal view returns (address) {
        address owner = _ownerOf(tokenId);
        if (owner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
        return owner;
    }

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the
     * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {
        if (to.code.length > 0) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                if (retval != IERC721Receiver.onERC721Received.selector) {
                    revert ERC721InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert ERC721InvalidReceiver(to);
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }
}

File 23 of 37 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/ERC721Enumerable.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds enumerability
 * of all the token ids in the contract as well as all token ids owned by each account.
 *
 * CAUTION: `ERC721` extensions that implement custom `balanceOf` logic, such as `ERC721Consecutive`,
 * interfere with enumerability and should not be used together with `ERC721Enumerable`.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    mapping(address owner => mapping(uint256 index => uint256)) private _ownedTokens;
    mapping(uint256 tokenId => uint256) private _ownedTokensIndex;

    uint256[] private _allTokens;
    mapping(uint256 tokenId => uint256) private _allTokensIndex;

    /**
     * @dev An `owner`'s token query was out of bounds for `index`.
     *
     * NOTE: The owner being `address(0)` indicates a global out of bounds index.
     */
    error ERC721OutOfBoundsIndex(address owner, uint256 index);

    /**
     * @dev Batch mint is not allowed.
     */
    error ERC721EnumerableForbiddenBatchMint();

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) {
        if (index >= balanceOf(owner)) {
            revert ERC721OutOfBoundsIndex(owner, index);
        }
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual returns (uint256) {
        if (index >= totalSupply()) {
            revert ERC721OutOfBoundsIndex(address(0), index);
        }
        return _allTokens[index];
    }

    /**
     * @dev See {ERC721-_update}.
     */
    function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address) {
        address previousOwner = super._update(to, tokenId, auth);

        if (previousOwner == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (previousOwner != to) {
            _removeTokenFromOwnerEnumeration(previousOwner, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (previousOwner != to) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }

        return previousOwner;
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = balanceOf(to) - 1;
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = balanceOf(from);
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }

    /**
     * See {ERC721-_increaseBalance}. We need that to account tokens that were minted in batch
     */
    function _increaseBalance(address account, uint128 amount) internal virtual override {
        if (amount > 0) {
            revert ERC721EnumerableForbiddenBatchMint();
        }
        super._increaseBalance(account, amount);
    }
}

File 24 of 37 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.20;

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

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 25 of 37 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.20;

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

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

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

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

File 26 of 37 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 27 of 37 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

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

File 28 of 37 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

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

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

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

File 29 of 37 : 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;
    }
}

File 30 of 37 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.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 ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 31 of 37 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

File 32 of 37 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 33 of 37 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.20;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeCast {
    /**
     * @dev Value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);

    /**
     * @dev An int value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedIntToUint(int256 value);

    /**
     * @dev Value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);

    /**
     * @dev An uint value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedUintToInt(uint256 value);

    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        if (value > type(uint248).max) {
            revert SafeCastOverflowedUintDowncast(248, value);
        }
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        if (value > type(uint240).max) {
            revert SafeCastOverflowedUintDowncast(240, value);
        }
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        if (value > type(uint232).max) {
            revert SafeCastOverflowedUintDowncast(232, value);
        }
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        if (value > type(uint224).max) {
            revert SafeCastOverflowedUintDowncast(224, value);
        }
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        if (value > type(uint216).max) {
            revert SafeCastOverflowedUintDowncast(216, value);
        }
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        if (value > type(uint208).max) {
            revert SafeCastOverflowedUintDowncast(208, value);
        }
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        if (value > type(uint200).max) {
            revert SafeCastOverflowedUintDowncast(200, value);
        }
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        if (value > type(uint192).max) {
            revert SafeCastOverflowedUintDowncast(192, value);
        }
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        if (value > type(uint184).max) {
            revert SafeCastOverflowedUintDowncast(184, value);
        }
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        if (value > type(uint176).max) {
            revert SafeCastOverflowedUintDowncast(176, value);
        }
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        if (value > type(uint168).max) {
            revert SafeCastOverflowedUintDowncast(168, value);
        }
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        if (value > type(uint160).max) {
            revert SafeCastOverflowedUintDowncast(160, value);
        }
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        if (value > type(uint152).max) {
            revert SafeCastOverflowedUintDowncast(152, value);
        }
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        if (value > type(uint144).max) {
            revert SafeCastOverflowedUintDowncast(144, value);
        }
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        if (value > type(uint136).max) {
            revert SafeCastOverflowedUintDowncast(136, value);
        }
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        if (value > type(uint128).max) {
            revert SafeCastOverflowedUintDowncast(128, value);
        }
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        if (value > type(uint120).max) {
            revert SafeCastOverflowedUintDowncast(120, value);
        }
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        if (value > type(uint112).max) {
            revert SafeCastOverflowedUintDowncast(112, value);
        }
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        if (value > type(uint104).max) {
            revert SafeCastOverflowedUintDowncast(104, value);
        }
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        if (value > type(uint96).max) {
            revert SafeCastOverflowedUintDowncast(96, value);
        }
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        if (value > type(uint88).max) {
            revert SafeCastOverflowedUintDowncast(88, value);
        }
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        if (value > type(uint80).max) {
            revert SafeCastOverflowedUintDowncast(80, value);
        }
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        if (value > type(uint72).max) {
            revert SafeCastOverflowedUintDowncast(72, value);
        }
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        if (value > type(uint64).max) {
            revert SafeCastOverflowedUintDowncast(64, value);
        }
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        if (value > type(uint56).max) {
            revert SafeCastOverflowedUintDowncast(56, value);
        }
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        if (value > type(uint48).max) {
            revert SafeCastOverflowedUintDowncast(48, value);
        }
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        if (value > type(uint40).max) {
            revert SafeCastOverflowedUintDowncast(40, value);
        }
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        if (value > type(uint32).max) {
            revert SafeCastOverflowedUintDowncast(32, value);
        }
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        if (value > type(uint24).max) {
            revert SafeCastOverflowedUintDowncast(24, value);
        }
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        if (value > type(uint16).max) {
            revert SafeCastOverflowedUintDowncast(16, value);
        }
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        if (value > type(uint8).max) {
            revert SafeCastOverflowedUintDowncast(8, value);
        }
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        if (value < 0) {
            revert SafeCastOverflowedIntToUint(value);
        }
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(248, value);
        }
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(240, value);
        }
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(232, value);
        }
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(224, value);
        }
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(216, value);
        }
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(208, value);
        }
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(200, value);
        }
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(192, value);
        }
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(184, value);
        }
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(176, value);
        }
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(168, value);
        }
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(160, value);
        }
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(152, value);
        }
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(144, value);
        }
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(136, value);
        }
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(128, value);
        }
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(120, value);
        }
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(112, value);
        }
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(104, value);
        }
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(96, value);
        }
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(88, value);
        }
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(80, value);
        }
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(72, value);
        }
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(64, value);
        }
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(56, value);
        }
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(48, value);
        }
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(40, value);
        }
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(32, value);
        }
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(24, value);
        }
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(16, value);
        }
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(8, value);
        }
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        if (value > uint256(type(int256).max)) {
            revert SafeCastOverflowedUintToInt(value);
        }
        return int256(value);
    }
}

File 34 of 37 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

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

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

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

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

File 35 of 37 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

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

    uint256 private _status;

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

    constructor() {
        _status = NOT_ENTERED;
    }

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

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

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

File 36 of 37 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

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

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

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

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

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

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

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

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

File 37 of 37 : Time.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/types/Time.sol)

pragma solidity ^0.8.20;

import {Math} from "../math/Math.sol";
import {SafeCast} from "../math/SafeCast.sol";

/**
 * @dev This library provides helpers for manipulating time-related objects.
 *
 * It uses the following types:
 * - `uint48` for timepoints
 * - `uint32` for durations
 *
 * While the library doesn't provide specific types for timepoints and duration, it does provide:
 * - a `Delay` type to represent duration that can be programmed to change value automatically at a given point
 * - additional helper functions
 */
library Time {
    using Time for *;

    /**
     * @dev Get the block timestamp as a Timepoint.
     */
    function timestamp() internal view returns (uint48) {
        return SafeCast.toUint48(block.timestamp);
    }

    /**
     * @dev Get the block number as a Timepoint.
     */
    function blockNumber() internal view returns (uint48) {
        return SafeCast.toUint48(block.number);
    }

    // ==================================================== Delay =====================================================
    /**
     * @dev A `Delay` is a uint32 duration that can be programmed to change value automatically at a given point in the
     * future. The "effect" timepoint describes when the transitions happens from the "old" value to the "new" value.
     * This allows updating the delay applied to some operation while keeping some guarantees.
     *
     * In particular, the {update} function guarantees that if the delay is reduced, the old delay still applies for
     * some time. For example if the delay is currently 7 days to do an upgrade, the admin should not be able to set
     * the delay to 0 and upgrade immediately. If the admin wants to reduce the delay, the old delay (7 days) should
     * still apply for some time.
     *
     *
     * The `Delay` type is 112 bits long, and packs the following:
     *
     * ```
     *   | [uint48]: effect date (timepoint)
     *   |           | [uint32]: value before (duration)
     *   ↓           ↓       ↓ [uint32]: value after (duration)
     * 0xAAAAAAAAAAAABBBBBBBBCCCCCCCC
     * ```
     *
     * NOTE: The {get} and {withUpdate} functions operate using timestamps. Block number based delays are not currently
     * supported.
     */
    type Delay is uint112;

    /**
     * @dev Wrap a duration into a Delay to add the one-step "update in the future" feature
     */
    function toDelay(uint32 duration) internal pure returns (Delay) {
        return Delay.wrap(duration);
    }

    /**
     * @dev Get the value at a given timepoint plus the pending value and effect timepoint if there is a scheduled
     * change after this timepoint. If the effect timepoint is 0, then the pending value should not be considered.
     */
    function _getFullAt(Delay self, uint48 timepoint) private pure returns (uint32, uint32, uint48) {
        (uint32 valueBefore, uint32 valueAfter, uint48 effect) = self.unpack();
        return effect <= timepoint ? (valueAfter, 0, 0) : (valueBefore, valueAfter, effect);
    }

    /**
     * @dev Get the current value plus the pending value and effect timepoint if there is a scheduled change. If the
     * effect timepoint is 0, then the pending value should not be considered.
     */
    function getFull(Delay self) internal view returns (uint32, uint32, uint48) {
        return _getFullAt(self, timestamp());
    }

    /**
     * @dev Get the current value.
     */
    function get(Delay self) internal view returns (uint32) {
        (uint32 delay, , ) = self.getFull();
        return delay;
    }

    /**
     * @dev Update a Delay object so that it takes a new duration after a timepoint that is automatically computed to
     * enforce the old delay at the moment of the update. Returns the updated Delay object and the timestamp when the
     * new delay becomes effective.
     */
    function withUpdate(
        Delay self,
        uint32 newValue,
        uint32 minSetback
    ) internal view returns (Delay updatedDelay, uint48 effect) {
        uint32 value = self.get();
        uint32 setback = uint32(Math.max(minSetback, value > newValue ? value - newValue : 0));
        effect = timestamp() + setback;
        return (pack(value, newValue, effect), effect);
    }

    /**
     * @dev Split a delay into its components: valueBefore, valueAfter and effect (transition timepoint).
     */
    function unpack(Delay self) internal pure returns (uint32 valueBefore, uint32 valueAfter, uint48 effect) {
        uint112 raw = Delay.unwrap(self);

        valueAfter = uint32(raw);
        valueBefore = uint32(raw >> 32);
        effect = uint48(raw >> 64);

        return (valueBefore, valueAfter, effect);
    }

    /**
     * @dev pack the components into a Delay object.
     */
    function pack(uint32 valueBefore, uint32 valueAfter, uint48 effect) internal pure returns (Delay) {
        return Delay.wrap((uint112(effect) << 64) | (uint112(valueBefore) << 32) | uint112(valueAfter));
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 5500
  },
  "viaIR": true,
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"contract IERC20","name":"_stakingToken","type":"address"},{"internalType":"contract IERC20[]","name":"rewardTokens","type":"address[]"},{"internalType":"contract IMaverickV2VotingEscrow[]","name":"veTokens","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"ERC721EnumerableForbiddenBatchMint","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"ERC721OutOfBoundsIndex","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"currentBalance","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"minDuration","type":"uint256"},{"internalType":"uint256","name":"maxDuration","type":"uint256"}],"name":"RewardDurationOutOfBounds","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"approved","type":"address"},{"internalType":"address","name":"getter","type":"address"}],"name":"RewardNotApprovedGetter","type":"error"},{"inputs":[{"internalType":"uint8","name":"index","type":"uint8"}],"name":"RewardNotValidIndex","type":"error"},{"inputs":[{"internalType":"contract IERC20","name":"rewardTokenAddress","type":"address"}],"name":"RewardNotValidRewardToken","type":"error"},{"inputs":[{"internalType":"contract IERC20","name":"stakingToken","type":"address"}],"name":"RewardTokenCannotBeStakingToken","type":"error"},{"inputs":[],"name":"RewardTransferNotSupported","type":"error"},{"inputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"minTimestamp","type":"uint256"}],"name":"RewardUnboostedTimePeriodNotMet","type":"error"},{"inputs":[],"name":"RewardZeroAmount","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"rewardTokenAddress","type":"address"},{"indexed":false,"internalType":"uint8","name":"rewardTokenIndex","type":"uint8"}],"name":"AddRewardToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"getter","type":"address"}],"name":"ApproveRewardGetter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint8","name":"rewardTokenIndex","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"stakeDuration","type":"uint256"},{"indexed":false,"internalType":"contract IERC20","name":"rewardTokenAddress","type":"address"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"asVe","type":"bool"},{"internalType":"contract IMaverickV2VotingEscrow","name":"veContract","type":"address"}],"indexed":false,"internalType":"struct IMaverickV2Reward.RewardOutput","name":"rewardOutput","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"lockupId","type":"uint256"}],"name":"GetReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"contract IERC20","name":"rewardTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardRate","type":"uint256"}],"name":"NotifyRewardAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20","name":"rewardTokenAddress","type":"address"},{"indexed":false,"internalType":"uint8","name":"rewardTokenIndex","type":"uint8"}],"name":"RemoveRewardToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"supplier","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"userBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"}],"name":"Stake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"userBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"}],"name":"UnStake","type":"event"},{"inputs":[],"name":"MAX_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNBOOSTED_MIN_TIME_GAP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"contract IMaverickV2VotingEscrow","name":"veToken","type":"address"},{"internalType":"uint256","name":"rawAmount","type":"uint256"},{"internalType":"uint256","name":"stakeDuration","type":"uint256"}],"name":"boostedAmount","outputs":[{"internalType":"uint256","name":"earnedAmount","type":"uint256"},{"internalType":"bool","name":"asVe","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"checkAuthorized","outputs":[{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractInfo","outputs":[{"components":[{"internalType":"uint256","name":"finishAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"escrowedReward","type":"uint256"},{"internalType":"uint256","name":"rewardPerTokenStored","type":"uint256"},{"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"internalType":"contract IMaverickV2VotingEscrow","name":"veRewardToken","type":"address"},{"internalType":"uint128","name":"unboostedAmount","type":"uint128"},{"internalType":"uint256","name":"lastUnboostedPushTimestamp","type":"uint256"}],"internalType":"struct IMaverickV2Reward.RewardInfo[]","name":"info","type":"tuple[]"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"contract IERC20","name":"stakingToken","type":"address"}],"internalType":"struct IMaverickV2Reward.ContractInfo","name":"_contractInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"earned","outputs":[{"components":[{"internalType":"uint256","name":"earned","type":"uint256"},{"internalType":"contract IERC20","name":"rewardToken","type":"address"}],"internalType":"struct IMaverickV2Reward.EarnedInfo[]","name":"earnedInfo","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"contract IERC20","name":"rewardTokenAddress","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint8","name":"rewardTokenIndex","type":"uint8"},{"internalType":"uint256","name":"stakeDuration","type":"uint256"}],"name":"getReward","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"asVe","type":"bool"},{"internalType":"contract IMaverickV2VotingEscrow","name":"veContract","type":"address"}],"internalType":"struct IMaverickV2Reward.RewardOutput","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint8","name":"rewardTokenIndex","type":"uint8"},{"internalType":"uint256","name":"stakeDuration","type":"uint256"}],"name":"getRewardToOwner","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"asVe","type":"bool"},{"internalType":"contract IMaverickV2VotingEscrow","name":"veContract","type":"address"}],"internalType":"struct IMaverickV2Reward.RewardOutput","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint8","name":"rewardTokenIndex","type":"uint8"},{"internalType":"uint256","name":"stakeDuration","type":"uint256"},{"internalType":"uint256","name":"lockupId","type":"uint256"}],"name":"getRewardToOwnerForExistingVeLockup","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"asVe","type":"bool"},{"internalType":"contract IMaverickV2VotingEscrow","name":"veContract","type":"address"}],"internalType":"struct IMaverickV2Reward.RewardOutput","name":"","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintToSender","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenId","outputs":[{"internalType":"uint256","name":"nextTokenId_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"notifyRewardAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"rewardTokenIndex","type":"uint8"}],"name":"pushUnboostedToVe","outputs":[{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint48","name":"timepoint","type":"uint48"},{"internalType":"uint256","name":"batchIndex","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardData","outputs":[{"internalType":"uint64","name":"finishAt","type":"uint64"},{"internalType":"uint64","name":"updatedAt","type":"uint64"},{"internalType":"uint128","name":"rewardRate","type":"uint128"},{"internalType":"uint128","name":"escrowedReward","type":"uint128"},{"internalType":"uint128","name":"unboostedAmount","type":"uint128"},{"internalType":"uint256","name":"lastUnboostedPushTimestamp","type":"uint256"},{"internalType":"uint256","name":"rewardPerTokenStored","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardInfo","outputs":[{"components":[{"internalType":"uint256","name":"finishAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint256","name":"rewardRate","type":"uint256"},{"internalType":"uint256","name":"escrowedReward","type":"uint256"},{"internalType":"uint256","name":"rewardPerTokenStored","type":"uint256"},{"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"internalType":"contract IMaverickV2VotingEscrow","name":"veRewardToken","type":"address"},{"internalType":"uint128","name":"unboostedAmount","type":"uint128"},{"internalType":"uint256","name":"lastUnboostedPushTimestamp","type":"uint256"}],"internalType":"struct IMaverickV2Reward.RewardInfo[]","name":"info","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"index","type":"uint8"}],"name":"rewardTokenByIndex","outputs":[{"internalType":"contract IERC20","name":"output","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardTokenCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stake","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"stakedTokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"stakeBalanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakeTotalSupply","outputs":[{"internalType":"uint256","name":"supply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokenIdsOfOwner","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"rewardToken","type":"address"}],"name":"tokenIndex","outputs":[{"internalType":"uint8","name":"rewardTokenIndex","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"includeStakingToken","type":"bool"}],"name":"tokenList","outputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"ownerToCheck","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndexExists","outputs":[{"internalType":"bool","name":"exists","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"rewardToken","type":"address"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferAndNotifyRewardAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferAndStake","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"stakedTokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstakeToOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"contract IMaverickV2RewardVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"index","type":"uint8"}],"name":"veTokenByIndex","outputs":[{"internalType":"contract IMaverickV2VotingEscrow","name":"output","type":"address"}],"stateMutability":"view","type":"function"}]

6102206040523461065d576155f48038038061001a8161067a565b928339810160a08282031261065d5781516001600160401b03919082811161065d578161004891850161069f565b926020918282015184811161065d578161006391840161069f565b936100706040840161070a565b93606084015182811161065d57840193601f84818701121561065d578551916100a061009b8461071e565b61067a565b9684888581520185600595861b8301019188831161065d5786809101915b838310610662575050505060808101519085821161065d57019480828701121561065d5785516100f061009b8261071e565b968580898481520192861b82010192831161065d578501905b82821061063e575050508851978489116106285760009889549a60019b8c81811c9116801561061e575b8782101461060a579081858493116105be575b508690858311600114610556578c9261054b575b5050600019600383901b1c1916908b1b1789555b805192858411610537578a54908b82811c9216801561052d575b868310146105195790839291859482116104c8575b50508491831160011461046957899261045e575b5050600019600383901b1c191690881b1787555b86600a5586600d5584608052604051916104d4808401918483109083111761044a5790839161512083396001600160a01b03968716815203019085f093841561043e575082610200941684528151946101e09580875261041a575b8551116103f6575b60028551116103d2575b60038551116103ad575b6004855111610387575b5050506040519061498792836107998439608051838181610bd801528181610e16015281816114ca01528181611f470152612edd015260a0518381816116100152818161282b0152612a24015260c0518381816115d60152818161285401526129ff015260e0518381816115980152818161287d01526129da01526101005183818161155a015281816128a601526129b5015261012051838181611506015281816128ce015261299101526101405183612de801526101605183612dc301526101805183612d9e01526101a05183612d7901526101c05183612d55015251828181610973015281816113c70152818161142201528181611661015281816118970152818161294c01528181612d100152818161350001526146f401525181818161027401528181610bb501528181610c78015281816117050152612eb60152f35b8261039461039f93610788565b511661012052610788565b51166101c052388080610246565b826103b783610778565b511661010052826103c782610778565b51166101a05261023c565b826103dc83610768565b511660e052826103eb82610768565b511661018052610232565b8261040083610758565b511660c0528261040f82610758565b511661016052610228565b8361042484610735565b511660a0528361043383610735565b511661014052610220565b604051903d90823e3d90fd5b634e487b7160e01b88526041600452602488fd5b0151905038806101b1565b8a8a52848a208b94509190601f1984168b5b878282106104b25750508411610499575b505050811b0187556101c5565b015160001960f88460031b161c1916905538808061048c565b8385015186558e9790950194938401930161047b565b90919293508b8b52858b209084808701821c830193888810610510575b9187968f93969594929601901c01915b828110610502575061019d565b8c81558695508d91016104f5565b935082936104e5565b634e487b7160e01b8b52602260045260248bfd5b91607f1691610188565b634e487b7160e01b8a52604160045260248afd5b01519050388061015a565b8c8052878d208e94509190601f1984168e5b8a82821061059f5750508411610586575b505050811b01895561016e565b015160001960f88460031b161c19169055388080610579565b91929395968291958786015181550195019301908f9594939291610568565b9091508b8052868c2085808501881c820192898610610601575b918f918695949301891c01915b8281106105f3575050610146565b8e81558594508f91016105e5565b925081926105d8565b634e487b7160e01b8c52602260045260248cfd5b90607f1690610133565b634e487b7160e01b600052604160045260246000fd5b81516001600160a01b038116810361065d578152908501908501610109565b600080fd5b819061066d8461070a565b81520191019086906100be565b6040519190601f01601f191682016001600160401b0381118382101761062857604052565b919080601f8401121561065d5782516001600160401b038111610628576020906106d1601f8201601f1916830161067a565b9281845282828701011161065d5760005b8181106106f757508260009394955001015290565b85810183015184820184015282016106e2565b51906001600160a01b038216820361065d57565b6001600160401b0381116106285760051b60200190565b8051156107425760200190565b634e487b7160e01b600052603260045260246000fd5b8051600110156107425760400190565b8051600210156107425760600190565b8051600310156107425760800190565b8051600410156107425760a0019056fe608060408181526004918236101561001657600080fd5b600092833560e01c91826301ffc9a71461212a5750816306fdde031461210c578163081812fc146120d2578163095ea7b314611fc657816315c43aaf14611eca57816318160ddd14611eab57816323b872dd14611e935781632f745c5914611e6a5781633a3619de14611e175781633e3cc23914611d8d578163427f91a614611d6a57816342842e0e14611d415781634709b70914611d23578163482af13b14611cf557816348fd65fe14611cca5781634b986ec214611c825781634c465899146119e25781634d6ed8c41461187d5781634f6ccce71461180f57816351a7c716146116865781635d62fd5f1461139e5781636352211e146113765781636565ac99146113405781636a6278421461131a5781636deda0fc14610e6057816370a0823114610e3a57816372f702f314610df6578163751df17a14610db357816375794a3c14610d945781637aaa90e114610c0157816388a2955214610b9157816395d89b4114610b605781639e59e59814610a98578163a22cb465146109c1578163a694fc3a14610996578163abb06b951461095b578163ac9650d81461079e578163b1724b4614610780578163b66503cf14610760578163b6a6d17714610742578163b88d4fde146106da578163c58181c4146106bb578163c87b56dd14610498578163c9f6707214610463578163d6d8266f146103cf578163e39c08fc14610375578163e48e622714610357578163e985e9c514610306578163f01a11fc146102da57508063f476eaf21461029c5763fbfa77cf1461025657600080fd5b34610298578160031936011261029857602090516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b5080fd5b5034610298576060600319360112610298576020906102d36102bc612274565b6102ca604435303384613f54565b60243590613023565b9051908152f35b905034610302576020600319360112610302576020928291358152600b845220549051908152f35b8280fd5b505034610298578060031936011261029857602091610323612274565b8261032c61228a565b926001600160a01b03809316815260058652209116600052825260ff81600020541690519015158152f35b5050346102985781600319360112610298576020906102d333613bf1565b8284346103cc57816003193601126103cc5760ff61039961039461228a565b61281c565b169060058210156103b9575060209260066102d39202600e019035613b79565b80603285634e487b7160e01b6024945252fd5b80fd5b905082346103cc5760806003193601126103cc575035906103ee61228a565b6044359060ff8216820361045e5760609361045c926104349261040f6127fd565b50610423833361041e82613681565b613e59565b6064359261042f6127fd565b6136d5565b915180926001600160a01b036040809280518552602081015115156020860152015116910152565bf35b600080fd5b505034610298578160031936011261029857610494906104816134fe565b90519182916020835260208301906122a0565b0390f35b90503461030257602090816003193601126106b75781929381356104bb81613681565b508551926104c884612435565b828452821561069a5781829184937a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000908181101561068d575b5050866d04ee2d6d415b85acef81000000008085101561067f575b5050662386f26fc1000080841015610670575b506305f5e10080841015610661575b5061271080841015610653575b50506064821015610643575b600a80921015610639575b60219088936001928161058b600186940161058361057a82612474565b9951998a612451565b808952612474565b97601f198b89019901368a3750860101905b6105f6575b50505050926105d9926105e59261049495885195836105ca889551809288808901910161222c565b8401915180938684019061222c565b01038084520182612451565b925b5192828493845283019061224f565b600019849101917f30313233343536373839616263646566000000000000000000000000000000008282061a8353049182156106345791908261059d565b6105a2565b916001019161055d565b9190606460029104910191610552565b930192909104903880610546565b60089194930492019238610539565b6010919493049201923861052a565b940193909204918638610517565b8a955004925038806104fc565b505050505061049482516106ad81612435565b60008152926105e7565b8380fd5b505034610298578160031936011261029857602090600c549051908152f35b839034610298576080600319360112610298576106f5612274565b6106fd61228a565b9060643567ffffffffffffffff811161073e573660238201121561073e5761073b9381602461073193369301359101612490565b916044359161335f565b80f35b8480fd5b505034610298578160031936011261029857602090516203f4808152f35b5050346102985780600319360112610298576020906102d36102ca612274565b505034610298578160031936011261029857602090516234bc008152f35b8391503461029857602091826003193601126103cc5781359167ffffffffffffffff90818411610302573660238501121561030257830135908082116103025760246005923660248260051b8801011161073e57926107fc84612c81565b9561080989519788612451565b848752601f1961081886612c81565b0188875b82811061094b5750505085917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbd82360301925b8681106108d1578a8a8a8a83519280840190808552835180925280868601968360051b870101940192955b8287106108875785850386f35b9091929382806108c1837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08a60019603018652885161224f565b960192019601959291909261087a565b8481831b84010135848112156109475783018581013590878211610943576044019080360382136109435789808d61091160019695610927953691612490565b80519101305af4610920613fc5565b9030614762565b610931828c612caa565b5261093c818b612caa565b500161084f565b8980fd5b8880fd5b60608a82018301528a910161081c565b505034610298578160031936011261029857602090517f00000000000000000000000000000000000000000000000000000000000000008152f35b905082346103cc5760206003193601126103cc57506109b59035612e5b565b82519182526020820152f35b919050346103025780600319360112610302576109dc612274565b906024359182151580930361045e576001600160a01b0316928315610a6a5750338452600560205280842083600052602052806000207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541660ff8416179055519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b8360249251917f5b08ba18000000000000000000000000000000000000000000000000000000008352820152fd5b8284346103cc57602090816003193601126103cc578290610ab7612274565b90610ac182612e0a565b610aca81612c81565b90610ad785519283612451565b808252610ae381612c81565b93601f198784019501368637835b828110610b365750505083519485948186019282875251809352850193925b828110610b1f57505050500390f35b835185528695509381019392810192600101610b10565b80610b49600192849a979698999a612783565b610b538289612caa565b5201969594929396610af1565b50503461029857816003193601126102985761049490610b7e614156565b905191829160208352602083019061224f565b8284346103cc57506109b5610bfc610ba8366123a0565b6001600160a01b039291927f000000000000000000000000000000000000000000000000000000000000000016337f0000000000000000000000000000000000000000000000000000000000000000613f54565b612e5b565b83833461029857610c11366123a0565b919093610c22853361041e82613681565b610c2b85613681565b92610c34613ff5565b8015610d6c57610c43866146f2565b858552600b60205282852054808211610d2a578190869782600c5403600c558752600b60205203838620556001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016803b15610d2657610cef948680948651978895869485937ff3fef3a30000000000000000000000000000000000000000000000000000000085528401602090939291936001600160a01b0360408201951681520152565b03925af1908115610d1d5750610d09575b506001600d5580f35b610d12906123e8565b6103cc578082610d00565b513d84823e3d90fd5b8580fd5b92517ffcca3733000000000000000000000000000000000000000000000000000000008152918201868152602081019390935260408301529081906060010390fd5b5090517f14f29f88000000000000000000000000000000000000000000000000000000008152fd5b505034610298578160031936011261029857602090600a549051908152f35b5050346102985780600319360112610298576020906001600160a01b03610dd8612274565b91610def602435610de881613681565b9485613e59565b5191168152f35b505034610298578160031936011261029857602090516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b505034610298576020600319360112610298576020906102d3610e5b612274565b612e0a565b8284346103cc5760806003193601126103cc5750813591610e7f612380565b9260443590606435610e8f6127fd565b50610e9e823361041e82613681565b610ea782613681565b610eaf6127fd565b610eb7613ff5565b966005811015611305576006810294610ed386600e018661420d565b8460005260138601602052876000208054976fffffffffffffffffffffffffffffffff97888a169283610f34575b60608d61045c8e6001600d555180926001600160a01b036040809280518552602081015115156020860152015116910152565b600f92939495969798999a9c506fffffffffffffffffffffffffffffffff19809d16905501908154838a8216039b8a8d116112f0578a8a9b9c9d9a999a169116178255610f8085612947565b610f8986612d0b565b90610f9e868684610f986127fd565b9c612a9a565b15801560208c0152818b526112475750908b8d6060938b8b8e610fcf6001600160a01b0380981694858551916139f1565b8385840152600019811460001461118b5750509060649394610ff360009351613b24565b935197889687957f1ef3467b00000000000000000000000000000000000000000000000000000000875216908501528a60248501528c1660448401525af18015611180579460609b98946110e5947fe47c57318950d2a193de7632844e22ae34cd95299259fc16515741c22b5d91ad9994610140999461045c9d99611151575b505b859d8651908184116110fc575b5050505060ff61109183612947565b928b5198338a5260208a01526001600160a01b038095168c8a0152168d88015260808701521660a085015260c08401906001600160a01b036040809280518552602081015115156020860152015116910152565b610120820152a19192848080808080808080610f01565b61110c61111792611148956139c0565b16825460801c6139cd565b6fffffffffffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff1983549260801b169116179055565b8d808080611082565b8f90611172913d606011611179575b61116a8183612451565b8101906142e3565b508f611073565b503d611160565b8b513d6000823e3d90fd5b93608495919461119e6000959451613b24565b9151998a9889977fea4914ef000000000000000000000000000000000000000000000000000000008952169087015260248601528b60448601521660648401525af18015611180579460609b98946110e5947fe47c57318950d2a193de7632844e22ae34cd95299259fc16515741c22b5d91ad9994610140999461045c9d99611228575b50611075565b8f90611240913d6060116111795761116a8183612451565b508f611222565b61014098935061045c9b979250947fe47c57318950d2a193de7632844e22ae34cd95299259fc16515741c22b5d91ad99946112eb60609f9c98936112d8906112e68f9a6110e59b519384917fa9059cbb0000000000000000000000000000000000000000000000000000000060208401528b60248401602090939291936001600160a01b0360408201951681520152565b03601f198101845283612451565b6145cf565b611075565b601183634e487b7160e01b6000525260246000fd5b603286634e487b7160e01b6000525260246000fd5b505034610298576020600319360112610298576020906102d361133b612274565b613bf1565b505034610298576020600319360112610298576020906001600160a01b0361136e611369612390565b612d0b565b915191168152f35b8284346103cc5760206003193601126103cc57506001600160a01b0361136e60209335613681565b8284346103cc57602090816003193601126103cc57833591821515830361045e57821561165f577f00000000000000000000000000000000000000000000000000000000000000006001810180911161164c57915b6114146113ff84612c81565b9361140c87519586612451565b808552612c81565b93601f1983850195013686377f000000000000000000000000000000000000000000000000000000000000000090816115ff575b600197600183116115c2575b60028311611584575b60038311611546575b8083116114f2575b506114b6575b5091908495939551948186019282875251809352850195925b82811061149a5785870386f35b83516001600160a01b031687529581019592810192840161148d565b6114c09084612caa565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016905286611474565b855181101561153157506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660a08601528861146e565b603290634e487b7160e01b6000525260246000fd5b855160031015611531576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166080870152611466565b855160021015611531576001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016606087015261145d565b855160011015611531576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001688870152611454565b845115611637576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168652611448565b603288634e487b7160e01b6000525260246000fd5b602483601188634e487b7160e01b835252fd5b7f0000000000000000000000000000000000000000000000000000000000000000916113f3565b919050346103025760606003193601126103025781356116a461228a565b604435916116b6813361041e82613681565b6116be613ff5565b82156117e6576116cd816146f2565b808652600b60205283862054908184116117a35792809291879482600c5403600c558552600b60205203848420556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690813b156106b7578361177b968651978895869485937ff3fef3a30000000000000000000000000000000000000000000000000000000085528401602090939291936001600160a01b0360408201951681520152565b03925af1908115610d1d575061179457506001600d5580f35b61179d906123e8565b38610d00565b84517ffcca373300000000000000000000000000000000000000000000000000000000815280870191825260208201839052604082018590529081906060010390fd5b505050517f14f29f88000000000000000000000000000000000000000000000000000000008152fd5b905034610302576020600319360112610302578035926008548410156118495760208361183b86612cd4565b91905490519160031b1c8152f35b604493919251927fa57d13dc0000000000000000000000000000000000000000000000000000000084528301526024820152fd5b8383346102985760209081600319360112610302578335907f0000000000000000000000000000000000000000000000000000000000000000926118c084612c81565b926118cd83519485612451565b848452601f196118dc86612c81565b0182875b8281106119c157505050855b60ff81168681101561196c576005821015611959579061194e6119549261191960068402600e0186613b79565b6001600160a01b0361192a85612947565b895192611936846123b6565b83521687820152611947828a612caa565b5287612caa565b50612c99565b6118ec565b60248860328b634e487b7160e01b835252fd5b8451848152865181860181905281908188019089880190888d8b5b8382106119945786860387f35b8451805187528301516001600160a01b031686840152879650948501949382019360019190910190611987565b85516119cc816123b6565b89815289838201528282890101520183906118e0565b90503461030257602091826003193601126106b7576119ff612390565b92611a0984612d0b565b90611a1385612947565b946005811015611c6f5760060294600f8601948554958660801c978815611c47576010019081546277f8808101809111611c345780421115611bfe57506fffffffffffffffffffffffffffffffff80981690554290556001600160a01b03809416611a7f8882856139f1565b65ffffffffffff804211611bc8579089914216958751947faa902b4d0000000000000000000000000000000000000000000000000000000086528686868187875af1958615611bbe57918795939185938d9698611b84575b50611ae56084969798613b24565b9b8b519c8d9889977f3082f0e90000000000000000000000000000000000000000000000000000000089528801528b60248801521660448601521660648401525af1938415611b7a578694611b47575b50606095508251948552840152820152f35b9080945081813d8311611b73575b611b5f8183612451565b81010312610d265760609550519238611b35565b503d611b55565b83513d88823e3d90fd5b95509590965084813d8311611bb7575b611b9e8183612451565b810103126102985792519486948b949190611ae5611ad7565b503d611b94565b89513d86823e3d90fd5b60448360308951917f6dfcc650000000000000000000000000000000000000000000000000000000008352820152426024820152fd5b836044918951917fb5b2827a00000000000000000000000000000000000000000000000000000000835242908301526024820152fd5b60248b601186634e487b7160e01b835252fd5b8287517f14f29f88000000000000000000000000000000000000000000000000000000008152fd5b602487603287634e487b7160e01b835252fd5b90503461030257608060031936011261030257602435906001600160a01b03821682036106b75790611cbc91606435916044359135612a9a565b825191825215156020820152f35b505034610298578060031936011261029857602090611cea610e5b612274565b602435109051908152f35b505034610298576020600319360112610298576020906001600160a01b0361136e611d1e612390565b612947565b505034610298578160031936011261029857602090516277f8808152f35b5050346102985761073b90611d553661234b565b91925192611d6284612435565b85845261335f565b5050346102985760206003193601126102985760209060ff61136e610394612274565b90503461030257602060031936011261030257359160058310156103cc5750600660e0920280600e01549067ffffffffffffffff92600f820154906011601084015493015493815195808216875281831c16602087015260801c908501526fffffffffffffffffffffffffffffffff8116606085015260801c608084015260a083015260c0820152f35b8284346103cc5760606003193601126103cc575061045c61043460609335611e3d612380565b611e456127fd565b50611e54823361041e82613681565b60443591611e6181613681565b9061042f6127fd565b5050346102985780600319360112610298576020906102d3611e8a612274565b60243590612783565b83346103cc5761073b611ea53661234b565b916124c7565b5050346102985781600319360112610298576020906008549051908152f35b8284346103cc57806003193601126103cc5781516080810181811067ffffffffffffffff821117611fb357611f7d945083526060815260606020820181815284830193808552828401908152611f1e6134fe565b95611f27614050565b8552611f31614156565b8352600c548652611fa46001600160a01b0393847f0000000000000000000000000000000000000000000000000000000000000000168452611f9583519a8b9a858c52858c01906122a0565b978a890360208c01525160808952608089019061224f565b9051878203602089015261224f565b95519085015251169101520390f35b602483604187634e487b7160e01b835252fd5b91905034610302578060031936011261030257611fe1612274565b91602435611fee81613681565b331515806120bf575b80612097575b6120685781906001600160a01b03809616958691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258880a484526020528220907fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905580f35b83517fa9fbf51f0000000000000000000000000000000000000000000000000000000081523381850152602490fd5b506001600160a01b0381168652600560205283862033875260205260ff848720541615611ffd565b50336001600160a01b0382161415611ff7565b9050346103025760206003193601126103025781602093826001600160a01b0393356120fd81613681565b50825285522054169051908152f35b50503461029857816003193601126102985761049490610b7e614050565b84913461030257602060031936011261030257357fffffffff00000000000000000000000000000000000000000000000000000000811680910361030257602092507f780e9d6300000000000000000000000000000000000000000000000000000000811490811561219e575b5015158152f35b7f80ac58cd00000000000000000000000000000000000000000000000000000000811491508115612202575b81156121d8575b5083612197565b7f01ffc9a700000000000000000000000000000000000000000000000000000000915014836121d1565b7f5b5e139f00000000000000000000000000000000000000000000000000000000811491506121ca565b60005b83811061223f5750506000910152565b818101518382015260200161222f565b90601f19601f60209361226d8151809281875287808801910161222c565b0116010190565b600435906001600160a01b038216820361045e57565b602435906001600160a01b038216820361045e57565b90815180825260208080930193019160005b8281106122c0575050505090565b835180518652808301518684015260408082015190870152606080820151908701526080808201519087015260a0808201516001600160a01b039081169188019190915260c0808301519091169087015260e0808201516fffffffffffffffffffffffffffffffff1690870152610100908101519086015261012090940193928101926001016122b2565b600319606091011261045e576001600160a01b0390600435828116810361045e5791602435908116810361045e579060443590565b6024359060ff8216820361045e57565b6004359060ff8216820361045e57565b600319604091011261045e576004359060243590565b6040810190811067ffffffffffffffff8211176123d257604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff81116123d257604052565b6060810190811067ffffffffffffffff8211176123d257604052565b610120810190811067ffffffffffffffff8211176123d257604052565b6020810190811067ffffffffffffffff8211176123d257604052565b90601f601f19910116810190811067ffffffffffffffff8211176123d257604052565b67ffffffffffffffff81116123d257601f01601f191660200190565b92919261249c82612474565b916124aa6040519384612451565b82948184528183011161045e578281602093846000960137010152565b916001600160a01b0380831693841561275257600094838652602095600287526040968488832054169633612742575b871580156126f2575b848452600383528984206001815401905587845260028352898420857fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905587858a7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8780a4156126765760085487845260098352808a8520556801000000000000000081101561266257876125a38260016125bb9401600855612cd4565b90919060001983549160031b92831b921b1916179055565b838803612610575b5050505016928383036125d65750505050565b6064945051927f64283d7b000000000000000000000000000000000000000000000000000000008452600484015260248301526044820152fd5b61261990612e0a565b92600019840193841161264e5782916007918a94526006815283832085845281528784842055878352522055388080806125c3565b602483634e487b7160e01b81526011600452fd5b602484634e487b7160e01b81526041600452fd5b8784146125bb5761268688612e0a565b87845260078352898420548181036126bb575b50878452838a81205588845260068352898420908452825282898120556125bb565b898552600684528a852082865284528a8520548a8652600685528b86208287528552808c8720558552600784528a85205538612699565b61272b88600052600460205260406000207fffffffffffffffffffffffff00000000000000000000000000000000000000008154169055565b888452600383528984206000198154019055612500565b61274d87338a613e59565b6124f7565b60246040517f64a0ae9200000000000000000000000000000000000000000000000000000000815260006004820152fd5b61278c81612e0a565b8210156127b9576001600160a01b0316600052600660205260406000209060005260205260406000205490565b6040517fa57d13dc0000000000000000000000000000000000000000000000000000000081526001600160a01b039190911660048201526024810191909152604490fd5b6040519061280a826123fc565b60006040838281528260208201520152565b6001600160a01b0380911690807f000000000000000000000000000000000000000000000000000000000000000016821461294057807f000000000000000000000000000000000000000000000000000000000000000016821461293957807f000000000000000000000000000000000000000000000000000000000000000016821461293257807f000000000000000000000000000000000000000000000000000000000000000016821461292b577f000000000000000000000000000000000000000000000000000000000000000016811461292557602490604051907f3dc09a5c0000000000000000000000000000000000000000000000000000000082526004820152fd5b50600490565b5050600390565b5050600290565b5050600190565b5050600090565b60ff167f0000000000000000000000000000000000000000000000000000000000000000811015612a46578015612a2157600181146129fc57600281146129d7576003146129b3577f000000000000000000000000000000000000000000000000000000000000000090565b7f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000000000000000000000000000000000000000000090565b602490604051907f205467d70000000000000000000000000000000000000000000000000000000082526004820152fd5b91908201809211612a8457565b634e487b7160e01b600052601160045260246000fd5b929392600092916001600160a01b0390811690848215612c765750612abe83613681565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152911660048201526020918282602481845afa918215612c3c578692612c47575b50908260049392604051948580927f18160ddd0000000000000000000000000000000000000000000000000000000082525afa928315612c3c578693612c0c575b50612b90939291612b64600b9260019485811190861802851890614322565b93875252612b826040862054600c5483811190841802831890614322565b8181119082180218906143d7565b670a688906bd8b000090810180911161264e57670de0b6b3a764000090612bb686614456565b936702c68af0bb140000948501809511612bf85750918183612bed93612bf2969510908218028118938181109082180218906144cc565b6144cc565b91151590565b80634e487b7160e01b602492526011600452fd5b9092508181813d8311612c35575b612c248183612451565b81010312610d26575191600b612b45565b503d612c1a565b6040513d88823e3d90fd5b9091508281813d8311612c6f575b612c5f8183612451565b81010312610d2657519082612b04565b503d612c55565b959650505050905091565b67ffffffffffffffff81116123d25760051b60200190565b60ff1660ff8114612a845760010190565b8051821015612cbe5760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b600854811015612cbe5760086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30190600090565b60ff167f0000000000000000000000000000000000000000000000000000000000000000811015612a46578015612de55760018114612dc05760028114612d9b57600314612d77577f000000000000000000000000000000000000000000000000000000000000000090565b7f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000000000000000000000000000000000000000000090565b6001600160a01b03168015612e2a57600052600360205260406000205490565b60246040517f89c62b6400000000000000000000000000000000000000000000000000000000815260006004820152fd5b8015612fa1575b612e6a613ff5565b612e7381613681565b50612e7d816146f2565b602460206001600160a01b03604051928380927f70a08231000000000000000000000000000000000000000000000000000000008252807f00000000000000000000000000000000000000000000000000000000000000001660048301527f0000000000000000000000000000000000000000000000000000000000000000165afa908115612f9557600091612f63575b50600c548091818110600014612f5c5750506000905b8180612f35575b50506001600d5591565b612f3e91612a77565b600c5581600052600b60205260406000208181540190553881612f2b565b0390612f24565b90506020813d602011612f8d575b81612f7e60209383612451565b8101031261045e575138612f0e565b3d9150612f71565b6040513d6000823e3d90fd5b50612fab33612e0a565b1561301557612fb933612e0a565b15612fde57336000526006602052604060002060008052602052604060002054612e62565b60446040517fa57d13dc00000000000000000000000000000000000000000000000000000000815233600482015260006024820152fd5b61301e33613bf1565b612e62565b9061302c613ff5565b6203f48080821061331f576234bc00908183116132e35750509061304f8161281c565b6005811015612cbe5780602460066130829302602081600e0193613072856147f5565b6001600160a01b03958691612947565b16604051938480927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa918215612f95576000926132ae575b50600f01546fffffffffffffffffffffffffffffffff1690818110156132a75750506000905b805467ffffffffffffffff908181164281101561329e57506000905b60801c9081810290808204831490151715612a84578060011b9080820460021490151715612a845784118015613296575b1561325957509160a0939161322e7ffcb9ca03b70a876a8d62dc2ef18aa125118fd02dae56cfffc36a627e7b1c481196946131af61317d6131788b87614030565b613b24565b84546fffffffffffffffffffffffffffffffff1660809190911b6fffffffffffffffffffffffffffffffff1916178455565b806131c26131bd8b42612a77565b614904565b167fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000845416178355421682907fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff6fffffffffffffffff000000000000000083549260401b169116179055565b5460801c916040519333855216602084015260408301528460608301526080820152a1906001600d55565b839196509161322e61329060a096947ffcb9ca03b70a876a8d62dc2ef18aa125118fd02dae56cfffc36a627e7b1c48119896614030565b976131af565b508015613137565b42900390613106565b03906130ea565b9091506020813d6020116132db575b816132ca60209383612451565b8101031261045e575190600f6130c4565b3d91506132bd565b60649350604051927fd3350e51000000000000000000000000000000000000000000000000000000008452600484015260248301526044820152fd5b60649250604051917fd3350e51000000000000000000000000000000000000000000000000000000008352600483015260248201526234bc006044820152fd5b919061336c8282856124c7565b803b613379575b50505050565b6133d56001600160a01b03809216946040519384937f150b7a020000000000000000000000000000000000000000000000000000000096878652336004870152166024850152604484015260806064840152608483019061224f565b03906020816000938185885af19082908261349d575b505061343b57826133fa613fc5565b805191908261343457602482604051907f64a0ae920000000000000000000000000000000000000000000000000000000082526004820152fd5b9050602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000160361346c575038808080613373565b602490604051907f64a0ae920000000000000000000000000000000000000000000000000000000082526004820152fd5b909192506020813d6020116134f6575b816134ba60209383612451565b810103126102985751907fffffffff00000000000000000000000000000000000000000000000000000000821682036103cc57509038806133eb565b3d91506134ad565b7f00000000000000000000000000000000000000000000000000000000000000009061352982612c81565b9160409061353982519485612451565b808452601f1961354882612c81565b0160005b81811061362c5750508360005b60ff81169083821015613624576005811015612cbe5761194e61361f926006830280600e015467ffffffffffffffff916080601182015461359988612947565b906135a389612d0b565b908d6010600f870154960154968151986135bc8a612418565b8082168a5281831c1660208a0152851c908801526fffffffffffffffffffffffffffffffff85166060880152838701526001600160a01b0380921660a08701521660c08501521c60e0830152610100820152613618828b612caa565b5288612caa565b613559565b505093505050565b602090845161363a81612418565b60008152826000818301526000878301526000606083015260006080830152600060a0830152600060c0830152600060e0830152600061010083015282890101520161354c565b8060005260026020526001600160a01b03604060002054169081156136a4575090565b602490604051907f7e2732890000000000000000000000000000000000000000000000000000000082526004820152fd5b93929091936136e2613ff5565b936005821015612cbe5760068202936136fe85600e018561420d565b836000526013850160205260409081600020938454946fffffffffffffffffffffffffffffffff978887169182613742575b50505050505050505050906001600d55565b600f92939495969798999a506fffffffffffffffffffffffffffffffff198099169055018054828a821603978a8911612a84578a8a9916911617815561378783612947565b8961379185612d0b565b916137a68786856137a06127fd565b9d612a9a565b15801560208d0152818c5261393057509060648a6137d46060946001600160a01b03809716809351916139f1565b808a8d015260006137e58d51613b24565b918b5196879586947f1ef3467b0000000000000000000000000000000000000000000000000000000086521660048501528b60248501528d1660448401525af1801561392557936138d4969361014099969360ff937fe47c57318950d2a193de7632844e22ae34cd95299259fc16515741c22b5d91ad9c9a97613906575b505b879c8851908184116138ed575b5050505061387f81612947565b93805198338a5260208a01526001600160a01b038096169089015216606087015260808601521660a084015260c08301906001600160a01b036040809280518552602081015115156020860152015116910152565b600019610120820152a138808080808080808080613730565b61110c611117926138fd956139c0565b38808080613872565b61391e9060603d6060116111795761116a8183612451565b5038613863565b86513d6000823e3d90fd5b60ff93507fe47c57318950d2a193de7632844e22ae34cd95299259fc16515741c22b5d91ad9b99969250936139bb6112d88a97936112e66101409e9b986138d49d519384917fa9059cbb0000000000000000000000000000000000000000000000000000000060208401528d60248401602090939291936001600160a01b0360408201951681520152565b613865565b91908203918211612a8457565b9190916fffffffffffffffffffffffffffffffff80809416911601918211612a8457565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000602082018181526001600160a01b038516602484015260448084019690965294825294939092613a46606485612451565b6001600160a01b0390818416600080809588519082855af190613a67613fc5565b82613af2575b5081613ae7575b5015613a84575b50505050509050565b60405196602088015216602486015280604486015260448552608085019085821067ffffffffffffffff831117613ad35750613ac893946112e691604052826145cf565b803880808080613a7b565b80634e487b7160e01b602492526041600452fd5b90503b151538613a74565b80519192508115918215613b0a575b50509038613a6d565b613b1d92506020809183010191016145b7565b3880613b01565b6fffffffffffffffffffffffffffffffff90818111613b41571690565b604490604051907f6dfcc650000000000000000000000000000000000000000000000000000000008252608060048301526024820152fd5b613bc2613be5926000838152600582016020526fffffffffffffffffffffffffffffffff60408220541693600b6020526004604083205493613bc86003820154613bc28361465b565b90612a77565b9284520160205260408220549081811015613be8575050906144cc565b90565b039190506144cc565b600a54906001600160a01b0390818116801561275257600093808552602090600282526040948587205416938415948486159687613e09575b818a5260038652888a2060018154019055848a5260028652888a20827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790558482847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8d80a415613d8c57506008548389526009855280888a205568010000000000000000811015613d785790613cd0846125a38460018a9601600855612cd4565b03613d27575b50505050613cf75750600a54906000198214612bf8575060018101600a5590565b6024925051907f73c6ac6e0000000000000000000000000000000000000000000000000000000082526004820152fd5b613d3090612e0a565b926000198401938411613d645786526006825284862083875282528486208190558552600790528284205538808080613cd6565b602487634e487b7160e01b81526011600452fd5b602489634e487b7160e01b81526041600452fd5b90808214613cd057613d9d81612e0a565b848a5260078652888a2054818103613dd2575b50848a528989812055818a5260068652888a20908a5285528888812055613cd0565b828b5260068752898b20828c528752898b2054838c52600688528a8c20828d528852808b8d20558b5260078752898b205538613db0565b613e4285600052600460205260406000207fffffffffffffffffffffffff00000000000000000000000000000000000000008154169055565b828a5260038652888a206000198154019055613c2a565b6001600160a01b03908183168015159081613ef5575b5015613e7b5750505050565b16613eb157602482604051907f7e2732890000000000000000000000000000000000000000000000000000000082526004820152fd5b6040517f177e802f0000000000000000000000000000000000000000000000000000000081526001600160a01b039190911660048201526024810191909152604490fd5b82841680821492508215613f2d575b508115613f13575b5038613e6f565b905084600052600460205282604060002054161438613f0c565b909150600052600560205260406000208160005260205260ff604060002054169038613f04565b9290604051927f23b872dd0000000000000000000000000000000000000000000000000000000060208501526001600160a01b03809216602485015216604483015260648201526064815260a081019181831067ffffffffffffffff8411176123d257613fc3926040526145cf565b565b3d15613ff0573d90613fd682612474565b91613fe46040519384612451565b82523d6000602084013e565b606090565b6002600d5414614006576002600d55565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fd5b811561403a570490565b634e487b7160e01b600052601260045260246000fd5b60405190600080549060018260011c906001841693841561414c575b602094858410811461413857838852879493929181156140f9575060011461409d575b5050613fc392500383612451565b60008080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56395935091905b8183106140e1575050613fc39350820101388061408f565b855488840185015294850194879450918301916140c9565b9050613fc39593507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b820101388061408f565b602485634e487b7160e01b81526022600452fd5b91607f169161406c565b604051906000600190600154918260011c9060018416938415614203575b602094858410811461413857838852879493929181156140f957506001146141a4575050613fc392500383612451565b9093915060016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6936000915b8183106141eb575050613fc39350820101388061408f565b855488840185015294850194879450918301916141d3565b91607f1691614174565b9060409061421a816147f5565b600090838252600b6020528282205490600381019061425682549360048301948560205287872054908181106000146142bf57505085906144cc565b80614269575b5050549382526020522055565b614274600591613b24565b9187865201602052848420906fffffffffffffffffffffffffffffffff198254916142b26fffffffffffffffffffffffffffffffff918285166139cd565b169116179055388061425c565b03906144cc565b51906fffffffffffffffffffffffffffffffff8216820361045e57565b9081606091031261045e5760408051916142fc836123fc565b614305816142c6565b8352614313602082016142c6565b60208401520151604082015290565b670de0b6b3a76400009182820291600019848209938380861095039480860395146143ca57848311156143a05782910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b60046040517f227bc153000000000000000000000000000000000000000000000000000000008152fd5b505090613be59250614030565b906703782dace9d900009082820291600019848209938380861095039480860395146143ca57848311156143a05782910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b670b1a2bc2ec5000009080820290600019818409908280831092039180830392146144bf57630784ce0090828211156143a0577f98f5be4dd1e14769fbd6666224dc1eb80dd2e0a3d2c8b328f57e76b7ae103957940990828211900360f71b910360091c170290565b5050630784ce0091500490565b90808202906000198184099082808310920391808303921461453057670de0b6b3a764000090828211156143a0577faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac10669940990828211900360ee1b910360121c170290565b5050670de0b6b3a764000091500490565b909182820291600019848209938380861095039480860395146143ca57848311156143a05782910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b9081602091031261045e5751801515810361045e5790565b6000806001600160a01b036145f993169360208151910182865af16145f2613fc5565b9083614762565b8051908115159182614640575b505061460f5750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b61465392506020809183010191016145b7565b153880614606565b5467ffffffffffffffff8082168042104282180218908260401c16908181106000146146eb5750506000905b81158080156146e1575b80156146d6575b6146ce57670de0b6b3a7640000808402938404141715612a8457613be591600c546001811190600118026001189160801c614541565b505050600090565b508160801c15614698565b50600c5415614691565b0390614687565b7f00000000000000000000000000000000000000000000000000000000000000006000805b8260ff8216106147275750505050565b600581101561474e578061474460066147499302600e018661420d565b612c99565b614717565b602482634e487b7160e01b81526032600452fd5b906147a1575080511561477757805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b815115806147ec575b6147b2575090565b6024906001600160a01b03604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b156147aa565b6147fe8161465b565b9081614866575b613fc3915061482667ffffffffffffffff8254168042104282180218614904565b7fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff6fffffffffffffffff000000000000000083549260401b169116179055565b60038101614875838254612a77565b9055670de0b6b3a7640000600c5461488d81856144cc565b93096148e2575b6148a0613fc392613b24565b60018201906fffffffffffffffffffffffffffffffff198254916148d76fffffffffffffffffffffffffffffffff918285166139cd565b169116179055614805565b600182018092111561489457634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff90818111614919571690565b604490604051907f6dfcc650000000000000000000000000000000000000000000000000000000008252604060048301526024820152fdfea2646970667358221220091b44d176fcb8b7cab87afbcc693fe5d47c5f762928f531c8fd019793af52ba64736f6c6343000819003360c034608057601f6104d438819003918201601f19168301916001600160401b03831184841017608557808492602094604052833981010312608057516001600160a01b03811681036080573360805260a052604051610438908161009c8239608051818181607d01526102ee015260a051818181610105015261033e0152f35b600080fd5b634e487b7160e01b600052604160045260246000fdfe608060409080825260048036101561001657600080fd5b600091823560e01c90816372f702f314610312575080638da5cb5b146102c15763f3fef3a31461004557600080fd5b346102bd57826003193601126102bd57803573ffffffffffffffffffffffffffffffffffffffff938482168092036102b957602494807f000000000000000000000000000000000000000000000000000000000000000016338103610284575081519260208401907fa9059cbb000000000000000000000000000000000000000000000000000000008252878501528635604485015260448452608084019167ffffffffffffffff928581108482111761025957918798979291839286527f00000000000000000000000000000000000000000000000000000000000000001695519082875af13d1561024c573d82811161022157835192601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168401908111848210176101f6578452825261018d91903d88602084013e5b84610362565b80519081151591826101ce575b50506101a4578480f35b51917f5274afe7000000000000000000000000000000000000000000000000000000008352820152fd5b81925090602091810103126101f257602001518015908115036101f257388061019a565b8580fd5b87896041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b86886041887f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b61018d9150606090610187565b88886041897f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b84604491888551927f551266a80000000000000000000000000000000000000000000000000000000084523390840152820152fd5b8380fd5b5080fd5b8284346102bd57816003193601126102bd576020905173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b8390346102bd57816003193601126102bd5760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b906103a1575080511561037757805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b815115806103f9575b6103b2575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b156103aa56fea26469706673582212207e8848ff620434987cb0cb661d55fe38df9d13c4a87115178798770df12e7bd164736f6c6343000819003300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000007fbaf021c972882ed4b3604c1e8757b2aadd54c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000194d6176657269636b2042502d47484f2d555344432d342d52310000000000000000000000000000000000000000000000000000000000000000000000000000114d42502d47484f2d555344432d342d523100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007448c7456a97769f6cd04f1e83a4a23ccdc46abd0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000c6addb3327a7d4b3b604227f82a6259ca7112053

Deployed Bytecode

0x608060408181526004918236101561001657600080fd5b600092833560e01c91826301ffc9a71461212a5750816306fdde031461210c578163081812fc146120d2578163095ea7b314611fc657816315c43aaf14611eca57816318160ddd14611eab57816323b872dd14611e935781632f745c5914611e6a5781633a3619de14611e175781633e3cc23914611d8d578163427f91a614611d6a57816342842e0e14611d415781634709b70914611d23578163482af13b14611cf557816348fd65fe14611cca5781634b986ec214611c825781634c465899146119e25781634d6ed8c41461187d5781634f6ccce71461180f57816351a7c716146116865781635d62fd5f1461139e5781636352211e146113765781636565ac99146113405781636a6278421461131a5781636deda0fc14610e6057816370a0823114610e3a57816372f702f314610df6578163751df17a14610db357816375794a3c14610d945781637aaa90e114610c0157816388a2955214610b9157816395d89b4114610b605781639e59e59814610a98578163a22cb465146109c1578163a694fc3a14610996578163abb06b951461095b578163ac9650d81461079e578163b1724b4614610780578163b66503cf14610760578163b6a6d17714610742578163b88d4fde146106da578163c58181c4146106bb578163c87b56dd14610498578163c9f6707214610463578163d6d8266f146103cf578163e39c08fc14610375578163e48e622714610357578163e985e9c514610306578163f01a11fc146102da57508063f476eaf21461029c5763fbfa77cf1461025657600080fd5b34610298578160031936011261029857602090516001600160a01b037f00000000000000000000000015a8ff4f612e025523c88737ae07c87e9b07702d168152f35b5080fd5b5034610298576060600319360112610298576020906102d36102bc612274565b6102ca604435303384613f54565b60243590613023565b9051908152f35b905034610302576020600319360112610302576020928291358152600b845220549051908152f35b8280fd5b505034610298578060031936011261029857602091610323612274565b8261032c61228a565b926001600160a01b03809316815260058652209116600052825260ff81600020541690519015158152f35b5050346102985781600319360112610298576020906102d333613bf1565b8284346103cc57816003193601126103cc5760ff61039961039461228a565b61281c565b169060058210156103b9575060209260066102d39202600e019035613b79565b80603285634e487b7160e01b6024945252fd5b80fd5b905082346103cc5760806003193601126103cc575035906103ee61228a565b6044359060ff8216820361045e5760609361045c926104349261040f6127fd565b50610423833361041e82613681565b613e59565b6064359261042f6127fd565b6136d5565b915180926001600160a01b036040809280518552602081015115156020860152015116910152565bf35b600080fd5b505034610298578160031936011261029857610494906104816134fe565b90519182916020835260208301906122a0565b0390f35b90503461030257602090816003193601126106b75781929381356104bb81613681565b508551926104c884612435565b828452821561069a5781829184937a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000908181101561068d575b5050866d04ee2d6d415b85acef81000000008085101561067f575b5050662386f26fc1000080841015610670575b506305f5e10080841015610661575b5061271080841015610653575b50506064821015610643575b600a80921015610639575b60219088936001928161058b600186940161058361057a82612474565b9951998a612451565b808952612474565b97601f198b89019901368a3750860101905b6105f6575b50505050926105d9926105e59261049495885195836105ca889551809288808901910161222c565b8401915180938684019061222c565b01038084520182612451565b925b5192828493845283019061224f565b600019849101917f30313233343536373839616263646566000000000000000000000000000000008282061a8353049182156106345791908261059d565b6105a2565b916001019161055d565b9190606460029104910191610552565b930192909104903880610546565b60089194930492019238610539565b6010919493049201923861052a565b940193909204918638610517565b8a955004925038806104fc565b505050505061049482516106ad81612435565b60008152926105e7565b8380fd5b505034610298578160031936011261029857602090600c549051908152f35b839034610298576080600319360112610298576106f5612274565b6106fd61228a565b9060643567ffffffffffffffff811161073e573660238201121561073e5761073b9381602461073193369301359101612490565b916044359161335f565b80f35b8480fd5b505034610298578160031936011261029857602090516203f4808152f35b5050346102985780600319360112610298576020906102d36102ca612274565b505034610298578160031936011261029857602090516234bc008152f35b8391503461029857602091826003193601126103cc5781359167ffffffffffffffff90818411610302573660238501121561030257830135908082116103025760246005923660248260051b8801011161073e57926107fc84612c81565b9561080989519788612451565b848752601f1961081886612c81565b0188875b82811061094b5750505085917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbd82360301925b8681106108d1578a8a8a8a83519280840190808552835180925280868601968360051b870101940192955b8287106108875785850386f35b9091929382806108c1837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08a60019603018652885161224f565b960192019601959291909261087a565b8481831b84010135848112156109475783018581013590878211610943576044019080360382136109435789808d61091160019695610927953691612490565b80519101305af4610920613fc5565b9030614762565b610931828c612caa565b5261093c818b612caa565b500161084f565b8980fd5b8880fd5b60608a82018301528a910161081c565b505034610298578160031936011261029857602090517f00000000000000000000000000000000000000000000000000000000000000018152f35b905082346103cc5760206003193601126103cc57506109b59035612e5b565b82519182526020820152f35b919050346103025780600319360112610302576109dc612274565b906024359182151580930361045e576001600160a01b0316928315610a6a5750338452600560205280842083600052602052806000207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0081541660ff8416179055519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b8360249251917f5b08ba18000000000000000000000000000000000000000000000000000000008352820152fd5b8284346103cc57602090816003193601126103cc578290610ab7612274565b90610ac182612e0a565b610aca81612c81565b90610ad785519283612451565b808252610ae381612c81565b93601f198784019501368637835b828110610b365750505083519485948186019282875251809352850193925b828110610b1f57505050500390f35b835185528695509381019392810192600101610b10565b80610b49600192849a979698999a612783565b610b538289612caa565b5201969594929396610af1565b50503461029857816003193601126102985761049490610b7e614156565b905191829160208352602083019061224f565b8284346103cc57506109b5610bfc610ba8366123a0565b6001600160a01b039291927f00000000000000000000000015a8ff4f612e025523c88737ae07c87e9b07702d16337f0000000000000000000000007fbaf021c972882ed4b3604c1e8757b2aadd54c0613f54565b612e5b565b83833461029857610c11366123a0565b919093610c22853361041e82613681565b610c2b85613681565b92610c34613ff5565b8015610d6c57610c43866146f2565b858552600b60205282852054808211610d2a578190869782600c5403600c558752600b60205203838620556001600160a01b037f00000000000000000000000015a8ff4f612e025523c88737ae07c87e9b07702d16803b15610d2657610cef948680948651978895869485937ff3fef3a30000000000000000000000000000000000000000000000000000000085528401602090939291936001600160a01b0360408201951681520152565b03925af1908115610d1d5750610d09575b506001600d5580f35b610d12906123e8565b6103cc578082610d00565b513d84823e3d90fd5b8580fd5b92517ffcca3733000000000000000000000000000000000000000000000000000000008152918201868152602081019390935260408301529081906060010390fd5b5090517f14f29f88000000000000000000000000000000000000000000000000000000008152fd5b505034610298578160031936011261029857602090600a549051908152f35b5050346102985780600319360112610298576020906001600160a01b03610dd8612274565b91610def602435610de881613681565b9485613e59565b5191168152f35b505034610298578160031936011261029857602090516001600160a01b037f0000000000000000000000007fbaf021c972882ed4b3604c1e8757b2aadd54c0168152f35b505034610298576020600319360112610298576020906102d3610e5b612274565b612e0a565b8284346103cc5760806003193601126103cc5750813591610e7f612380565b9260443590606435610e8f6127fd565b50610e9e823361041e82613681565b610ea782613681565b610eaf6127fd565b610eb7613ff5565b966005811015611305576006810294610ed386600e018661420d565b8460005260138601602052876000208054976fffffffffffffffffffffffffffffffff97888a169283610f34575b60608d61045c8e6001600d555180926001600160a01b036040809280518552602081015115156020860152015116910152565b600f92939495969798999a9c506fffffffffffffffffffffffffffffffff19809d16905501908154838a8216039b8a8d116112f0578a8a9b9c9d9a999a169116178255610f8085612947565b610f8986612d0b565b90610f9e868684610f986127fd565b9c612a9a565b15801560208c0152818b526112475750908b8d6060938b8b8e610fcf6001600160a01b0380981694858551916139f1565b8385840152600019811460001461118b5750509060649394610ff360009351613b24565b935197889687957f1ef3467b00000000000000000000000000000000000000000000000000000000875216908501528a60248501528c1660448401525af18015611180579460609b98946110e5947fe47c57318950d2a193de7632844e22ae34cd95299259fc16515741c22b5d91ad9994610140999461045c9d99611151575b505b859d8651908184116110fc575b5050505060ff61109183612947565b928b5198338a5260208a01526001600160a01b038095168c8a0152168d88015260808701521660a085015260c08401906001600160a01b036040809280518552602081015115156020860152015116910152565b610120820152a19192848080808080808080610f01565b61110c61111792611148956139c0565b16825460801c6139cd565b6fffffffffffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff1983549260801b169116179055565b8d808080611082565b8f90611172913d606011611179575b61116a8183612451565b8101906142e3565b508f611073565b503d611160565b8b513d6000823e3d90fd5b93608495919461119e6000959451613b24565b9151998a9889977fea4914ef000000000000000000000000000000000000000000000000000000008952169087015260248601528b60448601521660648401525af18015611180579460609b98946110e5947fe47c57318950d2a193de7632844e22ae34cd95299259fc16515741c22b5d91ad9994610140999461045c9d99611228575b50611075565b8f90611240913d6060116111795761116a8183612451565b508f611222565b61014098935061045c9b979250947fe47c57318950d2a193de7632844e22ae34cd95299259fc16515741c22b5d91ad99946112eb60609f9c98936112d8906112e68f9a6110e59b519384917fa9059cbb0000000000000000000000000000000000000000000000000000000060208401528b60248401602090939291936001600160a01b0360408201951681520152565b03601f198101845283612451565b6145cf565b611075565b601183634e487b7160e01b6000525260246000fd5b603286634e487b7160e01b6000525260246000fd5b505034610298576020600319360112610298576020906102d361133b612274565b613bf1565b505034610298576020600319360112610298576020906001600160a01b0361136e611369612390565b612d0b565b915191168152f35b8284346103cc5760206003193601126103cc57506001600160a01b0361136e60209335613681565b8284346103cc57602090816003193601126103cc57833591821515830361045e57821561165f577f00000000000000000000000000000000000000000000000000000000000000016001810180911161164c57915b6114146113ff84612c81565b9361140c87519586612451565b808552612c81565b93601f1983850195013686377f000000000000000000000000000000000000000000000000000000000000000190816115ff575b600197600183116115c2575b60028311611584575b60038311611546575b8083116114f2575b506114b6575b5091908495939551948186019282875251809352850195925b82811061149a5785870386f35b83516001600160a01b031687529581019592810192840161148d565b6114c09084612caa565b6001600160a01b037f0000000000000000000000007fbaf021c972882ed4b3604c1e8757b2aadd54c016905286611474565b855181101561153157506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660a08601528861146e565b603290634e487b7160e01b6000525260246000fd5b855160031015611531576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166080870152611466565b855160021015611531576001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016606087015261145d565b855160011015611531576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001688870152611454565b845115611637576001600160a01b037f0000000000000000000000007448c7456a97769f6cd04f1e83a4a23ccdc46abd168652611448565b603288634e487b7160e01b6000525260246000fd5b602483601188634e487b7160e01b835252fd5b7f0000000000000000000000000000000000000000000000000000000000000001916113f3565b919050346103025760606003193601126103025781356116a461228a565b604435916116b6813361041e82613681565b6116be613ff5565b82156117e6576116cd816146f2565b808652600b60205283862054908184116117a35792809291879482600c5403600c558552600b60205203848420556001600160a01b037f00000000000000000000000015a8ff4f612e025523c88737ae07c87e9b07702d1690813b156106b7578361177b968651978895869485937ff3fef3a30000000000000000000000000000000000000000000000000000000085528401602090939291936001600160a01b0360408201951681520152565b03925af1908115610d1d575061179457506001600d5580f35b61179d906123e8565b38610d00565b84517ffcca373300000000000000000000000000000000000000000000000000000000815280870191825260208201839052604082018590529081906060010390fd5b505050517f14f29f88000000000000000000000000000000000000000000000000000000008152fd5b905034610302576020600319360112610302578035926008548410156118495760208361183b86612cd4565b91905490519160031b1c8152f35b604493919251927fa57d13dc0000000000000000000000000000000000000000000000000000000084528301526024820152fd5b8383346102985760209081600319360112610302578335907f0000000000000000000000000000000000000000000000000000000000000001926118c084612c81565b926118cd83519485612451565b848452601f196118dc86612c81565b0182875b8281106119c157505050855b60ff81168681101561196c576005821015611959579061194e6119549261191960068402600e0186613b79565b6001600160a01b0361192a85612947565b895192611936846123b6565b83521687820152611947828a612caa565b5287612caa565b50612c99565b6118ec565b60248860328b634e487b7160e01b835252fd5b8451848152865181860181905281908188019089880190888d8b5b8382106119945786860387f35b8451805187528301516001600160a01b031686840152879650948501949382019360019190910190611987565b85516119cc816123b6565b89815289838201528282890101520183906118e0565b90503461030257602091826003193601126106b7576119ff612390565b92611a0984612d0b565b90611a1385612947565b946005811015611c6f5760060294600f8601948554958660801c978815611c47576010019081546277f8808101809111611c345780421115611bfe57506fffffffffffffffffffffffffffffffff80981690554290556001600160a01b03809416611a7f8882856139f1565b65ffffffffffff804211611bc8579089914216958751947faa902b4d0000000000000000000000000000000000000000000000000000000086528686868187875af1958615611bbe57918795939185938d9698611b84575b50611ae56084969798613b24565b9b8b519c8d9889977f3082f0e90000000000000000000000000000000000000000000000000000000089528801528b60248801521660448601521660648401525af1938415611b7a578694611b47575b50606095508251948552840152820152f35b9080945081813d8311611b73575b611b5f8183612451565b81010312610d265760609550519238611b35565b503d611b55565b83513d88823e3d90fd5b95509590965084813d8311611bb7575b611b9e8183612451565b810103126102985792519486948b949190611ae5611ad7565b503d611b94565b89513d86823e3d90fd5b60448360308951917f6dfcc650000000000000000000000000000000000000000000000000000000008352820152426024820152fd5b836044918951917fb5b2827a00000000000000000000000000000000000000000000000000000000835242908301526024820152fd5b60248b601186634e487b7160e01b835252fd5b8287517f14f29f88000000000000000000000000000000000000000000000000000000008152fd5b602487603287634e487b7160e01b835252fd5b90503461030257608060031936011261030257602435906001600160a01b03821682036106b75790611cbc91606435916044359135612a9a565b825191825215156020820152f35b505034610298578060031936011261029857602090611cea610e5b612274565b602435109051908152f35b505034610298576020600319360112610298576020906001600160a01b0361136e611d1e612390565b612947565b505034610298578160031936011261029857602090516277f8808152f35b5050346102985761073b90611d553661234b565b91925192611d6284612435565b85845261335f565b5050346102985760206003193601126102985760209060ff61136e610394612274565b90503461030257602060031936011261030257359160058310156103cc5750600660e0920280600e01549067ffffffffffffffff92600f820154906011601084015493015493815195808216875281831c16602087015260801c908501526fffffffffffffffffffffffffffffffff8116606085015260801c608084015260a083015260c0820152f35b8284346103cc5760606003193601126103cc575061045c61043460609335611e3d612380565b611e456127fd565b50611e54823361041e82613681565b60443591611e6181613681565b9061042f6127fd565b5050346102985780600319360112610298576020906102d3611e8a612274565b60243590612783565b83346103cc5761073b611ea53661234b565b916124c7565b5050346102985781600319360112610298576020906008549051908152f35b8284346103cc57806003193601126103cc5781516080810181811067ffffffffffffffff821117611fb357611f7d945083526060815260606020820181815284830193808552828401908152611f1e6134fe565b95611f27614050565b8552611f31614156565b8352600c548652611fa46001600160a01b0393847f0000000000000000000000007fbaf021c972882ed4b3604c1e8757b2aadd54c0168452611f9583519a8b9a858c52858c01906122a0565b978a890360208c01525160808952608089019061224f565b9051878203602089015261224f565b95519085015251169101520390f35b602483604187634e487b7160e01b835252fd5b91905034610302578060031936011261030257611fe1612274565b91602435611fee81613681565b331515806120bf575b80612097575b6120685781906001600160a01b03809616958691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258880a484526020528220907fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905580f35b83517fa9fbf51f0000000000000000000000000000000000000000000000000000000081523381850152602490fd5b506001600160a01b0381168652600560205283862033875260205260ff848720541615611ffd565b50336001600160a01b0382161415611ff7565b9050346103025760206003193601126103025781602093826001600160a01b0393356120fd81613681565b50825285522054169051908152f35b50503461029857816003193601126102985761049490610b7e614050565b84913461030257602060031936011261030257357fffffffff00000000000000000000000000000000000000000000000000000000811680910361030257602092507f780e9d6300000000000000000000000000000000000000000000000000000000811490811561219e575b5015158152f35b7f80ac58cd00000000000000000000000000000000000000000000000000000000811491508115612202575b81156121d8575b5083612197565b7f01ffc9a700000000000000000000000000000000000000000000000000000000915014836121d1565b7f5b5e139f00000000000000000000000000000000000000000000000000000000811491506121ca565b60005b83811061223f5750506000910152565b818101518382015260200161222f565b90601f19601f60209361226d8151809281875287808801910161222c565b0116010190565b600435906001600160a01b038216820361045e57565b602435906001600160a01b038216820361045e57565b90815180825260208080930193019160005b8281106122c0575050505090565b835180518652808301518684015260408082015190870152606080820151908701526080808201519087015260a0808201516001600160a01b039081169188019190915260c0808301519091169087015260e0808201516fffffffffffffffffffffffffffffffff1690870152610100908101519086015261012090940193928101926001016122b2565b600319606091011261045e576001600160a01b0390600435828116810361045e5791602435908116810361045e579060443590565b6024359060ff8216820361045e57565b6004359060ff8216820361045e57565b600319604091011261045e576004359060243590565b6040810190811067ffffffffffffffff8211176123d257604052565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff81116123d257604052565b6060810190811067ffffffffffffffff8211176123d257604052565b610120810190811067ffffffffffffffff8211176123d257604052565b6020810190811067ffffffffffffffff8211176123d257604052565b90601f601f19910116810190811067ffffffffffffffff8211176123d257604052565b67ffffffffffffffff81116123d257601f01601f191660200190565b92919261249c82612474565b916124aa6040519384612451565b82948184528183011161045e578281602093846000960137010152565b916001600160a01b0380831693841561275257600094838652602095600287526040968488832054169633612742575b871580156126f2575b848452600383528984206001815401905587845260028352898420857fffffffffffffffffffffffff000000000000000000000000000000000000000082541617905587858a7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8780a4156126765760085487845260098352808a8520556801000000000000000081101561266257876125a38260016125bb9401600855612cd4565b90919060001983549160031b92831b921b1916179055565b838803612610575b5050505016928383036125d65750505050565b6064945051927f64283d7b000000000000000000000000000000000000000000000000000000008452600484015260248301526044820152fd5b61261990612e0a565b92600019840193841161264e5782916007918a94526006815283832085845281528784842055878352522055388080806125c3565b602483634e487b7160e01b81526011600452fd5b602484634e487b7160e01b81526041600452fd5b8784146125bb5761268688612e0a565b87845260078352898420548181036126bb575b50878452838a81205588845260068352898420908452825282898120556125bb565b898552600684528a852082865284528a8520548a8652600685528b86208287528552808c8720558552600784528a85205538612699565b61272b88600052600460205260406000207fffffffffffffffffffffffff00000000000000000000000000000000000000008154169055565b888452600383528984206000198154019055612500565b61274d87338a613e59565b6124f7565b60246040517f64a0ae9200000000000000000000000000000000000000000000000000000000815260006004820152fd5b61278c81612e0a565b8210156127b9576001600160a01b0316600052600660205260406000209060005260205260406000205490565b6040517fa57d13dc0000000000000000000000000000000000000000000000000000000081526001600160a01b039190911660048201526024810191909152604490fd5b6040519061280a826123fc565b60006040838281528260208201520152565b6001600160a01b0380911690807f0000000000000000000000007448c7456a97769f6cd04f1e83a4a23ccdc46abd16821461294057807f000000000000000000000000000000000000000000000000000000000000000016821461293957807f000000000000000000000000000000000000000000000000000000000000000016821461293257807f000000000000000000000000000000000000000000000000000000000000000016821461292b577f000000000000000000000000000000000000000000000000000000000000000016811461292557602490604051907f3dc09a5c0000000000000000000000000000000000000000000000000000000082526004820152fd5b50600490565b5050600390565b5050600290565b5050600190565b5050600090565b60ff167f0000000000000000000000000000000000000000000000000000000000000001811015612a46578015612a2157600181146129fc57600281146129d7576003146129b3577f000000000000000000000000000000000000000000000000000000000000000090565b7f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000000000000000000000000000000000000000000090565b507f0000000000000000000000007448c7456a97769f6cd04f1e83a4a23ccdc46abd90565b602490604051907f205467d70000000000000000000000000000000000000000000000000000000082526004820152fd5b91908201809211612a8457565b634e487b7160e01b600052601160045260246000fd5b929392600092916001600160a01b0390811690848215612c765750612abe83613681565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152911660048201526020918282602481845afa918215612c3c578692612c47575b50908260049392604051948580927f18160ddd0000000000000000000000000000000000000000000000000000000082525afa928315612c3c578693612c0c575b50612b90939291612b64600b9260019485811190861802851890614322565b93875252612b826040862054600c5483811190841802831890614322565b8181119082180218906143d7565b670a688906bd8b000090810180911161264e57670de0b6b3a764000090612bb686614456565b936702c68af0bb140000948501809511612bf85750918183612bed93612bf2969510908218028118938181109082180218906144cc565b6144cc565b91151590565b80634e487b7160e01b602492526011600452fd5b9092508181813d8311612c35575b612c248183612451565b81010312610d26575191600b612b45565b503d612c1a565b6040513d88823e3d90fd5b9091508281813d8311612c6f575b612c5f8183612451565b81010312610d2657519082612b04565b503d612c55565b959650505050905091565b67ffffffffffffffff81116123d25760051b60200190565b60ff1660ff8114612a845760010190565b8051821015612cbe5760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b600854811015612cbe5760086000527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30190600090565b60ff167f0000000000000000000000000000000000000000000000000000000000000001811015612a46578015612de55760018114612dc05760028114612d9b57600314612d77577f000000000000000000000000000000000000000000000000000000000000000090565b7f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000000000000000000000000000000000000000000090565b507f000000000000000000000000c6addb3327a7d4b3b604227f82a6259ca711205390565b6001600160a01b03168015612e2a57600052600360205260406000205490565b60246040517f89c62b6400000000000000000000000000000000000000000000000000000000815260006004820152fd5b8015612fa1575b612e6a613ff5565b612e7381613681565b50612e7d816146f2565b602460206001600160a01b03604051928380927f70a08231000000000000000000000000000000000000000000000000000000008252807f00000000000000000000000015a8ff4f612e025523c88737ae07c87e9b07702d1660048301527f0000000000000000000000007fbaf021c972882ed4b3604c1e8757b2aadd54c0165afa908115612f9557600091612f63575b50600c548091818110600014612f5c5750506000905b8180612f35575b50506001600d5591565b612f3e91612a77565b600c5581600052600b60205260406000208181540190553881612f2b565b0390612f24565b90506020813d602011612f8d575b81612f7e60209383612451565b8101031261045e575138612f0e565b3d9150612f71565b6040513d6000823e3d90fd5b50612fab33612e0a565b1561301557612fb933612e0a565b15612fde57336000526006602052604060002060008052602052604060002054612e62565b60446040517fa57d13dc00000000000000000000000000000000000000000000000000000000815233600482015260006024820152fd5b61301e33613bf1565b612e62565b9061302c613ff5565b6203f48080821061331f576234bc00908183116132e35750509061304f8161281c565b6005811015612cbe5780602460066130829302602081600e0193613072856147f5565b6001600160a01b03958691612947565b16604051938480927f70a082310000000000000000000000000000000000000000000000000000000082523060048301525afa918215612f95576000926132ae575b50600f01546fffffffffffffffffffffffffffffffff1690818110156132a75750506000905b805467ffffffffffffffff908181164281101561329e57506000905b60801c9081810290808204831490151715612a84578060011b9080820460021490151715612a845784118015613296575b1561325957509160a0939161322e7ffcb9ca03b70a876a8d62dc2ef18aa125118fd02dae56cfffc36a627e7b1c481196946131af61317d6131788b87614030565b613b24565b84546fffffffffffffffffffffffffffffffff1660809190911b6fffffffffffffffffffffffffffffffff1916178455565b806131c26131bd8b42612a77565b614904565b167fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000845416178355421682907fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff6fffffffffffffffff000000000000000083549260401b169116179055565b5460801c916040519333855216602084015260408301528460608301526080820152a1906001600d55565b839196509161322e61329060a096947ffcb9ca03b70a876a8d62dc2ef18aa125118fd02dae56cfffc36a627e7b1c48119896614030565b976131af565b508015613137565b42900390613106565b03906130ea565b9091506020813d6020116132db575b816132ca60209383612451565b8101031261045e575190600f6130c4565b3d91506132bd565b60649350604051927fd3350e51000000000000000000000000000000000000000000000000000000008452600484015260248301526044820152fd5b60649250604051917fd3350e51000000000000000000000000000000000000000000000000000000008352600483015260248201526234bc006044820152fd5b919061336c8282856124c7565b803b613379575b50505050565b6133d56001600160a01b03809216946040519384937f150b7a020000000000000000000000000000000000000000000000000000000096878652336004870152166024850152604484015260806064840152608483019061224f565b03906020816000938185885af19082908261349d575b505061343b57826133fa613fc5565b805191908261343457602482604051907f64a0ae920000000000000000000000000000000000000000000000000000000082526004820152fd5b9050602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000160361346c575038808080613373565b602490604051907f64a0ae920000000000000000000000000000000000000000000000000000000082526004820152fd5b909192506020813d6020116134f6575b816134ba60209383612451565b810103126102985751907fffffffff00000000000000000000000000000000000000000000000000000000821682036103cc57509038806133eb565b3d91506134ad565b7f00000000000000000000000000000000000000000000000000000000000000019061352982612c81565b9160409061353982519485612451565b808452601f1961354882612c81565b0160005b81811061362c5750508360005b60ff81169083821015613624576005811015612cbe5761194e61361f926006830280600e015467ffffffffffffffff916080601182015461359988612947565b906135a389612d0b565b908d6010600f870154960154968151986135bc8a612418565b8082168a5281831c1660208a0152851c908801526fffffffffffffffffffffffffffffffff85166060880152838701526001600160a01b0380921660a08701521660c08501521c60e0830152610100820152613618828b612caa565b5288612caa565b613559565b505093505050565b602090845161363a81612418565b60008152826000818301526000878301526000606083015260006080830152600060a0830152600060c0830152600060e0830152600061010083015282890101520161354c565b8060005260026020526001600160a01b03604060002054169081156136a4575090565b602490604051907f7e2732890000000000000000000000000000000000000000000000000000000082526004820152fd5b93929091936136e2613ff5565b936005821015612cbe5760068202936136fe85600e018561420d565b836000526013850160205260409081600020938454946fffffffffffffffffffffffffffffffff978887169182613742575b50505050505050505050906001600d55565b600f92939495969798999a506fffffffffffffffffffffffffffffffff198099169055018054828a821603978a8911612a84578a8a9916911617815561378783612947565b8961379185612d0b565b916137a68786856137a06127fd565b9d612a9a565b15801560208d0152818c5261393057509060648a6137d46060946001600160a01b03809716809351916139f1565b808a8d015260006137e58d51613b24565b918b5196879586947f1ef3467b0000000000000000000000000000000000000000000000000000000086521660048501528b60248501528d1660448401525af1801561392557936138d4969361014099969360ff937fe47c57318950d2a193de7632844e22ae34cd95299259fc16515741c22b5d91ad9c9a97613906575b505b879c8851908184116138ed575b5050505061387f81612947565b93805198338a5260208a01526001600160a01b038096169089015216606087015260808601521660a084015260c08301906001600160a01b036040809280518552602081015115156020860152015116910152565b600019610120820152a138808080808080808080613730565b61110c611117926138fd956139c0565b38808080613872565b61391e9060603d6060116111795761116a8183612451565b5038613863565b86513d6000823e3d90fd5b60ff93507fe47c57318950d2a193de7632844e22ae34cd95299259fc16515741c22b5d91ad9b99969250936139bb6112d88a97936112e66101409e9b986138d49d519384917fa9059cbb0000000000000000000000000000000000000000000000000000000060208401528d60248401602090939291936001600160a01b0360408201951681520152565b613865565b91908203918211612a8457565b9190916fffffffffffffffffffffffffffffffff80809416911601918211612a8457565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000602082018181526001600160a01b038516602484015260448084019690965294825294939092613a46606485612451565b6001600160a01b0390818416600080809588519082855af190613a67613fc5565b82613af2575b5081613ae7575b5015613a84575b50505050509050565b60405196602088015216602486015280604486015260448552608085019085821067ffffffffffffffff831117613ad35750613ac893946112e691604052826145cf565b803880808080613a7b565b80634e487b7160e01b602492526041600452fd5b90503b151538613a74565b80519192508115918215613b0a575b50509038613a6d565b613b1d92506020809183010191016145b7565b3880613b01565b6fffffffffffffffffffffffffffffffff90818111613b41571690565b604490604051907f6dfcc650000000000000000000000000000000000000000000000000000000008252608060048301526024820152fd5b613bc2613be5926000838152600582016020526fffffffffffffffffffffffffffffffff60408220541693600b6020526004604083205493613bc86003820154613bc28361465b565b90612a77565b9284520160205260408220549081811015613be8575050906144cc565b90565b039190506144cc565b600a54906001600160a01b0390818116801561275257600093808552602090600282526040948587205416938415948486159687613e09575b818a5260038652888a2060018154019055848a5260028652888a20827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790558482847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8d80a415613d8c57506008548389526009855280888a205568010000000000000000811015613d785790613cd0846125a38460018a9601600855612cd4565b03613d27575b50505050613cf75750600a54906000198214612bf8575060018101600a5590565b6024925051907f73c6ac6e0000000000000000000000000000000000000000000000000000000082526004820152fd5b613d3090612e0a565b926000198401938411613d645786526006825284862083875282528486208190558552600790528284205538808080613cd6565b602487634e487b7160e01b81526011600452fd5b602489634e487b7160e01b81526041600452fd5b90808214613cd057613d9d81612e0a565b848a5260078652888a2054818103613dd2575b50848a528989812055818a5260068652888a20908a5285528888812055613cd0565b828b5260068752898b20828c528752898b2054838c52600688528a8c20828d528852808b8d20558b5260078752898b205538613db0565b613e4285600052600460205260406000207fffffffffffffffffffffffff00000000000000000000000000000000000000008154169055565b828a5260038652888a206000198154019055613c2a565b6001600160a01b03908183168015159081613ef5575b5015613e7b5750505050565b16613eb157602482604051907f7e2732890000000000000000000000000000000000000000000000000000000082526004820152fd5b6040517f177e802f0000000000000000000000000000000000000000000000000000000081526001600160a01b039190911660048201526024810191909152604490fd5b82841680821492508215613f2d575b508115613f13575b5038613e6f565b905084600052600460205282604060002054161438613f0c565b909150600052600560205260406000208160005260205260ff604060002054169038613f04565b9290604051927f23b872dd0000000000000000000000000000000000000000000000000000000060208501526001600160a01b03809216602485015216604483015260648201526064815260a081019181831067ffffffffffffffff8411176123d257613fc3926040526145cf565b565b3d15613ff0573d90613fd682612474565b91613fe46040519384612451565b82523d6000602084013e565b606090565b6002600d5414614006576002600d55565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fd5b811561403a570490565b634e487b7160e01b600052601260045260246000fd5b60405190600080549060018260011c906001841693841561414c575b602094858410811461413857838852879493929181156140f9575060011461409d575b5050613fc392500383612451565b60008080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56395935091905b8183106140e1575050613fc39350820101388061408f565b855488840185015294850194879450918301916140c9565b9050613fc39593507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0091501682840152151560051b820101388061408f565b602485634e487b7160e01b81526022600452fd5b91607f169161406c565b604051906000600190600154918260011c9060018416938415614203575b602094858410811461413857838852879493929181156140f957506001146141a4575050613fc392500383612451565b9093915060016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6936000915b8183106141eb575050613fc39350820101388061408f565b855488840185015294850194879450918301916141d3565b91607f1691614174565b9060409061421a816147f5565b600090838252600b6020528282205490600381019061425682549360048301948560205287872054908181106000146142bf57505085906144cc565b80614269575b5050549382526020522055565b614274600591613b24565b9187865201602052848420906fffffffffffffffffffffffffffffffff198254916142b26fffffffffffffffffffffffffffffffff918285166139cd565b169116179055388061425c565b03906144cc565b51906fffffffffffffffffffffffffffffffff8216820361045e57565b9081606091031261045e5760408051916142fc836123fc565b614305816142c6565b8352614313602082016142c6565b60208401520151604082015290565b670de0b6b3a76400009182820291600019848209938380861095039480860395146143ca57848311156143a05782910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b60046040517f227bc153000000000000000000000000000000000000000000000000000000008152fd5b505090613be59250614030565b906703782dace9d900009082820291600019848209938380861095039480860395146143ca57848311156143a05782910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b670b1a2bc2ec5000009080820290600019818409908280831092039180830392146144bf57630784ce0090828211156143a0577f98f5be4dd1e14769fbd6666224dc1eb80dd2e0a3d2c8b328f57e76b7ae103957940990828211900360f71b910360091c170290565b5050630784ce0091500490565b90808202906000198184099082808310920391808303921461453057670de0b6b3a764000090828211156143a0577faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac10669940990828211900360ee1b910360121c170290565b5050670de0b6b3a764000091500490565b909182820291600019848209938380861095039480860395146143ca57848311156143a05782910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b9081602091031261045e5751801515810361045e5790565b6000806001600160a01b036145f993169360208151910182865af16145f2613fc5565b9083614762565b8051908115159182614640575b505061460f5750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b61465392506020809183010191016145b7565b153880614606565b5467ffffffffffffffff8082168042104282180218908260401c16908181106000146146eb5750506000905b81158080156146e1575b80156146d6575b6146ce57670de0b6b3a7640000808402938404141715612a8457613be591600c546001811190600118026001189160801c614541565b505050600090565b508160801c15614698565b50600c5415614691565b0390614687565b7f00000000000000000000000000000000000000000000000000000000000000016000805b8260ff8216106147275750505050565b600581101561474e578061474460066147499302600e018661420d565b612c99565b614717565b602482634e487b7160e01b81526032600452fd5b906147a1575080511561477757805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b815115806147ec575b6147b2575090565b6024906001600160a01b03604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b156147aa565b6147fe8161465b565b9081614866575b613fc3915061482667ffffffffffffffff8254168042104282180218614904565b7fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff6fffffffffffffffff000000000000000083549260401b169116179055565b60038101614875838254612a77565b9055670de0b6b3a7640000600c5461488d81856144cc565b93096148e2575b6148a0613fc392613b24565b60018201906fffffffffffffffffffffffffffffffff198254916148d76fffffffffffffffffffffffffffffffff918285166139cd565b169116179055614805565b600182018092111561489457634e487b7160e01b600052601160045260246000fd5b67ffffffffffffffff90818111614919571690565b604490604051907f6dfcc650000000000000000000000000000000000000000000000000000000008252604060048301526024820152fdfea2646970667358221220091b44d176fcb8b7cab87afbcc693fe5d47c5f762928f531c8fd019793af52ba64736f6c63430008190033

Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.