ETH Price: $2,934.92 (-0.80%)

Contract

0x8944d2F321F9ea2Ca4306e9d771286445444d658
 

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

> 10 Internal Transactions found.

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
44362082024-06-06 13:57:11597 days ago1717682231
0x8944d2F3...45444d658
0 ETH
44348662024-06-06 13:12:27597 days ago1717679547
0x8944d2F3...45444d658
0 ETH
44344362024-06-06 12:58:07597 days ago1717678687
0x8944d2F3...45444d658
0 ETH
44334612024-06-06 12:25:37598 days ago1717676737
0x8944d2F3...45444d658
0 ETH
44270352024-06-06 8:51:25598 days ago1717663885
0x8944d2F3...45444d658
0 ETH
44252882024-06-06 7:53:11598 days ago1717660391
0x8944d2F3...45444d658
0 ETH
44252692024-06-06 7:52:33598 days ago1717660353
0x8944d2F3...45444d658
0 ETH
44252612024-06-06 7:52:17598 days ago1717660337
0x8944d2F3...45444d658
0 ETH
44249112024-06-06 7:40:37598 days ago1717659637
0x8944d2F3...45444d658
0 ETH
44248852024-06-06 7:39:45598 days ago1717659585
0x8944d2F3...45444d658
0 ETH
44237292024-06-06 7:01:13598 days ago1717657273
0x8944d2F3...45444d658
0 ETH
44235762024-06-06 6:56:07598 days ago1717656967
0x8944d2F3...45444d658
0 ETH
44231612024-06-06 6:42:17598 days ago1717656137
0x8944d2F3...45444d658
0 ETH
44215292024-06-06 5:47:53598 days ago1717652873
0x8944d2F3...45444d658
0 ETH
44154082024-06-06 2:23:51598 days ago1717640631
0x8944d2F3...45444d658
0 ETH
44144212024-06-06 1:50:57598 days ago1717638657
0x8944d2F3...45444d658
0 ETH
44142722024-06-06 1:45:59598 days ago1717638359
0x8944d2F3...45444d658
0 ETH
44142642024-06-06 1:45:43598 days ago1717638343
0x8944d2F3...45444d658
0 ETH
44114932024-06-06 0:13:21598 days ago1717632801
0x8944d2F3...45444d658
0 ETH
44112822024-06-06 0:06:19598 days ago1717632379
0x8944d2F3...45444d658
0 ETH
44109592024-06-05 23:55:33598 days ago1717631733
0x8944d2F3...45444d658
0 ETH
44108682024-06-05 23:52:31598 days ago1717631551
0x8944d2F3...45444d658
0 ETH
44108662024-06-05 23:52:27598 days ago1717631547
0x8944d2F3...45444d658
0 ETH
44106552024-06-05 23:45:25598 days ago1717631125
0x8944d2F3...45444d658
0 ETH
44105102024-06-05 23:40:35598 days ago1717630835
0x8944d2F3...45444d658
0 ETH
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VeTranche

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.7;

import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "./interfaces/ITranche.sol";
import "./interfaces/IVaultManager.sol";
import "./interfaces/IVeTranche.sol";
import "./interfaces/IERC20Rebasing.sol";
import "./interfaces/IBlast.sol";

contract VeTranche is ERC721Upgradeable, ReentrancyGuardUpgradeable, IVeTranche {

    using MathUpgradeable for uint256;
    using Counters for Counters.Counter;
    
    uint256 private constant _PRECISION = 1e6;

    IBlast public blast;
    Counters.Counter public tokenIds;
    ITranche public tranche;
    IVaultManager public vaultManager;
    address public treasury;

    uint public multiplierCoeff;
    uint public multiplierDenom;
    uint public rewardsDistributedPerSharePerLockPoint;
    uint public totalLockPoints;

    mapping(uint256 => uint256) public rewardsByTokenId;
    mapping(uint256 => uint256) public tokensByTokenId;
    mapping(uint256 => uint256) public lockTimeByTokenId;
    mapping(uint256 => uint256) public lockStartTimeByTokenId;
    mapping(uint256 => uint256) public lockMultiplierByTokenId;
    mapping(uint256 => uint256) public lastSharePoint;
    
    modifier onlyGov() {
        require(msg.sender == vaultManager.gov(), "GOV_ONLY");
        _;
    }
    modifier onlyManager() {
        require(msg.sender == address(vaultManager), "MANAGER_ONLY");
        _;
    }
    
    constructor() {
        _disableInitializers();
    }
    /**
     * @notice Initializes the VeTranche contract.
     * @param _tranche The address of the Tranche contract.
     * @param _vaultManager The address of the VaultManager contract.
     */
    function initialize(
        address _tranche, 
        address _vaultManager, 
        address _blast,
        address _blastPoints, 
        address _blastPointsOperator,
        address _treasury
    ) external initializer {
        tranche = ITranche(_tranche);
        vaultManager = IVaultManager(_vaultManager);
        multiplierCoeff = 1815e5;
        multiplierDenom = 1960230 * _PRECISION;

        __ERC721_init_unchained(
            string(abi.encodePacked("Locked ", tranche.name())),
            string(abi.encodePacked("ve-", tranche.symbol()))
        );
        __ReentrancyGuard_init_unchained();
        blast = IBlast(_blast);
        blast.configureClaimableGas(); 
        blast.configureGovernor(vaultManager.gov());
        IBlastPoints(_blastPoints).configurePointsOperator(_blastPointsOperator);
        treasury = _treasury;
    }

    /**
     * @notice Sets the VaultManager.
     * @param _vaultManager The new VaultManager address.
     */
    function setVaultManager(address _vaultManager) external onlyGov {
        require(_vaultManager != address(0), "ADDRESS_INVALID");
        vaultManager = IVaultManager(_vaultManager);
    }

    /**
     * @notice Sets the multiplier denominator.
     * @param _multiplierDenom The new multiplier denominator value.
     */
    function setMultiplierDenom(uint256 _multiplierDenom) external onlyGov {
        require(_multiplierDenom > 0, "NUMBER_INVALID");
        multiplierDenom = _multiplierDenom;
        emit NumberUpdated("Multiplier Denominator", _multiplierDenom);
    }

    /**
     * @notice Sets the multiplier coefficient.
     * @param _multiplierCoeff The new multiplier coefficient value.
     */
    function setMultiplierCoeff(uint256 _multiplierCoeff) external onlyGov {
        require(_multiplierCoeff > 0, "NUMBER_INVALID");
        multiplierCoeff = _multiplierCoeff;
        emit NumberUpdated("Multiplier Coefficient", _multiplierCoeff);
    }

    /**
     * @notice Distributes the reward to a specific tokenId.
     * @param reward The amount of reward to distribute.
     * @param tokenId The ID of the token to receive the reward.
     */
    function distributeReward(uint256 reward, uint256 tokenId) external onlyManager {
        rewardsByTokenId[tokenId] += reward;
    }

    /**
     * @notice Distributes the reward among the participants.
     * @param rewards The amount of reward to distribute.
     */
    function distributeRewards(
        uint256 rewards
    ) external override onlyManager returns (uint256) {
        return _distributeRewards(rewards);
    }

    function getTotalLockPoints() public view override returns (uint256) {
        return totalLockPoints/_PRECISION;
    }

    /**
     * @notice Locks a specified amount of shares until a specified end time.
     * @param shares The number of shares to lock.
     * @param duration The time until which the shares will be locked.
     * @return The tokenId for the locked shares.
     */
    function lock(uint256 shares, uint duration) public nonReentrant returns (uint256) {
        require(duration <= getMaxLockTime(), "OVER_MAX_LOCK_TIME");
        require(duration >= getMinLockTime(), "LOCK_TIME_TOO_SMALL");

        require(shares > 0, "LOCK_AMOUNT_IS_ZERO");
        require(tranche.balanceOf(msg.sender) >= shares, "INSUFFICIENT_TRANCHE_TOKENS");

        uint256 nextTokenId = tokenIds.current();
        tranche.transferFrom(msg.sender, address(this), shares);
        _mint(msg.sender, nextTokenId);

        tokensByTokenId[nextTokenId] = shares;
        lockTimeByTokenId[nextTokenId] = block.timestamp + duration;
        lockStartTimeByTokenId[nextTokenId] = block.timestamp;
        rewardsByTokenId[nextTokenId] = 0;
        lockMultiplierByTokenId[nextTokenId] = getLockPoints(duration);
        lastSharePoint[nextTokenId] = rewardsDistributedPerSharePerLockPoint;
        totalLockPoints += shares * lockMultiplierByTokenId[nextTokenId];

        tokenIds.increment();
        emit Locked(nextTokenId, msg.sender, shares, duration, lockMultiplierByTokenId[nextTokenId]);

        return nextTokenId;
    }

    /**
     * @notice Unlocks a specific tokenId.
     * @param tokenId The ID of the token to unlock.
     */
    function unlock(uint256 tokenId) public nonReentrant {
        require(tokensByTokenId[tokenId] > 0, "NOTHING_TO_UNLOCK");
        require(msg.sender == ownerOf(tokenId), "NOT_OWNER");
        uint256 fee = checkUnlockFee(tokenId);

        _claimRewards(tokenId);
        _burn(tokenId);

        tranche.transfer(msg.sender, tokensByTokenId[tokenId] - fee);
        tranche.transfer(treasury, fee);

        emit Unlocked(tokenId, msg.sender, tokensByTokenId[tokenId], fee);
        totalLockPoints -= tokensByTokenId[tokenId]* lockMultiplierByTokenId[tokenId];

        delete tokensByTokenId[tokenId];
        delete rewardsByTokenId[tokenId];
        delete lockTimeByTokenId[tokenId];
        delete lockStartTimeByTokenId[tokenId];
        delete lockMultiplierByTokenId[tokenId];
        delete lastSharePoint[tokenId];
    }

    /**
     * @notice Force unlocks a token if its lock time has passed.
     * @notice To be called by Keepers
     * @param _tokenId The ID of the token to unlock.
     */
    function forceUnlock(uint256 _tokenId) public nonReentrant{
        require(lockTimeByTokenId[_tokenId] < block.timestamp, "TOO_EARLY");
        require(tokensByTokenId[_tokenId] > 0, "NOTHING_TO_UNLOCK");

        _claimRewards(_tokenId);
        tranche.transfer(_ownerOf(_tokenId), tokensByTokenId[_tokenId] );

        _burn(_tokenId);

        emit Unlocked(_tokenId, _ownerOf(_tokenId), tokensByTokenId[_tokenId], 0);
        totalLockPoints -= tokensByTokenId[_tokenId]* lockMultiplierByTokenId[_tokenId];

        delete tokensByTokenId[_tokenId];
        delete rewardsByTokenId[_tokenId];
        delete lockTimeByTokenId[_tokenId];
        delete lockStartTimeByTokenId[_tokenId];
        delete lockMultiplierByTokenId[_tokenId];
        delete lastSharePoint[_tokenId];
    }

    /**
     * @notice Claims rewards accumulated by tokenId.
     * @param tokenId The ID of the token to claim rewards for.
     */
    function claimRewards(uint256 tokenId) public nonReentrant {
        require(msg.sender == _ownerOf(tokenId));
        _claimRewards(tokenId);
    }

    /** 
     * @notice Calculate the early withdrawal fee for a given asset amount
     * @param assets The amount of assets to be withdrawn
     * @return The calculated early withdrawal fee
     */
    function getEarlyWithdrawFee(uint256 assets) public view returns (uint256) {
        return tranche.feesOn() ? assets.mulDiv(vaultManager.earlyWithdrawFee(), 1e5, MathUpgradeable.Rounding.Up) : 0;
    }

    /** 
     * @notice Get the maximum lock time allowed for locking tranche tokens
     * @return The maximum lock time in seconds
     */
    function getMaxLockTime() public view returns (uint256) {
        return vaultManager.maxLockTime();
    }

    /** 
     * @notice Get the minimum lock time required for locking tranche tokens
     * @return The minimum lock time in seconds
     */
    function getMinLockTime() public view returns (uint256) {
        return vaultManager.minLockTime();
    }

    /** 
     * @notice Calculate the unlock fee for a given token ID based on remaining lockTime
     * @param tokenId The ID of the token to check the unlock fee for
     * @return The calculated unlock fee
     */
    function checkUnlockFee(uint256 tokenId) public view returns (uint256) {
        if (lockTimeByTokenId[tokenId] > block.timestamp) {
            uint256 fee = getEarlyWithdrawFee(tokensByTokenId[tokenId]);
/**
            if (fee > 0) {
                uint256 timeLeft = lockTimeByTokenId[tokenId] - block.timestamp;
                uint256 totalTime = lockTimeByTokenId[tokenId] - lockStartTimeByTokenId[tokenId];
                fee = fee.mulDiv(timeLeft, totalTime, MathUpgradeable.Rounding.Up);
            }
*/
            return fee;
        }
        return 0;
    }

    /** 
     * @notice Calculate lock points based on time locked
     * @param timeLocked The amount of time the tranche tokens are locked for
     * @return The calculated lock points
     */
    function getLockPoints(uint256 timeLocked) public view override returns (uint256) {
        uint256 lockedDays = timeLocked > getMinLockTime() ? (timeLocked - getMinLockTime()) / 86400 : 0;
        uint256 minPoints = 2e5;
        uint256 points = _PRECISION + minPoints + (((lockedDays ** 2) * multiplierCoeff * _PRECISION) / multiplierDenom);
        return points;
    }

    /** 
     * @dev Internal function to distribute rewards among participants
     * @param rewards The amount of rewards to distribute
     * @return The updated total lock points
     */
    function _distributeRewards(uint256 rewards) internal returns (uint256) {

        rewardsDistributedPerSharePerLockPoint += (rewards * (_PRECISION **3)) / getTotalLockPoints();
        emit RewardsDistributed(rewards, getTotalLockPoints());

        return getTotalLockPoints();
    }

    /** 
     * @dev Internal function to claim pending rewards for a specific token ID
     * @param tokenId The ID of the token for which to claim rewards
     */
    function _claimRewards(uint256 tokenId) internal {
        _updateReward(tokenId);
        if (rewardsByTokenId[tokenId] > 0) {
            SafeERC20.safeTransfer(IERC20Rebasing(tranche.asset()), _ownerOf(tokenId), rewardsByTokenId[tokenId]);
            emit RewardClaimed(tokenId, _ownerOf(tokenId), rewardsByTokenId[tokenId]);
            rewardsByTokenId[tokenId] = 0;
        }   
    }

    /** 
     * @dev Internal function to update the reward of a token ID. Updated while claiming reward.
     * @param _id The ID of the token for which to update the reward
     */
    function _updateReward(uint256 _id) internal {
        if(lastSharePoint[_id] == rewardsDistributedPerSharePerLockPoint ) return;

        uint256 pendingReward = ((rewardsDistributedPerSharePerLockPoint - lastSharePoint[_id]) *
                                tokensByTokenId[_id] * 
                                lockMultiplierByTokenId[_id]) /
                                (_PRECISION **4);
        rewardsByTokenId[_id] += pendingReward;
        lastSharePoint[_id] =  rewardsDistributedPerSharePerLockPoint;
    }

    /** 
     * @dev External function to update the lock multiplier of a token ID.
     * @param startId The starting ID of the token for which to update the lock multiplier
     * @param endId The ending ID of the token for which to update the lock multiplier
     */
    function updateLockMultipliers(uint startId, uint endId) external onlyGov {
        while (endId > startId) {
            uint _tokenId = endId;
            endId--;

            uint duration = lockTimeByTokenId[_tokenId] - lockStartTimeByTokenId[_tokenId];
            if (duration > 0 && tokensByTokenId[_tokenId] > 0) {
                _claimRewards(_tokenId);
                // remove current lock impact
                totalLockPoints -= tokensByTokenId[_tokenId] * lockMultiplierByTokenId[_tokenId];

                // use latest multiplier
                lockMultiplierByTokenId[_tokenId] = getLockPoints(duration);

                // add new lock impact to points
                totalLockPoints += tokensByTokenId[_tokenId] * lockMultiplierByTokenId[_tokenId];
            }
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

    uint256 private _status;

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

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

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

File 3 of 26 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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}.
 */
contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

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

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721_init_unchained(name_, symbol_);
    }

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

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

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

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

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

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

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be 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 override {
        address owner = ERC721Upgradeable.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner or approved for all"
        );

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @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.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - 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, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _ownerOf(tokenId) != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721Upgradeable.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * 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 virtual {
        _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);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @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 virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId, 1);

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId, 1);
    }

    /**
     * @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 virtual {
        address owner = ERC721Upgradeable.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId, 1);

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721Upgradeable.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId, 1);
    }

    /**
     * @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 virtual {
        require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * 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
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
     * being 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`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __unsafe_increaseBalance(address account, uint256 amount) internal {
        _balances[account] += amount;
    }

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

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

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../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 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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 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);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @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.encodeWithSelector(token.approve.selector, spender, value);

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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.isContract(address(token));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
import "@openzeppelin/contracts/interfaces/IERC4626.sol";

interface ITranche is IERC4626 {
    function feesOn() external view returns (bool);

    function sendVeRewards(uint256 rewards) external;

    function totalReserved() external view returns (uint256);

    function depositCap() external view returns (uint256);

    function veTranche() external view returns (address);

    function withdrawAsVaultManager(uint256 amount) external;

    function reserveBalance(uint256) external;

    function releaseBalance(uint256) external;

    function hasLiquidity(uint256 _reserveAmount) external view returns (bool);

    function claimYield() external;
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

interface IVaultManager {
    //events
    event GovChanged(address indexed newGov);
    event StorageChanged(address indexed previousStorage, address indexed newStorage);
    event EarlyWithdrawFeeUpdated(uint256 previousFee, uint256 newFee);
    event VaultChanged(address indexed previousVault, address indexed newVault);
    event RewardsAllocated(uint256 amount, bool isPnl);
    event RewardsDistributed(uint256 juniorRewards);
    event PnlRewardsDistributed(uint256 juniorRewards);
    event USDCSentToTrader(address indexed trader, uint256 amount);
    event USDCReceivedFromTrader(address indexed trader, uint256 amount);
    event BalanceReserved(uint256 amount);
    event BalanceReleased(uint256 amount);
    event TradingContractAdded(address a);
    event TradingContractRemoved(address a);
    event ReferralRebateAwarded(uint amount);
    event NumberUpdated(string name, uint value);
    event CurrentOpenPnlUpdated(int _newPnl);
    event KeeperSet(address keeper);
    event YieldReturned(uint amount);
    function maxLockTime() external view returns (uint256);

    function minLockTime() external view returns (uint256);

    function earlyWithdrawFee() external view returns (uint256);

    function getCollateralFee() external view returns (uint256);

    function gov() external view returns (address);

    function sendUSDCToTrader(address, uint) external;

    function receiveUSDCFromTrader(address, uint) external;

    function currentBalanceUSDC() external view returns (uint256);

    function allocateRewards(uint256, bool) external;

    function reserveBalance(uint256) external;

    function releaseBalance(uint256) external;

    function sendReferrerRebateToStorage(uint) external;

    function recieveBlastYield(uint, uint) external;

    function accYield(uint) external;
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

interface IVeTranche {
    // Define events
    event Locked(
        uint256 indexed tokenId,
        address indexed owner,
        uint256 shares,
        uint256 lockTime,
        uint256 lockMultiplier
    );
    event Unlocked(uint256 indexed tokenId, address indexed owner, uint256 shares, uint256 fee);
    event RewardsDistributed(uint256 totalRewards, uint256 totalLockPoints);
    event RewardClaimed(uint256 indexed tokenId, address indexed owner, uint256 amount);
    event NumberUpdated(string name, uint value);
    
    function distributeRewards(uint256) external returns (uint256);

    function getTotalLockPoints() external returns (uint256);

    function getLockPoints(uint256) external returns (uint256);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

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

interface IERC20Rebasing is IERC20 {
  // changes the yield mode of the caller and update the balance
  // to reflect the configuration
  function configure(YieldMode) external returns (uint256);
  // "claimable" yield mode accounts can call this this claim their yield
  // to another address
  function claim(address recipient, uint256 amount) external returns (uint256);
  // read the claimable amount for an account
  function getClaimableAmount(address account) external view returns (uint256);
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

enum YieldMode {
    AUTOMATIC,
    VOID,
    CLAIMABLE
}

enum GasMode {
    VOID,
    CLAIMABLE 
}

interface IBlastPoints{
    function configurePointsOperator(address operator) external;
}

interface IBlast {
    // configure
    function configureContract(address contractAddress, YieldMode _yield, GasMode gasMode, address governor) external;
    function configure(YieldMode _yield, GasMode gasMode, address governor) external;

    // base configuration options
    function configureClaimableYield() external;
    function configureClaimableYieldOnBehalf(address contractAddress) external;
    function configureAutomaticYield() external;
    function configureAutomaticYieldOnBehalf(address contractAddress) external;
    function configureVoidYield() external;
    function configureVoidYieldOnBehalf(address contractAddress) external;
    function configureClaimableGas() external;
    function configureClaimableGasOnBehalf(address contractAddress) external;
    function configureVoidGas() external;
    function configureVoidGasOnBehalf(address contractAddress) external;
    function configureGovernor(address _governor) external;
    function configureGovernorOnBehalf(address _newGovernor, address contractAddress) external;

    // claim yield
    function claimYield(address contractAddress, address recipientOfYield, uint256 amount) external returns (uint256);
    function claimAllYield(address contractAddress, address recipientOfYield) external returns (uint256);

    // claim gas
    function claimAllGas(address contractAddress, address recipientOfGas) external returns (uint256);
    function claimGasAtMinClaimRate(address contractAddress, address recipientOfGas, uint256 minClaimRateBips) external returns (uint256);
    function claimMaxGas(address contractAddress, address recipientOfGas) external returns (uint256);
    function claimGas(address contractAddress, address recipientOfGas, uint256 gasToClaim, uint256 gasSecondsToConsume) external returns (uint256);

    // read functions
    function readClaimableYield(address contractAddress) external view returns (uint256);
    function readYieldConfiguration(address contractAddress) external view returns (uint8);
    function readGasParams(address contractAddress) external view returns (uint256 etherSeconds, uint256 etherBalance, uint256 lastUpdated, GasMode);

}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

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

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * 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 caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

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

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

File 13 of 26 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = MathUpgradeable.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), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.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, MathUpgradeable.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) {
        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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        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 keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface 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].
     */
    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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC4626.sol)

pragma solidity ^0.8.0;

import "../token/ERC20/IERC20.sol";
import "../token/ERC20/extensions/IERC20Metadata.sol";

/**
 * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
 * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
 *
 * _Available since v4.7._
 */
interface IERC4626 is IERC20, IERC20Metadata {
    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);

    event Withdraw(
        address indexed sender,
        address indexed receiver,
        address indexed owner,
        uint256 assets,
        uint256 shares
    );

    /**
     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
     *
     * - MUST be an ERC-20 token contract.
     * - MUST NOT revert.
     */
    function asset() external view returns (address assetTokenAddress);

    /**
     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.
     *
     * - SHOULD include any compounding that occurs from yield.
     * - MUST be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT revert.
     */
    function totalAssets() external view returns (uint256 totalManagedAssets);

    /**
     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
     * scenario where all the conditions are met.
     *
     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT show any variations depending on the caller.
     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
     * - MUST NOT revert.
     *
     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
     * from.
     */
    function convertToShares(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
     * scenario where all the conditions are met.
     *
     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT show any variations depending on the caller.
     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
     * - MUST NOT revert.
     *
     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
     * from.
     */
    function convertToAssets(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
     * through a deposit call.
     *
     * - MUST return a limited value if receiver is subject to some deposit limit.
     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
     * - MUST NOT revert.
     */
    function maxDeposit(address receiver) external view returns (uint256 maxAssets);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
     * current on-chain conditions.
     *
     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
     *   in the same transaction.
     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.
     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
     */
    function previewDeposit(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
     *
     * - MUST emit the Deposit event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   deposit execution, and are accounted for during deposit.
     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
     *   approving enough underlying tokens to the Vault contract, etc).
     *
     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
     */
    function deposit(uint256 assets, address receiver) external returns (uint256 shares);

    /**
     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
     * - MUST return a limited value if receiver is subject to some mint limit.
     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
     * - MUST NOT revert.
     */
    function maxMint(address receiver) external view returns (uint256 maxShares);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
     * current on-chain conditions.
     *
     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
     *   same transaction.
     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
     *   would be accepted, regardless if the user has enough tokens approved, etc.
     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by minting.
     */
    function previewMint(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
     *
     * - MUST emit the Deposit event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
     *   execution, and are accounted for during mint.
     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
     *   approving enough underlying tokens to the Vault contract, etc).
     *
     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
     */
    function mint(uint256 shares, address receiver) external returns (uint256 assets);

    /**
     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
     * Vault, through a withdraw call.
     *
     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
     * - MUST NOT revert.
     */
    function maxWithdraw(address owner) external view returns (uint256 maxAssets);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
     * given current on-chain conditions.
     *
     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
     *   called
     *   in the same transaction.
     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.
     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
     */
    function previewWithdraw(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
     *
     * - MUST emit the Withdraw event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   withdraw execution, and are accounted for during withdraw.
     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
     *   not having enough shares, etc).
     *
     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
     * Those methods should be performed separately.
     */
    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);

    /**
     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
     * through a redeem call.
     *
     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
     * - MUST NOT revert.
     */
    function maxRedeem(address owner) external view returns (uint256 maxShares);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
     * given current on-chain conditions.
     *
     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
     *   same transaction.
     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
     *   redemption would be accepted, regardless if the user has enough shares, etc.
     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.
     */
    function previewRedeem(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
     *
     * - MUST emit the Withdraw event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   redeem execution, and are accounted for during redeem.
     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
     *   not having enough shares, etc).
     *
     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
     * Those methods should be performed separately.
     */
    function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
}

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

pragma solidity ^0.8.0;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUpgradeable {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @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 up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (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; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                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.
            require(denominator > prod1, "Math: mulDiv overflow");

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

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            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 (rounding == Rounding.Up && 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 down.
     *
     * 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 + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * 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 + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * 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 + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMathUpgradeable {
    /**
     * @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);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
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);
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "forge-std/=lib/forge-std/src/",
    "pyth-sdk-solidity/=lib/pyth-sdk-solidity/",
    "@chainlink/=lib/chainlink/",
    "chainlink/=lib/chainlink/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"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":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockMultiplier","type":"uint256"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"NumberUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalRewards","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalLockPoints","type":"uint256"}],"name":"RewardsDistributed","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":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"Unlocked","type":"event"},{"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":[],"name":"blast","outputs":[{"internalType":"contract IBlast","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"checkUnlockFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"distributeReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewards","type":"uint256"}],"name":"distributeRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"forceUnlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"getEarlyWithdrawFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timeLocked","type":"uint256"}],"name":"getLockPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxLockTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMinLockTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalLockPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tranche","type":"address"},{"internalType":"address","name":"_vaultManager","type":"address"},{"internalType":"address","name":"_blast","type":"address"},{"internalType":"address","name":"_blastPoints","type":"address"},{"internalType":"address","name":"_blastPointsOperator","type":"address"},{"internalType":"address","name":"_treasury","type":"address"}],"name":"initialize","outputs":[],"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":"uint256","name":"","type":"uint256"}],"name":"lastSharePoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"lock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockMultiplierByTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockStartTimeByTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockTimeByTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"multiplierCoeff","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"multiplierDenom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardsByTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsDistributedPerSharePerLockPoint","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":"_multiplierCoeff","type":"uint256"}],"name":"setMultiplierCoeff","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_multiplierDenom","type":"uint256"}],"name":"setMultiplierDenom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultManager","type":"address"}],"name":"setVaultManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenIds","outputs":[{"internalType":"uint256","name":"_value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokensByTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLockPoints","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tranche","outputs":[{"internalType":"contract ITranche","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startId","type":"uint256"},{"internalType":"uint256","name":"endId","type":"uint256"}],"name":"updateLockMultipliers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultManager","outputs":[{"internalType":"contract IVaultManager","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60806040523480156200001157600080fd5b506200001c62000022565b620000e3565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61390780620000f36000396000f3fe608060405234801561001057600080fd5b506004361061027f5760003560e01c80636ebc0af11161015c578063b543503e116100ce578063cce5fe6611610087578063cce5fe661461057f578063d5a39b8014610592578063d76c4752146105b2578063e3bcd27c146105d2578063e985e9c5146105e5578063eae85bb81461062157600080fd5b8063b543503e14610518578063b88d4fde1461052b578063bf968a1b1461053e578063c87b56dd14610551578063ca8f45bd14610564578063cc2a9a5b1461056c57600080fd5b80638dab49cf116101205780638dab49cf146104b957806390eab71e146104c257806391527611146104d557806395d89b41146104f5578063a22cb465146104fd578063a4ba87e31461051057600080fd5b80636ebc0af11461045657806370a0823114610469578063714cff561461047c578063814f76f7146104865780638a4adf24146104a657600080fd5b806331f758c2116101f557806342842e0e116101b957806342842e0e146103ee57806359974e38146104015780636198e3391461041457806361d027b3146104275780636352211e1461043a5780636c05a98d1461044d57600080fd5b806331f758c2146103975780633279cc86146103aa57806333d14c49146103ca578063394e5fc2146103d357806341745008146103e657600080fd5b80630e662512116102475780630e662512146103145780631338736f1461032b578063175e1a7d1461033e578063193f31e41461035157806323b872dd14610364578063259c5f251461037757600080fd5b806301ffc9a71461028457806306fdde03146102ac578063081812fc146102c1578063095ea7b3146102ec5780630962ef7914610301575b600080fd5b6102976102923660046132a7565b610634565b60405190151581526020015b60405180910390f35b6102b4610686565b6040516102a391906134a7565b6102d46102cf36600461334f565b610718565b6040516001600160a01b0390911681526020016102a3565b6102ff6102fa36600461325e565b61073f565b005b6102ff61030f36600461334f565b61085a565b61031d60cf5481565b6040519081526020016102a3565b61031d610339366004613381565b61089e565b60c9546102d4906001600160a01b031681565b61031d61035f36600461334f565b610be7565b6102ff610372366004613140565b610c24565b61031d61038536600461334f565b60d26020526000908152604090205481565b6102ff6103a536600461334f565b610c55565b61031d6103b836600461334f565b60d66020526000908152604090205481565b61031d60ce5481565b6102ff6103e136600461334f565b610db8565b61031d610f14565b6102ff6103fc366004613140565b610f96565b61031d61040f36600461334f565b610fb1565b6102ff61042236600461334f565b611006565b60cd546102d4906001600160a01b031681565b6102d461044836600461334f565b6112e1565b61031d60d15481565b60cb546102d4906001600160a01b031681565b61031d61047736600461304b565b611340565b60ca5461031d9081565b61031d61049436600461334f565b60d46020526000908152604090205481565b60cc546102d4906001600160a01b031681565b61031d60d05481565b6102ff6104d0366004613381565b6113c6565b61031d6104e336600461334f565b60d36020526000908152604090205481565b6102b4611572565b6102ff61050b366004613230565b611581565b61031d61158c565b6102ff61052636600461304b565b61159f565b6102ff610539366004613181565b6116bf565b6102ff61054c36600461334f565b6116f7565b6102b461055f36600461334f565b611944565b61031d6119b7565b6102ff61057a3660046130be565b6119fc565b61031d61058d36600461334f565b611e68565b61031d6105a036600461334f565b60d56020526000908152604090205481565b61031d6105c036600461334f565b60d76020526000908152604090205481565b6102ff6105e0366004613381565b611f01565b6102976105f3366004613085565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b61031d61062f36600461334f565b611f71565b60006001600160e01b031982166380ac58cd60e01b148061066557506001600160e01b03198216635b5e139f60e01b145b8061068057506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606065805461069590613805565b80601f01602080910402602001604051908101604052809291908181526020018280546106c190613805565b801561070e5780601f106106e35761010080835404028352916020019161070e565b820191906000526020600020905b8154815290600101906020018083116106f157829003601f168201915b5050505050905090565b600061072382612084565b506000908152606960205260409020546001600160a01b031690565b600061074a826112e1565b9050806001600160a01b0316836001600160a01b031614156107bd5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806107d957506107d981336105f3565b61084b5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016107b4565b61085583836120d4565b505050565b610862612142565b61086b8161219c565b6001600160a01b0316336001600160a01b03161461088857600080fd5b610891816121b7565b61089b6001609755565b50565b60006108a8612142565b6108b0610f14565b8211156108f45760405162461bcd60e51b81526020600482015260126024820152714f5645525f4d41585f4c4f434b5f54494d4560701b60448201526064016107b4565b6108fc6119b7565b8210156109415760405162461bcd60e51b81526020600482015260136024820152721313d0d2d7d512535157d513d3d7d4d3505313606a1b60448201526064016107b4565b600083116109875760405162461bcd60e51b81526020600482015260136024820152724c4f434b5f414d4f554e545f49535f5a45524f60681b60448201526064016107b4565b60cb546040516370a0823160e01b815233600482015284916001600160a01b0316906370a082319060240160206040518083038186803b1580156109ca57600080fd5b505afa1580156109de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a029190613368565b1015610a505760405162461bcd60e51b815260206004820152601b60248201527f494e53554646494349454e545f5452414e4348455f544f4b454e53000000000060448201526064016107b4565b6000610a5b60ca5490565b60cb546040516323b872dd60e01b8152336004820152306024820152604481018790529192506001600160a01b0316906323b872dd90606401602060405180830381600087803b158015610aae57600080fd5b505af1158015610ac2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae6919061328a565b50610af133826122e6565b600081815260d360205260409020849055610b0c8342613664565b600082815260d4602090815260408083209390935560d5815282822042905560d2905290812055610b3c83611e68565b600082815260d66020818152604080842094855560d05460d78352932092909255905254610b6a908561378c565b60d16000828254610b7b9190613664565b909155505060ca80546001019055600081815260d66020908152604091829020548251878152918201869052818301529051339183917fd5987d72b516fb12b1d31e6a7ab75f0c975e512aba9225ebbbb1b58c25cbb7a79181900360600190a390506106806001609755565b600081815260d46020526040812054421015610c1c57600082815260d36020526040812054610c1590611f71565b9392505050565b506000919050565b610c2e3382612453565b610c4a5760405162461bcd60e51b81526004016107b4906134ba565b6108558383836124d2565b60cc60009054906101000a90046001600160a01b03166001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b158015610ca357600080fd5b505afa158015610cb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdb9190613068565b6001600160a01b0316336001600160a01b031614610d0b5760405162461bcd60e51b81526004016107b4906135e9565b60008111610d4c5760405162461bcd60e51b815260206004820152600e60248201526d13955350915497d253959053125160921b60448201526064016107b4565b60cf819055604080518181526016918101919091527526bab63a34b83634b2b9102232b737b6b4b730ba37b960511b6060820152602081018290527f8cf3e35f6221b16e1670a3413180c9484bf5aa71787905909fa82a6a2662e9ab906080015b60405180910390a150565b60cc60009054906101000a90046001600160a01b03166001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0657600080fd5b505afa158015610e1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3e9190613068565b6001600160a01b0316336001600160a01b031614610e6e5760405162461bcd60e51b81526004016107b4906135e9565b60008111610eaf5760405162461bcd60e51b815260206004820152600e60248201526d13955350915497d253959053125160921b60448201526064016107b4565b60ce8190556040805181815260169181019190915275135d5b1d1a5c1b1a595c8810dbd959999a58da595b9d60521b6060820152602081018290527f8cf3e35f6221b16e1670a3413180c9484bf5aa71787905909fa82a6a2662e9ab90608001610dad565b60cc5460408051636984708760e11b815290516000926001600160a01b03169163d308e10e916004808301926020929190829003018186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190613368565b905090565b610855838383604051806020016040528060008152506116bf565b60cc546000906001600160a01b03163314610ffd5760405162461bcd60e51b815260206004820152600c60248201526b4d414e414745525f4f4e4c5960a01b60448201526064016107b4565b61068082612636565b61100e612142565b600081815260d3602052604090205461105d5760405162461bcd60e51b81526020600482015260116024820152704e4f5448494e475f544f5f554e4c4f434b60781b60448201526064016107b4565b611066816112e1565b6001600160a01b0316336001600160a01b0316146110b25760405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b60448201526064016107b4565b60006110bd82610be7565b90506110c8826121b7565b6110d1826126c3565b60cb54600083815260d360205260409020546001600160a01b039091169063a9059cbb9033906111029085906137ab565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561114857600080fd5b505af115801561115c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611180919061328a565b5060cb5460cd5460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb90604401602060405180830381600087803b1580156111d157600080fd5b505af11580156111e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611209919061328a565b50600082815260d36020908152604091829020548251908152908101839052339184917f264527c9df24015c81d07cee6ed0aaa3cb7dae31d37f68c16c15c9f8f89fba7b910160405180910390a3600082815260d6602090815260408083205460d39092529091205461127c919061378c565b60d1600082825461128d91906137ab565b909155505050600081815260d36020908152604080832083905560d2825280832083905560d4825280832083905560d5825280832083905560d6825280832083905560d790915281205561089b6001609755565b6000806112ed8361219c565b90506001600160a01b0381166106805760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016107b4565b60006001600160a01b0382166113aa5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016107b4565b506001600160a01b031660009081526068602052604090205490565b60cc60009054906101000a90046001600160a01b03166001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b15801561141457600080fd5b505afa158015611428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144c9190613068565b6001600160a01b0316336001600160a01b03161461147c5760405162461bcd60e51b81526004016107b4906135e9565b8181111561156e57808061148f816137ee565b600083815260d5602090815260408083205460d49092528220549295509092506114b8916137ab565b90506000811180156114d75750600082815260d3602052604090205415155b15611567576114e5826121b7565b600082815260d6602090815260408083205460d39092529091205461150a919061378c565b60d1600082825461151b91906137ab565b9091555061152a905081611e68565b600083815260d66020908152604080832084905560d3909152902054611550919061378c565b60d160008282546115619190613664565b90915550505b505061147c565b5050565b60606066805461069590613805565b61156e338383612758565b6000620f424060d154610f91919061367c565b60cc60009054906101000a90046001600160a01b03166001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b1580156115ed57600080fd5b505afa158015611601573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116259190613068565b6001600160a01b0316336001600160a01b0316146116555760405162461bcd60e51b81526004016107b4906135e9565b6001600160a01b03811661169d5760405162461bcd60e51b815260206004820152600f60248201526e105111149154d4d7d2539590531251608a1b60448201526064016107b4565b60cc80546001600160a01b0319166001600160a01b0392909216919091179055565b6116c93383612453565b6116e55760405162461bcd60e51b81526004016107b4906134ba565b6116f184848484612827565b50505050565b6116ff612142565b600081815260d4602052604090205442116117485760405162461bcd60e51b8152602060048201526009602482015268544f4f5f4541524c5960b81b60448201526064016107b4565b600081815260d360205260409020546117975760405162461bcd60e51b81526020600482015260116024820152704e4f5448494e475f544f5f554e4c4f434b60781b60448201526064016107b4565b6117a0816121b7565b60cb546001600160a01b031663a9059cbb6117ba8361219c565b600084815260d360205260409081902054905160e084901b6001600160e01b03191681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561181057600080fd5b505af1158015611824573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611848919061328a565b50611852816126c3565b61185b8161219c565b6001600160a01b0316817f264527c9df24015c81d07cee6ed0aaa3cb7dae31d37f68c16c15c9f8f89fba7b60d360008581526020019081526020016000205460006040516118b3929190918252602082015260400190565b60405180910390a3600081815260d6602090815260408083205460d3909252909120546118e0919061378c565b60d160008282546118f191906137ab565b9091555050600081815260d36020908152604080832083905560d2825280832083905560d4825280832083905560d5825280832083905560d6825280832083905560d790915281205561089b6001609755565b606061194f82612084565b600061196660408051602081019091526000815290565b905060008151116119865760405180602001604052806000815250610c15565b806119908461285a565b6040516020016119a19291906133eb565b6040516020818303038152906040529392505050565b60cc5460408051635307fbb360e11b815290516000926001600160a01b03169163a60ff766916004808301926020929190829003018186803b158015610f5957600080fd5b600054610100900460ff1615808015611a1c5750600054600160ff909116105b80611a365750303b158015611a36575060005460ff166001145b611a995760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016107b4565b6000805460ff191660011790558015611abc576000805461ff0019166101001790555b60cb80546001600160a01b03808a166001600160a01b03199283161790925560cc805492891692909116919091179055630ad1786060ce55611b04620f4240621de92661378c565b60cf5560cb54604080516306fdde0360e01b81529051611c4b926001600160a01b0316916306fdde03916004808301926000929190829003018186803b158015611b4d57600080fd5b505afa158015611b61573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b8991908101906132e1565b604051602001611b99919061341a565b60408051601f1981840301815282825260cb546395d89b4160e01b8452915190926001600160a01b03909216916395d89b41916004808301926000929190829003018186803b158015611beb57600080fd5b505afa158015611bff573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611c2791908101906132e1565b604051602001611c379190613449565b6040516020818303038152906040526128f7565b611c53612945565b60c980546001600160a01b0319166001600160a01b03871690811790915560408051634e606c4760e01b81529051634e606c479160048082019260009290919082900301818387803b158015611ca857600080fd5b505af1158015611cbc573d6000803e3d6000fd5b505060c95460cc54604080516312d43a5160e01b815290516001600160a01b03938416955063eb864698945091909216916312d43a51916004808301926020929190829003018186803b158015611d1257600080fd5b505afa158015611d26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4a9190613068565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401600060405180830381600087803b158015611d8b57600080fd5b505af1158015611d9f573d6000803e3d6000fd5b50506040516336b91f2b60e01b81526001600160a01b038681166004830152871692506336b91f2b9150602401600060405180830381600087803b158015611de657600080fd5b505af1158015611dfa573d6000803e3d6000fd5b505060cd80546001600160a01b0319166001600160a01b03861617905550508015611e5f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b600080611e736119b7565b8311611e80576000611ea0565b62015180611e8c6119b7565b611e9690856137ab565b611ea0919061367c565b9050600062030d409050600060cf54620f424060ce54600286611ec391906136e1565b611ecd919061378c565b611ed7919061378c565b611ee1919061367c565b611eee83620f4240613664565b611ef89190613664565b95945050505050565b60cc546001600160a01b03163314611f4a5760405162461bcd60e51b815260206004820152600c60248201526b4d414e414745525f4f4e4c5960a01b60448201526064016107b4565b600081815260d2602052604081208054849290611f68908490613664565b90915550505050565b60cb54604080516366b29f7360e11b815290516000926001600160a01b03169163cd653ee6916004808301926020929190829003018186803b158015611fb657600080fd5b505afa158015611fca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fee919061328a565b611ff9576000610680565b60cc54604080516354053c4160e11b81529051610680926001600160a01b03169163a80a7882916004808301926020929190829003018186803b15801561203f57600080fd5b505afa158015612053573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120779190613368565b8390620186a0600161296c565b61208d816129c7565b61089b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016107b4565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612109826112e1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600260975414156121955760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107b4565b6002609755565b6000908152606760205260409020546001600160a01b031690565b6121c0816129e4565b600081815260d260205260409020541561089b5760cb54604080516338d52e0f60e01b8152905161226f926001600160a01b0316916338d52e0f916004808301926020929190829003018186803b15801561221a57600080fd5b505afa15801561222e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122529190613068565b61225b8361219c565b600084815260d26020526040902054612a9f565b6122788161219c565b6001600160a01b0316817f24b5efa61dd1cfc659205a97fb8ed868f3cb8c81922bab2b96423e5de1de2cb760d26000858152602001908152602001600020546040516122c691815260200190565b60405180910390a3600090815260d26020526040812055565b6001609755565b6001600160a01b03821661233c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107b4565b612345816129c7565b156123925760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107b4565b61239b816129c7565b156123e85760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107b4565b6001600160a01b038216600081815260686020908152604080832080546001019055848352606790915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008061245f836112e1565b9050806001600160a01b0316846001600160a01b031614806124a657506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b806124ca5750836001600160a01b03166124bf84610718565b6001600160a01b0316145b949350505050565b826001600160a01b03166124e5826112e1565b6001600160a01b03161461250b5760405162461bcd60e51b81526004016107b490613559565b6001600160a01b03821661256d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016107b4565b826001600160a01b0316612580826112e1565b6001600160a01b0316146125a65760405162461bcd60e51b81526004016107b490613559565b600081815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260688552838620805460001901905590871680865283862080546001019055868652606790945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600061264061158c565b61264e6003620f42406136e1565b612658908461378c565b612662919061367c565b60d060008282546126739190613664565b909155507f29e98ba00d07f171959c4ddcd2f3020debc7c52cf537a034d7e664340d098c6c9050826126a361158c565b6040805192835260208301919091520160405180910390a161068061158c565b60006126ce826112e1565b90506126d9826112e1565b600083815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526068845282852080546000190190558785526067909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b031614156127ba5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107b4565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6128328484846124d2565b61283e84848484612af1565b6116f15760405162461bcd60e51b81526004016107b490613507565b6060600061286783612bfb565b600101905060008167ffffffffffffffff81111561288757612887613882565b6040519080825280601f01601f1916602001820160405280156128b1576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846128ea576128ef565b6128bb565b509392505050565b600054610100900460ff1661291e5760405162461bcd60e51b81526004016107b49061359e565b8151612931906065906020850190612fb2565b508051610855906066906020840190612fb2565b600054610100900460ff166122df5760405162461bcd60e51b81526004016107b49061359e565b60008061297a868686612cd3565b905060018360028111156129905761299061386c565b1480156129ad5750600084806129a8576129a8613856565b868809115b15611ef8576129bd600182613664565b9695505050505050565b6000806129d38361219c565b6001600160a01b0316141592915050565b60d054600082815260d7602052604090205414156129ff5750565b6000612a0f6004620f42406136e1565b600083815260d6602090815260408083205460d383528184205460d790935292205460d054612a3e91906137ab565b612a48919061378c565b612a52919061378c565b612a5c919061367c565b90508060d260008481526020019081526020016000206000828254612a819190613664565b909155505060d054600092835260d760205260409092209190915550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610855908490612dbd565b60006001600160a01b0384163b15612bf357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612b35903390899088908890600401613474565b602060405180830381600087803b158015612b4f57600080fd5b505af1925050508015612b7f575060408051601f3d908101601f19168201909252612b7c918101906132c4565b60015b612bd9573d808015612bad576040519150601f19603f3d011682016040523d82523d6000602084013e612bb2565b606091505b508051612bd15760405162461bcd60e51b81526004016107b490613507565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506124ca565b5060016124ca565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612c3a5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612c66576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612c8457662386f26fc10000830492506010015b6305f5e1008310612c9c576305f5e100830492506008015b6127108310612cb057612710830492506004015b60648310612cc2576064830492506002015b600a83106106805760010192915050565b600080806000198587098587029250828110838203039150508060001415612d0e57838281612d0457612d04613856565b0492505050610c15565b808411612d555760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b60448201526064016107b4565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6000612e12826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612e929092919063ffffffff16565b9050805160001480612e33575080806020019051810190612e33919061328a565b6108555760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016107b4565b60606124ca848460008585600080866001600160a01b03168587604051612eb991906133cf565b60006040518083038185875af1925050503d8060008114612ef6576040519150601f19603f3d011682016040523d82523d6000602084013e612efb565b606091505b5091509150612f0c87838387612f17565b979650505050505050565b60608315612f83578251612f7c576001600160a01b0385163b612f7c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107b4565b50816124ca565b6124ca8383815115612f985781518083602001fd5b8060405162461bcd60e51b81526004016107b491906134a7565b828054612fbe90613805565b90600052602060002090601f016020900481019282612fe05760008555613026565b82601f10612ff957805160ff1916838001178555613026565b82800160010185558215613026579182015b8281111561302657825182559160200191906001019061300b565b50613032929150613036565b5090565b5b808211156130325760008155600101613037565b60006020828403121561305d57600080fd5b8135610c1581613898565b60006020828403121561307a57600080fd5b8151610c1581613898565b6000806040838503121561309857600080fd5b82356130a381613898565b915060208301356130b381613898565b809150509250929050565b60008060008060008060c087890312156130d757600080fd5b86356130e281613898565b955060208701356130f281613898565b9450604087013561310281613898565b9350606087013561311281613898565b9250608087013561312281613898565b915060a087013561313281613898565b809150509295509295509295565b60008060006060848603121561315557600080fd5b833561316081613898565b9250602084013561317081613898565b929592945050506040919091013590565b6000806000806080858703121561319757600080fd5b84356131a281613898565b935060208501356131b281613898565b925060408501359150606085013567ffffffffffffffff8111156131d557600080fd5b8501601f810187136131e657600080fd5b80356131f96131f48261363c565b61360b565b81815288602083850101111561320e57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000806040838503121561324357600080fd5b823561324e81613898565b915060208301356130b3816138ad565b6000806040838503121561327157600080fd5b823561327c81613898565b946020939093013593505050565b60006020828403121561329c57600080fd5b8151610c15816138ad565b6000602082840312156132b957600080fd5b8135610c15816138bb565b6000602082840312156132d657600080fd5b8151610c15816138bb565b6000602082840312156132f357600080fd5b815167ffffffffffffffff81111561330a57600080fd5b8201601f8101841361331b57600080fd5b80516133296131f48261363c565b81815285602083850101111561333e57600080fd5b611ef88260208301602086016137c2565b60006020828403121561336157600080fd5b5035919050565b60006020828403121561337a57600080fd5b5051919050565b6000806040838503121561339457600080fd5b50508035926020909101359150565b600081518084526133bb8160208601602086016137c2565b601f01601f19169290920160200192915050565b600082516133e18184602087016137c2565b9190910192915050565b600083516133fd8184602088016137c2565b8351908301906134118183602088016137c2565b01949350505050565b6602637b1b5b2b2160cd1b81526000825161343c8160078501602087016137c2565b9190910160070192915050565b6276652d60e81b8152600082516134678160038501602087016137c2565b9190910160030192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906129bd908301846133a3565b602081526000610c1560208301846133a3565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b602080825260089082015267474f565f4f4e4c5960c01b604082015260600190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561363457613634613882565b604052919050565b600067ffffffffffffffff82111561365657613656613882565b50601f01601f191660200190565b6000821982111561367757613677613840565b500190565b60008261369957634e487b7160e01b600052601260045260246000fd5b500490565b600181815b808511156136d95781600019048211156136bf576136bf613840565b808516156136cc57918102915b93841c93908002906136a3565b509250929050565b6000610c1560ff8416836000826136fa57506001610680565b8161370757506000610680565b816001811461371d576002811461372757613743565b6001915050610680565b60ff84111561373857613738613840565b50506001821b610680565b5060208310610133831016604e8410600b8410161715613766575081810a610680565b613770838361369e565b806000190482111561378457613784613840565b029392505050565b60008160001904831182151516156137a6576137a6613840565b500290565b6000828210156137bd576137bd613840565b500390565b60005b838110156137dd5781810151838201526020016137c5565b838111156116f15750506000910152565b6000816137fd576137fd613840565b506000190190565b600181811c9082168061381957607f821691505b6020821081141561383a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461089b57600080fd5b801515811461089b57600080fd5b6001600160e01b03198116811461089b57600080fdfea2646970667358221220cef4bac9e82aeefbfc890367354657a5f36120efa4bfdd58f194c0b5e672c97864736f6c63430008070033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061027f5760003560e01c80636ebc0af11161015c578063b543503e116100ce578063cce5fe6611610087578063cce5fe661461057f578063d5a39b8014610592578063d76c4752146105b2578063e3bcd27c146105d2578063e985e9c5146105e5578063eae85bb81461062157600080fd5b8063b543503e14610518578063b88d4fde1461052b578063bf968a1b1461053e578063c87b56dd14610551578063ca8f45bd14610564578063cc2a9a5b1461056c57600080fd5b80638dab49cf116101205780638dab49cf146104b957806390eab71e146104c257806391527611146104d557806395d89b41146104f5578063a22cb465146104fd578063a4ba87e31461051057600080fd5b80636ebc0af11461045657806370a0823114610469578063714cff561461047c578063814f76f7146104865780638a4adf24146104a657600080fd5b806331f758c2116101f557806342842e0e116101b957806342842e0e146103ee57806359974e38146104015780636198e3391461041457806361d027b3146104275780636352211e1461043a5780636c05a98d1461044d57600080fd5b806331f758c2146103975780633279cc86146103aa57806333d14c49146103ca578063394e5fc2146103d357806341745008146103e657600080fd5b80630e662512116102475780630e662512146103145780631338736f1461032b578063175e1a7d1461033e578063193f31e41461035157806323b872dd14610364578063259c5f251461037757600080fd5b806301ffc9a71461028457806306fdde03146102ac578063081812fc146102c1578063095ea7b3146102ec5780630962ef7914610301575b600080fd5b6102976102923660046132a7565b610634565b60405190151581526020015b60405180910390f35b6102b4610686565b6040516102a391906134a7565b6102d46102cf36600461334f565b610718565b6040516001600160a01b0390911681526020016102a3565b6102ff6102fa36600461325e565b61073f565b005b6102ff61030f36600461334f565b61085a565b61031d60cf5481565b6040519081526020016102a3565b61031d610339366004613381565b61089e565b60c9546102d4906001600160a01b031681565b61031d61035f36600461334f565b610be7565b6102ff610372366004613140565b610c24565b61031d61038536600461334f565b60d26020526000908152604090205481565b6102ff6103a536600461334f565b610c55565b61031d6103b836600461334f565b60d66020526000908152604090205481565b61031d60ce5481565b6102ff6103e136600461334f565b610db8565b61031d610f14565b6102ff6103fc366004613140565b610f96565b61031d61040f36600461334f565b610fb1565b6102ff61042236600461334f565b611006565b60cd546102d4906001600160a01b031681565b6102d461044836600461334f565b6112e1565b61031d60d15481565b60cb546102d4906001600160a01b031681565b61031d61047736600461304b565b611340565b60ca5461031d9081565b61031d61049436600461334f565b60d46020526000908152604090205481565b60cc546102d4906001600160a01b031681565b61031d60d05481565b6102ff6104d0366004613381565b6113c6565b61031d6104e336600461334f565b60d36020526000908152604090205481565b6102b4611572565b6102ff61050b366004613230565b611581565b61031d61158c565b6102ff61052636600461304b565b61159f565b6102ff610539366004613181565b6116bf565b6102ff61054c36600461334f565b6116f7565b6102b461055f36600461334f565b611944565b61031d6119b7565b6102ff61057a3660046130be565b6119fc565b61031d61058d36600461334f565b611e68565b61031d6105a036600461334f565b60d56020526000908152604090205481565b61031d6105c036600461334f565b60d76020526000908152604090205481565b6102ff6105e0366004613381565b611f01565b6102976105f3366004613085565b6001600160a01b039182166000908152606a6020908152604080832093909416825291909152205460ff1690565b61031d61062f36600461334f565b611f71565b60006001600160e01b031982166380ac58cd60e01b148061066557506001600160e01b03198216635b5e139f60e01b145b8061068057506301ffc9a760e01b6001600160e01b03198316145b92915050565b60606065805461069590613805565b80601f01602080910402602001604051908101604052809291908181526020018280546106c190613805565b801561070e5780601f106106e35761010080835404028352916020019161070e565b820191906000526020600020905b8154815290600101906020018083116106f157829003601f168201915b5050505050905090565b600061072382612084565b506000908152606960205260409020546001600160a01b031690565b600061074a826112e1565b9050806001600160a01b0316836001600160a01b031614156107bd5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806107d957506107d981336105f3565b61084b5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016107b4565b61085583836120d4565b505050565b610862612142565b61086b8161219c565b6001600160a01b0316336001600160a01b03161461088857600080fd5b610891816121b7565b61089b6001609755565b50565b60006108a8612142565b6108b0610f14565b8211156108f45760405162461bcd60e51b81526020600482015260126024820152714f5645525f4d41585f4c4f434b5f54494d4560701b60448201526064016107b4565b6108fc6119b7565b8210156109415760405162461bcd60e51b81526020600482015260136024820152721313d0d2d7d512535157d513d3d7d4d3505313606a1b60448201526064016107b4565b600083116109875760405162461bcd60e51b81526020600482015260136024820152724c4f434b5f414d4f554e545f49535f5a45524f60681b60448201526064016107b4565b60cb546040516370a0823160e01b815233600482015284916001600160a01b0316906370a082319060240160206040518083038186803b1580156109ca57600080fd5b505afa1580156109de573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a029190613368565b1015610a505760405162461bcd60e51b815260206004820152601b60248201527f494e53554646494349454e545f5452414e4348455f544f4b454e53000000000060448201526064016107b4565b6000610a5b60ca5490565b60cb546040516323b872dd60e01b8152336004820152306024820152604481018790529192506001600160a01b0316906323b872dd90606401602060405180830381600087803b158015610aae57600080fd5b505af1158015610ac2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae6919061328a565b50610af133826122e6565b600081815260d360205260409020849055610b0c8342613664565b600082815260d4602090815260408083209390935560d5815282822042905560d2905290812055610b3c83611e68565b600082815260d66020818152604080842094855560d05460d78352932092909255905254610b6a908561378c565b60d16000828254610b7b9190613664565b909155505060ca80546001019055600081815260d66020908152604091829020548251878152918201869052818301529051339183917fd5987d72b516fb12b1d31e6a7ab75f0c975e512aba9225ebbbb1b58c25cbb7a79181900360600190a390506106806001609755565b600081815260d46020526040812054421015610c1c57600082815260d36020526040812054610c1590611f71565b9392505050565b506000919050565b610c2e3382612453565b610c4a5760405162461bcd60e51b81526004016107b4906134ba565b6108558383836124d2565b60cc60009054906101000a90046001600160a01b03166001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b158015610ca357600080fd5b505afa158015610cb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cdb9190613068565b6001600160a01b0316336001600160a01b031614610d0b5760405162461bcd60e51b81526004016107b4906135e9565b60008111610d4c5760405162461bcd60e51b815260206004820152600e60248201526d13955350915497d253959053125160921b60448201526064016107b4565b60cf819055604080518181526016918101919091527526bab63a34b83634b2b9102232b737b6b4b730ba37b960511b6060820152602081018290527f8cf3e35f6221b16e1670a3413180c9484bf5aa71787905909fa82a6a2662e9ab906080015b60405180910390a150565b60cc60009054906101000a90046001600160a01b03166001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0657600080fd5b505afa158015610e1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3e9190613068565b6001600160a01b0316336001600160a01b031614610e6e5760405162461bcd60e51b81526004016107b4906135e9565b60008111610eaf5760405162461bcd60e51b815260206004820152600e60248201526d13955350915497d253959053125160921b60448201526064016107b4565b60ce8190556040805181815260169181019190915275135d5b1d1a5c1b1a595c8810dbd959999a58da595b9d60521b6060820152602081018290527f8cf3e35f6221b16e1670a3413180c9484bf5aa71787905909fa82a6a2662e9ab90608001610dad565b60cc5460408051636984708760e11b815290516000926001600160a01b03169163d308e10e916004808301926020929190829003018186803b158015610f5957600080fd5b505afa158015610f6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f919190613368565b905090565b610855838383604051806020016040528060008152506116bf565b60cc546000906001600160a01b03163314610ffd5760405162461bcd60e51b815260206004820152600c60248201526b4d414e414745525f4f4e4c5960a01b60448201526064016107b4565b61068082612636565b61100e612142565b600081815260d3602052604090205461105d5760405162461bcd60e51b81526020600482015260116024820152704e4f5448494e475f544f5f554e4c4f434b60781b60448201526064016107b4565b611066816112e1565b6001600160a01b0316336001600160a01b0316146110b25760405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b60448201526064016107b4565b60006110bd82610be7565b90506110c8826121b7565b6110d1826126c3565b60cb54600083815260d360205260409020546001600160a01b039091169063a9059cbb9033906111029085906137ab565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561114857600080fd5b505af115801561115c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611180919061328a565b5060cb5460cd5460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810184905291169063a9059cbb90604401602060405180830381600087803b1580156111d157600080fd5b505af11580156111e5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611209919061328a565b50600082815260d36020908152604091829020548251908152908101839052339184917f264527c9df24015c81d07cee6ed0aaa3cb7dae31d37f68c16c15c9f8f89fba7b910160405180910390a3600082815260d6602090815260408083205460d39092529091205461127c919061378c565b60d1600082825461128d91906137ab565b909155505050600081815260d36020908152604080832083905560d2825280832083905560d4825280832083905560d5825280832083905560d6825280832083905560d790915281205561089b6001609755565b6000806112ed8361219c565b90506001600160a01b0381166106805760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016107b4565b60006001600160a01b0382166113aa5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016107b4565b506001600160a01b031660009081526068602052604090205490565b60cc60009054906101000a90046001600160a01b03166001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b15801561141457600080fd5b505afa158015611428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144c9190613068565b6001600160a01b0316336001600160a01b03161461147c5760405162461bcd60e51b81526004016107b4906135e9565b8181111561156e57808061148f816137ee565b600083815260d5602090815260408083205460d49092528220549295509092506114b8916137ab565b90506000811180156114d75750600082815260d3602052604090205415155b15611567576114e5826121b7565b600082815260d6602090815260408083205460d39092529091205461150a919061378c565b60d1600082825461151b91906137ab565b9091555061152a905081611e68565b600083815260d66020908152604080832084905560d3909152902054611550919061378c565b60d160008282546115619190613664565b90915550505b505061147c565b5050565b60606066805461069590613805565b61156e338383612758565b6000620f424060d154610f91919061367c565b60cc60009054906101000a90046001600160a01b03166001600160a01b03166312d43a516040518163ffffffff1660e01b815260040160206040518083038186803b1580156115ed57600080fd5b505afa158015611601573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116259190613068565b6001600160a01b0316336001600160a01b0316146116555760405162461bcd60e51b81526004016107b4906135e9565b6001600160a01b03811661169d5760405162461bcd60e51b815260206004820152600f60248201526e105111149154d4d7d2539590531251608a1b60448201526064016107b4565b60cc80546001600160a01b0319166001600160a01b0392909216919091179055565b6116c93383612453565b6116e55760405162461bcd60e51b81526004016107b4906134ba565b6116f184848484612827565b50505050565b6116ff612142565b600081815260d4602052604090205442116117485760405162461bcd60e51b8152602060048201526009602482015268544f4f5f4541524c5960b81b60448201526064016107b4565b600081815260d360205260409020546117975760405162461bcd60e51b81526020600482015260116024820152704e4f5448494e475f544f5f554e4c4f434b60781b60448201526064016107b4565b6117a0816121b7565b60cb546001600160a01b031663a9059cbb6117ba8361219c565b600084815260d360205260409081902054905160e084901b6001600160e01b03191681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561181057600080fd5b505af1158015611824573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611848919061328a565b50611852816126c3565b61185b8161219c565b6001600160a01b0316817f264527c9df24015c81d07cee6ed0aaa3cb7dae31d37f68c16c15c9f8f89fba7b60d360008581526020019081526020016000205460006040516118b3929190918252602082015260400190565b60405180910390a3600081815260d6602090815260408083205460d3909252909120546118e0919061378c565b60d160008282546118f191906137ab565b9091555050600081815260d36020908152604080832083905560d2825280832083905560d4825280832083905560d5825280832083905560d6825280832083905560d790915281205561089b6001609755565b606061194f82612084565b600061196660408051602081019091526000815290565b905060008151116119865760405180602001604052806000815250610c15565b806119908461285a565b6040516020016119a19291906133eb565b6040516020818303038152906040529392505050565b60cc5460408051635307fbb360e11b815290516000926001600160a01b03169163a60ff766916004808301926020929190829003018186803b158015610f5957600080fd5b600054610100900460ff1615808015611a1c5750600054600160ff909116105b80611a365750303b158015611a36575060005460ff166001145b611a995760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016107b4565b6000805460ff191660011790558015611abc576000805461ff0019166101001790555b60cb80546001600160a01b03808a166001600160a01b03199283161790925560cc805492891692909116919091179055630ad1786060ce55611b04620f4240621de92661378c565b60cf5560cb54604080516306fdde0360e01b81529051611c4b926001600160a01b0316916306fdde03916004808301926000929190829003018186803b158015611b4d57600080fd5b505afa158015611b61573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b8991908101906132e1565b604051602001611b99919061341a565b60408051601f1981840301815282825260cb546395d89b4160e01b8452915190926001600160a01b03909216916395d89b41916004808301926000929190829003018186803b158015611beb57600080fd5b505afa158015611bff573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611c2791908101906132e1565b604051602001611c379190613449565b6040516020818303038152906040526128f7565b611c53612945565b60c980546001600160a01b0319166001600160a01b03871690811790915560408051634e606c4760e01b81529051634e606c479160048082019260009290919082900301818387803b158015611ca857600080fd5b505af1158015611cbc573d6000803e3d6000fd5b505060c95460cc54604080516312d43a5160e01b815290516001600160a01b03938416955063eb864698945091909216916312d43a51916004808301926020929190829003018186803b158015611d1257600080fd5b505afa158015611d26573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4a9190613068565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401600060405180830381600087803b158015611d8b57600080fd5b505af1158015611d9f573d6000803e3d6000fd5b50506040516336b91f2b60e01b81526001600160a01b038681166004830152871692506336b91f2b9150602401600060405180830381600087803b158015611de657600080fd5b505af1158015611dfa573d6000803e3d6000fd5b505060cd80546001600160a01b0319166001600160a01b03861617905550508015611e5f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050565b600080611e736119b7565b8311611e80576000611ea0565b62015180611e8c6119b7565b611e9690856137ab565b611ea0919061367c565b9050600062030d409050600060cf54620f424060ce54600286611ec391906136e1565b611ecd919061378c565b611ed7919061378c565b611ee1919061367c565b611eee83620f4240613664565b611ef89190613664565b95945050505050565b60cc546001600160a01b03163314611f4a5760405162461bcd60e51b815260206004820152600c60248201526b4d414e414745525f4f4e4c5960a01b60448201526064016107b4565b600081815260d2602052604081208054849290611f68908490613664565b90915550505050565b60cb54604080516366b29f7360e11b815290516000926001600160a01b03169163cd653ee6916004808301926020929190829003018186803b158015611fb657600080fd5b505afa158015611fca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fee919061328a565b611ff9576000610680565b60cc54604080516354053c4160e11b81529051610680926001600160a01b03169163a80a7882916004808301926020929190829003018186803b15801561203f57600080fd5b505afa158015612053573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120779190613368565b8390620186a0600161296c565b61208d816129c7565b61089b5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016107b4565b600081815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612109826112e1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600260975414156121955760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016107b4565b6002609755565b6000908152606760205260409020546001600160a01b031690565b6121c0816129e4565b600081815260d260205260409020541561089b5760cb54604080516338d52e0f60e01b8152905161226f926001600160a01b0316916338d52e0f916004808301926020929190829003018186803b15801561221a57600080fd5b505afa15801561222e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122529190613068565b61225b8361219c565b600084815260d26020526040902054612a9f565b6122788161219c565b6001600160a01b0316817f24b5efa61dd1cfc659205a97fb8ed868f3cb8c81922bab2b96423e5de1de2cb760d26000858152602001908152602001600020546040516122c691815260200190565b60405180910390a3600090815260d26020526040812055565b6001609755565b6001600160a01b03821661233c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016107b4565b612345816129c7565b156123925760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107b4565b61239b816129c7565b156123e85760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016107b4565b6001600160a01b038216600081815260686020908152604080832080546001019055848352606790915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008061245f836112e1565b9050806001600160a01b0316846001600160a01b031614806124a657506001600160a01b038082166000908152606a602090815260408083209388168352929052205460ff165b806124ca5750836001600160a01b03166124bf84610718565b6001600160a01b0316145b949350505050565b826001600160a01b03166124e5826112e1565b6001600160a01b03161461250b5760405162461bcd60e51b81526004016107b490613559565b6001600160a01b03821661256d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016107b4565b826001600160a01b0316612580826112e1565b6001600160a01b0316146125a65760405162461bcd60e51b81526004016107b490613559565b600081815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260688552838620805460001901905590871680865283862080546001019055868652606790945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600061264061158c565b61264e6003620f42406136e1565b612658908461378c565b612662919061367c565b60d060008282546126739190613664565b909155507f29e98ba00d07f171959c4ddcd2f3020debc7c52cf537a034d7e664340d098c6c9050826126a361158c565b6040805192835260208301919091520160405180910390a161068061158c565b60006126ce826112e1565b90506126d9826112e1565b600083815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526068845282852080546000190190558785526067909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b816001600160a01b0316836001600160a01b031614156127ba5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016107b4565b6001600160a01b038381166000818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6128328484846124d2565b61283e84848484612af1565b6116f15760405162461bcd60e51b81526004016107b490613507565b6060600061286783612bfb565b600101905060008167ffffffffffffffff81111561288757612887613882565b6040519080825280601f01601f1916602001820160405280156128b1576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a85049450846128ea576128ef565b6128bb565b509392505050565b600054610100900460ff1661291e5760405162461bcd60e51b81526004016107b49061359e565b8151612931906065906020850190612fb2565b508051610855906066906020840190612fb2565b600054610100900460ff166122df5760405162461bcd60e51b81526004016107b49061359e565b60008061297a868686612cd3565b905060018360028111156129905761299061386c565b1480156129ad5750600084806129a8576129a8613856565b868809115b15611ef8576129bd600182613664565b9695505050505050565b6000806129d38361219c565b6001600160a01b0316141592915050565b60d054600082815260d7602052604090205414156129ff5750565b6000612a0f6004620f42406136e1565b600083815260d6602090815260408083205460d383528184205460d790935292205460d054612a3e91906137ab565b612a48919061378c565b612a52919061378c565b612a5c919061367c565b90508060d260008481526020019081526020016000206000828254612a819190613664565b909155505060d054600092835260d760205260409092209190915550565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610855908490612dbd565b60006001600160a01b0384163b15612bf357604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612b35903390899088908890600401613474565b602060405180830381600087803b158015612b4f57600080fd5b505af1925050508015612b7f575060408051601f3d908101601f19168201909252612b7c918101906132c4565b60015b612bd9573d808015612bad576040519150601f19603f3d011682016040523d82523d6000602084013e612bb2565b606091505b508051612bd15760405162461bcd60e51b81526004016107b490613507565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506124ca565b5060016124ca565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612c3a5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612c66576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612c8457662386f26fc10000830492506010015b6305f5e1008310612c9c576305f5e100830492506008015b6127108310612cb057612710830492506004015b60648310612cc2576064830492506002015b600a83106106805760010192915050565b600080806000198587098587029250828110838203039150508060001415612d0e57838281612d0457612d04613856565b0492505050610c15565b808411612d555760405162461bcd60e51b81526020600482015260156024820152744d6174683a206d756c446976206f766572666c6f7760581b60448201526064016107b4565b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b6000612e12826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612e929092919063ffffffff16565b9050805160001480612e33575080806020019051810190612e33919061328a565b6108555760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016107b4565b60606124ca848460008585600080866001600160a01b03168587604051612eb991906133cf565b60006040518083038185875af1925050503d8060008114612ef6576040519150601f19603f3d011682016040523d82523d6000602084013e612efb565b606091505b5091509150612f0c87838387612f17565b979650505050505050565b60608315612f83578251612f7c576001600160a01b0385163b612f7c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107b4565b50816124ca565b6124ca8383815115612f985781518083602001fd5b8060405162461bcd60e51b81526004016107b491906134a7565b828054612fbe90613805565b90600052602060002090601f016020900481019282612fe05760008555613026565b82601f10612ff957805160ff1916838001178555613026565b82800160010185558215613026579182015b8281111561302657825182559160200191906001019061300b565b50613032929150613036565b5090565b5b808211156130325760008155600101613037565b60006020828403121561305d57600080fd5b8135610c1581613898565b60006020828403121561307a57600080fd5b8151610c1581613898565b6000806040838503121561309857600080fd5b82356130a381613898565b915060208301356130b381613898565b809150509250929050565b60008060008060008060c087890312156130d757600080fd5b86356130e281613898565b955060208701356130f281613898565b9450604087013561310281613898565b9350606087013561311281613898565b9250608087013561312281613898565b915060a087013561313281613898565b809150509295509295509295565b60008060006060848603121561315557600080fd5b833561316081613898565b9250602084013561317081613898565b929592945050506040919091013590565b6000806000806080858703121561319757600080fd5b84356131a281613898565b935060208501356131b281613898565b925060408501359150606085013567ffffffffffffffff8111156131d557600080fd5b8501601f810187136131e657600080fd5b80356131f96131f48261363c565b61360b565b81815288602083850101111561320e57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b6000806040838503121561324357600080fd5b823561324e81613898565b915060208301356130b3816138ad565b6000806040838503121561327157600080fd5b823561327c81613898565b946020939093013593505050565b60006020828403121561329c57600080fd5b8151610c15816138ad565b6000602082840312156132b957600080fd5b8135610c15816138bb565b6000602082840312156132d657600080fd5b8151610c15816138bb565b6000602082840312156132f357600080fd5b815167ffffffffffffffff81111561330a57600080fd5b8201601f8101841361331b57600080fd5b80516133296131f48261363c565b81815285602083850101111561333e57600080fd5b611ef88260208301602086016137c2565b60006020828403121561336157600080fd5b5035919050565b60006020828403121561337a57600080fd5b5051919050565b6000806040838503121561339457600080fd5b50508035926020909101359150565b600081518084526133bb8160208601602086016137c2565b601f01601f19169290920160200192915050565b600082516133e18184602087016137c2565b9190910192915050565b600083516133fd8184602088016137c2565b8351908301906134118183602088016137c2565b01949350505050565b6602637b1b5b2b2160cd1b81526000825161343c8160078501602087016137c2565b9190910160070192915050565b6276652d60e81b8152600082516134678160038501602087016137c2565b9190910160030192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906129bd908301846133a3565b602081526000610c1560208301846133a3565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b602080825260089082015267474f565f4f4e4c5960c01b604082015260600190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561363457613634613882565b604052919050565b600067ffffffffffffffff82111561365657613656613882565b50601f01601f191660200190565b6000821982111561367757613677613840565b500190565b60008261369957634e487b7160e01b600052601260045260246000fd5b500490565b600181815b808511156136d95781600019048211156136bf576136bf613840565b808516156136cc57918102915b93841c93908002906136a3565b509250929050565b6000610c1560ff8416836000826136fa57506001610680565b8161370757506000610680565b816001811461371d576002811461372757613743565b6001915050610680565b60ff84111561373857613738613840565b50506001821b610680565b5060208310610133831016604e8410600b8410161715613766575081810a610680565b613770838361369e565b806000190482111561378457613784613840565b029392505050565b60008160001904831182151516156137a6576137a6613840565b500290565b6000828210156137bd576137bd613840565b500390565b60005b838110156137dd5781810151838201526020016137c5565b838111156116f15750506000910152565b6000816137fd576137fd613840565b506000190190565b600181811c9082168061381957607f821691505b6020821081141561383a57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461089b57600080fd5b801515811461089b57600080fd5b6001600160e01b03198116811461089b57600080fdfea2646970667358221220cef4bac9e82aeefbfc890367354657a5f36120efa4bfdd58f194c0b5e672c97864736f6c63430008070033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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