Contract 0x4d5fa31a68f51ec53ea036cd4cc4cb8645deab3b 1

 

Contract Overview

Atlendis: Lockdrop Wintermute USDC
Balance:
0 MATIC

MATIC Value:
$0.00

Token:
 
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0xb48facdb071cc407ba2afa4f773fdb11d27806ef4faa8432009011f37418c56eClaim And Withdr...433936922023-06-01 4:17:357 hrs 39 mins ago0x7c7fb6846e7633342eeef5bd236b54dd511dac30 IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.02342215987 152.62812784
0x3e18ddc5547f281259d81d773304fa45f2aceebd6e4d3d3d15c3e7c817752979Claim And Withdr...432142972023-05-27 15:18:384 days 20 hrs ago0x9ddb50f7e09d95e52565b02029ab7e33ee5503e5 IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.020069559706 146.999587675
0x8d05934931e5e6887de4660a40dedaa55dd7842dcc613b5b477f43f9467dd5e9Claim And Withdr...431980812023-05-27 5:24:035 days 6 hrs ago0x8dd4abfc90031237b8a0736d7485f0c4b4601872 IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.01983946493 129.281859846
0x7f59b64ced87870180bfabf91b7538e97db51b18fcfe1e01edfb891af3eaf4c3Claim And Withdr...431596672023-05-26 6:12:236 days 5 hrs ago icezt999.wallet  IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.026248138227 192.254616107
0xb19c7dc411b7d05d8c22dc775d5c4a3216eae62b8dcd81befdf946a0fa8d5c58Claim And Withdr...431384202023-05-25 17:14:326 days 18 hrs ago0x54fd0462b48f4758331357239546a799294f0b7c IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.020069616147
0x9fe37492e51381760c87ca466ae0828422085846de5dba0baf7bca28cf848246Claim And Withdr...431235972023-05-25 8:15:487 days 3 hrs ago earlystarker.crypto  IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.023685295297 173.483060597
0xc77eefc91b52d18c95a0e7b87d072feeb71f8a02fc335bdeff76704ea40177a0Claim And Withdr...430903262023-05-24 12:15:187 days 23 hrs ago oooo000.crypto  IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.022652736562 147.61425894
0x201db8c34ea836a1ffba37b931f560296c99332b1651400111ce2fbe27b725cfClaim And Withdr...430665182023-05-23 21:46:418 days 14 hrs ago0x62f56981d431e68b5cab37ae3a242a72824d3ac7 IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.018619535218 121.332311681
0x33a9d0b8781c36dc8e4d539f53a9e18f38e60b88a12fe2e9f40fc99e17f5c6dcClaim And Withdr...430484312023-05-23 10:55:179 days 1 hr ago bachibouzoukjr-100212.blockchain  IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.025013817163
0xcc8ff195701df6fc4d2f96b875b01d597e878f515ede758e09d13ae9fd07fb24Claim And Withdr...430483952023-05-23 10:54:019 days 1 hr ago jorowill123456789.blockchain  IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.031919472208
0x70931849766f7c4cc803e1f989168880958fb525038c5a3673d727b5f7a84bdbClaim And Withdr...430430432023-05-23 7:41:229 days 4 hrs ago0x9fb365392b92cbfb6346d72e9fc7805868abb00e IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.028019226624 182.584446822
0x1895597f79ffd38f175aa7187a5dbbacbfb6545a51105b105970c9cf491eaf49Claim And Withdr...429931972023-05-21 23:52:0210 days 12 hrs ago 124440377077737.blockchain  IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.01733270745 141.09067669
0xd152f26cdfcc151731ffd4321469e8d7606da4e9c12384ee59ac75999b5ae5f8Claim And Withdr...429710342023-05-21 10:30:1611 days 1 hr ago0x7eef6f6affb8d30dbfc332e9f3065b27ae80d5e1 IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.024009756877 175.859581018
0x979a00d9e5446a8016be055ba3f50d9f4cb15ed2d4ac8677e17a975b7bf18567Claim And Withdr...429660732023-05-21 7:32:1911 days 4 hrs ago0xe28033a9bd54202d5f2487dd2c8518f48f4f07c2 IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.017512922869 142.557655554
0x2ced6b8c298b3b825e3aec5827c63b1373d33f374b5b673c0a80efb576529dfeClaim And Withdr...429182232023-05-20 2:43:2712 days 9 hrs ago mowjek.nft  IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.018690520029 136.89880486
0xf9c6d3b85388daa150adbd67fe52c5788f5080131c05a0fe54518b90fc5aeb7aClaim And Withdr...428059572023-05-17 7:09:1315 days 4 hrs ago web3magnetic.nft  IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.019035437678 139.425155856
0x307da3e38ae04c58c25e4e32051e827dac5d0b00aa29bae6042ea083fb60be81Claim And Withdr...428044692023-05-17 6:15:0015 days 5 hrs ago0xe53959fa51f8136e31382263c5ca73504fc25708 IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.022676325767 147.7679756
0x2f8848d22cac903f5c0ca6233c9af495ca90d7dd94a87455456ccabd5fec0a6bClaim And Withdr...427928662023-05-16 23:16:2915 days 12 hrs ago0x7f4e21b39d6506e333b9b470b3fdedd4fcbbc6e8 IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.015116153097 123.047612479
0x9db1a4a9b53f3124647e7e9a43037298a6fb71aad215aeac6a8d8b67d0c90557Claim And Withdr...427551952023-05-16 0:52:2916 days 11 hrs ago darimanauangnya.wallet  IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.036534548538 267.597478457
0x79765280def8739e1185ffc04521950343e0b4845a74c2695863f8b6e57d1d9aClaim And Withdr...427411972023-05-15 16:27:2216 days 19 hrs ago0x237e4ba90ffdddf75b44854dd4f8c61253433ea9 IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.029705957841 217.581432685
0xbdc7b268c412753b54c1d07133367d0da9e97add9568847ac0f2a66a2bbadeaaClaim And Withdr...427370442023-05-15 13:59:4616 days 21 hrs ago0x9288d36548b084d0adca9376e7e2c7263ce5426a IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.028756368128 210.626158213
0x61ca881169e52b2865fd1aa45680f01650c6328f0885b444986217dc71ad82a7Claim And Withdr...427140082023-05-15 0:14:0317 days 11 hrs ago0x442e783df75df94aaa3d88136528810c06dabae5 IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.017137879408 125.526481074
0x7a16871559d7d4894e645680221183b58ecb628a355fd670bfa2317d8eb83634Claim And Withdr...424932162023-05-09 12:18:2722 days 23 hrs ago0x185cfafca1f2d364c1acb7d568b0f221623d40ed IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.021116961731 154.671288902
0x0cfa759b3467afa5a80377b8c9348e2fcbe4eeb264981c50a5fd2ffe689a3c25Claim And Withdr...424929862023-05-09 12:10:1722 days 23 hrs ago0x185cfafca1f2d364c1acb7d568b0f221623d40ed IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.026991732447 175.888885291
0xeb6d42f1883c3cfffff1765f3b29406a28af576e3347f1c47028d08a3353e526Claim And Withdr...424713812023-05-08 23:16:1723 days 12 hrs ago 1trader.bitcoin  IN  Atlendis: Lockdrop Wintermute USDC0 MATIC0.022139796301 162.163045688
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0x47e433BA92B5BB2e017a25D6598A7ac24EDDfbfF

Contract Name:
AtlendisLockdrop

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 19 : AtlendisLockdrop.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "./BaseLockdrop.sol";
import "../external/IPoolsController.sol";
import "../external/IPositionManager.sol";

/**
 * @title AtlendisLockdrop
 * @notice Lockdrop contract designed to rewards users that lock their Atlendis
 * positions for a given duration with a corresponding amount of tokens
 **/
contract AtlendisLockdrop is BaseLockdrop {
    using SafeERC20 for ERC20;

    ////////////
    // EVENTS //
    ////////////

    event LockdropCreated(
        address poolsContract,
        address positionsContract,
        bytes32 poolHash,
        uint256 maxMultiplier,
        uint256 minLockingPeriod,
        uint256 maxLockingPeriod,
        uint256 minPositionAmount
    );
    event RateUpdated(uint256 tokenId, address from, uint256 newRate);

    /////////////
    // STORAGE //
    /////////////

    bytes32 private immutable poolHash; // a lockdrop is specific to an Atlendis pool
    uint256 private immutable minPositionAmount; // positions must have a minimum underlying token value
    address private immutable poolsController; // address of Atlendis' pools contract

    /////////////////
    // CONSTRUCTOR //
    /////////////////

    constructor(
        address _poolsController,
        address _positionManager,
        bytes32 _poolHash,
        uint256 _maxMultiplier,
        uint256 _minLockingPeriod,
        uint256 _maxLockingPeriod,
        uint256 _minPositionAmount
    )
        BaseLockdrop(
            _positionManager,
            _maxMultiplier,
            _minLockingPeriod,
            _maxLockingPeriod
        )
    {
        require(_poolHash != "", "Wrong pool input");

        poolHash = _poolHash;
        minPositionAmount = _minPositionAmount;
        poolsController = _poolsController;

        (address underlyingToken, , , , , , , , , , ) = IPoolsController(
            poolsController
        ).getPoolParameters(poolHash);
        require(underlyingToken != address(0), "Target pool does not exist");

        emit LockdropCreated(
            _poolsController,
            _positionManager,
            _poolHash,
            _maxMultiplier,
            _minLockingPeriod,
            _maxLockingPeriod,
            _minPositionAmount
        );
    }

    /////////////////////////
    // POSITION MANAGEMENT //
    /////////////////////////

    /**
     * @notice Update the rate of the underlying Atlendis position
     **/
    function updateRate(uint256 tokenId, uint256 newRate)
        external
        isLockOwner(tokenId)
    {
        IPositionManager(nft).updateRate(uint128(tokenId), uint128(newRate));

        emit RateUpdated(tokenId, _msgSender(), newRate);
    }

    ///////////////
    // OVERRIDES //
    ///////////////

    /**
     * @notice Get back remaining rewards
     * Owner can get back remaining rewards
     * Rescueing rewards lets users claim their pending rewards
     * Users won't be able to use lock positions anymore
     **/
    function rescueRewards(address to) external override onlyOwner {
        uint256[] memory toRescue = new uint256[](tokens.length);
        for (uint256 i = 0; i < tokens.length; i++) {
            toRescue[i] =
                ERC20(tokens[i]).balanceOf(address(this)) -
                pendingRewards[tokens[i]];
            ERC20(tokens[i]).safeTransfer(_msgSender(), toRescue[i]);
        }

        emit RewardsRescued(to, toRescue);
    }

    /**
     * @notice Locking logic
     * Implementation of _lock function to take into account Atlendis' specific use case
     * Verifies that the position complies with the lockdrop conditions
     * Computes the rewards and transfers the nft to the lockdrop contract
     **/
    function _lock(
        uint256 tokenId,
        uint256[] memory baseAllocations,
        uint256 lockingDuration
    ) internal override {
        (
            uint128 bondsQuantity,
            uint128 normalizedDepositedAmount
        ) = IPositionManager(nft).getPositionRepartition(uint128(tokenId));
        require(
            (bondsQuantity + normalizedDepositedAmount) > minPositionAmount,
            "Unsufficient position size"
        );
        (bytes32 _poolHash, , , , , , ) = IPositionManager(nft).position(
            uint128(tokenId)
        );
        require(_poolHash == poolHash, "Wrong pool hash");
        currentLocks[tokenId].owner = _msgSender();
        currentLocks[tokenId].endDate = block.timestamp + lockingDuration;
        uint256[] memory rewards = new uint256[](tokens.length);
        for (uint256 i = 0; i < tokens.length; i++) {
            uint256 reward = _getRewardsAmount(
                baseAllocations[i],
                lockingDuration,
                tokenId,
                tokens[i]
            );
            require(
                ERC20(tokens[i]).balanceOf(address(this)) >=
                    (pendingRewards[tokens[i]] + reward),
                "Not enough rewards left to distribute"
            );
            pendingRewards[tokens[i]] += reward;
            currentLocks[tokenId].rewards[tokens[i]] = reward;
            rewards[i] = reward;
        }
        ERC721(nft).transferFrom(_msgSender(), address(this), tokenId);
        emit Locked(
            tokenId,
            bondsQuantity + normalizedDepositedAmount,
            lockingDuration,
            _msgSender(),
            baseAllocations,
            rewards
        );
    }

    /**
     * @notice Computes token rewards amount
     * Implementation to comply with Atlendis' specific use case
     **/
    function _getRewardsAmount(
        uint256 baseAmount,
        uint256 lockingDuration,
        uint256 tokenId,
        address token
    ) internal view override returns (uint256) {
        (
            uint128 bondsQuantity,
            uint128 normalizedDepositedAmount
        ) = IPositionManager(nft).getPositionRepartition(uint128(tokenId));
        uint256 positionAmount = uint256(
            bondsQuantity + normalizedDepositedAmount
        );
        uint256 multiplier = _getMultiplier(lockingDuration, tokenId);
        uint256 baseAllocation = (baseAmount * multiplier) / baseMultiplier;
        uint256 rewardsAmount = (positionAmount *
            tokenParameters[token].rate * // rate is in token per second and inherits its precision
            lockingDuration *
            multiplier) /
            baseMultiplier /
            1e18; // getPositionRepartition always returns wad precision
        return baseAllocation + rewardsAmount;
    }

    /**
     * @notice Computes token rewards multiplier
     * Implementation to comply with Atlendis' specific use case
     * the longer the lock, the bigger the reward
     **/
    function _getMultiplier(uint256 lockingDuration, uint256)
        internal
        view
        override
        returns (uint256 multiplier)
    {
        return
            baseMultiplier +
            ((maxMultiplier - baseMultiplier) *
                (lockingDuration - minLockingPeriod)) /
            (maxLockingPeriod - minLockingPeriod);
    }
}

File 2 of 19 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.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;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    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));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    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");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @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");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 3 of 19 : BaseLockdrop.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";

/**
 * @title BaseLockdrop
 * @notice Lockdrop contract designed to rewards users that lock their NFTs
 * for a given time with a corresponding amount of tokens
 **/
abstract contract BaseLockdrop is Ownable {
    using SafeERC20 for ERC20;

    ////////////
    // EVENTS //
    ////////////

    event Locked(
        uint256 tokenId,
        uint256 amount,
        uint256 lockDuration,
        address from,
        uint256[] baseAllocations,
        uint256[] rewards
    );
    event Quit(uint256 tokenId, uint256 lockEnd, address from);
    event Claimed(
        uint256 tokenId,
        uint256 lockEnd,
        address from,
        uint256[] rewards
    );
    event Withdrawn(
        uint256 tokenId,
        uint256 lockEnd,
        address from,
        uint256[] rewards
    );
    event TokenAdded(address token, uint256 rate, bytes32 root);
    event RootSet(address token, bytes32 root);
    event RewardsRescued(address to, uint256[] amounts);

    /////////////
    // STORAGE //
    /////////////

    // lock parameters
    address public immutable nft; // address of the nft to lock
    uint256 public immutable baseMultiplier = 1e18; // 1
    uint256 public immutable maxMultiplier;
    uint256 public immutable minLockingPeriod;
    uint256 public immutable maxLockingPeriod;

    // tokens
    address[] public tokens; // token rewards addresses
    struct TokenParameters {
        uint256 rate; // base tokens per nft value unit per second of locking
        bytes32 root; // merkle tree root used for base token allocations
    }
    mapping(address => TokenParameters) public tokenParameters;

    // contract state
    mapping(address => uint256) public pendingRewards; // rewards attributed to currently locked positions
    struct LockDrop {
        address owner;
        mapping(address => uint256) rewards;
        uint256 endDate;
        bool claimed;
        bool withdrawn;
    }
    mapping(uint256 => LockDrop) internal currentLocks;
    mapping(bytes32 => bool) public claimedAllocations; // base allocations can only be claimed once

    /////////////////
    // CONSTRUCTOR //
    /////////////////

    constructor(
        address _nft,
        uint256 _maxMultiplier,
        uint256 _minLockingPeriod,
        uint256 _maxLockingPeriod
    ) {
        require(
            _minLockingPeriod < _maxLockingPeriod,
            "Wrong locking periods input"
        );
        require(
            _maxMultiplier >= baseMultiplier,
            "Max multiplier must be greater or equal than base multiplier"
        );
        require(_nft != address(0), "Wrong nft address");
        nft = _nft;
        maxMultiplier = _maxMultiplier;
        minLockingPeriod = _minLockingPeriod;
        maxLockingPeriod = _maxLockingPeriod;
    }

    ///////////////
    // MODIFIERS //
    ///////////////

    /**
     * @notice Position lock ownership verification logic
     **/
    modifier isLockOwner(uint256 tokenId) {
        require(
            _msgSender() == currentLocks[tokenId].owner,
            "Caller is not the owner of the lock"
        );
        _;
    }

    /**
     * @notice Lock validity verification logic
     **/
    modifier validLock(uint256 lockingDuration) {
        require(
            (lockingDuration <= maxLockingPeriod) &&
                (lockingDuration >= minLockingPeriod),
            "Wrong locking duration"
        );
        require(tokens.length > 0, "No token is registered");
        _;
    }

    ///////////
    // VIEWS //
    ///////////

    /**
     * @notice Get lock for target tokenId
     **/
    function getLockParameters(uint256 tokenId)
        external
        view
        returns (
            address,
            uint256,
            bool
        )
    {
        return (
            currentLocks[tokenId].owner,
            currentLocks[tokenId].endDate,
            currentLocks[tokenId].claimed
        );
    }

    /**
     * @notice Get lock rewards for target tokenId and reward token address
     **/
    function getLockRewards(uint256 tokenId, address _token)
        external
        view
        returns (uint256)
    {
        return currentLocks[tokenId].rewards[_token];
    }

    /**
     * @notice Preview rewards for upcoming lock
     **/
    function previewRewards(
        uint256 baseAmount,
        uint256 tokenId,
        uint256 lockingDuration,
        address token
    ) external view returns (uint256 rewards) {
        require(
            (lockingDuration <= maxLockingPeriod) &&
                (lockingDuration >= minLockingPeriod),
            "Wrong locking duration"
        );
        require(tokens.length > 0, "No token is registered");
        require(tokenParameters[token].rate > 0, "Token not registered");
        rewards = _getRewardsAmount(
            baseAmount,
            lockingDuration,
            tokenId,
            token
        );
        require(
            ERC20(token).balanceOf(address(this)) >
                (pendingRewards[token] + rewards),
            "Not enough rewards left to distribute"
        );
    }

    ////////////
    // OWNER  //
    ////////////

    /**
     * @notice Add new token reward
     * Owner can add new types of token rewards
     * Distribution can begin after the lockdrop contract is sent tokens to distribute
     **/
    function addToken(
        address token,
        uint256 rate,
        bytes32 root
    ) external onlyOwner {
        for (uint256 i = 0; i < tokens.length; i++) {
            require(tokens[i] != token, "Token already supported");
        }
        tokens.push(token);
        tokenParameters[token] = TokenParameters({rate: rate, root: root});

        emit TokenAdded(token, rate, root);
    }

    /**
     * @notice Set token base allocation merkle root
     * Owner can set base allocation merkle root for a token
     * Can only be done if root was set to 0 beforehand
     **/
    function setRoot(address token, bytes32 root) external onlyOwner {
        require(
            tokenParameters[token].root == bytes32(0),
            "Root has already been set"
        );

        tokenParameters[token].root = root;

        emit RootSet(token, root);
    }

    /**
     * @notice Get back remaining rewards
     * Owner can get back remaining rewards in some circumstances
     * This function must be overidden to specify conditions for the target use case
     **/
    function rescueRewards(address to) external virtual;

    /////////////
    // LOCKING //
    /////////////

    /**
     * @notice Lock without base allocation
     * A user locks its nft in exchange for future rewards
     * The longer the user locks its position, the bigger the rewards
     **/
    function lock(uint256 tokenId, uint256 lockingDuration)
        external
        validLock(lockingDuration)
    {
        uint256[] memory noAllocations = new uint256[](tokens.length);
        _lock(tokenId, noAllocations, lockingDuration);
    }

    /**
     * @notice Lock with base allocation
     * A merkle tree root is specified at deployment time including base token allocations
     * These allocations serve as a base amount to compute future rewards
     * Base allocations benefit from multipliers
     **/
    function lock(
        bytes32[][] calldata proofs,
        uint256[] memory baseAllocations,
        uint256 tokenId,
        uint256 lockingDuration
    ) external validLock(lockingDuration) {
        for (uint256 i = 0; i < tokens.length; i++) {
            if (baseAllocations[i] > 0) {
                bytes32 leaf = keccak256(
                    abi.encode(_msgSender(), baseAllocations[i])
                );
                require(
                    !claimedAllocations[leaf],
                    "Base allocation already claimed"
                );
                require(
                    MerkleProof.verify(
                        proofs[i],
                        tokenParameters[tokens[i]].root,
                        leaf
                    ),
                    "Proof is not valid"
                );
                claimedAllocations[leaf] = true; // claimed allocations that are quitted cannot be claimed again
            }
        }
        _lock(tokenId, baseAllocations, lockingDuration);
    }

    ///////////////
    // RELEASING //
    ///////////////

    /**
     * @notice Stops lock before maturity, renouncing to rewards
     **/
    function quit(uint256 tokenId) external virtual isLockOwner(tokenId) {
        require(
            block.timestamp < currentLocks[tokenId].endDate,
            "Quit too late"
        );

        for (uint256 i = 0; i < tokens.length; i++) {
            pendingRewards[tokens[i]] -= currentLocks[tokenId].rewards[
                tokens[i]
            ];
            currentLocks[tokenId].rewards[tokens[i]] = 0;
        }
        uint256 endDate = currentLocks[tokenId].endDate;
        delete currentLocks[tokenId];

        ERC721(nft).transferFrom(address(this), _msgSender(), tokenId);

        emit Quit(tokenId, endDate, _msgSender());
    }

    /**
     * @notice Withdraw locked nft
     * Sends back nft after the lock is successfully completed
     * A lock is considered final when both token is withdrawn and rewards are claimed
     * Logic can be modified by inheriting contracts
     **/
    function withdraw(uint256 tokenId) public virtual isLockOwner(tokenId) {
        require(
            block.timestamp >= currentLocks[tokenId].endDate,
            "Withdraw too early"
        );

        uint256[] memory rewards = new uint256[](tokens.length);
        for (uint256 i = 0; i < tokens.length; i++) {
            rewards[i] = currentLocks[tokenId].rewards[tokens[i]];
            if (currentLocks[tokenId].claimed)
                currentLocks[tokenId].rewards[tokens[i]] = 0;
        }
        uint256 endDate = currentLocks[tokenId].endDate;
        // lock rewards were already claimed
        if (currentLocks[tokenId].claimed) {
            delete currentLocks[tokenId];
        } else {
            currentLocks[tokenId].withdrawn = true;
        }

        ERC721(nft).transferFrom(address(this), _msgSender(), tokenId);

        emit Withdrawn(tokenId, endDate, _msgSender(), rewards);
    }

    /**
     * @notice Claim lock rewards
     * Send token rewards after a lock is successfully completed
     * A lock is considered final when both token is withdrawn and rewards are claimed
     * Logic can be modified by inheriting contracts
     **/
    function claim(uint256 tokenId) public virtual isLockOwner(tokenId) {
        require(
            block.timestamp >= currentLocks[tokenId].endDate,
            "Claim too early"
        );
        require(!currentLocks[tokenId].claimed, "Lock already claimed");

        bool toDelete = currentLocks[tokenId].withdrawn;
        uint256[] memory rewards = new uint256[](tokens.length);
        for (uint256 i = 0; i < tokens.length; i++) {
            pendingRewards[tokens[i]] -= currentLocks[tokenId].rewards[
                tokens[i]
            ];
            rewards[i] = currentLocks[tokenId].rewards[tokens[i]];
            if (toDelete) currentLocks[tokenId].rewards[tokens[i]] = 0;
        }
        uint256 endDate = currentLocks[tokenId].endDate;
        // locked token was already withdrawn
        if (toDelete) {
            delete currentLocks[tokenId];
        } else {
            currentLocks[tokenId].claimed = true;
        }

        for (uint256 i = 0; i < tokens.length; i++) {
            ERC20(tokens[i]).safeTransfer(_msgSender(), rewards[i]);
        }
        emit Claimed(tokenId, endDate, _msgSender(), rewards);
    }

    /**
     * @notice Claim lock rewards and withdraw position
     * Helper method to do both actions in the same transaction
     **/
    function claimAndWithdraw(uint256 tokenId) external {
        claim(tokenId);
        withdraw(tokenId);
    }

    //////////////////////////////
    // INTERNAL VIRTUAL METHODS //
    //////////////////////////////

    /**
     * @notice Internal lock logic
     * Computes rewards, gets target position and saves data for future position releasing
     **/
    function _lock(
        uint256 tokenId,
        uint256[] memory baseAllocations,
        uint256 lockingDuration
    ) internal virtual;

    /**
     * @notice Computes token rewards amount
     **/
    function _getRewardsAmount(
        uint256 baseAmount,
        uint256 lockingDuration,
        uint256 tokenId,
        address token
    ) internal view virtual returns (uint256 rewardsAmount);

    /**
     * @notice Computes token rewards multiplier
     * the longer the lock, the bigger the reward
     **/
    function _getMultiplier(uint256 lockingDuration, uint256 tokenId)
        internal
        view
        virtual
        returns (uint256 multiplier);
}

File 4 of 19 : IPoolsController.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;

/////////////////////////////////////////////////////////////
// PASTED FROM https://github.com/Atlendis/priv-contracts/ //
/////////////////////////////////////////////////////////////

/**
 * @title IPoolsController
 * @notice Management of the pools
 **/
interface IPoolsController {
    // EVENTS

    /**
     * @notice Emitted after a pool was creted
     **/
    event PoolCreated(PoolCreationParams params);

    /**
     * @notice Emitted after a borrower address was allowed to borrow from a pool
     * @param borrowerAddress The address to allow
     * @param poolHash The identifier of the pool
     **/
    event BorrowerAllowed(address borrowerAddress, bytes32 poolHash);

    /**
     * @notice Emitted after a borrower address was disallowed to borrow from a pool
     * @param borrowerAddress The address to disallow
     * @param poolHash The identifier of the pool
     **/
    event BorrowerDisallowed(address borrowerAddress, bytes32 poolHash);

    /**
     * @notice Emitted when a pool is active, i.e. after the borrower deposits enough tokens
     * in its pool liquidity rewards reserve as agreed before the pool creation
     * @param poolHash The identifier of the pool
     **/
    event PoolActivated(bytes32 poolHash);

    /**
     * @notice Emitted after pool is closed
     * @param poolHash The identifier of the pool
     * @param collectedLiquidityRewards The amount of liquidity rewards to have been collected at closing time
     **/
    event PoolClosed(bytes32 poolHash, uint128 collectedLiquidityRewards);

    /**
     * @notice Emitted when a pool defaults on its loan repayment
     * @param poolHash The identifier of the pool
     * @param distributedLiquidityRewards The remaining liquidity rewards distributed to
     * bond holders
     **/
    event Default(bytes32 poolHash, uint128 distributedLiquidityRewards);

    /**
     * @notice Emitted after governance sets the maximum borrowable amount for a pool
     **/
    event SetMaxBorrowableAmount(uint128 maxTokenDeposit, bytes32 poolHash);

    /**
     * @notice Emitted after governance sets the liquidity rewards distribution rate for a pool
     **/
    event SetLiquidityRewardsDistributionRate(
        uint128 distributionRate,
        bytes32 poolHash
    );

    /**
     * @notice Emitted after governance sets the establishment fee for a pool
     **/
    event SetEstablishmentFeeRate(uint128 establishmentRate, bytes32 poolHash);

    /**
     * @notice Emitted after governance sets the repayment fee for a pool
     **/
    event SetRepaymentFeeRate(uint128 repaymentFeeRate, bytes32 poolHash);

    /**
     * @notice Set the pool early repay option
     **/
    event SetEarlyRepay(bool earlyRepay, bytes32 poolHash);

    /**
     * @notice Emitted after governance claims the fees associated with a pool
     * @param poolHash The identifier of the pool
     * @param normalizedAmount The amount of tokens claimed
     * @param to The address receiving the fees
     **/
    event ClaimProtocolFees(
        bytes32 poolHash,
        uint128 normalizedAmount,
        address to
    );

    // VIEW METHODS

    /**
     * @notice Returns the parameters of a pool
     * @param poolHash The identifier of the pool
     * @return underlyingToken Address of the underlying token of the pool
     * @return minRate Minimum rate of deposits accepted in the pool
     * @return maxRate Maximum rate of deposits accepted in the pool
     * @return rateSpacing Difference between two rates in the pool
     * @return maxBorrowableAmount Maximum amount of tokens that can be borrowed from the pool
     * @return loanDuration Duration of a loan in the pool
     * @return liquidityRewardsDistributionRate Rate at which liquidity rewards are distributed to lenders
     * @return cooldownPeriod Period after a loan during which a borrower cannot take another loan
     * @return repaymentPeriod Period after a loan end during which a borrower can repay without penalty
     * @return lateRepayFeePerBondRate Penalty a borrower has to pay when it repays late
     * @return liquidityRewardsActivationThreshold Minimum amount of liqudity rewards a borrower has to
     * deposit to active the pool
     **/
    function getPoolParameters(bytes32 poolHash)
        external
        view
        returns (
            address underlyingToken,
            uint128 minRate,
            uint128 maxRate,
            uint128 rateSpacing,
            uint128 maxBorrowableAmount,
            uint128 loanDuration,
            uint128 liquidityRewardsDistributionRate,
            uint128 cooldownPeriod,
            uint128 repaymentPeriod,
            uint128 lateRepayFeePerBondRate,
            uint128 liquidityRewardsActivationThreshold
        );

    /**
     * @notice Returns the fee rates of a pool
     * @return establishmentFeeRate Amount of fees paid to the protocol at borrow time
     * @return repaymentFeeRate Amount of fees paid to the protocol at repay time
     **/
    function getPoolFeeRates(bytes32 poolHash)
        external
        view
        returns (uint128 establishmentFeeRate, uint128 repaymentFeeRate);

    /**
     * @notice Returns the state of a pool
     * @param poolHash The identifier of the pool
     * @return active Signals if a pool is active and ready to accept deposits
     * @return defaulted Signals if a pool was defaulted
     * @return closed Signals if a pool was closed
     * @return currentMaturity End timestamp of current loan
     * @return bondsIssuedQuantity Amount of bonds issued, to be repaid at maturity
     * @return normalizedBorrowedAmount Actual amount of tokens that were borrowed
     * @return normalizedAvailableDeposits Actual amount of tokens available to be borrowed
     * @return lowerInterestRate Minimum rate at which a deposit was made
     * @return nextLoanMinStart Cool down period, minimum timestamp after which a new loan can be taken
     * @return remainingAdjustedLiquidityRewardsReserve Remaining liquidity rewards to be distributed to lenders
     * @return yieldProviderLiquidityRatio Last recorded yield provider liquidity ratio
     * @return currentBondsIssuanceIndex Current borrow period identifier of the pool
     **/
    function getPoolState(bytes32 poolHash)
        external
        view
        returns (
            bool active,
            bool defaulted,
            bool closed,
            uint128 currentMaturity,
            uint128 bondsIssuedQuantity,
            uint128 normalizedBorrowedAmount,
            uint128 normalizedAvailableDeposits,
            uint128 lowerInterestRate,
            uint128 nextLoanMinStart,
            uint128 remainingAdjustedLiquidityRewardsReserve,
            uint128 yieldProviderLiquidityRatio,
            uint128 currentBondsIssuanceIndex
        );

    /**
     * @notice Signals whether the early repay feature is activated or not
     * @return earlyRepay Flag that signifies whether the early repay feature is activated or not
     **/
    function isEarlyRepay(bytes32 poolHash)
        external
        view
        returns (bool earlyRepay);

    /**
     * @notice Returns the state of a pool
     * @return defaultTimestamp The timestamp at which the pool was defaulted
     **/
    function getDefaultTimestamp(bytes32 poolHash)
        external
        view
        returns (uint128 defaultTimestamp);

    // GOVERNANCE METHODS

    /**
     * @notice Parameters used for a pool creation
     * @param poolHash The identifier of the pool
     * @param underlyingToken Address of the pool underlying token
     * @param yieldProvider Yield provider of the pool
     * @param minRate Minimum bidding rate for the pool
     * @param maxRate Maximum bidding rate for the pool
     * @param rateSpacing Difference between two tick rates in the pool
     * @param maxBorrowableAmount Maximum amount of tokens a borrower can get from a pool
     * @param loanDuration Duration of a loan i.e. maturity of the issued bonds
     * @param distributionRate Rate at which the liquidity rewards are distributed to unmatched positions
     * @param cooldownPeriod Period of time after a repay during which the borrow cannot take a loan
     * @param repaymentPeriod Period after the end of a loan during which the borrower can repay without penalty
     * @param lateRepayFeePerBondRate Additional fees applied when a borrower repays its loan after the repayment period ends
     * @param establishmentFeeRate Fees paid to Atlendis at borrow time
     * @param repaymentFeeRate Fees paid to Atlendis at repay time
     * @param liquidityRewardsActivationThreshold Amount of tokens the borrower has to lock into the liquidity
     * @param earlyRepay Is early repay activated
     * rewards reserve to activate the pool
     **/
    struct PoolCreationParams {
        bytes32 poolHash;
        address underlyingToken;
        address yieldProvider;
        uint128 minRate;
        uint128 maxRate;
        uint128 rateSpacing;
        uint128 maxBorrowableAmount;
        uint128 loanDuration;
        uint128 distributionRate;
        uint128 cooldownPeriod;
        uint128 repaymentPeriod;
        uint128 lateRepayFeePerBondRate;
        uint128 establishmentFeeRate;
        uint128 repaymentFeeRate;
        uint128 liquidityRewardsActivationThreshold;
        bool earlyRepay;
    }

    /**
     * @notice Creates a new pool
     * @param params A struct defining the pool creation parameters
     **/
    function createNewPool(PoolCreationParams calldata params) external;

    /**
     * @notice Allow an address to interact with a borrower pool
     * @param borrowerAddress The address to allow
     * @param poolHash The identifier of the pool
     **/
    function allow(address borrowerAddress, bytes32 poolHash) external;

    /**
     * @notice Remove pool interaction rights from an address
     * @param borrowerAddress The address to disallow
     * @param poolHash The identifier of the borrower pool
     **/
    function disallow(address borrowerAddress, bytes32 poolHash) external;

    /**
     * @notice Flags the pool as closed
     * @param poolHash The identifier of the pool to be closed
     * @param to An address to which the remaining liquidity rewards will be sent
     **/
    function closePool(bytes32 poolHash, address to) external;

    /**
     * @notice Flags the pool as defaulted
     * @param poolHash The identifier of the pool to default
     **/
    function setDefault(bytes32 poolHash) external;

    /**
     * @notice Set the maximum amount of tokens that can be borrowed in the target pool
     **/
    function setMaxBorrowableAmount(uint128 maxTokenDeposit, bytes32 poolHash)
        external;

    /**
     * @notice Set the pool liquidity rewards distribution rate
     **/
    function setLiquidityRewardsDistributionRate(
        uint128 distributionRate,
        bytes32 poolHash
    ) external;

    /**
     * @notice Set the pool establishment protocol fee rate
     **/
    function setEstablishmentFeeRate(
        uint128 establishmentFeeRate,
        bytes32 poolHash
    ) external;

    /**
     * @notice Set the pool repayment protocol fee rate
     **/
    function setRepaymentFeeRate(uint128 repaymentFeeRate, bytes32 poolHash)
        external;

    /**
     * @notice Set the pool early repay option
     **/
    function setEarlyRepay(bool earlyRepay, bytes32 poolHash) external;

    /**
     * @notice Withdraws protocol fees to a target address
     * @param poolHash The identifier of the pool
     * @param normalizedAmount The amount of tokens claimed
     * @param to The address receiving the fees
     **/
    function claimProtocolFees(
        bytes32 poolHash,
        uint128 normalizedAmount,
        address to
    ) external;

    /**
     * @notice Stops all actions on all pools
     **/
    function freezePool() external;

    /**
     * @notice Cancel a freeze, makes actions available again on all pools
     **/
    function unfreezePool() external;
}

File 5 of 19 : IPositionManager.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;

/////////////////////////////////////////////////////////////
// PASTED FROM https://github.com/Atlendis/priv-contracts/ //
/////////////////////////////////////////////////////////////

/**
 * @title IPositionManager
 * @notice Contains methods that can be called by lenders to create and manage their position
 **/
interface IPositionManager {
    /**
     * @notice Emitted when #deposit is called and is a success
     * @param lender The address of the lender depositing token on the protocol
     * @param tokenId The tokenId of the position
     * @param amount The amount of deposited token
     * @param rate The position bidding rate
     * @param poolHash The identifier of the pool
     * @param bondsIssuanceIndex The borrow period assigned to the position
     **/
    event Deposit(
        address indexed lender,
        uint128 tokenId,
        uint128 amount,
        uint128 rate,
        bytes32 poolHash,
        uint128 bondsIssuanceIndex
    );

    /**
     * @notice Emitted when #updateRate is called and is a success
     * @param lender The address of the lender updating their position
     * @param tokenId The tokenId of the position
     * @param amount The amount of deposited token plus their accrued interests
     * @param rate The new rate required by lender to lend their deposited token
     * @param poolHash The identifier of the pool
     **/
    event UpdateRate(
        address indexed lender,
        uint128 tokenId,
        uint128 amount,
        uint128 rate,
        bytes32 poolHash
    );

    /**
     * @notice Emitted when #withdraw is called and is a success
     * @param lender The address of the withdrawing lender
     * @param tokenId The tokenId of the position
     * @param amount The amount of tokens withdrawn
     * @param rate The position bidding rate
     * @param poolHash The identifier of the pool
     **/
    event Withdraw(
        address indexed lender,
        uint128 tokenId,
        uint128 amount,
        uint128 remainingBonds,
        uint128 rate,
        bytes32 poolHash
    );

    /**
     * @notice Set the position descriptor address
     * @param positionDescriptor The address of the new position descriptor
     **/
    event SetPositionDescriptor(address positionDescriptor);

    /**
     * @notice Emitted when #withdraw is called and is a success
     * @param tokenId The tokenId of the position
     * @return poolHash The identifier of the pool
     * @return adjustedBalance Adjusted balance of the position original deposit
     * @return rate Position bidding rate
     * @return underlyingToken Address of the tokens the position contains
     * @return remainingBonds Quantity of bonds remaining in the position after a partial withdraw
     * @return bondsMaturity Maturity of the position's remaining bonds
     * @return bondsIssuanceIndex Borrow period the deposit was made in
     **/
    function position(uint128 tokenId)
        external
        view
        returns (
            bytes32 poolHash,
            uint128 adjustedBalance,
            uint128 rate,
            address underlyingToken,
            uint128 remainingBonds,
            uint128 bondsMaturity,
            uint128 bondsIssuanceIndex
        );

    /**
     * @notice Returns the balance on yield provider and the quantity of bond held
     * @param tokenId The tokenId of the position
     * @return bondsQuantity Quantity of bond held, represents funds borrowed
     * @return normalizedDepositedAmount Amount of deposit placed on yield provider
     **/
    function getPositionRepartition(uint128 tokenId)
        external
        view
        returns (uint128 bondsQuantity, uint128 normalizedDepositedAmount);

    /**
     * @notice Deposits tokens into the yield provider and places a bid at the indicated rate within the
     * respective borrower's order book. A new position is created within the positions map that keeps
     * track of this position's composition. An ERC721 NFT is minted for the user as a representation
     * of the position.
     * @param to The address for which the position is created
     * @param amount The amount of tokens to be deposited
     * @param rate The rate at which to bid for a bonds
     * @param poolHash The identifier of the pool
     * @param underlyingToken The contract address of the token to be deposited
     **/
    function deposit(
        address to,
        uint128 amount,
        uint128 rate,
        bytes32 poolHash,
        address underlyingToken
    ) external returns (uint128 tokenId);

    /**
     * @notice Allows a user to update the rate at which to bid for bonds. A rate is only
     * upgradable as long as the full amount of deposits are currently allocated with the
     * yield provider i.e the position does not hold any bonds.
     * @param tokenId The tokenId of the position
     * @param newRate The new rate at which to bid for bonds
     **/
    function updateRate(uint128 tokenId, uint128 newRate) external;

    /**
     * @notice Withdraws the amount of tokens that are deposited with the yield provider.
     * The bonds portion of the position is not affected.
     * @param tokenId The tokenId of the position
     **/
    function withdraw(uint128 tokenId) external;

    /**
     * @notice Set the address of the position descriptor.
     * Only accessible to governance.
     * @param positionDescriptor The address of the position descriptor
     **/
    function setPositionDescriptor(address positionDescriptor) external;
}

File 6 of 19 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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);
}

File 7 of 19 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library 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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev 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) {
        require(isContract(target), "Address: delegate call to non-contract");

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

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

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

File 8 of 19 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 9 of 19 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

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

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 19 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.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 ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings 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.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        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) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        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 = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

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

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        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: transfer caller is not owner nor 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: transfer caller is not owner nor 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 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 _owners[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) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.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);

        _balances[to] += 1;
        _owners[tokenId] = to;

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

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

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

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

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

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

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

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

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {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 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 IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

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

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

File 11 of 19 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

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

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

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

pragma solidity ^0.8.0;

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

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

File 13 of 19 : IERC20Metadata.sol
// 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);
}

File 14 of 19 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

    /**
     * @dev 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 15 of 19 : IERC721Receiver.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 IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 17 of 19 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_poolsController","type":"address"},{"internalType":"address","name":"_positionManager","type":"address"},{"internalType":"bytes32","name":"_poolHash","type":"bytes32"},{"internalType":"uint256","name":"_maxMultiplier","type":"uint256"},{"internalType":"uint256","name":"_minLockingPeriod","type":"uint256"},{"internalType":"uint256","name":"_maxLockingPeriod","type":"uint256"},{"internalType":"uint256","name":"_minPositionAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockEnd","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"rewards","type":"uint256[]"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"poolsContract","type":"address"},{"indexed":false,"internalType":"address","name":"positionsContract","type":"address"},{"indexed":false,"internalType":"bytes32","name":"poolHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"maxMultiplier","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minLockingPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxLockingPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minPositionAmount","type":"uint256"}],"name":"LockdropCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockDuration","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"baseAllocations","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"rewards","type":"uint256[]"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockEnd","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"}],"name":"Quit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"RateUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"RewardsRescued","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"RootSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"TokenAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockEnd","type":"uint256"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"rewards","type":"uint256[]"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"addToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"baseMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"claimAndWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"claimedAllocations","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getLockParameters","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"_token","type":"address"}],"name":"getLockRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[][]","name":"proofs","type":"bytes32[][]"},{"internalType":"uint256[]","name":"baseAllocations","type":"uint256[]"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"lockingDuration","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"lockingDuration","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxLockingPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minLockingPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nft","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"baseAmount","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"lockingDuration","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"name":"previewRewards","outputs":[{"internalType":"uint256","name":"rewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"quit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"rescueRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"name":"setRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenParameters","outputs":[{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"newRate","type":"uint256"}],"name":"updateRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

610180604052670de0b6b3a764000060a0523480156200001e57600080fd5b5060405162003360380380620033608339810160408190526200004191620003ad565b85848484620000503362000340565b808210620000a55760405162461bcd60e51b815260206004820152601b60248201527f57726f6e67206c6f636b696e6720706572696f647320696e707574000000000060448201526064015b60405180910390fd5b60a0518310156200011f5760405162461bcd60e51b815260206004820152603c60248201527f4d6178206d756c7469706c696572206d7573742062652067726561746572206f60448201527f7220657175616c207468616e2062617365206d756c7469706c6965720000000060648201526084016200009c565b6001600160a01b0384166200016b5760405162461bcd60e51b815260206004820152601160248201527057726f6e67206e6674206164647265737360781b60448201526064016200009c565b6001600160a01b0390931660805260c09190915260e0526101005284620001c85760405162461bcd60e51b815260206004820152601060248201526f15dc9bdb99c81c1bdbdb081a5b9c1d5d60821b60448201526064016200009c565b6101208590526101408190526001600160a01b03871661016081905260405163aa5976c160e01b8152600481018790526000919063aa5976c1906024016101606040518083038186803b1580156200021f57600080fd5b505afa15801562000234573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200025a91906200042c565b50505050505050505050905060006001600160a01b0316816001600160a01b03161415620002cb5760405162461bcd60e51b815260206004820152601a60248201527f54617267657420706f6f6c20646f6573206e6f7420657869737400000000000060448201526064016200009c565b604080516001600160a01b03808b16825289166020820152908101879052606081018690526080810185905260a0810184905260c081018390527f93bc1ac1d4cdc2b02abad6b5356b27eb3d3afae67590ac176df5faa1d82a582f9060e00160405180910390a150505050505050506200050f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620003a857600080fd5b919050565b600080600080600080600060e0888a031215620003c957600080fd5b620003d48862000390565b9650620003e46020890162000390565b604089015160608a015160808b015160a08c015160c0909c01519a9d939c50919a90999198509650945092505050565b80516001600160801b0381168114620003a857600080fd5b60008060008060008060008060008060006101608c8e0312156200044f57600080fd5b6200045a8c62000390565b9a506200046a60208d0162000414565b99506200047a60408d0162000414565b98506200048a60608d0162000414565b97506200049a60808d0162000414565b9650620004aa60a08d0162000414565b9550620004ba60c08d0162000414565b9450620004ca60e08d0162000414565b9350620004db6101008d0162000414565b9250620004ec6101208d0162000414565b9150620004fd6101408d0162000414565b90509295989b509295989b9093969950565b60805160a05160c05160e05161010051610120516101405161016051612d5b62000605600039600050506000611b0801526000611c340152600081816103c7015281816104a801528181610746015281816114e901526123e60152600081816102ef015281816104d30152818161077101528181611514015281816123c5015261240f01526000818161017d015261245a0152600081816103ee0152818161215b015281816121b701528181612439015261249801526000818161025e01528181610aa101528181610ec00152818161140a01528181611a8801528181611ba801528181611f4f01526120b40152612d5b6000f3fe608060405234801561001057600080fd5b50600436106101735760003560e01c8063715018a6116100de578063bac9a21011610097578063e68b922e11610071578063e68b922e14610410578063f235784c1461044c578063f2fde38b1461047f578063f62b46c91461049257600080fd5b8063bac9a21014610388578063bf0df445146103c2578063d60a0955146103e957600080fd5b8063715018a6146102be5780637f94f65d146102c65780638da5cb5b146102d9578063949c3038146102ea578063b7e04a6214610311578063b90817f21461037557600080fd5b8063344cbc6811610130578063344cbc6814610220578063379607f514610233578063405abb411461024657806347ccca02146102595780634f64b2be1461029857806366b9efb4146102ab57600080fd5b80630187aea01461017857806312207cd9146101b25780631338736f146101c75780632e1a7d4d146101da5780632efbd853146101ed57806331d7a26214610200575b600080fd5b61019f7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6101c56101c0366004612676565b6104a5565b005b6101c56101d536600461271f565b610743565b6101c56101e8366004612741565b61082a565b6101c56101fb36600461276f565b610b51565b61019f61020e3660046127a4565b60036020526000908152604090205481565b6101c561022e366004612741565b610cd0565b6101c5610241366004612741565b610f9c565b6101c561025436600461271f565b6113a3565b6102807f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101a9565b6102806102a6366004612741565b6114bb565b61019f6102b93660046127c1565b6114e5565b6101c561169d565b6101c56102d4366004612802565b6116d3565b6000546001600160a01b0316610280565b61019f7f000000000000000000000000000000000000000000000000000000000000000081565b61034e61031f366004612741565b6000908152600460205260409020805460028201546003909201546001600160a01b039091169260ff90911690565b604080516001600160a01b03909416845260208401929092521515908201526060016101a9565b6101c56103833660046127a4565b6117c2565b61019f61039636600461282e565b60008281526004602090815260408083206001600160a01b038516845260010190915290205492915050565b61019f7f000000000000000000000000000000000000000000000000000000000000000081565b61019f7f000000000000000000000000000000000000000000000000000000000000000081565b61043761041e3660046127a4565b6002602052600090815260409020805460019091015482565b604080519283526020830191909152016101a9565b61046f61045a366004612741565b60056020526000908152604090205460ff1681565b60405190151581526020016101a9565b6101c561048d3660046127a4565b611998565b6101c56104a0366004612741565b611a33565b807f000000000000000000000000000000000000000000000000000000000000000081111580156104f657507f00000000000000000000000000000000000000000000000000000000000000008110155b61051b5760405162461bcd60e51b81526004016105129061285e565b60405180910390fd5b60015461053a5760405162461bcd60e51b81526004016105129061288e565b60005b60015481101561072f57600085828151811061055b5761055b6128be565b6020026020010151111561071d5760003386838151811061057e5761057e6128be565b60200260200101516040516020016105ab9291906001600160a01b03929092168252602082015260400190565b60408051601f1981840301815291815281516020928301206000818152600590935291205490915060ff16156106235760405162461bcd60e51b815260206004820152601f60248201527f4261736520616c6c6f636174696f6e20616c726561647920636c61696d6564006044820152606401610512565b6106c2888884818110610638576106386128be565b905060200281019061064a91906128d4565b8080602002602001604051908101604052809392919081815260200183836020028082843760009201829052506001805460029550919350915087908110610694576106946128be565b60009182526020808320909101546001600160a01b0316835282019290925260400190206001015483611a45565b6107035760405162461bcd60e51b8152602060048201526012602482015271141c9bdbd9881a5cc81b9bdd081d985b1a5960721b6044820152606401610512565b6000908152600560205260409020805460ff191660011790555b806107278161293b565b91505061053d565b5061073b838584611a5d565b505050505050565b807f0000000000000000000000000000000000000000000000000000000000000000811115801561079457507f00000000000000000000000000000000000000000000000000000000000000008110155b6107b05760405162461bcd60e51b81526004016105129061285e565b6001546107cf5760405162461bcd60e51b81526004016105129061288e565b60015460009067ffffffffffffffff8111156107ed576107ed6125d0565b604051908082528060200260200182016040528015610816578160200160208202803683370190505b509050610824848285611a5d565b50505050565b60008181526004602052604090205481906001600160a01b0316336001600160a01b03161461086b5760405162461bcd60e51b815260040161051290612956565b6000828152600460205260409020600201544210156108c15760405162461bcd60e51b8152602060048201526012602482015271576974686472617720746f6f206561726c7960701b6044820152606401610512565b60015460009067ffffffffffffffff8111156108df576108df6125d0565b604051908082528060200260200182016040528015610908578160200160208202803683370190505b50905060005b600154811015610a065760008481526004602052604081206001805491810192918490811061093f5761093f6128be565b60009182526020808320909101546001600160a01b031683528201929092526040019020548251839083908110610978576109786128be565b60209081029190910181019190915260008581526004909152604090206003015460ff16156109f4576000600460008681526020019081526020016000206001016000600184815481106109ce576109ce6128be565b60009182526020808320909101546001600160a01b031683528201929092526040019020555b806109fe8161293b565b91505061090e565b506000838152600460205260409020600281015460039091015460ff1615610a5d57600084815260046020526040812080546001600160a01b03191681556002810191909155600301805461ffff19169055610a7c565b6000848152600460205260409020600301805461ff0019166101001790555b604080516323b872dd60e01b81523060048201523360248201526044810186905290517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316916323b872dd91606480830192600092919082900301818387803b158015610af057600080fd5b505af1158015610b04573d6000803e3d6000fd5b505050507fe4f0c67ad5fad250d1e29c3aade0cebbcc215855ea862a5b4d089d47b85f388e8482610b323390565b85604051610b4394939291906129d4565b60405180910390a150505050565b6000546001600160a01b03163314610b7b5760405162461bcd60e51b815260040161051290612a0b565b60005b600154811015610c1a57836001600160a01b031660018281548110610ba557610ba56128be565b6000918252602090912001546001600160a01b03161415610c085760405162461bcd60e51b815260206004820152601760248201527f546f6b656e20616c726561647920737570706f727465640000000000000000006044820152606401610512565b80610c128161293b565b915050610b7e565b506001805480820182557fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60180546001600160a01b0319166001600160a01b03861690811790915560408051808201825285815260208082018681526000858152600283528490209251835551919094015580519182529181018490529081018290527f55da7a6a7d3b708ae471975643f183a0b160d485625acbbc628e25f2516304b7906060015b60405180910390a1505050565b60008181526004602052604090205481906001600160a01b0316336001600160a01b031614610d115760405162461bcd60e51b815260040161051290612956565b6000828152600460205260409020600201544210610d615760405162461bcd60e51b815260206004820152600d60248201526c5175697420746f6f206c61746560981b6044820152606401610512565b60005b600154811015610e8457600083815260046020526040812060018054918101929184908110610d9557610d956128be565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020546003600060018481548110610deb57610deb6128be565b60009182526020808320909101546001600160a01b0316835282019290925260400181208054909190610e1f908490612a40565b90915550506000838152600460205260408120600180549181019183919085908110610e4d57610e4d6128be565b60009182526020808320909101546001600160a01b0316835282019290925260400190205580610e7c8161293b565b915050610d64565b50600082815260046020526040812060028101805482546001600160a01b0319168355929055600301805461ffff191690556001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd30336040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101869052606401600060405180830381600087803b158015610f3657600080fd5b505af1158015610f4a573d6000803e3d6000fd5b505050507f142188641170ea0e16bdb91d06543c08013438605edbfa4168ed367b531518db8382610f783390565b6040805193845260208401929092526001600160a01b031690820152606001610cc3565b60008181526004602052604090205481906001600160a01b0316336001600160a01b031614610fdd5760405162461bcd60e51b815260040161051290612956565b6000828152600460205260409020600201544210156110305760405162461bcd60e51b815260206004820152600f60248201526e436c61696d20746f6f206561726c7960881b6044820152606401610512565b60008281526004602052604090206003015460ff16156110895760405162461bcd60e51b8152602060048201526014602482015273131bd8dac8185b1c9958591e4818db185a5b595960621b6044820152606401610512565b60008281526004602052604081206003015460015461010090910460ff16919067ffffffffffffffff8111156110c1576110c16125d0565b6040519080825280602002602001820160405280156110ea578160200160208202803683370190505b50905060005b60015481101561128757600085815260046020526040812060018054918101929184908110611121576111216128be565b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152602001908152602001600020546003600060018481548110611177576111776128be565b60009182526020808320909101546001600160a01b03168352820192909252604001812080549091906111ab908490612a40565b90915550506000858152600460205260408120600180549181019291849081106111d7576111d76128be565b60009182526020808320909101546001600160a01b031683528201929092526040019020548251839083908110611210576112106128be565b60200260200101818152505082156112755760006004600087815260200190815260200160002060010160006001848154811061124f5761124f6128be565b60009182526020808320909101546001600160a01b031683528201929092526040019020555b8061127f8161293b565b9150506110f0565b5060008481526004602052604090206002015482156112d557600085815260046020526040812080546001600160a01b03191681556002810191909155600301805461ffff191690556112f2565b6000858152600460205260409020600301805460ff191660011790555b60005b60015481101561135e5761134c33848381518110611315576113156128be565b602002602001015160018481548110611330576113306128be565b6000918252602090912001546001600160a01b03169190612030565b806113568161293b565b9150506112f5565b507fe22ba123cb933b52f1d3587302c8e8249361ce662c367a3575a575357680edcd8582338560405161139494939291906129d4565b60405180910390a15050505050565b60008281526004602052604090205482906001600160a01b0316336001600160a01b0316146113e45760405162461bcd60e51b815260040161051290612956565b6040516360bc5b2360e01b81526001600160801b038085166004830152831660248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906360bc5b2390604401600060405180830381600087803b15801561145657600080fd5b505af115801561146a573d6000803e3d6000fd5b505050507f49710b35fb4ddecfc392150b848bd5541464bcd36b188d2387a79d6d3813820e836114973390565b604080519283526001600160a01b0390911660208301528101849052606001610cc3565b600181815481106114cb57600080fd5b6000918252602090912001546001600160a01b0316905081565b60007f0000000000000000000000000000000000000000000000000000000000000000831115801561153757507f00000000000000000000000000000000000000000000000000000000000000008310155b6115535760405162461bcd60e51b81526004016105129061285e565b6001546115725760405162461bcd60e51b81526004016105129061288e565b6001600160a01b0382166000908152600260205260409020546115ce5760405162461bcd60e51b8152602060048201526014602482015273151bdad95b881b9bdd081c9959da5cdd195c995960621b6044820152606401610512565b6115da85848685612087565b6001600160a01b038316600090815260036020526040902054909150611601908290612a57565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a082319060240160206040518083038186803b15801561164057600080fd5b505afa158015611654573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116789190612a6f565b116116955760405162461bcd60e51b815260040161051290612a88565b949350505050565b6000546001600160a01b031633146116c75760405162461bcd60e51b815260040161051290612a0b565b6116d16000612228565b565b6000546001600160a01b031633146116fd5760405162461bcd60e51b815260040161051290612a0b565b6001600160a01b038216600090815260026020526040902060010154156117665760405162461bcd60e51b815260206004820152601960248201527f526f6f742068617320616c7265616479206265656e20736574000000000000006044820152606401610512565b6001600160a01b038216600081815260026020908152604091829020600101849055815192835282018390527f6133c805bf9e179972b1ebaab2903a3b516e45ae50dfaff11228f621a69ad16f91015b60405180910390a15050565b6000546001600160a01b031633146117ec5760405162461bcd60e51b815260040161051290612a0b565b60015460009067ffffffffffffffff81111561180a5761180a6125d0565b604051908082528060200260200182016040528015611833578160200160208202803683370190505b50905060005b60015481101561196657600360006001838154811061185a5761185a6128be565b60009182526020808320909101546001600160a01b031683528201929092526040019020546001805483908110611893576118936128be565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156118df57600080fd5b505afa1580156118f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119179190612a6f565b6119219190612a40565b828281518110611933576119336128be565b602090810291909101015261195433838381518110611315576113156128be565b8061195e8161293b565b915050611839565b507f83a6b9abe27628e0a82c25ec27124e2577b2b00eceb4020545e18daf6fc5c9cb82826040516117b6929190612acd565b6000546001600160a01b031633146119c25760405162461bcd60e51b815260040161051290612a0b565b6001600160a01b038116611a275760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610512565b611a3081612228565b50565b611a3c81610f9c565b611a308161082a565b600082611a528584612278565b1490505b9392505050565b60405163d89f46ab60e01b81526001600160801b038416600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d89f46ab90602401604080518083038186803b158015611ac957600080fd5b505afa158015611add573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b019190612b0d565b90925090507f0000000000000000000000000000000000000000000000000000000000000000611b318284612b40565b6001600160801b031611611b875760405162461bcd60e51b815260206004820152601a60248201527f556e73756666696369656e7420706f736974696f6e2073697a650000000000006044820152606401610512565b604051633103751960e11b81526001600160801b03861660048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636206ea329060240160e06040518083038186803b158015611bf257600080fd5b505afa158015611c06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2a9190612b6b565b50505050505090507f00000000000000000000000000000000000000000000000000000000000000008114611c935760405162461bcd60e51b815260206004820152600f60248201526e0aee4dedcce40e0deded840d0c2e6d608b1b6044820152606401610512565b600086815260046020526040902080546001600160a01b03191633179055611cbb8442612a57565b60008781526004602052604081206002019190915560015467ffffffffffffffff811115611ceb57611ceb6125d0565b604051908082528060200260200182016040528015611d14578160200160208202803683370190505b50905060005b600154811015611f44576000611d72888381518110611d3b57611d3b6128be565b6020026020010151888b60018681548110611d5857611d586128be565b6000918252602090912001546001600160a01b0316612087565b9050806003600060018581548110611d8c57611d8c6128be565b60009182526020808320909101546001600160a01b03168352820192909252604001902054611dbb9190612a57565b60018381548110611dce57611dce6128be565b6000918252602090912001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b158015611e1a57600080fd5b505afa158015611e2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e529190612a6f565b1015611e705760405162461bcd60e51b815260040161051290612a88565b806003600060018581548110611e8857611e886128be565b60009182526020808320909101546001600160a01b0316835282019290925260400181208054909190611ebc908490612a57565b9091555050600089815260046020526040812060018054849392820192919086908110611eeb57611eeb6128be565b60009182526020808320909101546001600160a01b0316835282019290925260400190205582518190849084908110611f2657611f266128be565b60209081029190910101525080611f3c8161293b565b915050611d1a565b506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018a9052606401600060405180830381600087803b158015611fc357600080fd5b505af1158015611fd7573d6000803e3d6000fd5b505050507fead6f8db471cf8ffe5fa1e7749aa5209074c425f0b32de8697a28ac96d322e6e8784866120099190612b40565b87338a8660405161201f96959493929190612bec565b60405180910390a150505050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526120829084906122ec565b505050565b60405163d89f46ab60e01b81526001600160801b0383166004820152600090819081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063d89f46ab90602401604080518083038186803b1580156120f557600080fd5b505afa158015612109573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212d9190612b0d565b9092509050600061213e8284612b40565b6001600160801b03169050600061215588886123be565b905060007f0000000000000000000000000000000000000000000000000000000000000000612184838c612c47565b61218e9190612c66565b6001600160a01b03881660009081526002602052604081205491925090670de0b6b3a7640000907f00000000000000000000000000000000000000000000000000000000000000009085908d906121e59089612c47565b6121ef9190612c47565b6121f99190612c47565b6122039190612c66565b61220d9190612c66565b90506122198183612a57565b9b9a5050505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081815b84518110156122e457600085828151811061229a5761229a6128be565b602002602001015190508083116122c057600083815260208290526040902092506122d1565b600081815260208490526040902092505b50806122dc8161293b565b91505061227d565b509392505050565b6000612341826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166124bc9092919063ffffffff16565b805190915015612082578080602001905181019061235f9190612c88565b6120825760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610512565b600061240a7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000612a40565b6124347f000000000000000000000000000000000000000000000000000000000000000085612a40565b61247e7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000612a40565b6124889190612c47565b6124929190612c66565b611a56907f0000000000000000000000000000000000000000000000000000000000000000612a57565b60606116958484600085856001600160a01b0385163b61251e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610512565b600080866001600160a01b0316858760405161253a9190612cd6565b60006040518083038185875af1925050503d8060008114612577576040519150601f19603f3d011682016040523d82523d6000602084013e61257c565b606091505b509150915061258c828286612597565b979650505050505050565b606083156125a6575081611a56565b8251156125b65782518084602001fd5b8160405162461bcd60e51b81526004016105129190612cf2565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126125f757600080fd5b8135602067ffffffffffffffff80831115612614576126146125d0565b8260051b604051601f19603f83011681018181108482111715612639576126396125d0565b60405293845285810183019383810192508785111561265757600080fd5b83870191505b8482101561258c5781358352918301919083019061265d565b60008060008060006080868803121561268e57600080fd5b853567ffffffffffffffff808211156126a657600080fd5b818801915088601f8301126126ba57600080fd5b8135818111156126c957600080fd5b8960208260051b85010111156126de57600080fd5b6020928301975095509087013590808211156126f957600080fd5b50612706888289016125e6565b9598949750949560408101359550606001359392505050565b6000806040838503121561273257600080fd5b50508035926020909101359150565b60006020828403121561275357600080fd5b5035919050565b6001600160a01b0381168114611a3057600080fd5b60008060006060848603121561278457600080fd5b833561278f8161275a565b95602085013595506040909401359392505050565b6000602082840312156127b657600080fd5b8135611a568161275a565b600080600080608085870312156127d757600080fd5b84359350602085013592506040850135915060608501356127f78161275a565b939692955090935050565b6000806040838503121561281557600080fd5b82356128208161275a565b946020939093013593505050565b6000806040838503121561284157600080fd5b8235915060208301356128538161275a565b809150509250929050565b6020808252601690820152752bb937b733903637b1b5b4b73390323ab930ba34b7b760511b604082015260600190565b602080825260169082015275139bc81d1bdad95b881a5cc81c9959da5cdd195c995960521b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000808335601e198436030181126128eb57600080fd5b83018035915067ffffffffffffffff82111561290657600080fd5b6020019150600581901b360382131561291e57600080fd5b9250929050565b634e487b7160e01b600052601160045260246000fd5b600060001982141561294f5761294f612925565b5060010190565b60208082526023908201527f43616c6c6572206973206e6f7420746865206f776e6572206f6620746865206c6040820152626f636b60e81b606082015260800190565b600081518084526020808501945080840160005b838110156129c9578151875295820195908201906001016129ad565b509495945050505050565b84815283602082015260018060a01b0383166040820152608060608201526000612a016080830184612999565b9695505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600082821015612a5257612a52612925565b500390565b60008219821115612a6a57612a6a612925565b500190565b600060208284031215612a8157600080fd5b5051919050565b60208082526025908201527f4e6f7420656e6f7567682072657761726473206c65667420746f206469737472604082015264696275746560d81b606082015260800190565b6001600160a01b038316815260406020820181905260009061169590830184612999565b80516001600160801b0381168114612b0857600080fd5b919050565b60008060408385031215612b2057600080fd5b612b2983612af1565b9150612b3760208401612af1565b90509250929050565b60006001600160801b03808316818516808303821115612b6257612b62612925565b01949350505050565b600080600080600080600060e0888a031215612b8657600080fd5b87519650612b9660208901612af1565b9550612ba460408901612af1565b94506060880151612bb48161275a565b9350612bc260808901612af1565b9250612bd060a08901612af1565b9150612bde60c08901612af1565b905092959891949750929550565b8681526001600160801b038616602082015284604082015260018060a01b038416606082015260c060808201526000612c2860c0830185612999565b82810360a0840152612c3a8185612999565b9998505050505050505050565b6000816000190483118215151615612c6157612c61612925565b500290565b600082612c8357634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215612c9a57600080fd5b81518015158114611a5657600080fd5b60005b83811015612cc5578181015183820152602001612cad565b838111156108245750506000910152565b60008251612ce8818460208701612caa565b9190910192915050565b6020815260008251806020840152612d11816040850160208701612caa565b601f01601f1916919091016040019291505056fea264697066735822122021ab9a514d642b464addf2adc22e8b5858c2b0012673e59c5f5a16cde70dbabe64736f6c63430008090033000000000000000000000000bc13e1b5da083b10622ff5b52c9cfa1912f10b1f00000000000000000000000055e4e70a725c1439dac6b9412b71fc8372bd73e9cc8205597c46655e974dc8962e08946779f73491ded5504e8ace905f3427844f00000000000000000000000000000000000000000000000010a741a462780000000000000000000000000000000000000000000000000000000000000013c680000000000000000000000000000000000000000000000000000000000076a7000000000000000000000000000000000000000000000000008ac7230489e80000

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.