ETH Price: $3,121.54 (+0.80%)

Contract

0x5301CbBeDc048AbaC7e213184132cf982d593563
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Claim Rewards206193772024-08-27 10:39:1180 days ago1724755151IN
0x5301CbBe...82d593563
0 ETH0.000104521.54142574
Claim Rewards198946012024-05-18 4:58:11182 days ago1716008291IN
0x5301CbBe...82d593563
0 ETH0.000294462.88621346
Claim Rewards197507232024-04-28 2:05:59202 days ago1714269959IN
0x5301CbBe...82d593563
0 ETH0.000529375.18882361
Claim Rewards196995852024-04-20 22:23:59209 days ago1713651839IN
0x5301CbBe...82d593563
0 ETH0.000681756.68240007
Claim Rewards196405982024-04-12 16:03:35217 days ago1712937815IN
0x5301CbBe...82d593563
0 ETH0.0016791324.75758986
Claim Rewards196369392024-04-12 3:47:11218 days ago1712893631IN
0x5301CbBe...82d593563
0 ETH0.0008564312.63197983
Claim Rewards195511342024-03-31 3:13:35230 days ago1711854815IN
0x5301CbBe...82d593563
0 ETH0.0019239118.85768627
Claim Rewards195464052024-03-30 11:14:47230 days ago1711797287IN
0x5301CbBe...82d593563
0 ETH0.0013578420.02046344
Claim Rewards195379862024-03-29 6:50:23232 days ago1711695023IN
0x5301CbBe...82d593563
0 ETH0.0024091223.61353751
Claim Rewards195250612024-03-27 10:26:11233 days ago1711535171IN
0x5301CbBe...82d593563
0 ETH0.0020773324.46138351
Claim Rewards195249932024-03-27 10:12:35233 days ago1711534355IN
0x5301CbBe...82d593563
0 ETH0.0019115822.51277445
Withdraw195115942024-03-25 12:48:23235 days ago1711370903IN
0x5301CbBe...82d593563
0 ETH0.00046519.16347526
Withdraw195115922024-03-25 12:47:59235 days ago1711370879IN
0x5301CbBe...82d593563
0 ETH0.000442218.22411913
Withdraw195115892024-03-25 12:47:23235 days ago1711370843IN
0x5301CbBe...82d593563
0 ETH0.0016566220.22890055
Withdraw195115842024-03-25 12:46:23235 days ago1711370783IN
0x5301CbBe...82d593563
0 ETH0.0019248218.80321572
Claim Rewards194617052024-03-18 12:32:59242 days ago1710765179IN
0x5301CbBe...82d593563
0 ETH0.0034075850.24226198
Claim Rewards194536322024-03-17 9:19:23244 days ago1710667163IN
0x5301CbBe...82d593563
0 ETH0.0021774325.64009011
Claim Rewards194484922024-03-16 15:58:47244 days ago1710604727IN
0x5301CbBe...82d593563
0 ETH0.0028874534.00085091
Claim Rewards194420962024-03-15 18:21:23245 days ago1710526883IN
0x5301CbBe...82d593563
0 ETH0.0024723636.45322727
Claim Rewards194388402024-03-15 7:24:59246 days ago1710487499IN
0x5301CbBe...82d593563
0 ETH0.0029060734.22011002
Claim Rewards194243542024-03-13 6:26:35248 days ago1710311195IN
0x5301CbBe...82d593563
0 ETH0.0028362541.8185126
Claim Rewards194027112024-03-10 5:49:23251 days ago1710049763IN
0x5301CbBe...82d593563
0 ETH0.0039410746.40758502
Claim Rewards193954362024-03-09 5:24:47252 days ago1709961887IN
0x5301CbBe...82d593563
0 ETH0.0049180448.20526
Claim Rewards193825122024-03-07 9:51:11253 days ago1709805071IN
0x5301CbBe...82d593563
0 ETH0.0048109956.6512731
Claim Rewards193453272024-03-02 5:14:11259 days ago1709356451IN
0x5301CbBe...82d593563
0 ETH0.0037430144.07541084
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:
Staking

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 13 : Staking.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

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

contract Staking is BasePool {
    using Math for uint256;
    using SafeCast for uint256;
    using SafeCast for int256;
    using SafeERC20 for IERC20;

    event Deposited(
        address indexed staker,
        uint256 indexed amount,
        uint256 indexed duration,
        uint256 start
    );

    event Withdrawn(
        uint256 indexed depositId,
        address indexed receiver,
        address indexed from,
        uint256 amount
    );

    uint256 public MAX_REWARD;
    uint256 public MAX_LOCK_DURATION = 360 days;
    uint256 public MIN_LOCK_DURATION = 90 days;

    uint256 public rewardReleased;
    uint256 public rewardPerSecond;
    uint256 public lastRewardTime;
    uint256 public totalStaked;

    struct Deposit {
        uint256 amount;
        uint64 start;
        uint64 end;
    }

    mapping(address => Deposit[]) public depositsOf;
    mapping(address => uint256) public totalDepositOf;
    mapping(address => uint256) public claimableTime;

    uint256 public start;
    uint256 public end;

    modifier allowed2Stake(uint256 duration) {
        require(
            block.timestamp >= start,
            "Staking.allowed2Stake: staking has not started"
        );
        require(
            block.timestamp <= end,
            "Staking.allowed2Stake: staking has finished"
        );
        require(
            end - block.timestamp >= duration,
            "Staking.allowed2Stake: staking duration is too long"
        );
        _;
    }

    constructor(
        string memory _name,
        string memory _symbol,
        address _stakingToken,
        uint256 _maxReward,
        uint256 _start
    ) BasePool(_name, _symbol, _stakingToken) {
        MAX_REWARD = _maxReward;
        rewardPerSecond = _maxReward / (365 days);

        start = Math.max(_start, block.timestamp);
        end = start + 365 days;

        lastRewardTime = start;
    }

    function stakeWith90Days(uint256 amount) external allowed2Stake(90 days) {
        _stakeWithDuration(msg.sender, amount, 90 days);
    }

    function stakeWith180Days(uint256 amount) external allowed2Stake(180 days) {
        _stakeWithDuration(msg.sender, amount, 180 days);
    }

    function stakeWith270Days(uint256 amount) external allowed2Stake(270 days) {
        _stakeWithDuration(msg.sender, amount, 270 days);
    }

    function stakeWith360Days(uint256 amount) external allowed2Stake(360 days) {
        _stakeWithDuration(msg.sender, amount, 360 days);
    }

    function distributeRewards() public {
        if (rewardReleased >= MAX_REWARD || lastRewardTime >= end) {
            return;
        }

        if (block.timestamp <= lastRewardTime) {
            return;
        }

        if (totalSupply() == 0) {
            lastRewardTime = block.timestamp;
            return;
        }
        uint256 latestTime = end.min(block.timestamp);
        uint256 reward = rewardPerSecond * (latestTime - lastRewardTime);
        rewardReleased += reward;
        _distributeRewards(reward);

        // update lastRewardTime
        lastRewardTime = latestTime;
    }

    function withdraw(uint256 depositId, address receiver) external {
        require(
            depositId < depositsOf[receiver].length,
            "Staking.withdraw: depositId is not existed"
        );
        Deposit memory userDeposit = depositsOf[receiver][depositId];
        require(
            block.timestamp >= userDeposit.end,
            "Staking.withdraw: staking has not released"
        );

        distributeRewards();

        // remove Deposit
        totalDepositOf[receiver] -= userDeposit.amount;
        depositsOf[receiver][depositId] = depositsOf[receiver][
            depositsOf[receiver].length - 1
        ];
        depositsOf[receiver].pop();

        // update the total staked tokens
        totalStaked -= userDeposit.amount;

        // burn shares
        uint256 sharesAmount = _getSharesAmount(
            userDeposit.amount,
            uint256(userDeposit.end - userDeposit.start)
        );
        _burn(receiver, sharesAmount);

        // return tokens
        IERC20(stakingToken).safeTransfer(receiver, userDeposit.amount);

        emit Withdrawn(depositId, receiver, msg.sender, userDeposit.amount);
    }

    function claimRewards(address _receiver) external virtual {
        require(
            block.timestamp >= claimableTime[_receiver],
            "Staking.claimRewards: rewards are not released"
        );

        distributeRewards();

        uint256 rewardAmount = _prepareCollect(_receiver);

        if (rewardAmount > 0) {
            IERC20(stakingToken).safeTransfer(_receiver, rewardAmount);
        }

        emit RewardsClaimed(msg.sender, _receiver, rewardAmount);
    }

    function getDepositsOf(
        address account,
        uint256 offset,
        uint256 limit
    ) external view returns (Deposit[] memory _depositsOf) {
        uint256 depositsOfLength = depositsOf[account].length;
        uint256 dl = (depositsOfLength - offset).min(limit);
        _depositsOf = new Deposit[](dl);

        if (offset >= depositsOfLength) return _depositsOf;

        for (uint256 i = offset; i < dl; i++) {
            _depositsOf[i - offset] = depositsOf[account][i];
        }
    }

    function getDepositsOfLength(address account)
        external
        view
        returns (uint256)
    {
        return depositsOf[account].length;
    }

    function pendingRewards(address account) external view returns (uint256) {
        uint256 shares = totalSupply();
        if (shares == 0) {
            return withdrawableRewardsOf(account);
        }

        uint256 reward = rewardPerSecond *
            (end.min(block.timestamp) - lastRewardTime);
        uint256 pointsPerShare_ = pointsPerShare +
            ((reward * POINTS_MULTIPLIER) / shares);

        uint256 cumulativeRewards = ((pointsPerShare_ * balanceOf(account))
            .toInt256() + pointsCorrection[account]).toUint256() /
            POINTS_MULTIPLIER;

        return cumulativeRewards - withdrawnRewards[account];
    }

    function getInfo()
        external
        view
        returns (
            uint256 startTime,
            uint256 endTime,
            uint256 totalStaked_,
            uint256 rewardReleased_,
            uint256 apr
        )
    {
        startTime = start;
        endTime = end;
        totalStaked_ = totalStaked;
        rewardReleased_ = rewardReleased;

        if (totalStaked == 0) {
            apr = 0;
        } else {
            apr = (MAX_REWARD * 100) / totalStaked;
        }
    }

    function _getSharesAmount(uint256 amount, uint256 duration)
        internal
        view
        returns (uint256)
    {
        return (duration / MIN_LOCK_DURATION) * amount;
    }

    function _stakeWithDuration(
        address staker,
        uint256 amount,
        uint256 duration
    ) internal {
        require(amount > 0, "Staking._stakeWithDuration: amount is zero");
        require(
            duration >= MIN_LOCK_DURATION && duration <= MAX_LOCK_DURATION,
            "Staking._stakeWithDuration: duration is invalid"
        );

        // first claim time for rewards
        if (claimableTime[staker] == 0) {
            claimableTime[staker] = block.timestamp + (90 days);
        }

        distributeRewards();

        // transfer tokens
        IERC20(stakingToken).safeTransferFrom(staker, address(this), amount);

        // record deposit
        depositsOf[staker].push(
            Deposit({
                amount: amount,
                start: uint64(block.timestamp),
                end: uint64(block.timestamp) + uint64(duration)
            })
        );
        totalDepositOf[staker] += amount;

        // update the total staked tokens
        totalStaked += amount;

        // mint shares
        uint256 sharesAmount = _getSharesAmount(amount, duration);
        _mint(staker, sharesAmount);

        emit Deposited(staker, amount, duration, block.timestamp);
    }

    /// @notice Disable share transfers
    function _transfer(
        address, /* _from */
        address, /* _to */
        uint256 /* _amount */
    ) internal pure override {
        revert("non-transferable");
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 3 of 13 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a / b + (a % b == 0 ? 0 : 1);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

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

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

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

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

File 5 of 13 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol)

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 uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

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

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

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

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

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        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.
     */
    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.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 7 of 13 : BasePool.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

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

import "./AbstractRewards.sol";

abstract contract BasePool is ERC20, AbstractRewards {
    using SafeERC20 for IERC20;
    using SafeCast for uint256;
    using SafeCast for int256;

    address public stakingToken;

    event RewardsClaimed(
        address indexed _from,
        address indexed _receiver,
        uint256 indexed rewardAmount
    );

    constructor(
        string memory _name,
        string memory _symbol,
        address _stakingToken
    ) ERC20(_name, _symbol) AbstractRewards(balanceOf, totalSupply) {
        require(
            _stakingToken != address(0),
            "BasePool.constructor: staking token is not set"
        );

        stakingToken = _stakingToken;
    }

    function _mint(address _account, uint256 _amount)
        internal
        virtual
        override
    {
        super._mint(_account, _amount);
        _correctPoints(_account, -(_amount.toInt256()));
    }

    function _burn(address _account, uint256 _amount)
        internal
        virtual
        override
    {
        super._burn(_account, _amount);
        _correctPoints(_account, _amount.toInt256());
    }

    function _transfer(
        address _from,
        address _to,
        uint256 _value
    ) internal virtual override {
        super._transfer(_from, _to, _value);
        _correctPointsForTransfer(_from, _to, _value);
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 9 of 13 : 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 10 of 13 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

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

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 11 of 13 : AbstractRewards.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

import "./IAbstractRewards.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";

/**
 * @dev Based on: https://github.com/indexed-finance/dividends/blob/master/contracts/base/AbstractDividends.sol
 * Renamed dividends to rewards.
 * @dev (OLD) Many functions in this contract were taken from this repository:
 * https://github.com/atpar/funds-distribution-token/blob/master/contracts/FundsDistributionToken.sol
 * which is an example implementation of ERC 2222, the draft for which can be found at
 * https://github.com/atpar/funds-distribution-token/blob/master/EIP-DRAFT.md
 *
 * This contract has been substantially modified from the original and does not comply with ERC 2222.
 * Many functions were renamed as "rewards" rather than "funds" and the core functionality was separated
 * into this abstract contract which can be inherited by anything tracking ownership of reward shares.
 */
abstract contract AbstractRewards is IAbstractRewards {
    using SafeCast for uint128;
    using SafeCast for uint256;
    using SafeCast for int256;

    /* ========  Constants  ======== */
    uint128 public constant POINTS_MULTIPLIER = type(uint128).max;

    /* ========  Internal Function References  ======== */
    function(address) view returns (uint256) private immutable getSharesOf;
    function() view returns (uint256) private immutable getTotalShares;

    /* ========  Storage  ======== */
    uint256 public pointsPerShare;
    mapping(address => int256) public pointsCorrection;
    mapping(address => uint256) public withdrawnRewards;

    constructor(
        function(address) view returns (uint256) getSharesOf_,
        function() view returns (uint256) getTotalShares_
    ) {
        getSharesOf = getSharesOf_;
        getTotalShares = getTotalShares_;
    }

    /* ========  Public View Functions  ======== */
    /**
     * @dev Returns the total amount of rewards a given address is able to withdraw.
     * @param account Address of a reward recipient
     * @return A uint256 representing the rewards `account` can withdraw
     */
    function withdrawableRewardsOf(address account)
        public
        view
        override
        returns (uint256)
    {
        return cumulativeRewardsOf(account) - withdrawnRewards[account];
    }

    /**
     * @notice View the amount of rewards that an address has withdrawn.
     * @param account The address of a token holder.
     * @return The amount of rewards that `account` has withdrawn.
     */
    function withdrawnRewardsOf(address account)
        public
        view
        override
        returns (uint256)
    {
        return withdrawnRewards[account];
    }

    /**
     * @notice View the amount of rewards that an address has earned in total.
     * @dev accumulativeFundsOf(account) = withdrawableRewardsOf(account) + withdrawnRewardsOf(account)
     * = (pointsPerShare * balanceOf(account) + pointsCorrection[account]) / POINTS_MULTIPLIER
     * @param account The address of a token holder.
     * @return The amount of rewards that `account` has earned in total.
     */
    function cumulativeRewardsOf(address account)
        public
        view
        override
        returns (uint256)
    {
        return
            ((pointsPerShare * getSharesOf(account)).toInt256() +
                pointsCorrection[account]).toUint256() / POINTS_MULTIPLIER;
    }

    /* ========  Dividend Utility Functions  ======== */

    /**
     * @notice Distributes rewards to token holders.
     * @dev It reverts if the total shares is 0.
     * It emits the `RewardsDistributed` event if the amount to distribute is greater than 0.
     * About undistributed rewards:
     *   In each distribution, there is a small amount which does not get distributed,
     *   which is `(amount * POINTS_MULTIPLIER) % totalShares()`.
     *   With a well-chosen `POINTS_MULTIPLIER`, the amount of funds that are not getting
     *   distributed in a distribution can be less than 1 (base unit).
     */
    function _distributeRewards(uint256 amount) internal {
        uint256 shares = getTotalShares();
        require(
            shares > 0,
            "AbstractRewards._distributeRewards: total share supply is zero"
        );

        if (amount > 0) {
            pointsPerShare =
                pointsPerShare +
                ((amount * POINTS_MULTIPLIER) / shares);
            emit RewardsDistributed(msg.sender, amount);
        }
    }

    /**
     * @notice Prepares collection of owed rewards
     * @dev It emits a `RewardsWithdrawn` event if the amount of withdrawn rewards is
     * greater than 0.
     */
    function _prepareCollect(address account) internal returns (uint256) {
        uint256 _withdrawableDividend = withdrawableRewardsOf(account);
        if (_withdrawableDividend > 0) {
            withdrawnRewards[account] =
                withdrawnRewards[account] +
                _withdrawableDividend;
            emit RewardsWithdrawn(account, _withdrawableDividend);
        }
        return _withdrawableDividend;
    }

    function _correctPointsForTransfer(
        address from,
        address to,
        uint256 shares
    ) internal {
        int256 _magCorrection = (pointsPerShare * shares).toInt256();
        pointsCorrection[from] = pointsCorrection[from] + _magCorrection;
        pointsCorrection[to] = pointsCorrection[to] - _magCorrection;
    }

    /**
     * @dev Increases or decreases the points correction for `account` by
     * `shares*pointsPerShare`.
     */
    function _correctPoints(address account, int256 shares) internal {
        pointsCorrection[account] =
            pointsCorrection[account] +
            (shares * (int256(pointsPerShare)));
    }
}

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

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

File 13 of 13 : IAbstractRewards.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

interface IAbstractRewards {
    /**
     * @dev Returns the total amount of rewards a given address is able to withdraw.
     * @param account Address of a reward recipient
     * @return A uint256 representing the rewards `account` can withdraw
     */
    function withdrawableRewardsOf(address account)
        external
        view
        returns (uint256);

    /**
     * @dev View the amount of funds that an address has withdrawn.
     * @param account The address of a token holder.
     * @return The amount of funds that `account` has withdrawn.
     */
    function withdrawnRewardsOf(address account)
        external
        view
        returns (uint256);

    /**
     * @dev View the amount of funds that an address has earned in total.
     * accumulativeFundsOf(account) = withdrawableRewardsOf(account) + withdrawnRewardsOf(account)
     * = (pointsPerShare * balanceOf(account) + pointsCorrection[account]) / POINTS_MULTIPLIER
     * @param account The address of a token holder.
     * @return The amount of funds that `account` has earned in total.
     */
    function cumulativeRewardsOf(address account)
        external
        view
        returns (uint256);

    /**
     * @dev This event emits when new funds are distributed
     * @param by the address of the sender who distributed funds
     * @param rewardsDistributed the amount of funds received for distribution
     */
    event RewardsDistributed(address indexed by, uint256 rewardsDistributed);

    /**
     * @dev This event emits when distributed funds are withdrawn by a token holder.
     * @param by the address of the receiver of funds
     * @param fundsWithdrawn the amount of funds that were withdrawn
     */
    event RewardsWithdrawn(address indexed by, uint256 fundsWithdrawn);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_stakingToken","type":"address"},{"internalType":"uint256","name":"_maxReward","type":"uint256"},{"internalType":"uint256","name":"_start","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"duration","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_receiver","type":"address"},{"indexed":true,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"RewardsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardsDistributed","type":"uint256"}],"name":"RewardsDistributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"uint256","name":"fundsWithdrawn","type":"uint256"}],"name":"RewardsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"depositId","type":"uint256"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"MAX_LOCK_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_REWARD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_LOCK_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POINTS_MULTIPLIER","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimableTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"cumulativeRewardsOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"depositsOf","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"start","type":"uint64"},{"internalType":"uint64","name":"end","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributeRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"end","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"getDepositsOf","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"start","type":"uint64"},{"internalType":"uint64","name":"end","type":"uint64"}],"internalType":"struct Staking.Deposit[]","name":"_depositsOf","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getDepositsOfLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInfo","outputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"totalStaked_","type":"uint256"},{"internalType":"uint256","name":"rewardReleased_","type":"uint256"},{"internalType":"uint256","name":"apr","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastRewardTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"pendingRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pointsCorrection","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pointsPerShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeWith180Days","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeWith270Days","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeWith360Days","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeWith90Days","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"start","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalDepositOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"depositId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"withdrawableRewardsOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"withdrawnRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"withdrawnRewardsOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60c06040526301da9c00600a556276a700600b553480156200002057600080fd5b506040516200297c3803806200297c833981016040819052620000439162000342565b8484846200019360201b62000faa17620001ae60201b62000aa4178484816003908051906020019062000078929190620001cf565b5080516200008e906004906020840190620001cf565b5050506001600160401b039182166080521660a0526001600160a01b038116620001155760405162461bcd60e51b815260206004820152602e60248201527f42617365506f6f6c2e636f6e7374727563746f723a207374616b696e6720746f60448201526d1ad95b881a5cc81b9bdd081cd95d60921b606482015260840160405180910390fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055505060098290556200014c6301e1338083620003e0565b600d81905550620001698142620001b460201b620012821760201c565b60138190556200017e906301e1338062000403565b6014555050601354600e555062000467915050565b6001600160a01b031660009081526020819052604090205490565b60025490565b600081831015620001c65781620001c8565b825b9392505050565b828054620001dd906200042a565b90600052602060002090601f0160209004810192826200020157600085556200024c565b82601f106200021c57805160ff19168380011785556200024c565b828001600101855582156200024c579182015b828111156200024c5782518255916020019190600101906200022f565b506200025a9291506200025e565b5090565b5b808211156200025a57600081556001016200025f565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200029d57600080fd5b81516001600160401b0380821115620002ba57620002ba62000275565b604051601f8301601f19908116603f01168101908282118183101715620002e557620002e562000275565b816040528381526020925086838588010111156200030257600080fd5b600091505b8382101562000326578582018301518183018401529082019062000307565b83821115620003385760008385830101525b9695505050505050565b600080600080600060a086880312156200035b57600080fd5b85516001600160401b03808211156200037357600080fd5b6200038189838a016200028b565b965060208801519150808211156200039857600080fd5b50620003a7888289016200028b565b604088015190955090506001600160a01b0381168114620003c757600080fd5b6060870151608090970151959894975095949392505050565b600082620003fe57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156200042557634e487b7160e01b600052601160045260246000fd5b500190565b600181811c908216806200043f57607f821691505b602082108114156200046157634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a0516124ef6200048d600039600061186d01526000610a5101526124ef6000f3fe608060405234801561001057600080fd5b506004361061025d5760003560e01c806372f702f311610146578063a9059cbb116100c3578063c5d511e111610087578063c5d511e11461057b578063c812e6331461059b578063dd62ed3e146105ae578063dd6624e4146105c1578063ef5cfb8c146105e1578063efbe1c1c146105f457600080fd5b8063a9059cbb146104dd578063ae22192e146104f0578063b182eb9114610529578063b8162dd214610549578063be9a65551461057257600080fd5b80638f10369a1161010a5780638f10369a1461048a5780638f2203f6146104935780639231cf74146104b957806395d89b41146104c2578063a457c2d7146104ca57600080fd5b806372f702f31461043157806378b4330f1461045c5780637cd0b5c7146104655780637e245d7914610478578063817b1cd21461048157600080fd5b80632bb14fd2116101df5780634f1bfc9e116101a35780634f1bfc9e146103aa5780635a9b0b89146103b35780635dc252b7146103e3578063616869be146104035780636f4a2cd01461041657806370a082311461041e57600080fd5b80632bb14fd214610342578063313ce5671461036257806331d7a26214610371578063383c7d8714610384578063395093511461039757600080fd5b806310accecc1161022657806310accecc146102d857806318160ddd146102eb57806318f9e291146102f357806323b872dd1461031c578063278dc9691461032f57600080fd5b8062f714ce1461026257806306fdde0314610277578063095ea7b31461029557806309dbf795146102b85780630e1505e0146102cf575b600080fd5b610275610270366004611f50565b6105fd565b005b61027f610973565b60405161028c9190611fa8565b60405180910390f35b6102a86102a3366004611fdb565b610a05565b604051901515815260200161028c565b6102c1600c5481565b60405190815260200161028c565b6102c160095481565b6102c16102e6366004612005565b610a1d565b6002546102c1565b6102c1610301366004612005565b6001600160a01b031660009081526007602052604090205490565b6102a861032a366004612020565b610aaa565b61027561033d36600461205c565b610ad0565b610355610350366004612075565b610b59565b60405161028c91906120a8565b6040516012815260200161028c565b6102c161037f366004612005565b610cc0565b61027561039236600461205c565b610db4565b6102a86103a5366004611fdb565b610e37565b6102c1600a5481565b6103bb610e59565b604080519586526020860194909452928401919091526060830152608082015260a00161028c565b6102c16103f1366004612005565b60126020526000908152604090205481565b61027561041136600461205c565b610e99565b610275610f1c565b6102c161042c366004612005565b610faa565b600854610444906001600160a01b031681565b6040516001600160a01b03909116815260200161028c565b6102c1600b5481565b6102c1610473366004612005565b610fc5565b6102c160055481565b6102c1600f5481565b6102c1600d5481565b6104a16001600160801b0381565b6040516001600160801b03909116815260200161028c565b6102c1600e5481565b61027f610ff1565b6102a86104d8366004611fdb565b611000565b6102a86104eb366004611fdb565b611086565b6105036104fe366004611fdb565b611094565b6040805193845267ffffffffffffffff928316602085015291169082015260600161028c565b6102c1610537366004612005565b60066020526000908152604090205481565b6102c1610557366004612005565b6001600160a01b031660009081526010602052604090205490565b6102c160135481565b6102c1610589366004612005565b60116020526000908152604090205481565b6102756105a936600461205c565b6110e5565b6102c16105bc36600461210f565b61116a565b6102c16105cf366004612005565b60076020526000908152604090205481565b6102756105ef366004612005565b611195565b6102c160145481565b6001600160a01b038116600090815260106020526040902054821061067c5760405162461bcd60e51b815260206004820152602a60248201527f5374616b696e672e77697468647261773a206465706f7369744964206973206e6044820152691bdd08195e1a5cdd195960b21b60648201526084015b60405180910390fd5b6001600160a01b03811660009081526010602052604081208054849081106106a6576106a6612139565b6000918252602091829020604080516060810182526002909302909101805483526001015467ffffffffffffffff80821694840194909452600160401b900490921691810182905291504210156107525760405162461bcd60e51b815260206004820152602a60248201527f5374616b696e672e77697468647261773a207374616b696e6720686173206e6f6044820152691d081c995b19585cd95960b21b6064820152608401610673565b61075a610f1c565b80516001600160a01b03831660009081526011602052604081208054909190610784908490612165565b90915550506001600160a01b038216600090815260106020526040902080546107af90600190612165565b815481106107bf576107bf612139565b906000526020600020906002020160106000846001600160a01b03166001600160a01b03168152602001908152602001600020848154811061080357610803612139565b6000918252602080832084546002909302019182556001938401805494909201805467ffffffffffffffff19811667ffffffffffffffff96871690811783559354600160401b908190049096169095026001600160801b03199095169092179390931790556001600160a01b038416815260109091526040902080548061088c5761088c61217c565b60008281526020812060026000199093019283020181815560010180546001600160801b031916905591558151600f8054919290916108cc908490612165565b9250508190555060006109008260000151836020015184604001516108f19190612192565b67ffffffffffffffff16611299565b905061090c83826112b4565b8151600854610928916001600160a01b039091169085906112d0565b815160405190815233906001600160a01b0385169086907fe5df19de43c8c04fd192bc68e484b2593570925fbb6ad8c07ccafbc2aa5c37a1906020015b60405180910390a450505050565b606060038054610982906121bb565b80601f01602080910402602001604051908101604052809291908181526020018280546109ae906121bb565b80156109fb5780601f106109d0576101008083540402835291602001916109fb565b820191906000526020600020905b8154815290600101906020018083116109de57829003601f168201915b5050505050905090565b600033610a13818585611338565b5060019392505050565b6001600160a01b0381166000908152600660205260408120546001600160801b0390610a9490610a85610a738663ffffffff7f000000000000000000000000000000000000000000000000000000000000000016565b600554610a8091906121f6565b61145c565b610a8f9190612215565b6114ca565b610a9e9190612256565b92915050565b60025490565b600033610ab885828561151c565b610ac3858585611596565b60019150505b9392505050565b6301da9c00601354421015610af75760405162461bcd60e51b815260040161067390612278565b601454421115610b195760405162461bcd60e51b8152600401610673906122c6565b8042601454610b289190612165565b1015610b465760405162461bcd60e51b815260040161067390612311565b610b5533836301da9c006115d1565b5050565b6001600160a01b038316600090815260106020526040812054606091610b8984610b838785612165565b90611857565b90508067ffffffffffffffff811115610ba457610ba4612364565b604051908082528060200260200182016040528015610bef57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181610bc25790505b509250818510610c00575050610ac9565b845b81811015610cb6576001600160a01b0387166000908152601060205260409020805482908110610c3457610c34612139565b6000918252602091829020604080516060810182526002909302909101805483526001015467ffffffffffffffff80821694840194909452600160401b90049092169181019190915284610c888884612165565b81518110610c9857610c98612139565b60200260200101819052508080610cae9061237a565b915050610c02565b5050509392505050565b600080610ccc60025490565b905080610cdc57610ac983610fc5565b6000600e54610cf64260145461185790919063ffffffff16565b610d009190612165565b600d54610d0d91906121f6565b9050600082610d236001600160801b03846121f6565b610d2d9190612256565b600554610d3a9190612395565b6001600160a01b038616600090815260066020526040812054919250906001600160801b0390610d7a90610a85610d708a610faa565b610a8090876121f6565b610d849190612256565b6001600160a01b038716600090815260076020526040902054909150610daa9082612165565b9695505050505050565b6276a700601354421015610dda5760405162461bcd60e51b815260040161067390612278565b601454421115610dfc5760405162461bcd60e51b8152600401610673906122c6565b8042601454610e0b9190612165565b1015610e295760405162461bcd60e51b815260040161067390612311565b610b5533836276a7006115d1565b600033610a13818585610e4a838361116a565b610e549190612395565b611338565b601354601454600f54600c54600082610e7457506000610e92565b600f54600954610e859060646121f6565b610e8f9190612256565b90505b9091929394565b62ed4e00601354421015610ebf5760405162461bcd60e51b815260040161067390612278565b601454421115610ee15760405162461bcd60e51b8152600401610673906122c6565b8042601454610ef09190612165565b1015610f0e5760405162461bcd60e51b815260040161067390612311565b610b55338362ed4e006115d1565b600954600c54101580610f335750601454600e5410155b15610f3a57565b600e544211610f4557565b600254610f525742600e55565b601454600090610f629042611857565b90506000600e5482610f749190612165565b600d54610f8191906121f6565b905080600c6000828254610f959190612395565b90915550610fa4905081611866565b50600e55565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b038116600090815260076020526040812054610fe783610a1d565b610a9e9190612165565b606060048054610982906121bb565b6000338161100e828661116a565b90508381101561106e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610673565b61107b8286868403611338565b506001949350505050565b600033610a13818585611596565b601060205281600052604060002081815481106110b057600080fd5b60009182526020909120600290910201805460019091015490925067ffffffffffffffff8082169250600160401b9091041683565b630163f50060135442101561110c5760405162461bcd60e51b815260040161067390612278565b60145442111561112e5760405162461bcd60e51b8152600401610673906122c6565b804260145461113d9190612165565b101561115b5760405162461bcd60e51b815260040161067390612311565b610b553383630163f5006115d1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0381166000908152601260205260409020544210156112145760405162461bcd60e51b815260206004820152602e60248201527f5374616b696e672e636c61696d526577617264733a207265776172647320617260448201526d19481b9bdd081c995b19585cd95960921b6064820152608401610673565b61121c610f1c565b600061122782611977565b9050801561124657600854611246906001600160a01b031683836112d0565b60405181906001600160a01b0384169033907f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c790600090a45050565b6000818310156112925781610ac9565b5090919050565b600082600b54836112aa9190612256565b610ac991906121f6565b6112be8282611a0c565b610b55826112cb8361145c565b611b5a565b6040516001600160a01b03831660248201526044810182905261133390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611baa565b505050565b6001600160a01b03831661139a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610673565b6001600160a01b0382166113fb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610673565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006001600160ff1b038211156114c65760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b6064820152608401610673565b5090565b6000808212156114c65760405162461bcd60e51b815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f7369746976656044820152606401610673565b6000611528848461116a565b9050600019811461159057818110156115835760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610673565b6115908484848403611338565b50505050565b60405162461bcd60e51b815260206004820152601060248201526f6e6f6e2d7472616e7366657261626c6560801b6044820152606401610673565b600082116116345760405162461bcd60e51b815260206004820152602a60248201527f5374616b696e672e5f7374616b65576974684475726174696f6e3a20616d6f756044820152696e74206973207a65726f60b01b6064820152608401610673565b600b5481101580156116485750600a548111155b6116ac5760405162461bcd60e51b815260206004820152602f60248201527f5374616b696e672e5f7374616b65576974684475726174696f6e3a206475726160448201526e1d1a5bdb881a5cc81a5b9d985b1a59608a1b6064820152608401610673565b6001600160a01b0383166000908152601260205260409020546116f0576116d6426276a700612395565b6001600160a01b0384166000908152601260205260409020555b6116f8610f1c565b600854611710906001600160a01b0316843085611c7c565b60106000846001600160a01b03166001600160a01b0316815260200190815260200160002060405180606001604052808481526020014267ffffffffffffffff168152602001834261176291906123ad565b67ffffffffffffffff908116909152825460018181018555600094855260208086208551600290940201928355808501519290910180546040958601518516600160401b026001600160801b031990911693909416929092179290921790556001600160a01b038616835260119052812080548492906117e3908490612395565b9250508190555081600f60008282546117fc9190612395565b909155506000905061180e8383611299565b905061181a8482611cb4565b8183856001600160a01b03167f91ede45f04a37a7c170f5c1207df3b6bc748dc1e04ad5e917a241d0f52feada34260405161096591815260200190565b60008183106112925781610ac9565b60006118947f000000000000000000000000000000000000000000000000000000000000000063ffffffff16565b90506000811161190c5760405162461bcd60e51b815260206004820152603e60248201527f4162737472616374526577617264732e5f64697374726962757465526577617260448201527f64733a20746f74616c20736861726520737570706c79206973207a65726f00006064820152608401610673565b8115610b5557806119246001600160801b03846121f6565b61192e9190612256565b60055461193b9190612395565b60055560405182815233907fdf29796aad820e4bb192f3a8d631b76519bcd2cbe77cc85af20e9df53cece0869060200160405180910390a25050565b60008061198383610fc5565b90508015610a9e576001600160a01b0383166000908152600760205260409020546119af908290612395565b6001600160a01b038416600081815260076020526040908190209290925590517f8a43c4352486ec339f487f64af78ca5cbf06cd47833f073d3baf3a193e503161906119fe9084815260200190565b60405180910390a292915050565b6001600160a01b038216611a6c5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610673565b6001600160a01b03821660009081526020819052604090205481811015611ae05760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610673565b6001600160a01b0383166000908152602081905260408120838303905560028054849290611b0f908490612165565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600554611b6790826123d9565b6001600160a01b038316600090815260066020526040902054611b8a9190612215565b6001600160a01b0390921660009081526006602052604090209190915550565b6000611bff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611cd49092919063ffffffff16565b8051909150156113335780806020019051810190611c1d919061245e565b6113335760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610673565b6040516001600160a01b03808516602483015283166044820152606481018290526115909085906323b872dd60e01b906084016112fc565b611cbe8282611ceb565b610b5582611ccb8361145c565b6112cb90612480565b6060611ce38484600085611dca565b949350505050565b6001600160a01b038216611d415760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610673565b8060026000828254611d539190612395565b90915550506001600160a01b03821660009081526020819052604081208054839290611d80908490612395565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b606082471015611e2b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610673565b6001600160a01b0385163b611e825760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610673565b600080866001600160a01b03168587604051611e9e919061249d565b60006040518083038185875af1925050503d8060008114611edb576040519150601f19603f3d011682016040523d82523d6000602084013e611ee0565b606091505b5091509150611ef0828286611efb565b979650505050505050565b60608315611f0a575081610ac9565b825115611f1a5782518084602001fd5b8160405162461bcd60e51b81526004016106739190611fa8565b80356001600160a01b0381168114611f4b57600080fd5b919050565b60008060408385031215611f6357600080fd5b82359150611f7360208401611f34565b90509250929050565b60005b83811015611f97578181015183820152602001611f7f565b838111156115905750506000910152565b6020815260008251806020840152611fc7816040850160208701611f7c565b601f01601f19169190910160400192915050565b60008060408385031215611fee57600080fd5b611ff783611f34565b946020939093013593505050565b60006020828403121561201757600080fd5b610ac982611f34565b60008060006060848603121561203557600080fd5b61203e84611f34565b925061204c60208501611f34565b9150604084013590509250925092565b60006020828403121561206e57600080fd5b5035919050565b60008060006060848603121561208a57600080fd5b61209384611f34565b95602085013595506040909401359392505050565b602080825282518282018190526000919060409081850190868401855b82811015612102578151805185528681015167ffffffffffffffff90811688870152908601511685850152606090930192908501906001016120c5565b5091979650505050505050565b6000806040838503121561212257600080fd5b61212b83611f34565b9150611f7360208401611f34565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156121775761217761214f565b500390565b634e487b7160e01b600052603160045260246000fd5b600067ffffffffffffffff838116908316818110156121b3576121b361214f565b039392505050565b600181811c908216806121cf57607f821691505b602082108114156121f057634e487b7160e01b600052602260045260246000fd5b50919050565b60008160001904831182151516156122105761221061214f565b500290565b600080821280156001600160ff1b03849003851316156122375761223761214f565b600160ff1b83900384128116156122505761225061214f565b50500190565b60008261227357634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e908201527f5374616b696e672e616c6c6f776564325374616b653a207374616b696e67206860408201526d185cc81b9bdd081cdd185c9d195960921b606082015260800190565b6020808252602b908201527f5374616b696e672e616c6c6f776564325374616b653a207374616b696e67206860408201526a185cc8199a5b9a5cda195960aa1b606082015260800190565b60208082526033908201527f5374616b696e672e616c6c6f776564325374616b653a207374616b696e67206460408201527275726174696f6e20697320746f6f206c6f6e6760681b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b600060001982141561238e5761238e61214f565b5060010190565b600082198211156123a8576123a861214f565b500190565b600067ffffffffffffffff8083168185168083038211156123d0576123d061214f565b01949350505050565b60006001600160ff1b03818413828413808216868404861116156123ff576123ff61214f565b600160ff1b600087128281168783058912161561241e5761241e61214f565b6000871292508782058712848416161561243a5761243a61214f565b878505871281841616156124505761245061214f565b505050929093029392505050565b60006020828403121561247057600080fd5b81518015158114610ac957600080fd5b6000600160ff1b8214156124965761249661214f565b5060000390565b600082516124af818460208701611f7c565b919091019291505056fea2646970667358221220150fd9622a923ca58063354ccd610add38e54d194657141d328a90123a2d286664736f6c634300080a003300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000c98d64da73a6616c42117b582e832812e7b8d57f000000000000000000000000000000000000000000108b2a2c2802909400000000000000000000000000000000000000000000000000000000000000627a7df0000000000000000000000000000000000000000000000000000000000000000b5374616b6564205253533300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057352535333000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061025d5760003560e01c806372f702f311610146578063a9059cbb116100c3578063c5d511e111610087578063c5d511e11461057b578063c812e6331461059b578063dd62ed3e146105ae578063dd6624e4146105c1578063ef5cfb8c146105e1578063efbe1c1c146105f457600080fd5b8063a9059cbb146104dd578063ae22192e146104f0578063b182eb9114610529578063b8162dd214610549578063be9a65551461057257600080fd5b80638f10369a1161010a5780638f10369a1461048a5780638f2203f6146104935780639231cf74146104b957806395d89b41146104c2578063a457c2d7146104ca57600080fd5b806372f702f31461043157806378b4330f1461045c5780637cd0b5c7146104655780637e245d7914610478578063817b1cd21461048157600080fd5b80632bb14fd2116101df5780634f1bfc9e116101a35780634f1bfc9e146103aa5780635a9b0b89146103b35780635dc252b7146103e3578063616869be146104035780636f4a2cd01461041657806370a082311461041e57600080fd5b80632bb14fd214610342578063313ce5671461036257806331d7a26214610371578063383c7d8714610384578063395093511461039757600080fd5b806310accecc1161022657806310accecc146102d857806318160ddd146102eb57806318f9e291146102f357806323b872dd1461031c578063278dc9691461032f57600080fd5b8062f714ce1461026257806306fdde0314610277578063095ea7b31461029557806309dbf795146102b85780630e1505e0146102cf575b600080fd5b610275610270366004611f50565b6105fd565b005b61027f610973565b60405161028c9190611fa8565b60405180910390f35b6102a86102a3366004611fdb565b610a05565b604051901515815260200161028c565b6102c1600c5481565b60405190815260200161028c565b6102c160095481565b6102c16102e6366004612005565b610a1d565b6002546102c1565b6102c1610301366004612005565b6001600160a01b031660009081526007602052604090205490565b6102a861032a366004612020565b610aaa565b61027561033d36600461205c565b610ad0565b610355610350366004612075565b610b59565b60405161028c91906120a8565b6040516012815260200161028c565b6102c161037f366004612005565b610cc0565b61027561039236600461205c565b610db4565b6102a86103a5366004611fdb565b610e37565b6102c1600a5481565b6103bb610e59565b604080519586526020860194909452928401919091526060830152608082015260a00161028c565b6102c16103f1366004612005565b60126020526000908152604090205481565b61027561041136600461205c565b610e99565b610275610f1c565b6102c161042c366004612005565b610faa565b600854610444906001600160a01b031681565b6040516001600160a01b03909116815260200161028c565b6102c1600b5481565b6102c1610473366004612005565b610fc5565b6102c160055481565b6102c1600f5481565b6102c1600d5481565b6104a16001600160801b0381565b6040516001600160801b03909116815260200161028c565b6102c1600e5481565b61027f610ff1565b6102a86104d8366004611fdb565b611000565b6102a86104eb366004611fdb565b611086565b6105036104fe366004611fdb565b611094565b6040805193845267ffffffffffffffff928316602085015291169082015260600161028c565b6102c1610537366004612005565b60066020526000908152604090205481565b6102c1610557366004612005565b6001600160a01b031660009081526010602052604090205490565b6102c160135481565b6102c1610589366004612005565b60116020526000908152604090205481565b6102756105a936600461205c565b6110e5565b6102c16105bc36600461210f565b61116a565b6102c16105cf366004612005565b60076020526000908152604090205481565b6102756105ef366004612005565b611195565b6102c160145481565b6001600160a01b038116600090815260106020526040902054821061067c5760405162461bcd60e51b815260206004820152602a60248201527f5374616b696e672e77697468647261773a206465706f7369744964206973206e6044820152691bdd08195e1a5cdd195960b21b60648201526084015b60405180910390fd5b6001600160a01b03811660009081526010602052604081208054849081106106a6576106a6612139565b6000918252602091829020604080516060810182526002909302909101805483526001015467ffffffffffffffff80821694840194909452600160401b900490921691810182905291504210156107525760405162461bcd60e51b815260206004820152602a60248201527f5374616b696e672e77697468647261773a207374616b696e6720686173206e6f6044820152691d081c995b19585cd95960b21b6064820152608401610673565b61075a610f1c565b80516001600160a01b03831660009081526011602052604081208054909190610784908490612165565b90915550506001600160a01b038216600090815260106020526040902080546107af90600190612165565b815481106107bf576107bf612139565b906000526020600020906002020160106000846001600160a01b03166001600160a01b03168152602001908152602001600020848154811061080357610803612139565b6000918252602080832084546002909302019182556001938401805494909201805467ffffffffffffffff19811667ffffffffffffffff96871690811783559354600160401b908190049096169095026001600160801b03199095169092179390931790556001600160a01b038416815260109091526040902080548061088c5761088c61217c565b60008281526020812060026000199093019283020181815560010180546001600160801b031916905591558151600f8054919290916108cc908490612165565b9250508190555060006109008260000151836020015184604001516108f19190612192565b67ffffffffffffffff16611299565b905061090c83826112b4565b8151600854610928916001600160a01b039091169085906112d0565b815160405190815233906001600160a01b0385169086907fe5df19de43c8c04fd192bc68e484b2593570925fbb6ad8c07ccafbc2aa5c37a1906020015b60405180910390a450505050565b606060038054610982906121bb565b80601f01602080910402602001604051908101604052809291908181526020018280546109ae906121bb565b80156109fb5780601f106109d0576101008083540402835291602001916109fb565b820191906000526020600020905b8154815290600101906020018083116109de57829003601f168201915b5050505050905090565b600033610a13818585611338565b5060019392505050565b6001600160a01b0381166000908152600660205260408120546001600160801b0390610a9490610a85610a738663ffffffff7f0000000000000000000000000000000000000000000000000000019300000faa16565b600554610a8091906121f6565b61145c565b610a8f9190612215565b6114ca565b610a9e9190612256565b92915050565b60025490565b600033610ab885828561151c565b610ac3858585611596565b60019150505b9392505050565b6301da9c00601354421015610af75760405162461bcd60e51b815260040161067390612278565b601454421115610b195760405162461bcd60e51b8152600401610673906122c6565b8042601454610b289190612165565b1015610b465760405162461bcd60e51b815260040161067390612311565b610b5533836301da9c006115d1565b5050565b6001600160a01b038316600090815260106020526040812054606091610b8984610b838785612165565b90611857565b90508067ffffffffffffffff811115610ba457610ba4612364565b604051908082528060200260200182016040528015610bef57816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181610bc25790505b509250818510610c00575050610ac9565b845b81811015610cb6576001600160a01b0387166000908152601060205260409020805482908110610c3457610c34612139565b6000918252602091829020604080516060810182526002909302909101805483526001015467ffffffffffffffff80821694840194909452600160401b90049092169181019190915284610c888884612165565b81518110610c9857610c98612139565b60200260200101819052508080610cae9061237a565b915050610c02565b5050509392505050565b600080610ccc60025490565b905080610cdc57610ac983610fc5565b6000600e54610cf64260145461185790919063ffffffff16565b610d009190612165565b600d54610d0d91906121f6565b9050600082610d236001600160801b03846121f6565b610d2d9190612256565b600554610d3a9190612395565b6001600160a01b038616600090815260066020526040812054919250906001600160801b0390610d7a90610a85610d708a610faa565b610a8090876121f6565b610d849190612256565b6001600160a01b038716600090815260076020526040902054909150610daa9082612165565b9695505050505050565b6276a700601354421015610dda5760405162461bcd60e51b815260040161067390612278565b601454421115610dfc5760405162461bcd60e51b8152600401610673906122c6565b8042601454610e0b9190612165565b1015610e295760405162461bcd60e51b815260040161067390612311565b610b5533836276a7006115d1565b600033610a13818585610e4a838361116a565b610e549190612395565b611338565b601354601454600f54600c54600082610e7457506000610e92565b600f54600954610e859060646121f6565b610e8f9190612256565b90505b9091929394565b62ed4e00601354421015610ebf5760405162461bcd60e51b815260040161067390612278565b601454421115610ee15760405162461bcd60e51b8152600401610673906122c6565b8042601454610ef09190612165565b1015610f0e5760405162461bcd60e51b815260040161067390612311565b610b55338362ed4e006115d1565b600954600c54101580610f335750601454600e5410155b15610f3a57565b600e544211610f4557565b600254610f525742600e55565b601454600090610f629042611857565b90506000600e5482610f749190612165565b600d54610f8191906121f6565b905080600c6000828254610f959190612395565b90915550610fa4905081611866565b50600e55565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b038116600090815260076020526040812054610fe783610a1d565b610a9e9190612165565b606060048054610982906121bb565b6000338161100e828661116a565b90508381101561106e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610673565b61107b8286868403611338565b506001949350505050565b600033610a13818585611596565b601060205281600052604060002081815481106110b057600080fd5b60009182526020909120600290910201805460019091015490925067ffffffffffffffff8082169250600160401b9091041683565b630163f50060135442101561110c5760405162461bcd60e51b815260040161067390612278565b60145442111561112e5760405162461bcd60e51b8152600401610673906122c6565b804260145461113d9190612165565b101561115b5760405162461bcd60e51b815260040161067390612311565b610b553383630163f5006115d1565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6001600160a01b0381166000908152601260205260409020544210156112145760405162461bcd60e51b815260206004820152602e60248201527f5374616b696e672e636c61696d526577617264733a207265776172647320617260448201526d19481b9bdd081c995b19585cd95960921b6064820152608401610673565b61121c610f1c565b600061122782611977565b9050801561124657600854611246906001600160a01b031683836112d0565b60405181906001600160a01b0384169033907f9310ccfcb8de723f578a9e4282ea9f521f05ae40dc08f3068dfad528a65ee3c790600090a45050565b6000818310156112925781610ac9565b5090919050565b600082600b54836112aa9190612256565b610ac991906121f6565b6112be8282611a0c565b610b55826112cb8361145c565b611b5a565b6040516001600160a01b03831660248201526044810182905261133390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611baa565b505050565b6001600160a01b03831661139a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610673565b6001600160a01b0382166113fb5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610673565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60006001600160ff1b038211156114c65760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b6064820152608401610673565b5090565b6000808212156114c65760405162461bcd60e51b815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f7369746976656044820152606401610673565b6000611528848461116a565b9050600019811461159057818110156115835760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610673565b6115908484848403611338565b50505050565b60405162461bcd60e51b815260206004820152601060248201526f6e6f6e2d7472616e7366657261626c6560801b6044820152606401610673565b600082116116345760405162461bcd60e51b815260206004820152602a60248201527f5374616b696e672e5f7374616b65576974684475726174696f6e3a20616d6f756044820152696e74206973207a65726f60b01b6064820152608401610673565b600b5481101580156116485750600a548111155b6116ac5760405162461bcd60e51b815260206004820152602f60248201527f5374616b696e672e5f7374616b65576974684475726174696f6e3a206475726160448201526e1d1a5bdb881a5cc81a5b9d985b1a59608a1b6064820152608401610673565b6001600160a01b0383166000908152601260205260409020546116f0576116d6426276a700612395565b6001600160a01b0384166000908152601260205260409020555b6116f8610f1c565b600854611710906001600160a01b0316843085611c7c565b60106000846001600160a01b03166001600160a01b0316815260200190815260200160002060405180606001604052808481526020014267ffffffffffffffff168152602001834261176291906123ad565b67ffffffffffffffff908116909152825460018181018555600094855260208086208551600290940201928355808501519290910180546040958601518516600160401b026001600160801b031990911693909416929092179290921790556001600160a01b038616835260119052812080548492906117e3908490612395565b9250508190555081600f60008282546117fc9190612395565b909155506000905061180e8383611299565b905061181a8482611cb4565b8183856001600160a01b03167f91ede45f04a37a7c170f5c1207df3b6bc748dc1e04ad5e917a241d0f52feada34260405161096591815260200190565b60008183106112925781610ac9565b60006118947f000000000000000000000000000000000000000000000000000001ae00000aa463ffffffff16565b90506000811161190c5760405162461bcd60e51b815260206004820152603e60248201527f4162737472616374526577617264732e5f64697374726962757465526577617260448201527f64733a20746f74616c20736861726520737570706c79206973207a65726f00006064820152608401610673565b8115610b5557806119246001600160801b03846121f6565b61192e9190612256565b60055461193b9190612395565b60055560405182815233907fdf29796aad820e4bb192f3a8d631b76519bcd2cbe77cc85af20e9df53cece0869060200160405180910390a25050565b60008061198383610fc5565b90508015610a9e576001600160a01b0383166000908152600760205260409020546119af908290612395565b6001600160a01b038416600081815260076020526040908190209290925590517f8a43c4352486ec339f487f64af78ca5cbf06cd47833f073d3baf3a193e503161906119fe9084815260200190565b60405180910390a292915050565b6001600160a01b038216611a6c5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608401610673565b6001600160a01b03821660009081526020819052604090205481811015611ae05760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608401610673565b6001600160a01b0383166000908152602081905260408120838303905560028054849290611b0f908490612165565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b600554611b6790826123d9565b6001600160a01b038316600090815260066020526040902054611b8a9190612215565b6001600160a01b0390921660009081526006602052604090209190915550565b6000611bff826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611cd49092919063ffffffff16565b8051909150156113335780806020019051810190611c1d919061245e565b6113335760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610673565b6040516001600160a01b03808516602483015283166044820152606481018290526115909085906323b872dd60e01b906084016112fc565b611cbe8282611ceb565b610b5582611ccb8361145c565b6112cb90612480565b6060611ce38484600085611dca565b949350505050565b6001600160a01b038216611d415760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610673565b8060026000828254611d539190612395565b90915550506001600160a01b03821660009081526020819052604081208054839290611d80908490612395565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b606082471015611e2b5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610673565b6001600160a01b0385163b611e825760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610673565b600080866001600160a01b03168587604051611e9e919061249d565b60006040518083038185875af1925050503d8060008114611edb576040519150601f19603f3d011682016040523d82523d6000602084013e611ee0565b606091505b5091509150611ef0828286611efb565b979650505050505050565b60608315611f0a575081610ac9565b825115611f1a5782518084602001fd5b8160405162461bcd60e51b81526004016106739190611fa8565b80356001600160a01b0381168114611f4b57600080fd5b919050565b60008060408385031215611f6357600080fd5b82359150611f7360208401611f34565b90509250929050565b60005b83811015611f97578181015183820152602001611f7f565b838111156115905750506000910152565b6020815260008251806020840152611fc7816040850160208701611f7c565b601f01601f19169190910160400192915050565b60008060408385031215611fee57600080fd5b611ff783611f34565b946020939093013593505050565b60006020828403121561201757600080fd5b610ac982611f34565b60008060006060848603121561203557600080fd5b61203e84611f34565b925061204c60208501611f34565b9150604084013590509250925092565b60006020828403121561206e57600080fd5b5035919050565b60008060006060848603121561208a57600080fd5b61209384611f34565b95602085013595506040909401359392505050565b602080825282518282018190526000919060409081850190868401855b82811015612102578151805185528681015167ffffffffffffffff90811688870152908601511685850152606090930192908501906001016120c5565b5091979650505050505050565b6000806040838503121561212257600080fd5b61212b83611f34565b9150611f7360208401611f34565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156121775761217761214f565b500390565b634e487b7160e01b600052603160045260246000fd5b600067ffffffffffffffff838116908316818110156121b3576121b361214f565b039392505050565b600181811c908216806121cf57607f821691505b602082108114156121f057634e487b7160e01b600052602260045260246000fd5b50919050565b60008160001904831182151516156122105761221061214f565b500290565b600080821280156001600160ff1b03849003851316156122375761223761214f565b600160ff1b83900384128116156122505761225061214f565b50500190565b60008261227357634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e908201527f5374616b696e672e616c6c6f776564325374616b653a207374616b696e67206860408201526d185cc81b9bdd081cdd185c9d195960921b606082015260800190565b6020808252602b908201527f5374616b696e672e616c6c6f776564325374616b653a207374616b696e67206860408201526a185cc8199a5b9a5cda195960aa1b606082015260800190565b60208082526033908201527f5374616b696e672e616c6c6f776564325374616b653a207374616b696e67206460408201527275726174696f6e20697320746f6f206c6f6e6760681b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b600060001982141561238e5761238e61214f565b5060010190565b600082198211156123a8576123a861214f565b500190565b600067ffffffffffffffff8083168185168083038211156123d0576123d061214f565b01949350505050565b60006001600160ff1b03818413828413808216868404861116156123ff576123ff61214f565b600160ff1b600087128281168783058912161561241e5761241e61214f565b6000871292508782058712848416161561243a5761243a61214f565b878505871281841616156124505761245061214f565b505050929093029392505050565b60006020828403121561247057600080fd5b81518015158114610ac957600080fd5b6000600160ff1b8214156124965761249661214f565b5060000390565b600082516124af818460208701611f7c565b919091019291505056fea2646970667358221220150fd9622a923ca58063354ccd610add38e54d194657141d328a90123a2d286664736f6c634300080a0033

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

00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000c98d64da73a6616c42117b582e832812e7b8d57f000000000000000000000000000000000000000000108b2a2c2802909400000000000000000000000000000000000000000000000000000000000000627a7df0000000000000000000000000000000000000000000000000000000000000000b5374616b6564205253533300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000057352535333000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): Staked RSS3
Arg [1] : _symbol (string): sRSS3
Arg [2] : _stakingToken (address): 0xc98D64DA73a6616c42117b582e832812e7B8D57F
Arg [3] : _maxReward (uint256): 20000000000000000000000000
Arg [4] : _start (uint256): 1652194800

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 000000000000000000000000c98d64da73a6616c42117b582e832812e7b8d57f
Arg [3] : 000000000000000000000000000000000000000000108b2a2c28029094000000
Arg [4] : 00000000000000000000000000000000000000000000000000000000627a7df0
Arg [5] : 000000000000000000000000000000000000000000000000000000000000000b
Arg [6] : 5374616b65642052535333000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [8] : 7352535333000000000000000000000000000000000000000000000000000000


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.