ETH Price: $2,489.37 (-1.13%)

Contract

0x0A72F3A18FEF15eE5F9d337f4c81C3b99990Bd2d
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Unstake Forfeit187884112023-12-15 2:02:11323 days ago1702605731IN
0x0A72F3A1...99990Bd2d
0 ETH0.0026504137.71710403
Stake176907552023-07-14 9:17:35477 days ago1689326255IN
0x0A72F3A1...99990Bd2d
0 ETH0.0021597217.93258759
Stake176907362023-07-14 9:13:35477 days ago1689326015IN
0x0A72F3A1...99990Bd2d
0 ETH0.0019305416.02964314
Stake176467202023-07-08 4:37:23483 days ago1688791043IN
0x0A72F3A1...99990Bd2d
0 ETH0.0020900715.20898611
Unstake Forfeit176427432023-07-07 15:13:35484 days ago1688742815IN
0x0A72F3A1...99990Bd2d
0 ETH0.0028640640.7573549
Unstake Forfeit176424402023-07-07 14:12:11484 days ago1688739131IN
0x0A72F3A1...99990Bd2d
0 ETH0.0035042649.85930154
Unstake Forfeit176410002023-07-07 9:20:59484 days ago1688721659IN
0x0A72F3A1...99990Bd2d
0 ETH0.0006389824.33196128
Stake176405302023-07-07 7:45:35484 days ago1688715935IN
0x0A72F3A1...99990Bd2d
0 ETH0.0027235723.26232634
Unstake Forfeit176396722023-07-07 4:51:47484 days ago1688705507IN
0x0A72F3A1...99990Bd2d
0 ETH0.0013677519.46406577
Unstake Forfeit176396702023-07-07 4:51:23484 days ago1688705483IN
0x0A72F3A1...99990Bd2d
0 ETH0.0014515620.66780984
Unstake Forfeit176395302023-07-07 4:23:23484 days ago1688703803IN
0x0A72F3A1...99990Bd2d
0 ETH0.0014452220.56648814
Unstake Forfeit176386312023-07-07 1:21:59484 days ago1688692919IN
0x0A72F3A1...99990Bd2d
0 ETH0.0015744822.40590357
Unstake Forfeit176385312023-07-07 1:01:59484 days ago1688691719IN
0x0A72F3A1...99990Bd2d
0 ETH0.0019156327.25600577
Unstake Forfeit176385192023-07-07 0:59:35484 days ago1688691575IN
0x0A72F3A1...99990Bd2d
0 ETH0.0017070824.29293039
Unstake Forfeit176384922023-07-07 0:54:11484 days ago1688691251IN
0x0A72F3A1...99990Bd2d
0 ETH0.0017875625.43817726
Unstake Forfeit176384722023-07-07 0:50:11484 days ago1688691011IN
0x0A72F3A1...99990Bd2d
0 ETH0.0019604227.89337121
Unstake Forfeit176384692023-07-07 0:49:35484 days ago1688690975IN
0x0A72F3A1...99990Bd2d
0 ETH0.0021983831.28438828
Unstake Forfeit176384132023-07-07 0:38:11484 days ago1688690291IN
0x0A72F3A1...99990Bd2d
0 ETH0.0023539333.49791197
Unstake Forfeit176382442023-07-07 0:03:59484 days ago1688688239IN
0x0A72F3A1...99990Bd2d
0 ETH0.0036834855.59811566
Unstake Forfeit176382442023-07-07 0:03:59484 days ago1688688239IN
0x0A72F3A1...99990Bd2d
0 ETH0.0039069355.59811566
Unstake Forfeit176380542023-07-06 23:25:23484 days ago1688685923IN
0x0A72F3A1...99990Bd2d
0 ETH0.001631823.22158625
Stake176379822023-07-06 23:10:47484 days ago1688685047IN
0x0A72F3A1...99990Bd2d
0 ETH0.0027962523.21774494
Unstake Forfeit176379272023-07-06 22:59:35484 days ago1688684375IN
0x0A72F3A1...99990Bd2d
0 ETH0.0016184223.02723695
Unstake Forfeit176379202023-07-06 22:58:11484 days ago1688684291IN
0x0A72F3A1...99990Bd2d
0 ETH0.0014250520.27591302
Unstake Forfeit176378692023-07-06 22:47:59484 days ago1688683679IN
0x0A72F3A1...99990Bd2d
0 ETH0.0018032925.66193808
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TopiaLpStaking

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 32000 runs

Other Settings:
default evmVersion
File 1 of 9 : TopiaLpStaking.sol
// SPDX-License-Identifier: MIT

// MUST STAKE AT LEAST 1 TIME BEFORE SETTING REWARDS!!

pragma solidity 0.8.19;

import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./ITopiaLpStaking.sol";

contract TopiaLpStaking is ITopiaLpStaking, Ownable {
    using SafeCast for uint256;
    using SafeERC20 for IERC20;

    bool public rewardsSet;
    IERC20 public immutable rewardsToken;
    IERC20 public immutable stakingToken;
    RewardsPeriod public rewardsPeriod;
    RewardsPerWeight public rewardsPerWeight;
    uint32[] public lockupIntervals; // timestamps for duration of lockups available
    uint8[] public lockupIntervalMultipliers; // lockup multiplier, must match lockup intervals array length
    mapping(address => ITopiaLpStaking.UserStake[]) public userStakes;

    constructor(
        IERC20 _rewardsToken,
        IERC20 _stakingToken,
        uint32[] memory _lockupIntervals,
        uint8[] memory _lockupIntervalMultipliers
    ) {
        if (_lockupIntervals.length != _lockupIntervalMultipliers.length) {
            revert IntervalsMismatch();
        }

        rewardsToken = _rewardsToken;
        stakingToken = _stakingToken;
        lockupIntervals = _lockupIntervals;
        lockupIntervalMultipliers = _lockupIntervalMultipliers;
    }

    function stake(uint256 _lpAmount, uint8 _lockupIntervalIndex) external override {
        if (_lpAmount == 0) {
            revert LPAmountZero();
        }

        uint256 weight = getLpIntervalWeight(_lpAmount, _lockupIntervalIndex);
        updateRewardsPerWeight(weight, true);

        stakingToken.safeTransferFrom(msg.sender, address(this), _lpAmount);

        userStakes[msg.sender].push(
            UserStake({
                lpAmount: _lpAmount,
                checkpoint: rewardsPerWeight.accumulated,
                startedAt: block.timestamp.toUint32(),
                lockupIntervalIndex: _lockupIntervalIndex,
                claimed: false,
                forfeited: false
            })
        );

        emit LpTokensStaked(
            msg.sender,
            (userStakes[msg.sender].length - 1).toUint16(),
            _lpAmount,
            lockupIntervals[_lockupIntervalIndex]
        );
    }

    function unstakeClaim(uint16 _userStakeIndex) external override {
        UserStake storage userStake = userStakes[msg.sender][_userStakeIndex];

        if (block.timestamp < userStake.startedAt + lockupIntervals[userStake.lockupIntervalIndex]) {
            revert LockupTimeUnmet();
        }

        uint256 reward = getUserStakeReward(msg.sender, _userStakeIndex);

        rewardsToken.safeTransfer(msg.sender, reward);

        unstake(_userStakeIndex, true);
        emit LpTokensUnstaked(msg.sender, _userStakeIndex, userStake.lpAmount, reward);
    }

    function unstakeForfeit(uint16 _userStakeIndex) external override {
        unstake(_userStakeIndex, false);
        emit LpTokensUnstakeForfeited(msg.sender, _userStakeIndex, userStakes[msg.sender][_userStakeIndex].lpAmount);
    }

    function setRewards(uint32 _start, uint32 _end, uint96 _rate) external onlyOwner {
        if (rewardsSet) {
          revert RewardsAlreadySet();
        }

        if (rewardsPerWeight.totalWeight == 0) {
          revert StakedPositionsRequired();
        }

        if (block.timestamp > _start || block.timestamp + 30 days < _start) {
          revert InvalidStart();
        }

        if (_start >= _end) {
            revert InvalidStartEnd();
        }
        if (_rate < 1 ether) {
            revert InvalidRewardRate();
        }

        rewardsPeriod.start = _start;
        rewardsPeriod.end = _end;

        rewardsPerWeight.lastUpdated = _start;
        rewardsPerWeight.rate = _rate;

        rewardsSet = true;

        emit RewardsSet(_start, _end, _rate);
    }

    function estimateStakeReward(
        uint256 _lpAmount,
        uint8 _lockupIntervalIndex
    ) external view override returns (uint256) {
        // the assumed estimate if weight were not to change the duration of the staking, used for initial stake estimate.
        uint32 duration = lockupIntervals[_lockupIntervalIndex];
        uint256 stakeWeight = getLpIntervalWeight(_lpAmount, _lockupIntervalIndex);

        return duration * rewardsPerWeight.rate * stakeWeight / (rewardsPerWeight.totalWeight + stakeWeight);
    }

    function getUserStakeReward(address _user, uint16 _userStakeIndex) public view override returns (uint256) {
        RewardsPerWeight memory rewardsPerWeight_ = rewardsPerWeight;
        UserStake storage userStake = userStakes[_user][_userStakeIndex];

        if (userStake.claimed || userStake.forfeited) {
            return 0;
        }

        // Find out the unaccounted time
        // End is the lowest of current timestamp, reward period end, or lockup end time.
        uint32 end = min(block.timestamp.toUint32(), rewardsPeriod.end);

        uint256 unaccountedTime = end - rewardsPerWeight_.lastUpdated; // Cast to uint256 to avoid overflows later on
        if (unaccountedTime != 0) {
            // Calculate and update the new value of the accumulator. unaccountedTime casts it into uint256, which is desired.
            if (rewardsPerWeight_.totalWeight != 0) {
                rewardsPerWeight_.accumulated = (rewardsPerWeight_.accumulated +
                    (unaccountedTime * rewardsPerWeight_.rate) /
                    rewardsPerWeight_.totalWeight).toUint96();
            }
        }

        // Calculate and update the new value user reserves. userRewards_.stakedWeight casts it into uint256, which is desired.
        return getUserStakeWeight(userStake) * (rewardsPerWeight_.accumulated - userStake.checkpoint);
    }

    function getUserStakeRewards(
        address _user,
        uint16[] calldata _userStakeIndexes
    ) external view override returns (uint256[] memory) {
        uint256[] memory stakeRewards = new uint256[](_userStakeIndexes.length);

        for (uint256 i = 0; i < _userStakeIndexes.length; i++) {
            stakeRewards[i] = getUserStakeReward(_user, _userStakeIndexes[i]);
        }

        return stakeRewards;
    }

    function getUserStake(address _user, uint16 _userStakeIndex) external view override returns (UserStake memory) {
        return userStakes[_user][_userStakeIndex];
    }

    function getUserStakes(address _user) external view override returns (UserStake[] memory) {
        return userStakes[_user];
    }

    function getUserStakesCount(address _user) external view override returns (uint256) {
        return userStakes[_user].length;
    }

    function getLockupIntervals() external view override returns (uint32[] memory) {
        return lockupIntervals;
    }

    function getLockupIntervalsCount() external view override returns (uint8) {
        return lockupIntervals.length.toUint8();
    }

    function getLockupIntervalMultipliers() external view override returns (uint8[] memory) {
        return lockupIntervalMultipliers;
    }

    function unstake(uint16 _userStakeIndex, bool _claimed) internal {
        UserStake storage userStake = userStakes[msg.sender][_userStakeIndex];
        if (userStake.claimed || userStake.forfeited) {
            revert AlreadyUnstaked();
        }

        updateRewardsPerWeight(getUserStakeWeight(userStake), false);

        userStake.claimed = _claimed;
        userStake.forfeited = !_claimed;

        stakingToken.safeTransfer(msg.sender, userStake.lpAmount);
    }

    function updateRewardsPerWeight(uint256 _weight, bool _increase) internal {
        if (block.timestamp.toUint32() >= rewardsPeriod.start) {
            uint32 end = min(block.timestamp.toUint32(), rewardsPeriod.end);
            uint256 unaccountedTime = end - rewardsPerWeight.lastUpdated;

            if (unaccountedTime != 0) {
                if (rewardsPerWeight.totalWeight != 0) {
                    rewardsPerWeight.accumulated = (rewardsPerWeight.accumulated +
                        (unaccountedTime * rewardsPerWeight.rate) /
                        rewardsPerWeight.totalWeight).toUint96();
                }

                rewardsPerWeight.lastUpdated = end;
            }
        }

        if (_increase) {
            rewardsPerWeight.totalWeight += _weight;
        } else {
            rewardsPerWeight.totalWeight -= _weight;
        }

        emit RewardsPerWeightUpdated(rewardsPerWeight.accumulated);
    }

    function getLpIntervalWeight(uint256 _lpAmount, uint8 _lockupIntervalIndex) internal view returns (uint256 weight) {
        weight = _lpAmount * lockupIntervalMultipliers[_lockupIntervalIndex];
    }

    function getUserStakeWeight(UserStake memory _userStake) internal view returns (uint256 weight) {
        weight = getLpIntervalWeight(_userStake.lpAmount, _userStake.lockupIntervalIndex);
    }

    function min(uint32 _x, uint32 _y) internal pure returns (uint32 z) {
        z = (_x < _y) ? _x : _y;
    }
}

File 2 of 9 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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 Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        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 3 of 9 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 5 of 9 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

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

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

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

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

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

File 7 of 9 : 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 8 of 9 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 9 of 9 : ITopiaLpStaking.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface ITopiaLpStaking {
    event LpTokensStaked(address indexed user, uint16 userStakeIndex, uint256 amount, uint256 lockupTime);
    event LpTokensUnstaked(address indexed user, uint16 userStakeIndex, uint256 amount, uint256 reward);
    event LpTokensUnstakeForfeited(address indexed user, uint16 userStakeIndex, uint256 amount);
    event RewardsSet(uint32 start, uint32 end, uint256 rate);
    event RewardsPerWeightUpdated(uint256 accumulated);
    event LockupIntervalAdded(uint8 lockupIntervalIndex, uint32 interval, uint8 multiplier);
    event RewardsTokenSet(address rewardsTokenAddress);
    event UniswapPairSet(address uniswapPairAddress);

    error IntervalsMismatch();
    error LPAmountZero();
    error AlreadyUnstaked();
    error LockupTimeUnmet();
    error StakedPositionsRequired();
    error RewardsAlreadySet();
    error InvalidStart();
    error InvalidStartEnd();
    error InvalidRewardRate();

    struct RewardsPeriod {
        uint32 start; // reward start time, in unix epoch
        uint32 end; // reward end time, in unix epoch
    }

    struct RewardsPerWeight {
        uint256 totalWeight;
        uint96 accumulated;
        uint32 lastUpdated;
        uint96 rate;
    }

    struct UserStake {
        uint256 lpAmount;
        uint96 checkpoint;
        uint32 startedAt;
        uint8 lockupIntervalIndex;
        bool claimed;
        bool forfeited;
    }

    // view functions
    function estimateStakeReward(uint256 _lpAmount, uint8 _lockupIntervalIndex) external view returns (uint256);

    function getUserStakeReward(address _user, uint16 _userStakeIndex) external view returns (uint256);

    function getUserStakeRewards(
        address _user,
        uint16[] calldata _userStakeIndexes
    ) external view returns (uint256[] memory);

    function getUserStake(address _user, uint16 _userStakeIndex) external view returns (UserStake memory);

    function getUserStakes(address _user) external view returns (UserStake[] memory);

    function getUserStakesCount(address _user) external view returns (uint256);

    function getLockupIntervals() external view returns (uint32[] memory);

    function getLockupIntervalsCount() external view returns (uint8);

    function getLockupIntervalMultipliers() external view returns (uint8[] memory);

    // public functions
    function stake(uint256 _lpAmount, uint8 _lockupIntervalIndex) external;

    function unstakeClaim(uint16 _userStakeIndex) external;

    function unstakeForfeit(uint16 _userStakeIndex) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_rewardsToken","type":"address"},{"internalType":"contract IERC20","name":"_stakingToken","type":"address"},{"internalType":"uint32[]","name":"_lockupIntervals","type":"uint32[]"},{"internalType":"uint8[]","name":"_lockupIntervalMultipliers","type":"uint8[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyUnstaked","type":"error"},{"inputs":[],"name":"IntervalsMismatch","type":"error"},{"inputs":[],"name":"InvalidRewardRate","type":"error"},{"inputs":[],"name":"InvalidStart","type":"error"},{"inputs":[],"name":"InvalidStartEnd","type":"error"},{"inputs":[],"name":"LPAmountZero","type":"error"},{"inputs":[],"name":"LockupTimeUnmet","type":"error"},{"inputs":[],"name":"RewardsAlreadySet","type":"error"},{"inputs":[],"name":"StakedPositionsRequired","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"lockupIntervalIndex","type":"uint8"},{"indexed":false,"internalType":"uint32","name":"interval","type":"uint32"},{"indexed":false,"internalType":"uint8","name":"multiplier","type":"uint8"}],"name":"LockupIntervalAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint16","name":"userStakeIndex","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockupTime","type":"uint256"}],"name":"LpTokensStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint16","name":"userStakeIndex","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"LpTokensUnstakeForfeited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint16","name":"userStakeIndex","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"LpTokensUnstaked","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":"accumulated","type":"uint256"}],"name":"RewardsPerWeightUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"start","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"end","type":"uint32"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"}],"name":"RewardsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"rewardsTokenAddress","type":"address"}],"name":"RewardsTokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"uniswapPairAddress","type":"address"}],"name":"UniswapPairSet","type":"event"},{"inputs":[{"internalType":"uint256","name":"_lpAmount","type":"uint256"},{"internalType":"uint8","name":"_lockupIntervalIndex","type":"uint8"}],"name":"estimateStakeReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLockupIntervalMultipliers","outputs":[{"internalType":"uint8[]","name":"","type":"uint8[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLockupIntervals","outputs":[{"internalType":"uint32[]","name":"","type":"uint32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLockupIntervalsCount","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint16","name":"_userStakeIndex","type":"uint16"}],"name":"getUserStake","outputs":[{"components":[{"internalType":"uint256","name":"lpAmount","type":"uint256"},{"internalType":"uint96","name":"checkpoint","type":"uint96"},{"internalType":"uint32","name":"startedAt","type":"uint32"},{"internalType":"uint8","name":"lockupIntervalIndex","type":"uint8"},{"internalType":"bool","name":"claimed","type":"bool"},{"internalType":"bool","name":"forfeited","type":"bool"}],"internalType":"struct ITopiaLpStaking.UserStake","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint16","name":"_userStakeIndex","type":"uint16"}],"name":"getUserStakeReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint16[]","name":"_userStakeIndexes","type":"uint16[]"}],"name":"getUserStakeRewards","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserStakes","outputs":[{"components":[{"internalType":"uint256","name":"lpAmount","type":"uint256"},{"internalType":"uint96","name":"checkpoint","type":"uint96"},{"internalType":"uint32","name":"startedAt","type":"uint32"},{"internalType":"uint8","name":"lockupIntervalIndex","type":"uint8"},{"internalType":"bool","name":"claimed","type":"bool"},{"internalType":"bool","name":"forfeited","type":"bool"}],"internalType":"struct ITopiaLpStaking.UserStake[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserStakesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockupIntervalMultipliers","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lockupIntervals","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardsPerWeight","outputs":[{"internalType":"uint256","name":"totalWeight","type":"uint256"},{"internalType":"uint96","name":"accumulated","type":"uint96"},{"internalType":"uint32","name":"lastUpdated","type":"uint32"},{"internalType":"uint96","name":"rate","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsPeriod","outputs":[{"internalType":"uint32","name":"start","type":"uint32"},{"internalType":"uint32","name":"end","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_start","type":"uint32"},{"internalType":"uint32","name":"_end","type":"uint32"},{"internalType":"uint96","name":"_rate","type":"uint96"}],"name":"setRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_lpAmount","type":"uint256"},{"internalType":"uint8","name":"_lockupIntervalIndex","type":"uint8"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_userStakeIndex","type":"uint16"}],"name":"unstakeClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_userStakeIndex","type":"uint16"}],"name":"unstakeForfeit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userStakes","outputs":[{"internalType":"uint256","name":"lpAmount","type":"uint256"},{"internalType":"uint96","name":"checkpoint","type":"uint96"},{"internalType":"uint32","name":"startedAt","type":"uint32"},{"internalType":"uint8","name":"lockupIntervalIndex","type":"uint8"},{"internalType":"bool","name":"claimed","type":"bool"},{"internalType":"bool","name":"forfeited","type":"bool"}],"stateMutability":"view","type":"function"}]

60c06040523480156200001157600080fd5b5060405162002d6938038062002d69833981016040819052620000349162000371565b6200003f33620000ab565b8051825114620000625760405163fa88582b60e01b815260040160405180910390fd5b6001600160a01b03808516608052831660a05281516200008a906004906020850190620000fb565b508051620000a0906005906020840190620001b1565b505050505062000472565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b828054828255906000526020600020906007016008900481019282156200019f5791602002820160005b838211156200016b57835183826101000a81548163ffffffff021916908363ffffffff160217905550926020019260040160208160030104928301926001030262000125565b80156200019d5782816101000a81549063ffffffff02191690556004016020816003010492830192600103026200016b565b505b50620001ad9291506200024a565b5090565b82805482825590600052602060002090601f016020900481019282156200019f5791602002820160005b838211156200021b57835183826101000a81548160ff021916908360ff1602179055509260200192600101602081600001049283019260010302620001db565b80156200019d5782816101000a81549060ff02191690556001016020816000010492830192600103026200021b565b5b80821115620001ad57600081556001016200024b565b80516001600160a01b03811681146200027957600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620002bf57620002bf6200027e565b604052919050565b60006001600160401b03821115620002e357620002e36200027e565b5060051b60200190565b600082601f830112620002ff57600080fd5b81516020620003186200031283620002c7565b62000294565b82815260059290921b840181019181810190868411156200033857600080fd5b8286015b848110156200036657805160ff81168114620003585760008081fd5b83529183019183016200033c565b509695505050505050565b600080600080608085870312156200038857600080fd5b620003938562000261565b93506020620003a481870162000261565b60408701519094506001600160401b0380821115620003c257600080fd5b818801915088601f830112620003d757600080fd5b8151620003e86200031282620002c7565b81815260059190911b8301840190848101908b8311156200040857600080fd5b938501935b828510156200043c57845163ffffffff811681146200042c5760008081fd5b825293850193908501906200040d565b60608b015190975094505050808311156200045657600080fd5b50506200046687828801620002ed565b91505092959194509250565b60805160a0516128bc620004ad600039600081816102e6015281816105a20152611c8c015260008181610453015261096301526128bc6000f3fe608060405234801561001057600080fd5b50600436106101985760003560e01c8063842e2981116100e3578063cfa8586d1161008c578063ef304a5211610066578063ef304a521461048a578063f2fde38b1461049d578063fc196d08146104b057600080fd5b8063cfa8586d14610419578063d1af0c7d1461044e578063dc6c3da01461047557600080fd5b8063a354f39e116100bd578063a354f39e146103a1578063aa68507b146103b4578063b5d5b5fa146103bc57600080fd5b8063842e29811461032d5780638da5cb5b1461034d57806398dc8dea1461036b57600080fd5b80634dd83c02116101455780635fdaefa51161011f5780635fdaefa5146102b9578063715018a6146102d957806372f702f3146102e157600080fd5b80634dd83c021461027157806357de00fb146102865780635f659bf1146102a657600080fd5b806326ae2b781161017657806326ae2b78146101f2578063325ee43d1461022b5780633a1cf6fa1461024c57600080fd5b806310087fb11461019d578063151e75ea146101b25780631cd5722b146101df575b600080fd5b6101b06101ab366004612244565b610535565b005b6101c56101c036600461227a565b610821565b60405163ffffffff90911681526020015b60405180910390f35b6101b06101ed3660046122aa565b61085b565b60015461020e9063ffffffff8082169164010000000090041682565b6040805163ffffffff9384168152929091166020830152016101d6565b61023e6102393660046122e9565b6109db565b6040519081526020016101d6565b61025f61025a36600461227a565b610c64565b60405160ff90911681526020016101d6565b610279610c98565b6040516101d6919061231c565b6102996102943660046122e9565b610d1c565b6040516101d69190612366565b6101b06102b43660046122aa565b610e3e565b6102cc6102c73660046123c4565b610ec0565b6040516101d6919061244a565b6101b0610f77565b6103087f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d6565b61034061033b366004612482565b610f8b565b6040516101d6919061249d565b60005473ffffffffffffffffffffffffffffffffffffffff16610308565b61023e610379366004612482565b73ffffffffffffffffffffffffffffffffffffffff1660009081526006602052604090205490565b6101b06103af366004612543565b6110a2565b61025f61137b565b6103cf6103ca36600461259b565b61138f565b604080519687526bffffffffffffffffffffffff909516602087015263ffffffff9093169385019390935260ff1660608401529015156080830152151560a082015260c0016101d6565b60005461043e9074010000000000000000000000000000000000000000900460ff1681565b60405190151581526020016101d6565b6103087f000000000000000000000000000000000000000000000000000000000000000081565b61047d61143a565b6040516101d691906125c5565b61023e610498366004612244565b6114af565b6101b06104ab366004612482565b61156a565b6002546003546104fc91906bffffffffffffffffffffffff8082169163ffffffff6c01000000000000000000000000820416917001000000000000000000000000000000009091041684565b604080519485526bffffffffffffffffffffffff938416602086015263ffffffff909216918401919091521660608201526080016101d6565b8160000361056f576040517fbbb9b84400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061057b8383611626565b905061058881600161166d565b6105ca73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633308661183e565b33600090815260066020908152604091829020825160c0810184528681526003546bffffffffffffffffffffffff169281019290925291810161060c42611920565b63ffffffff908116825260ff808716602080850191909152600060408086018290526060958601829052875460018181018a55988352838320885160029092020190815587840151908901805489840151988a015160808b015160a0909b015115157201000000000000000000000000000000000000027fffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffff9b151571010000000000000000000000000000000000027fffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffff9290991670010000000000000000000000000000000002919091167fffffffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffff9a9099166c01000000000000000000000000027fffffffffffffffffffffffffffffffff000000000000000000000000000000009092166bffffffffffffffffffffffff9094169390931717979097169590951793909317959095169290921790925533808452600690915291205490917fde7444c7f0307aa4864dcb5647d866ae70d4300bf5a73a1da71f811a6dc25b2b916107bd916107b89161262f565b6119ba565b8560048660ff16815481106107d4576107d4612642565b60009182526020918290206008820401546040805161ffff969096168652928501939093526007166004026101000a90910463ffffffff16908201526060015b60405180910390a2505050565b6004818154811061083157600080fd5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b336000908152600660205260408120805461ffff841690811061088057610880612642565b9060005260206000209060020201905060048160010160109054906101000a900460ff1660ff16815481106108b7576108b7612642565b6000918252602090912060088204015460018301546108fc926007166004026101000a90910463ffffffff908116916c01000000000000000000000000900416612671565b63ffffffff1642101561093b576040517f83a44d2000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061094733846109db565b905061098a73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163383611a4e565b610995836001611aa9565b81546040805161ffff861681526020810192909252810182905233907f8b4f4a6c857b3e6333d6be98111fa0aa5d3ff8077d1e886c42f68d4dcb4fe42190606001610814565b6040805160808101825260025481526003546bffffffffffffffffffffffff80821660208085019190915263ffffffff6c010000000000000000000000008404168486015270010000000000000000000000000000000090920416606083015273ffffffffffffffffffffffffffffffffffffffff851660009081526006909152918220805483919061ffff8616908110610a7857610a78612642565b906000526020600020906002020190508060010160119054906101000a900460ff1680610abf575060018101547201000000000000000000000000000000000000900460ff165b15610acf57600092505050610c5e565b6000610af3610add42611920565b600154640100000000900463ffffffff16611cc9565b90506000836040015182610b079190612695565b63ffffffff1690508015610b8057835115610b805783516060850151610b6c9190610b40906bffffffffffffffffffffffff16846126b2565b610b4a91906126c9565b85602001516bffffffffffffffffffffffff16610b679190612704565b611ceb565b6bffffffffffffffffffffffff1660208501525b60018301546020850151610ba2916bffffffffffffffffffffffff1690612717565b6040805160c0810182528554815260018601546bffffffffffffffffffffffff818116602084015263ffffffff6c010000000000000000000000008304169383019390935260ff700100000000000000000000000000000000820481166060840152710100000000000000000000000000000000008204811615156080840152720100000000000000000000000000000000000090910416151560a0820152911690610c4d90611d89565b610c5791906126b2565b9450505050505b92915050565b60058181548110610c7457600080fd5b9060005260206000209060209182820401919006915054906101000a900460ff1681565b60606004805480602002602001604051908101604052809291908181526020018280548015610d1257602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff1681526020019060040190602082600301049283019260010382029150808411610cd55790505b5050505050905090565b6040805160c08101825260008082526020808301829052828401829052606083018290526080830182905260a0830182905273ffffffffffffffffffffffffffffffffffffffff861682526006905291909120805461ffff8416908110610d8557610d85612642565b60009182526020918290206040805160c081018252600290930290910180548352600101546bffffffffffffffffffffffff81169383019390935263ffffffff6c010000000000000000000000008404169082015260ff7001000000000000000000000000000000008304811660608301527101000000000000000000000000000000000083048116151560808301527201000000000000000000000000000000000000909204909116151560a0820152905092915050565b610e49816000611aa9565b33600081815260066020526040902080547f17218b7f7d9847c4cc1c13147aaeaaa6ff8e56292aa2b37963afab6141afda7391849161ffff8316908110610e9257610e92612642565b6000918252602091829020600290910201546040805161ffff9094168452918301520160405180910390a250565b606060008267ffffffffffffffff811115610edd57610edd61273c565b604051908082528060200260200182016040528015610f06578160200160208202803683370190505b50905060005b83811015610f6e57610f3f86868684818110610f2a57610f2a612642565b905060200201602081019061023991906122aa565b828281518110610f5157610f51612642565b602090810291909101015280610f668161276b565b915050610f0c565b50949350505050565b610f7f611d9d565b610f896000611e1e565b565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600660209081526040808320805482518185028101850190935280835260609492939192909184015b828210156110975760008481526020908190206040805160c08101825260028602909201805483526001908101546bffffffffffffffffffffffff81168486015263ffffffff6c010000000000000000000000008204169284019290925260ff7001000000000000000000000000000000008304811660608501527101000000000000000000000000000000000083048116151560808501527201000000000000000000000000000000000000909204909116151560a08301529083529092019101610fd0565b505050509050919050565b6110aa611d9d565b60005474010000000000000000000000000000000000000000900460ff16156110ff576040517f566e79f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460000361113b576040517ff7e64e6d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8263ffffffff16421180611160575063ffffffff831661115e4262278d00612704565b105b15611197576040517f38356e4c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8163ffffffff168363ffffffff16106111dc576040517fe5b55bb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b670de0b6b3a7640000816bffffffffffffffffffffffff16101561122c576040517f22be228400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001805463ffffffff8581167fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000909216821764010000000091861691820217909255600380547fffffffff00000000000000000000000000000000ffffffffffffffffffffffff166c0100000000000000000000000083027fffffffff000000000000000000000000ffffffffffffffffffffffffffffffff16177001000000000000000000000000000000006bffffffffffffffffffffffff86169081029190911790915560008054740100000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909116179055604080519283526020830193909352918101919091527f95efd8a2a0aa591f48fd9673cf5d13c2150ca7a1fe1cbe438dd3f0ae470646639060600160405180910390a1505050565b60045460009061138a90611e93565b905090565b600660205281600052604060002081815481106113ab57600080fd5b6000918252602090912060029091020180546001909101549092506bffffffffffffffffffffffff8116915063ffffffff6c010000000000000000000000008204169060ff700100000000000000000000000000000000820481169171010000000000000000000000000000000000810482169172010000000000000000000000000000000000009091041686565b60606005805480602002602001604051908101604052809291908181526020018280548015610d1257602002820191906000526020600020906000905b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116114775790505050505050905090565b60008060048360ff16815481106114c8576114c8612642565b60009182526020822060088204015460079091166004026101000a900463ffffffff1691506114f78585611626565b600254909150611508908290612704565b600354829061153f9070010000000000000000000000000000000090046bffffffffffffffffffffffff1663ffffffff86166127a3565b6bffffffffffffffffffffffff1661155791906126b2565b61156191906126c9565b95945050505050565b611572611d9d565b73ffffffffffffffffffffffffffffffffffffffff811661161a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61162381611e1e565b50565b600060058260ff168154811061163e5761163e612642565b60009182526020918290209181049091015461166691601f166101000a900460ff16846126b2565b9392505050565b60015463ffffffff1661167f42611920565b63ffffffff16106117b4576000611698610add42611920565b6003549091506000906116c1906c01000000000000000000000000900463ffffffff1683612695565b63ffffffff16905080156117b1576002541561177157600254600354611733919061170e9070010000000000000000000000000000000090046bffffffffffffffffffffffff16846126b2565b61171891906126c9565b600354610b6791906bffffffffffffffffffffffff16612704565b600380547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff929092169190911790555b600380547fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff166c0100000000000000000000000063ffffffff8516021790555b50505b80156117da5781600260000160008282546117cf9190612704565b909155506117f59050565b81600260000160008282546117ef919061262f565b90915550505b6003546040516bffffffffffffffffffffffff90911681527faac1802288db8019f8ec43430efc11a152c72473c57d6ddcde3b6dd0c89260679060200160405180910390a15050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261191a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611f26565b50505050565b600063ffffffff8211156119b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f32206269747300000000000000000000000000000000000000000000000000006064820152608401611611565b5090565b600061ffff8211156119b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f36206269747300000000000000000000000000000000000000000000000000006064820152608401611611565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611aa49084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611898565b505050565b336000908152600660205260408120805461ffff8516908110611ace57611ace612642565b906000526020600020906002020190508060010160119054906101000a900460ff1680611b15575060018101547201000000000000000000000000000000000000900460ff165b15611b4c576040517fd831531200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160c0810182528254815260018301546bffffffffffffffffffffffff8116602083015263ffffffff6c010000000000000000000000008204169282019290925260ff7001000000000000000000000000000000008304811660608301527101000000000000000000000000000000000083048116151560808301527201000000000000000000000000000000000000909204909116151560a0820152611c0090611bf990611d89565b600061166d565b6001810180547fffffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffffff167101000000000000000000000000000000000084158015919091027fffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffff16919091177201000000000000000000000000000000000000919091021790558054611aa4907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16903390611a4e565b60008163ffffffff168363ffffffff1610611ce45781611666565b5090919050565b60006bffffffffffffffffffffffff8211156119b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203960448201527f36206269747300000000000000000000000000000000000000000000000000006064820152608401611611565b6000610c5e82600001518360600151611626565b60005473ffffffffffffffffffffffffffffffffffffffff163314610f89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611611565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060ff8211156119b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203860448201527f20626974730000000000000000000000000000000000000000000000000000006064820152608401611611565b6000611f88826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166120359092919063ffffffff16565b9050805160001480611fa9575080806020019051810190611fa991906127d3565b611aa4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401611611565b6060612044848460008561204c565b949350505050565b6060824710156120de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401611611565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516121079190612819565b60006040518083038185875af1925050503d8060008114612144576040519150601f19603f3d011682016040523d82523d6000602084013e612149565b606091505b509150915061215a87838387612165565b979650505050505050565b606083156121fb5782516000036121f45773ffffffffffffffffffffffffffffffffffffffff85163b6121f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611611565b5081612044565b61204483838151156122105781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116119190612835565b6000806040838503121561225757600080fd5b82359150602083013560ff8116811461226f57600080fd5b809150509250929050565b60006020828403121561228c57600080fd5b5035919050565b803561ffff811681146122a557600080fd5b919050565b6000602082840312156122bc57600080fd5b61166682612293565b803573ffffffffffffffffffffffffffffffffffffffff811681146122a557600080fd5b600080604083850312156122fc57600080fd5b612305836122c5565b915061231360208401612293565b90509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561235a57835163ffffffff1683529284019291840191600101612338565b50909695505050505050565b60c08101610c5e8284805182526bffffffffffffffffffffffff602082015116602083015263ffffffff604082015116604083015260ff606082015116606083015260808101511515608083015260a0810151151560a08301525050565b6000806000604084860312156123d957600080fd5b6123e2846122c5565b9250602084013567ffffffffffffffff808211156123ff57600080fd5b818601915086601f83011261241357600080fd5b81358181111561242257600080fd5b8760208260051b850101111561243757600080fd5b6020830194508093505050509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561235a57835183529284019291840191600101612466565b60006020828403121561249457600080fd5b611666826122c5565b6020808252825182820181905260009190848201906040850190845b8181101561235a5761251c838551805182526bffffffffffffffffffffffff602082015116602083015263ffffffff604082015116604083015260ff606082015116606083015260808101511515608083015260a0810151151560a08301525050565b9284019260c092909201916001016124b9565b803563ffffffff811681146122a557600080fd5b60008060006060848603121561255857600080fd5b6125618461252f565b925061256f6020850161252f565b915060408401356bffffffffffffffffffffffff8116811461259057600080fd5b809150509250925092565b600080604083850312156125ae57600080fd5b6125b7836122c5565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b8181101561235a57835160ff16835292840192918401916001016125e1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115610c5e57610c5e612600565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b63ffffffff81811683821601908082111561268e5761268e612600565b5092915050565b63ffffffff82811682821603908082111561268e5761268e612600565b8082028115828204841417610c5e57610c5e612600565b6000826126ff577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b80820180821115610c5e57610c5e612600565b6bffffffffffffffffffffffff82811682821603908082111561268e5761268e612600565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361279c5761279c612600565b5060010190565b6bffffffffffffffffffffffff8181168382160280821691908281146127cb576127cb612600565b505092915050565b6000602082840312156127e557600080fd5b8151801515811461166657600080fd5b60005b838110156128105781810151838201526020016127f8565b50506000910152565b6000825161282b8184602087016127f5565b9190910192915050565b60208152600082518060208401526128548160408501602087016127f5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220c31e302ca59f248efb99cce034b2e6021c79dadad4e1b38df354a577a5f59ce264736f6c63430008130033000000000000000000000000ccccb68e1a848cbdb5b60a974e07aae143ed40c3000000000000000000000000c91ef786fbf6d62858262c82c63de45085dea6590000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000278d0000000000000000000000000000000000000000000000000000000000004f1a00000000000000000000000000000000000000000000000000000000000076a7000000000000000000000000000000000000000000000000000000000000ed4e000000000000000000000000000000000000000000000000000000000001da9c000000000000000000000000000000000000000000000000000000000003b5380000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000018

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101985760003560e01c8063842e2981116100e3578063cfa8586d1161008c578063ef304a5211610066578063ef304a521461048a578063f2fde38b1461049d578063fc196d08146104b057600080fd5b8063cfa8586d14610419578063d1af0c7d1461044e578063dc6c3da01461047557600080fd5b8063a354f39e116100bd578063a354f39e146103a1578063aa68507b146103b4578063b5d5b5fa146103bc57600080fd5b8063842e29811461032d5780638da5cb5b1461034d57806398dc8dea1461036b57600080fd5b80634dd83c02116101455780635fdaefa51161011f5780635fdaefa5146102b9578063715018a6146102d957806372f702f3146102e157600080fd5b80634dd83c021461027157806357de00fb146102865780635f659bf1146102a657600080fd5b806326ae2b781161017657806326ae2b78146101f2578063325ee43d1461022b5780633a1cf6fa1461024c57600080fd5b806310087fb11461019d578063151e75ea146101b25780631cd5722b146101df575b600080fd5b6101b06101ab366004612244565b610535565b005b6101c56101c036600461227a565b610821565b60405163ffffffff90911681526020015b60405180910390f35b6101b06101ed3660046122aa565b61085b565b60015461020e9063ffffffff8082169164010000000090041682565b6040805163ffffffff9384168152929091166020830152016101d6565b61023e6102393660046122e9565b6109db565b6040519081526020016101d6565b61025f61025a36600461227a565b610c64565b60405160ff90911681526020016101d6565b610279610c98565b6040516101d6919061231c565b6102996102943660046122e9565b610d1c565b6040516101d69190612366565b6101b06102b43660046122aa565b610e3e565b6102cc6102c73660046123c4565b610ec0565b6040516101d6919061244a565b6101b0610f77565b6103087f000000000000000000000000c91ef786fbf6d62858262c82c63de45085dea65981565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d6565b61034061033b366004612482565b610f8b565b6040516101d6919061249d565b60005473ffffffffffffffffffffffffffffffffffffffff16610308565b61023e610379366004612482565b73ffffffffffffffffffffffffffffffffffffffff1660009081526006602052604090205490565b6101b06103af366004612543565b6110a2565b61025f61137b565b6103cf6103ca36600461259b565b61138f565b604080519687526bffffffffffffffffffffffff909516602087015263ffffffff9093169385019390935260ff1660608401529015156080830152151560a082015260c0016101d6565b60005461043e9074010000000000000000000000000000000000000000900460ff1681565b60405190151581526020016101d6565b6103087f000000000000000000000000ccccb68e1a848cbdb5b60a974e07aae143ed40c381565b61047d61143a565b6040516101d691906125c5565b61023e610498366004612244565b6114af565b6101b06104ab366004612482565b61156a565b6002546003546104fc91906bffffffffffffffffffffffff8082169163ffffffff6c01000000000000000000000000820416917001000000000000000000000000000000009091041684565b604080519485526bffffffffffffffffffffffff938416602086015263ffffffff909216918401919091521660608201526080016101d6565b8160000361056f576040517fbbb9b84400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061057b8383611626565b905061058881600161166d565b6105ca73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c91ef786fbf6d62858262c82c63de45085dea6591633308661183e565b33600090815260066020908152604091829020825160c0810184528681526003546bffffffffffffffffffffffff169281019290925291810161060c42611920565b63ffffffff908116825260ff808716602080850191909152600060408086018290526060958601829052875460018181018a55988352838320885160029092020190815587840151908901805489840151988a015160808b015160a0909b015115157201000000000000000000000000000000000000027fffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffff9b151571010000000000000000000000000000000000027fffffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffff9290991670010000000000000000000000000000000002919091167fffffffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffff9a9099166c01000000000000000000000000027fffffffffffffffffffffffffffffffff000000000000000000000000000000009092166bffffffffffffffffffffffff9094169390931717979097169590951793909317959095169290921790925533808452600690915291205490917fde7444c7f0307aa4864dcb5647d866ae70d4300bf5a73a1da71f811a6dc25b2b916107bd916107b89161262f565b6119ba565b8560048660ff16815481106107d4576107d4612642565b60009182526020918290206008820401546040805161ffff969096168652928501939093526007166004026101000a90910463ffffffff16908201526060015b60405180910390a2505050565b6004818154811061083157600080fd5b9060005260206000209060089182820401919006600402915054906101000a900463ffffffff1681565b336000908152600660205260408120805461ffff841690811061088057610880612642565b9060005260206000209060020201905060048160010160109054906101000a900460ff1660ff16815481106108b7576108b7612642565b6000918252602090912060088204015460018301546108fc926007166004026101000a90910463ffffffff908116916c01000000000000000000000000900416612671565b63ffffffff1642101561093b576040517f83a44d2000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061094733846109db565b905061098a73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ccccb68e1a848cbdb5b60a974e07aae143ed40c3163383611a4e565b610995836001611aa9565b81546040805161ffff861681526020810192909252810182905233907f8b4f4a6c857b3e6333d6be98111fa0aa5d3ff8077d1e886c42f68d4dcb4fe42190606001610814565b6040805160808101825260025481526003546bffffffffffffffffffffffff80821660208085019190915263ffffffff6c010000000000000000000000008404168486015270010000000000000000000000000000000090920416606083015273ffffffffffffffffffffffffffffffffffffffff851660009081526006909152918220805483919061ffff8616908110610a7857610a78612642565b906000526020600020906002020190508060010160119054906101000a900460ff1680610abf575060018101547201000000000000000000000000000000000000900460ff165b15610acf57600092505050610c5e565b6000610af3610add42611920565b600154640100000000900463ffffffff16611cc9565b90506000836040015182610b079190612695565b63ffffffff1690508015610b8057835115610b805783516060850151610b6c9190610b40906bffffffffffffffffffffffff16846126b2565b610b4a91906126c9565b85602001516bffffffffffffffffffffffff16610b679190612704565b611ceb565b6bffffffffffffffffffffffff1660208501525b60018301546020850151610ba2916bffffffffffffffffffffffff1690612717565b6040805160c0810182528554815260018601546bffffffffffffffffffffffff818116602084015263ffffffff6c010000000000000000000000008304169383019390935260ff700100000000000000000000000000000000820481166060840152710100000000000000000000000000000000008204811615156080840152720100000000000000000000000000000000000090910416151560a0820152911690610c4d90611d89565b610c5791906126b2565b9450505050505b92915050565b60058181548110610c7457600080fd5b9060005260206000209060209182820401919006915054906101000a900460ff1681565b60606004805480602002602001604051908101604052809291908181526020018280548015610d1257602002820191906000526020600020906000905b82829054906101000a900463ffffffff1663ffffffff1681526020019060040190602082600301049283019260010382029150808411610cd55790505b5050505050905090565b6040805160c08101825260008082526020808301829052828401829052606083018290526080830182905260a0830182905273ffffffffffffffffffffffffffffffffffffffff861682526006905291909120805461ffff8416908110610d8557610d85612642565b60009182526020918290206040805160c081018252600290930290910180548352600101546bffffffffffffffffffffffff81169383019390935263ffffffff6c010000000000000000000000008404169082015260ff7001000000000000000000000000000000008304811660608301527101000000000000000000000000000000000083048116151560808301527201000000000000000000000000000000000000909204909116151560a0820152905092915050565b610e49816000611aa9565b33600081815260066020526040902080547f17218b7f7d9847c4cc1c13147aaeaaa6ff8e56292aa2b37963afab6141afda7391849161ffff8316908110610e9257610e92612642565b6000918252602091829020600290910201546040805161ffff9094168452918301520160405180910390a250565b606060008267ffffffffffffffff811115610edd57610edd61273c565b604051908082528060200260200182016040528015610f06578160200160208202803683370190505b50905060005b83811015610f6e57610f3f86868684818110610f2a57610f2a612642565b905060200201602081019061023991906122aa565b828281518110610f5157610f51612642565b602090810291909101015280610f668161276b565b915050610f0c565b50949350505050565b610f7f611d9d565b610f896000611e1e565b565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600660209081526040808320805482518185028101850190935280835260609492939192909184015b828210156110975760008481526020908190206040805160c08101825260028602909201805483526001908101546bffffffffffffffffffffffff81168486015263ffffffff6c010000000000000000000000008204169284019290925260ff7001000000000000000000000000000000008304811660608501527101000000000000000000000000000000000083048116151560808501527201000000000000000000000000000000000000909204909116151560a08301529083529092019101610fd0565b505050509050919050565b6110aa611d9d565b60005474010000000000000000000000000000000000000000900460ff16156110ff576040517f566e79f700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460000361113b576040517ff7e64e6d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8263ffffffff16421180611160575063ffffffff831661115e4262278d00612704565b105b15611197576040517f38356e4c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8163ffffffff168363ffffffff16106111dc576040517fe5b55bb900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b670de0b6b3a7640000816bffffffffffffffffffffffff16101561122c576040517f22be228400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001805463ffffffff8581167fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000909216821764010000000091861691820217909255600380547fffffffff00000000000000000000000000000000ffffffffffffffffffffffff166c0100000000000000000000000083027fffffffff000000000000000000000000ffffffffffffffffffffffffffffffff16177001000000000000000000000000000000006bffffffffffffffffffffffff86169081029190911790915560008054740100000000000000000000000000000000000000007fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909116179055604080519283526020830193909352918101919091527f95efd8a2a0aa591f48fd9673cf5d13c2150ca7a1fe1cbe438dd3f0ae470646639060600160405180910390a1505050565b60045460009061138a90611e93565b905090565b600660205281600052604060002081815481106113ab57600080fd5b6000918252602090912060029091020180546001909101549092506bffffffffffffffffffffffff8116915063ffffffff6c010000000000000000000000008204169060ff700100000000000000000000000000000000820481169171010000000000000000000000000000000000810482169172010000000000000000000000000000000000009091041686565b60606005805480602002602001604051908101604052809291908181526020018280548015610d1257602002820191906000526020600020906000905b825461010083900a900460ff168152602060019283018181049485019490930390920291018084116114775790505050505050905090565b60008060048360ff16815481106114c8576114c8612642565b60009182526020822060088204015460079091166004026101000a900463ffffffff1691506114f78585611626565b600254909150611508908290612704565b600354829061153f9070010000000000000000000000000000000090046bffffffffffffffffffffffff1663ffffffff86166127a3565b6bffffffffffffffffffffffff1661155791906126b2565b61156191906126c9565b95945050505050565b611572611d9d565b73ffffffffffffffffffffffffffffffffffffffff811661161a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61162381611e1e565b50565b600060058260ff168154811061163e5761163e612642565b60009182526020918290209181049091015461166691601f166101000a900460ff16846126b2565b9392505050565b60015463ffffffff1661167f42611920565b63ffffffff16106117b4576000611698610add42611920565b6003549091506000906116c1906c01000000000000000000000000900463ffffffff1683612695565b63ffffffff16905080156117b1576002541561177157600254600354611733919061170e9070010000000000000000000000000000000090046bffffffffffffffffffffffff16846126b2565b61171891906126c9565b600354610b6791906bffffffffffffffffffffffff16612704565b600380547fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166bffffffffffffffffffffffff929092169190911790555b600380547fffffffffffffffffffffffffffffffff00000000ffffffffffffffffffffffff166c0100000000000000000000000063ffffffff8516021790555b50505b80156117da5781600260000160008282546117cf9190612704565b909155506117f59050565b81600260000160008282546117ef919061262f565b90915550505b6003546040516bffffffffffffffffffffffff90911681527faac1802288db8019f8ec43430efc11a152c72473c57d6ddcde3b6dd0c89260679060200160405180910390a15050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261191a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611f26565b50505050565b600063ffffffff8211156119b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f32206269747300000000000000000000000000000000000000000000000000006064820152608401611611565b5090565b600061ffff8211156119b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f36206269747300000000000000000000000000000000000000000000000000006064820152608401611611565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611aa49084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611898565b505050565b336000908152600660205260408120805461ffff8516908110611ace57611ace612642565b906000526020600020906002020190508060010160119054906101000a900460ff1680611b15575060018101547201000000000000000000000000000000000000900460ff165b15611b4c576040517fd831531200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805160c0810182528254815260018301546bffffffffffffffffffffffff8116602083015263ffffffff6c010000000000000000000000008204169282019290925260ff7001000000000000000000000000000000008304811660608301527101000000000000000000000000000000000083048116151560808301527201000000000000000000000000000000000000909204909116151560a0820152611c0090611bf990611d89565b600061166d565b6001810180547fffffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffffff167101000000000000000000000000000000000084158015919091027fffffffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffff16919091177201000000000000000000000000000000000000919091021790558054611aa4907f000000000000000000000000c91ef786fbf6d62858262c82c63de45085dea65973ffffffffffffffffffffffffffffffffffffffff16903390611a4e565b60008163ffffffff168363ffffffff1610611ce45781611666565b5090919050565b60006bffffffffffffffffffffffff8211156119b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203960448201527f36206269747300000000000000000000000000000000000000000000000000006064820152608401611611565b6000610c5e82600001518360600151611626565b60005473ffffffffffffffffffffffffffffffffffffffff163314610f89576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611611565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060ff8211156119b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203860448201527f20626974730000000000000000000000000000000000000000000000000000006064820152608401611611565b6000611f88826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166120359092919063ffffffff16565b9050805160001480611fa9575080806020019051810190611fa991906127d3565b611aa4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401611611565b6060612044848460008561204c565b949350505050565b6060824710156120de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401611611565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516121079190612819565b60006040518083038185875af1925050503d8060008114612144576040519150601f19603f3d011682016040523d82523d6000602084013e612149565b606091505b509150915061215a87838387612165565b979650505050505050565b606083156121fb5782516000036121f45773ffffffffffffffffffffffffffffffffffffffff85163b6121f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611611565b5081612044565b61204483838151156122105781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116119190612835565b6000806040838503121561225757600080fd5b82359150602083013560ff8116811461226f57600080fd5b809150509250929050565b60006020828403121561228c57600080fd5b5035919050565b803561ffff811681146122a557600080fd5b919050565b6000602082840312156122bc57600080fd5b61166682612293565b803573ffffffffffffffffffffffffffffffffffffffff811681146122a557600080fd5b600080604083850312156122fc57600080fd5b612305836122c5565b915061231360208401612293565b90509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561235a57835163ffffffff1683529284019291840191600101612338565b50909695505050505050565b60c08101610c5e8284805182526bffffffffffffffffffffffff602082015116602083015263ffffffff604082015116604083015260ff606082015116606083015260808101511515608083015260a0810151151560a08301525050565b6000806000604084860312156123d957600080fd5b6123e2846122c5565b9250602084013567ffffffffffffffff808211156123ff57600080fd5b818601915086601f83011261241357600080fd5b81358181111561242257600080fd5b8760208260051b850101111561243757600080fd5b6020830194508093505050509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561235a57835183529284019291840191600101612466565b60006020828403121561249457600080fd5b611666826122c5565b6020808252825182820181905260009190848201906040850190845b8181101561235a5761251c838551805182526bffffffffffffffffffffffff602082015116602083015263ffffffff604082015116604083015260ff606082015116606083015260808101511515608083015260a0810151151560a08301525050565b9284019260c092909201916001016124b9565b803563ffffffff811681146122a557600080fd5b60008060006060848603121561255857600080fd5b6125618461252f565b925061256f6020850161252f565b915060408401356bffffffffffffffffffffffff8116811461259057600080fd5b809150509250925092565b600080604083850312156125ae57600080fd5b6125b7836122c5565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b8181101561235a57835160ff16835292840192918401916001016125e1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115610c5e57610c5e612600565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b63ffffffff81811683821601908082111561268e5761268e612600565b5092915050565b63ffffffff82811682821603908082111561268e5761268e612600565b8082028115828204841417610c5e57610c5e612600565b6000826126ff577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b80820180821115610c5e57610c5e612600565b6bffffffffffffffffffffffff82811682821603908082111561268e5761268e612600565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361279c5761279c612600565b5060010190565b6bffffffffffffffffffffffff8181168382160280821691908281146127cb576127cb612600565b505092915050565b6000602082840312156127e557600080fd5b8151801515811461166657600080fd5b60005b838110156128105781810151838201526020016127f8565b50506000910152565b6000825161282b8184602087016127f5565b9190910192915050565b60208152600082518060208401526128548160408501602087016127f5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220c31e302ca59f248efb99cce034b2e6021c79dadad4e1b38df354a577a5f59ce264736f6c63430008130033

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

000000000000000000000000ccccb68e1a848cbdb5b60a974e07aae143ed40c3000000000000000000000000c91ef786fbf6d62858262c82c63de45085dea6590000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000278d0000000000000000000000000000000000000000000000000000000000004f1a00000000000000000000000000000000000000000000000000000000000076a7000000000000000000000000000000000000000000000000000000000000ed4e000000000000000000000000000000000000000000000000000000000001da9c000000000000000000000000000000000000000000000000000000000003b5380000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000018

-----Decoded View---------------
Arg [0] : _rewardsToken (address): 0xcccCb68e1A848CBDB5b60a974E07aAE143ed40C3
Arg [1] : _stakingToken (address): 0xc91Ef786Fbf6d62858262C82c63dE45085dEa659
Arg [2] : _lockupIntervals (uint32[]): 2592000,5184000,7776000,15552000,31104000,62208000
Arg [3] : _lockupIntervalMultipliers (uint8[]): 1,2,3,6,12,24

-----Encoded View---------------
18 Constructor Arguments found :
Arg [0] : 000000000000000000000000ccccb68e1a848cbdb5b60a974e07aae143ed40c3
Arg [1] : 000000000000000000000000c91ef786fbf6d62858262c82c63de45085dea659
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [5] : 0000000000000000000000000000000000000000000000000000000000278d00
Arg [6] : 00000000000000000000000000000000000000000000000000000000004f1a00
Arg [7] : 000000000000000000000000000000000000000000000000000000000076a700
Arg [8] : 0000000000000000000000000000000000000000000000000000000000ed4e00
Arg [9] : 0000000000000000000000000000000000000000000000000000000001da9c00
Arg [10] : 0000000000000000000000000000000000000000000000000000000003b53800
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [16] : 000000000000000000000000000000000000000000000000000000000000000c
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000018


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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