false
true
0

Contract Address Details

0xc9926CD34ab4296E981E31d2A05E76b69Fa78BaE

Token
Staked + Bonus GPLX (sbGPLX)
Creator
0xa39657–77d92c at 0xa62f19–982aa9
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
6 Transactions
Transfers
0 Transfers
Gas Used
0
Last Balance Update
27551618
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
RewardTracker




Optimization enabled
true
Compiler version
v0.8.7+commit.e28d00a7




Optimization runs
10
EVM Version
default




Verified at
2023-07-04T10:03:30.405627Z

Constructor Arguments

0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000135374616b6564202b20426f6e75732047504c58000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006736247504c580000000000000000000000000000000000000000000000000000

Arg [0] (string) : Staked + Bonus GPLX
Arg [1] (string) : sbGPLX

              

contracts/staking/RewardTracker.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./interfaces/IRewardDistributor.sol";
import "./interfaces/IRewardTracker.sol";
import "../access/Governable.sol";

contract RewardTracker is IERC20, ReentrancyGuard, IRewardTracker, Governable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    uint256 public constant BASIS_POINTS_DIVISOR = 10000;
    uint256 public constant PRECISION = 1e30;

    uint8 public constant decimals = 18;

    bool public isInitialized;

    string public name;
    string public symbol;

    address public distributor;
    mapping (address => bool) public isDepositToken;
    mapping (address => mapping (address => uint256)) public override depositBalances;
    mapping (address => uint256) public totalDepositSupply;

    uint256 public override totalSupply;
    mapping (address => uint256) public balances;
    mapping (address => mapping (address => uint256)) public allowances;

    uint256 public cumulativeRewardPerToken;
    mapping (address => uint256) public override stakedAmounts;
    mapping (address => uint256) public claimableReward;
    mapping (address => uint256) public previousCumulatedRewardPerToken;
    mapping (address => uint256) public override cumulativeRewards;
    mapping (address => uint256) public override averageStakedAmounts;

    bool public inPrivateTransferMode;
    bool public inPrivateStakingMode;
    bool public inPrivateClaimingMode;
    mapping (address => bool) public isHandler;

    event Claim(address receiver, uint256 amount);

    constructor(string memory _name, string memory _symbol) {
        name = _name;
        symbol = _symbol;
    }

    function initialize(
        address[] memory _depositTokens,
        address _distributor
    ) external onlyGov {
        require(!isInitialized, "RewardTracker: already initialized");
        isInitialized = true;

        for (uint256 i = 0; i < _depositTokens.length; i++) {
            address depositToken = _depositTokens[i];
            isDepositToken[depositToken] = true;
        }

        distributor = _distributor;
    }

    function setDepositToken(address _depositToken, bool _isDepositToken) external onlyGov {
        isDepositToken[_depositToken] = _isDepositToken;
    }

    function setInPrivateTransferMode(bool _inPrivateTransferMode) external onlyGov {
        inPrivateTransferMode = _inPrivateTransferMode;
    }

    function setInPrivateStakingMode(bool _inPrivateStakingMode) external onlyGov {
        inPrivateStakingMode = _inPrivateStakingMode;
    }

    function setInPrivateClaimingMode(bool _inPrivateClaimingMode) external onlyGov {
        inPrivateClaimingMode = _inPrivateClaimingMode;
    }

    function setHandler(address _handler, bool _isActive) external onlyGov {
        isHandler[_handler] = _isActive;
    }

    // to help users who accidentally send their tokens to this contract
    function withdrawToken(address _token, address _account, uint256 _amount) external onlyGov {
        IERC20(_token).safeTransfer(_account, _amount);
    }

    function balanceOf(address _account) external view override returns (uint256) {
        return balances[_account];
    }

    function stake(address _depositToken, uint256 _amount) external override nonReentrant {
        if (inPrivateStakingMode) { revert("RewardTracker: action not enabled"); }
        _stake(msg.sender, msg.sender, _depositToken, _amount);
    }

    function stakeForAccount(address _fundingAccount, address _account, address _depositToken, uint256 _amount) external override nonReentrant {
        _validateHandler();
        _stake(_fundingAccount, _account, _depositToken, _amount);
    }

    function unstake(address _depositToken, uint256 _amount) external override nonReentrant {
        if (inPrivateStakingMode) { revert("RewardTracker: action not enabled"); }
        _unstake(msg.sender, _depositToken, _amount, msg.sender);
    }

    function unstakeForAccount(address _account, address _depositToken, uint256 _amount, address _receiver) external override nonReentrant {
        _validateHandler();
        _unstake(_account, _depositToken, _amount, _receiver);
    }

    function transfer(address _recipient, uint256 _amount) external override returns (bool) {
        _transfer(msg.sender, _recipient, _amount);
        return true;
    }

    function allowance(address _owner, address _spender) external view override returns (uint256) {
        return allowances[_owner][_spender];
    }

    function approve(address _spender, uint256 _amount) external override returns (bool) {
        _approve(msg.sender, _spender, _amount);
        return true;
    }

    function transferFrom(address _sender, address _recipient, uint256 _amount) external override returns (bool) {
        if (isHandler[msg.sender]) {
            _transfer(_sender, _recipient, _amount);
            return true;
        }

        uint256 nextAllowance = allowances[_sender][msg.sender].sub(_amount, "RewardTracker: transfer amount exceeds allowance");
        _approve(_sender, msg.sender, nextAllowance);
        _transfer(_sender, _recipient, _amount);
        return true;
    }

    function tokensPerInterval() external override view returns (uint256) {
        return IRewardDistributor(distributor).tokensPerInterval();
    }

    function updateRewards() external override nonReentrant {
        _updateRewards(address(0));
    }

    function claim(address _receiver) external override nonReentrant returns (uint256) {
        if (inPrivateClaimingMode) { revert("RewardTracker: action not enabled"); }
        return _claim(msg.sender, _receiver);
    }

    function claimForAccount(address _account, address _receiver) external override nonReentrant returns (uint256) {
        _validateHandler();
        return _claim(_account, _receiver);
    }

    function claimable(address _account) public override view returns (uint256) {
        uint256 stakedAmount = stakedAmounts[_account];
        if (stakedAmount == 0) {
            return claimableReward[_account];
        }
        uint256 supply = totalSupply;
        uint256 pendingRewards = IRewardDistributor(distributor).pendingRewards().mul(PRECISION);
        uint256 nextCumulativeRewardPerToken = cumulativeRewardPerToken.add(pendingRewards.div(supply));
        return claimableReward[_account].add(
            stakedAmount.mul(nextCumulativeRewardPerToken.sub(previousCumulatedRewardPerToken[_account])).div(PRECISION));
    }

    function rewardToken() public view returns (address) {
        return IRewardDistributor(distributor).rewardToken();
    }

    function _claim(address _account, address _receiver) private returns (uint256) {
        _updateRewards(_account);

        uint256 tokenAmount = claimableReward[_account];
        claimableReward[_account] = 0;

        if (tokenAmount > 0) {
            IERC20(rewardToken()).safeTransfer(_receiver, tokenAmount);
            emit Claim(_account, tokenAmount);
        }

        return tokenAmount;
    }

    function _mint(address _account, uint256 _amount) internal {
        require(_account != address(0), "RewardTracker: mint to the zero address");

        totalSupply = totalSupply.add(_amount);
        balances[_account] = balances[_account].add(_amount);

        emit Transfer(address(0), _account, _amount);
    }

    function _burn(address _account, uint256 _amount) internal {
        require(_account != address(0), "RewardTracker: burn from the zero address");

        balances[_account] = balances[_account].sub(_amount, "RewardTracker: burn amount exceeds balance");
        totalSupply = totalSupply.sub(_amount);

        emit Transfer(_account, address(0), _amount);
    }

    function _transfer(address _sender, address _recipient, uint256 _amount) private {
        require(_sender != address(0), "RewardTracker: transfer from the zero address");
        require(_recipient != address(0), "RewardTracker: transfer to the zero address");

        if (inPrivateTransferMode) { _validateHandler(); }

        balances[_sender] = balances[_sender].sub(_amount, "RewardTracker: transfer amount exceeds balance");
        balances[_recipient] = balances[_recipient].add(_amount);

        emit Transfer(_sender, _recipient,_amount);
    }

    function _approve(address _owner, address _spender, uint256 _amount) private {
        require(_owner != address(0), "RewardTracker: approve from the zero address");
        require(_spender != address(0), "RewardTracker: approve to the zero address");

        allowances[_owner][_spender] = _amount;

        emit Approval(_owner, _spender, _amount);
    }

    function _validateHandler() private view {
        require(isHandler[msg.sender], "RewardTracker: forbidden");
    }

    function _stake(address _fundingAccount, address _account, address _depositToken, uint256 _amount) private {
        require(_amount > 0, "RewardTracker: invalid _amount");
        require(isDepositToken[_depositToken], "RewardTracker: invalid _depositToken");

        IERC20(_depositToken).safeTransferFrom(_fundingAccount, address(this), _amount);

        _updateRewards(_account);

        stakedAmounts[_account] = stakedAmounts[_account].add(_amount);
        depositBalances[_account][_depositToken] = depositBalances[_account][_depositToken].add(_amount);
        totalDepositSupply[_depositToken] = totalDepositSupply[_depositToken].add(_amount);

        _mint(_account, _amount);
    }

    function _unstake(address _account, address _depositToken, uint256 _amount, address _receiver) private {
        require(_amount > 0, "RewardTracker: invalid _amount");
        require(isDepositToken[_depositToken], "RewardTracker: invalid _depositToken");

        _updateRewards(_account);

        uint256 stakedAmount = stakedAmounts[_account];
        require(stakedAmounts[_account] >= _amount, "RewardTracker: _amount exceeds stakedAmount");

        stakedAmounts[_account] = stakedAmount.sub(_amount);

        uint256 depositBalance = depositBalances[_account][_depositToken];
        require(depositBalance >= _amount, "RewardTracker: _amount exceeds depositBalance");
        depositBalances[_account][_depositToken] = depositBalance.sub(_amount);
        totalDepositSupply[_depositToken] = totalDepositSupply[_depositToken].sub(_amount);

        _burn(_account, _amount);
        IERC20(_depositToken).safeTransfer(_receiver, _amount);
    }

    function _updateRewards(address _account) private {
        uint256 blockReward = IRewardDistributor(distributor).distribute();

        uint256 supply = totalSupply;
        uint256 _cumulativeRewardPerToken = cumulativeRewardPerToken;
        if (supply > 0 && blockReward > 0) {
            _cumulativeRewardPerToken = _cumulativeRewardPerToken.add(blockReward.mul(PRECISION).div(supply));
            cumulativeRewardPerToken = _cumulativeRewardPerToken;
        }

        // cumulativeRewardPerToken can only increase
        // so if cumulativeRewardPerToken is zero, it means there are no rewards yet
        if (_cumulativeRewardPerToken == 0) {
            return;
        }

        if (_account != address(0)) {
            uint256 stakedAmount = stakedAmounts[_account];
            uint256 accountReward = stakedAmount.mul(_cumulativeRewardPerToken.sub(previousCumulatedRewardPerToken[_account])).div(PRECISION);
            uint256 _claimableReward = claimableReward[_account].add(accountReward);

            claimableReward[_account] = _claimableReward;
            previousCumulatedRewardPerToken[_account] = _cumulativeRewardPerToken;

            if (_claimableReward > 0 && stakedAmounts[_account] > 0) {
                uint256 nextCumulativeReward = cumulativeRewards[_account].add(accountReward);

                averageStakedAmounts[_account] = averageStakedAmounts[_account].mul(cumulativeRewards[_account]).div(nextCumulativeReward)
                    .add(stakedAmount.mul(accountReward).div(nextCumulativeReward));

                cumulativeRewards[_account] = nextCumulativeReward;
            }
        }
    }
}
        

@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol

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

pragma solidity ^0.8.0;

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

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

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

@openzeppelin/contracts/security/ReentrancyGuard.sol

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

@openzeppelin/contracts/token/ERC20/IERC20.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts/utils/Address.sol

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts/utils/math/SafeMath.sol

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

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}
          

contracts/access/Governable.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

contract Governable {
    address public gov;

    constructor() {
        gov = msg.sender;
    }

    modifier onlyGov() {
        require(msg.sender == gov, "Governable: forbidden");
        _;
    }

    function setGov(address _gov) external onlyGov {
        gov = _gov;
    }
}
          

contracts/staking/interfaces/IRewardDistributor.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IRewardDistributor {
    function rewardToken() external view returns (address);
    function tokensPerInterval() external view returns (uint256);
    function pendingRewards() external view returns (uint256);
    function distribute() external returns (uint256);
}
          

contracts/staking/interfaces/IRewardTracker.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IRewardTracker {
    function depositBalances(address _account, address _depositToken) external view returns (uint256);
    function stakedAmounts(address _account) external view returns (uint256);
    function updateRewards() external;
    function stake(address _depositToken, uint256 _amount) external;
    function stakeForAccount(address _fundingAccount, address _account, address _depositToken, uint256 _amount) external;
    function unstake(address _depositToken, uint256 _amount) external;
    function unstakeForAccount(address _account, address _depositToken, uint256 _amount, address _receiver) external;
    function tokensPerInterval() external view returns (uint256);
    function claim(address _receiver) external returns (uint256);
    function claimForAccount(address _account, address _receiver) external returns (uint256);
    function claimable(address _account) external view returns (uint256);
    function averageStakedAmounts(address _account) external view returns (uint256);
    function cumulativeRewards(address _account) external view returns (uint256);
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":10,"enabled":true},"libraries":{}}
              

Contract ABI

[{"type":"constructor","inputs":[{"type":"string","name":"_name","internalType":"string"},{"type":"string","name":"_symbol","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"BASIS_POINTS_DIVISOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"PRECISION","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"_owner","internalType":"address"},{"type":"address","name":"_spender","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowances","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"_spender","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"averageStakedAmounts","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balances","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claim","inputs":[{"type":"address","name":"_receiver","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimForAccount","inputs":[{"type":"address","name":"_account","internalType":"address"},{"type":"address","name":"_receiver","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimable","inputs":[{"type":"address","name":"_account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"claimableReward","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"cumulativeRewardPerToken","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"cumulativeRewards","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"depositBalances","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"distributor","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"gov","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"inPrivateClaimingMode","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"inPrivateStakingMode","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"inPrivateTransferMode","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address[]","name":"_depositTokens","internalType":"address[]"},{"type":"address","name":"_distributor","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isDepositToken","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isHandler","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isInitialized","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"previousCumulatedRewardPerToken","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"rewardToken","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDepositToken","inputs":[{"type":"address","name":"_depositToken","internalType":"address"},{"type":"bool","name":"_isDepositToken","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setGov","inputs":[{"type":"address","name":"_gov","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setHandler","inputs":[{"type":"address","name":"_handler","internalType":"address"},{"type":"bool","name":"_isActive","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setInPrivateClaimingMode","inputs":[{"type":"bool","name":"_inPrivateClaimingMode","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setInPrivateStakingMode","inputs":[{"type":"bool","name":"_inPrivateStakingMode","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setInPrivateTransferMode","inputs":[{"type":"bool","name":"_inPrivateTransferMode","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stake","inputs":[{"type":"address","name":"_depositToken","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"stakeForAccount","inputs":[{"type":"address","name":"_fundingAccount","internalType":"address"},{"type":"address","name":"_account","internalType":"address"},{"type":"address","name":"_depositToken","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"stakedAmounts","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"tokensPerInterval","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalDepositSupply","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"_recipient","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"_sender","internalType":"address"},{"type":"address","name":"_recipient","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unstake","inputs":[{"type":"address","name":"_depositToken","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unstakeForAccount","inputs":[{"type":"address","name":"_account","internalType":"address"},{"type":"address","name":"_depositToken","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"address","name":"_receiver","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRewards","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawToken","inputs":[{"type":"address","name":"_token","internalType":"address"},{"type":"address","name":"_account","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","indexed":true},{"type":"address","name":"spender","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false},{"type":"event","name":"Claim","inputs":[{"type":"address","name":"receiver","indexed":false},{"type":"uint256","name":"amount","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","indexed":true},{"type":"address","name":"to","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false}]
              

Contract Creation Code

0x60806040523480156200001157600080fd5b50604051620026d3380380620026d38339810160408190526200003491620001dc565b6001600081905580546001600160a01b031916331790558151620000609060029060208501906200007f565b508051620000769060039060208401906200007f565b50505062000299565b8280546200008d9062000246565b90600052602060002090601f016020900481019282620000b15760008555620000fc565b82601f10620000cc57805160ff1916838001178555620000fc565b82800160010185558215620000fc579182015b82811115620000fc578251825591602001919060010190620000df565b506200010a9291506200010e565b5090565b5b808211156200010a57600081556001016200010f565b600082601f8301126200013757600080fd5b81516001600160401b038082111562000154576200015462000283565b604051601f8301601f19908116603f011681019082821181831017156200017f576200017f62000283565b816040528381526020925086838588010111156200019c57600080fd5b600091505b83821015620001c05785820183015181830184015290820190620001a1565b83821115620001d25760008385830101525b9695505050505050565b60008060408385031215620001f057600080fd5b82516001600160401b03808211156200020857600080fd5b620002168683870162000125565b935060208501519150808211156200022d57600080fd5b506200023c8582860162000125565b9150509250929050565b600181811c908216806200025b57607f821691505b602082108114156200027d57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b61242a80620002a96000396000f3fe608060405234801561001057600080fd5b50600436106102255760003560e01c806301e336671461022a57806306fdde031461023f578063095ea7b31461025d578063098bf59d1461028057806310c1c10314610293578063126082cf146102c157806312d43a51146102ca57806313e82e7a146102f557806318160ddd146103085780631d30d5bc146103115780631e83409a1461032457806323b872dd1461033757806327e235e31461034a578063313ce5671461036a5780633792def314610384578063392e53cd146103a45780633cd7f700146103b85780633e158b0c146103cb578063402914f5146103d357806344a08411146103e6578063462d0b2e1461040657806346ea87af14610419578063552ce1dc1461043c57806355b6ed5c1461045c5780635a47a1a71461048757806370a082311461049a578063790b5a6c146104c357806395d89b41146104d65780639cb7de4b146104de578063a3180217146104f1578063a8d9362714610511578063a9059cbb14610519578063aaf5eb681461052c578063adc9772e1461053f578063b89e45b314610552578063bfe1092814610575578063c2a672e014610588578063c5fa27301461059b578063cfad57a2146105ad578063dd62ed3e146105c0578063dfbaefb1146105f9578063e44b755814610606578063e950342514610619578063f5d9d63e14610639578063f5fc507614610664578063f76033d31461066d578063f7c618c114610680575b600080fd5b61023d610238366004611e81565b610688565b005b6102476106d4565b60405161025491906120d4565b60405180910390f35b61027061026b366004611f43565b610762565b6040519015158152602001610254565b61023d61028e366004611ec2565b610779565b6102b36102a1366004611dbd565b600c6020526000908152604090205481565b604051908152602001610254565b6102b361271081565b6001546102dd906001600160a01b031681565b6040516001600160a01b039091168152602001610254565b6102b3610303366004611df7565b6107a5565b6102b360085481565b61023d61031f36600461204c565b6107cd565b6102b3610332366004611dbd565b610811565b610270610345366004611e81565b61085f565b6102b3610358366004611dbd565b60096020526000908152604090205481565b610372601281565b60405160ff9091168152602001610254565b6102b3610392366004611dbd565b600f6020526000908152604090205481565b60015461027090600160a01b900460ff1681565b61023d6103c636600461204c565b6108f9565b61023d61093f565b6102b36103e1366004611dbd565b61095d565b6102b36103f4366004611dbd565b600e6020526000908152604090205481565b61023d610414366004611f6f565b610ac2565b610270610427366004611dbd565b60126020526000908152604090205460ff1681565b6102b361044a366004611dbd565b60076020526000908152604090205481565b6102b361046a366004611df7565b600a60209081526000928352604080842090915290825290205481565b61023d61049536600461204c565b610be9565b6102b36104a8366004611dbd565b6001600160a01b031660009081526009602052604090205490565b61023d6104d1366004611e30565b610c26565b610247610c42565b61023d6104ec366004611f15565b610c4f565b6102b36104ff366004611dbd565b60106020526000908152604090205481565b6102b3610ca4565b610270610527366004611f43565b610d31565b6102b368327cb2734119d3b7a9601e1b81565b61023d61054d366004611f43565b610d3e565b610270610560366004611dbd565b60056020526000908152604090205460ff1681565b6004546102dd906001600160a01b031681565b61023d610596366004611f43565b610d88565b60115461027090610100900460ff1681565b61023d6105bb366004611dbd565b610dc4565b6102b36105ce366004611df7565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b6011546102709060ff1681565b61023d610614366004611f15565b610e10565b6102b3610627366004611dbd565b600d6020526000908152604090205481565b6102b3610647366004611df7565b600660209081526000928352604080842090915290825290205481565b6102b3600b5481565b6011546102709062010000900460ff1681565b6102dd610e65565b6001546001600160a01b031633146106bb5760405162461bcd60e51b81526004016106b290612182565b60405180910390fd5b6106cf6001600160a01b0384168383610eed565b505050565b600280546106e19061228e565b80601f016020809104026020016040519081016040528092919081815260200182805461070d9061228e565b801561075a5780601f1061072f5761010080835404028352916020019161075a565b820191906000526020600020905b81548152906001019060200180831161073d57829003601f168201915b505050505081565b600061076f338484610f43565b5060015b92915050565b610781611079565b6107896110d3565b6107958484848461112d565b61079f6001600055565b50505050565b60006107af611079565b6107b76110d3565b6107c18383611333565b90506107736001600055565b6001546001600160a01b031633146107f75760405162461bcd60e51b81526004016106b290612182565b601180549115156101000261ff0019909216919091179055565b600061081b611079565b60115462010000900460ff16156108445760405162461bcd60e51b81526004016106b2906121b1565b61084e3383611333565b905061085a6001600055565b919050565b3360009081526012602052604081205460ff161561088a576108828484846113be565b5060016108f2565b60006108d483604051806060016040528060308152602001612397603091396001600160a01b0388166000908152600a602090815260408083203384529091529020549190611555565b90506108e1853383610f43565b6108ec8585856113be565b60019150505b9392505050565b6001546001600160a01b031633146109235760405162461bcd60e51b81526004016106b290612182565b60118054911515620100000262ff000019909216919091179055565b610947611079565b6109516000611581565b61095b6001600055565b565b6001600160a01b0381166000908152600c6020526040812054806109985750506001600160a01b03166000908152600d602052604090205490565b60085460048054604080516376f69fed60e11b81529051600093610a319368327cb2734119d3b7a9601e1b936001600160a01b039091169263eded3fda92828101926020929190829003018186803b1580156109f357600080fd5b505afa158015610a07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2b9190612086565b906117d9565b90506000610a4b610a4283856117e5565b600b54906117f1565b6001600160a01b0387166000908152600e6020526040902054909150610ab890610a999068327cb2734119d3b7a9601e1b90610a9390610a8c9086906117fd565b88906117d9565b906117e5565b6001600160a01b0388166000908152600d6020526040902054906117f1565b9695505050505050565b6001546001600160a01b03163314610aec5760405162461bcd60e51b81526004016106b290612182565b600154600160a01b900460ff1615610b515760405162461bcd60e51b815260206004820152602260248201527f526577617264547261636b65723a20616c726561647920696e697469616c697a604482015261195960f21b60648201526084016106b2565b6001805460ff60a01b1916600160a01b17905560005b8251811015610bc5576000838281518110610b8457610b846122fa565b6020908102919091018101516001600160a01b03166000908152600590915260409020805460ff191660011790555080610bbd816122c9565b915050610b67565b50600480546001600160a01b0319166001600160a01b039290921691909117905550565b6001546001600160a01b03163314610c135760405162461bcd60e51b81526004016106b290612182565b6011805460ff1916911515919091179055565b610c2e611079565b610c366110d3565b61079584848484611809565b600380546106e19061228e565b6001546001600160a01b03163314610c795760405162461bcd60e51b81526004016106b290612182565b6001600160a01b03919091166000908152601260205260409020805460ff1916911515919091179055565b6000600460009054906101000a90046001600160a01b03166001600160a01b031663a8d936276040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf457600080fd5b505afa158015610d08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2c9190612086565b905090565b600061076f3384846113be565b610d46611079565b601154610100900460ff1615610d6e5760405162461bcd60e51b81526004016106b2906121b1565b610d7a33338484611809565b610d846001600055565b5050565b610d90611079565b601154610100900460ff1615610db85760405162461bcd60e51b81526004016106b2906121b1565b610d7a3383833361112d565b6001546001600160a01b03163314610dee5760405162461bcd60e51b81526004016106b290612182565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b03163314610e3a5760405162461bcd60e51b81526004016106b290612182565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6000600460009054906101000a90046001600160a01b03166001600160a01b031663f7c618c16040518163ffffffff1660e01b815260040160206040518083038186803b158015610eb557600080fd5b505afa158015610ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2c9190611dda565b6106cf8363a9059cbb60e01b8484604051602401610f0c9291906120bb565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261193e565b6001600160a01b038316610fae5760405162461bcd60e51b815260206004820152602c60248201527f526577617264547261636b65723a20617070726f76652066726f6d207468652060448201526b7a65726f206164647265737360a01b60648201526084016106b2565b6001600160a01b0382166110175760405162461bcd60e51b815260206004820152602a60248201527f526577617264547261636b65723a20617070726f766520746f20746865207a65604482015269726f206164647265737360b01b60648201526084016106b2565b6001600160a01b038381166000818152600a602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b600260005414156110cc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b2565b6002600055565b3360009081526012602052604090205460ff1661095b5760405162461bcd60e51b81526020600482015260186024820152772932bbb0b9322a3930b1b5b2b91d103337b93134b23232b760411b60448201526064016106b2565b6000821161114d5760405162461bcd60e51b81526004016106b290612107565b6001600160a01b03831660009081526005602052604090205460ff166111855760405162461bcd60e51b81526004016106b29061213e565b61118e84611581565b6001600160a01b0384166000908152600c60205260409020548281101561120b5760405162461bcd60e51b815260206004820152602b60248201527f526577617264547261636b65723a205f616d6f756e742065786365656473207360448201526a1d185ad959105b5bdd5b9d60aa1b60648201526084016106b2565b61121581846117fd565b6001600160a01b038087166000908152600c6020908152604080832094909455600681528382209288168252919091522054838110156112ad5760405162461bcd60e51b815260206004820152602d60248201527f526577617264547261636b65723a205f616d6f756e742065786365656473206460448201526c65706f73697442616c616e636560981b60648201526084016106b2565b6112b781856117fd565b6001600160a01b038088166000908152600660209081526040808320938a1683529281528282209390935560079092529020546112f490856117fd565b6001600160a01b0386166000908152600760205260409020556113178685611a13565b61132b6001600160a01b0386168486610eed565b505050505050565b600061133e83611581565b6001600160a01b0383166000908152600d60205260408120805491905580156108f25761137e838261136e610e65565b6001600160a01b03169190610eed565b7f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d484826040516113af9291906120bb565b60405180910390a19392505050565b6001600160a01b03831661142a5760405162461bcd60e51b815260206004820152602d60248201527f526577617264547261636b65723a207472616e736665722066726f6d2074686560448201526c207a65726f206164647265737360981b60648201526084016106b2565b6001600160a01b0382166114945760405162461bcd60e51b815260206004820152602b60248201527f526577617264547261636b65723a207472616e7366657220746f20746865207a60448201526a65726f206164647265737360a81b60648201526084016106b2565b60115460ff16156114a7576114a76110d3565b6114e4816040518060600160405280602e81526020016123c7602e91396001600160a01b0386166000908152600960205260409020549190611555565b6001600160a01b03808516600090815260096020526040808220939093559084168152205461151390826117f1565b6001600160a01b0380841660008181526009602052604090819020939093559151908516906000805160206123778339815191529061106c9085815260200190565b600081848411156115795760405162461bcd60e51b81526004016106b291906120d4565b505050900390565b6000600460009054906101000a90046001600160a01b03166001600160a01b031663e4fc6b6d6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156115d357600080fd5b505af11580156115e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160b9190612086565b600854600b549192509081158015906116245750600083115b156116555761164d61164683610a938668327cb2734119d3b7a9601e1b6117d9565b82906117f1565b600b81905590505b806116605750505050565b6001600160a01b0384161561079f576001600160a01b0384166000908152600c6020908152604080832054600e9092528220549091906116be9068327cb2734119d3b7a9601e1b90610a93906116b79087906117fd565b85906117d9565b6001600160a01b0387166000908152600d6020526040812054919250906116e590836117f1565b6001600160a01b0388166000908152600d60209081526040808320849055600e90915290208590559050801580159061173557506001600160a01b0387166000908152600c602052604090205415155b156117d0576001600160a01b0387166000908152600f602052604081205461175d90846117f1565b90506117aa61177082610a9387876117d9565b6001600160a01b038a166000908152600f60209081526040808320546010909252909120546117a4918591610a93916117d9565b906117f1565b6001600160a01b038916600090815260106020908152604080832093909355600f905220555b50505050505050565b60006108f2828461222c565b60006108f2828461220a565b60006108f282846121f2565b60006108f2828461224b565b600081116118295760405162461bcd60e51b81526004016106b290612107565b6001600160a01b03821660009081526005602052604090205460ff166118615760405162461bcd60e51b81526004016106b29061213e565b6118766001600160a01b038316853084611b15565b61187f83611581565b6001600160a01b0383166000908152600c60205260409020546118a290826117f1565b6001600160a01b038085166000908152600c60209081526040808320949094556006815283822092861682529190915220546118de90826117f1565b6001600160a01b038085166000908152600660209081526040808320938716835292815282822093909355600790925290205461191b90826117f1565b6001600160a01b03831660009081526007602052604090205561079f8382611b4d565b6000611993826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c259092919063ffffffff16565b90508051600014806119b45750808060200190518101906119b49190612069565b6106cf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106b2565b6001600160a01b038216611a7b5760405162461bcd60e51b815260206004820152602960248201527f526577617264547261636b65723a206275726e2066726f6d20746865207a65726044820152686f206164647265737360b81b60648201526084016106b2565b611ab8816040518060600160405280602a815260200161234d602a91396001600160a01b0385166000908152600960205260409020549190611555565b6001600160a01b038316600090815260096020526040902055600854611ade90826117fd565b6008556040518181526000906001600160a01b03841690600080516020612377833981519152906020015b60405180910390a35050565b6040516001600160a01b038085166024830152831660448201526064810182905261079f9085906323b872dd60e01b90608401610f0c565b6001600160a01b038216611bb35760405162461bcd60e51b815260206004820152602760248201527f526577617264547261636b65723a206d696e7420746f20746865207a65726f206044820152666164647265737360c81b60648201526084016106b2565b600854611bc090826117f1565b6008556001600160a01b038216600090815260096020526040902054611be690826117f1565b6001600160a01b03831660008181526009602052604080822093909355915190919060008051602061237783398151915290611b099085815260200190565b6060611c348484600085611c3c565b949350505050565b606082471015611c9d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106b2565b600080866001600160a01b03168587604051611cb9919061209f565b60006040518083038185875af1925050503d8060008114611cf6576040519150601f19603f3d011682016040523d82523d6000602084013e611cfb565b606091505b5091509150611d0c87838387611d17565b979650505050505050565b60608315611d83578251611d7c576001600160a01b0385163b611d7c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106b2565b5081611c34565b611c348383815115611d985781518083602001fd5b8060405162461bcd60e51b81526004016106b291906120d4565b803561085a81612326565b600060208284031215611dcf57600080fd5b81356108f281612326565b600060208284031215611dec57600080fd5b81516108f281612326565b60008060408385031215611e0a57600080fd5b8235611e1581612326565b91506020830135611e2581612326565b809150509250929050565b60008060008060808587031215611e4657600080fd5b8435611e5181612326565b93506020850135611e6181612326565b92506040850135611e7181612326565b9396929550929360600135925050565b600080600060608486031215611e9657600080fd5b8335611ea181612326565b92506020840135611eb181612326565b929592945050506040919091013590565b60008060008060808587031215611ed857600080fd5b8435611ee381612326565b93506020850135611ef381612326565b9250604085013591506060850135611f0a81612326565b939692955090935050565b60008060408385031215611f2857600080fd5b8235611f3381612326565b91506020830135611e258161233e565b60008060408385031215611f5657600080fd5b8235611f6181612326565b946020939093013593505050565b60008060408385031215611f8257600080fd5b82356001600160401b0380821115611f9957600080fd5b818501915085601f830112611fad57600080fd5b8135602082821115611fc157611fc1612310565b8160051b604051601f19603f83011681018181108682111715611fe657611fe6612310565b604052838152828101945085830182870184018b101561200557600080fd5b600096505b8487101561202f5761201b81611db2565b86526001969096019594830194830161200a565b50965061203f9050878201611db2565b9450505050509250929050565b60006020828403121561205e57600080fd5b81356108f28161233e565b60006020828403121561207b57600080fd5b81516108f28161233e565b60006020828403121561209857600080fd5b5051919050565b600082516120b1818460208701612262565b9190910192915050565b6001600160a01b03929092168252602082015260400190565b60208152600082518060208401526120f3816040850160208701612262565b601f01601f19169190910160400192915050565b6020808252601e908201527f526577617264547261636b65723a20696e76616c6964205f616d6f756e740000604082015260600190565b60208082526024908201527f526577617264547261636b65723a20696e76616c6964205f6465706f7369745460408201526337b5b2b760e11b606082015260800190565b60208082526015908201527423b7bb32b93730b136329d103337b93134b23232b760591b604082015260600190565b60208082526021908201527f526577617264547261636b65723a20616374696f6e206e6f7420656e61626c656040820152601960fa1b606082015260800190565b60008219821115612205576122056122e4565b500190565b60008261222757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612246576122466122e4565b500290565b60008282101561225d5761225d6122e4565b500390565b60005b8381101561227d578181015183820152602001612265565b8381111561079f5750506000910152565b600181811c908216806122a257607f821691505b602082108114156122c357634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156122dd576122dd6122e4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461233b57600080fd5b50565b801515811461233b57600080fdfe526577617264547261636b65723a206275726e20616d6f756e7420657863656564732062616c616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef526577617264547261636b65723a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365526577617264547261636b65723a207472616e7366657220616d6f756e7420657863656564732062616c616e6365a2646970667358221220e723f8f0900db65d5e4cabd04135373519ec83dd493e0abdfb7e0f0492f0c4b264736f6c634300080700330000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000135374616b6564202b20426f6e75732047504c58000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006736247504c580000000000000000000000000000000000000000000000000000

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106102255760003560e01c806301e336671461022a57806306fdde031461023f578063095ea7b31461025d578063098bf59d1461028057806310c1c10314610293578063126082cf146102c157806312d43a51146102ca57806313e82e7a146102f557806318160ddd146103085780631d30d5bc146103115780631e83409a1461032457806323b872dd1461033757806327e235e31461034a578063313ce5671461036a5780633792def314610384578063392e53cd146103a45780633cd7f700146103b85780633e158b0c146103cb578063402914f5146103d357806344a08411146103e6578063462d0b2e1461040657806346ea87af14610419578063552ce1dc1461043c57806355b6ed5c1461045c5780635a47a1a71461048757806370a082311461049a578063790b5a6c146104c357806395d89b41146104d65780639cb7de4b146104de578063a3180217146104f1578063a8d9362714610511578063a9059cbb14610519578063aaf5eb681461052c578063adc9772e1461053f578063b89e45b314610552578063bfe1092814610575578063c2a672e014610588578063c5fa27301461059b578063cfad57a2146105ad578063dd62ed3e146105c0578063dfbaefb1146105f9578063e44b755814610606578063e950342514610619578063f5d9d63e14610639578063f5fc507614610664578063f76033d31461066d578063f7c618c114610680575b600080fd5b61023d610238366004611e81565b610688565b005b6102476106d4565b60405161025491906120d4565b60405180910390f35b61027061026b366004611f43565b610762565b6040519015158152602001610254565b61023d61028e366004611ec2565b610779565b6102b36102a1366004611dbd565b600c6020526000908152604090205481565b604051908152602001610254565b6102b361271081565b6001546102dd906001600160a01b031681565b6040516001600160a01b039091168152602001610254565b6102b3610303366004611df7565b6107a5565b6102b360085481565b61023d61031f36600461204c565b6107cd565b6102b3610332366004611dbd565b610811565b610270610345366004611e81565b61085f565b6102b3610358366004611dbd565b60096020526000908152604090205481565b610372601281565b60405160ff9091168152602001610254565b6102b3610392366004611dbd565b600f6020526000908152604090205481565b60015461027090600160a01b900460ff1681565b61023d6103c636600461204c565b6108f9565b61023d61093f565b6102b36103e1366004611dbd565b61095d565b6102b36103f4366004611dbd565b600e6020526000908152604090205481565b61023d610414366004611f6f565b610ac2565b610270610427366004611dbd565b60126020526000908152604090205460ff1681565b6102b361044a366004611dbd565b60076020526000908152604090205481565b6102b361046a366004611df7565b600a60209081526000928352604080842090915290825290205481565b61023d61049536600461204c565b610be9565b6102b36104a8366004611dbd565b6001600160a01b031660009081526009602052604090205490565b61023d6104d1366004611e30565b610c26565b610247610c42565b61023d6104ec366004611f15565b610c4f565b6102b36104ff366004611dbd565b60106020526000908152604090205481565b6102b3610ca4565b610270610527366004611f43565b610d31565b6102b368327cb2734119d3b7a9601e1b81565b61023d61054d366004611f43565b610d3e565b610270610560366004611dbd565b60056020526000908152604090205460ff1681565b6004546102dd906001600160a01b031681565b61023d610596366004611f43565b610d88565b60115461027090610100900460ff1681565b61023d6105bb366004611dbd565b610dc4565b6102b36105ce366004611df7565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b6011546102709060ff1681565b61023d610614366004611f15565b610e10565b6102b3610627366004611dbd565b600d6020526000908152604090205481565b6102b3610647366004611df7565b600660209081526000928352604080842090915290825290205481565b6102b3600b5481565b6011546102709062010000900460ff1681565b6102dd610e65565b6001546001600160a01b031633146106bb5760405162461bcd60e51b81526004016106b290612182565b60405180910390fd5b6106cf6001600160a01b0384168383610eed565b505050565b600280546106e19061228e565b80601f016020809104026020016040519081016040528092919081815260200182805461070d9061228e565b801561075a5780601f1061072f5761010080835404028352916020019161075a565b820191906000526020600020905b81548152906001019060200180831161073d57829003601f168201915b505050505081565b600061076f338484610f43565b5060015b92915050565b610781611079565b6107896110d3565b6107958484848461112d565b61079f6001600055565b50505050565b60006107af611079565b6107b76110d3565b6107c18383611333565b90506107736001600055565b6001546001600160a01b031633146107f75760405162461bcd60e51b81526004016106b290612182565b601180549115156101000261ff0019909216919091179055565b600061081b611079565b60115462010000900460ff16156108445760405162461bcd60e51b81526004016106b2906121b1565b61084e3383611333565b905061085a6001600055565b919050565b3360009081526012602052604081205460ff161561088a576108828484846113be565b5060016108f2565b60006108d483604051806060016040528060308152602001612397603091396001600160a01b0388166000908152600a602090815260408083203384529091529020549190611555565b90506108e1853383610f43565b6108ec8585856113be565b60019150505b9392505050565b6001546001600160a01b031633146109235760405162461bcd60e51b81526004016106b290612182565b60118054911515620100000262ff000019909216919091179055565b610947611079565b6109516000611581565b61095b6001600055565b565b6001600160a01b0381166000908152600c6020526040812054806109985750506001600160a01b03166000908152600d602052604090205490565b60085460048054604080516376f69fed60e11b81529051600093610a319368327cb2734119d3b7a9601e1b936001600160a01b039091169263eded3fda92828101926020929190829003018186803b1580156109f357600080fd5b505afa158015610a07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2b9190612086565b906117d9565b90506000610a4b610a4283856117e5565b600b54906117f1565b6001600160a01b0387166000908152600e6020526040902054909150610ab890610a999068327cb2734119d3b7a9601e1b90610a9390610a8c9086906117fd565b88906117d9565b906117e5565b6001600160a01b0388166000908152600d6020526040902054906117f1565b9695505050505050565b6001546001600160a01b03163314610aec5760405162461bcd60e51b81526004016106b290612182565b600154600160a01b900460ff1615610b515760405162461bcd60e51b815260206004820152602260248201527f526577617264547261636b65723a20616c726561647920696e697469616c697a604482015261195960f21b60648201526084016106b2565b6001805460ff60a01b1916600160a01b17905560005b8251811015610bc5576000838281518110610b8457610b846122fa565b6020908102919091018101516001600160a01b03166000908152600590915260409020805460ff191660011790555080610bbd816122c9565b915050610b67565b50600480546001600160a01b0319166001600160a01b039290921691909117905550565b6001546001600160a01b03163314610c135760405162461bcd60e51b81526004016106b290612182565b6011805460ff1916911515919091179055565b610c2e611079565b610c366110d3565b61079584848484611809565b600380546106e19061228e565b6001546001600160a01b03163314610c795760405162461bcd60e51b81526004016106b290612182565b6001600160a01b03919091166000908152601260205260409020805460ff1916911515919091179055565b6000600460009054906101000a90046001600160a01b03166001600160a01b031663a8d936276040518163ffffffff1660e01b815260040160206040518083038186803b158015610cf457600080fd5b505afa158015610d08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2c9190612086565b905090565b600061076f3384846113be565b610d46611079565b601154610100900460ff1615610d6e5760405162461bcd60e51b81526004016106b2906121b1565b610d7a33338484611809565b610d846001600055565b5050565b610d90611079565b601154610100900460ff1615610db85760405162461bcd60e51b81526004016106b2906121b1565b610d7a3383833361112d565b6001546001600160a01b03163314610dee5760405162461bcd60e51b81526004016106b290612182565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b03163314610e3a5760405162461bcd60e51b81526004016106b290612182565b6001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b6000600460009054906101000a90046001600160a01b03166001600160a01b031663f7c618c16040518163ffffffff1660e01b815260040160206040518083038186803b158015610eb557600080fd5b505afa158015610ec9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2c9190611dda565b6106cf8363a9059cbb60e01b8484604051602401610f0c9291906120bb565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261193e565b6001600160a01b038316610fae5760405162461bcd60e51b815260206004820152602c60248201527f526577617264547261636b65723a20617070726f76652066726f6d207468652060448201526b7a65726f206164647265737360a01b60648201526084016106b2565b6001600160a01b0382166110175760405162461bcd60e51b815260206004820152602a60248201527f526577617264547261636b65723a20617070726f766520746f20746865207a65604482015269726f206164647265737360b01b60648201526084016106b2565b6001600160a01b038381166000818152600a602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b600260005414156110cc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016106b2565b6002600055565b3360009081526012602052604090205460ff1661095b5760405162461bcd60e51b81526020600482015260186024820152772932bbb0b9322a3930b1b5b2b91d103337b93134b23232b760411b60448201526064016106b2565b6000821161114d5760405162461bcd60e51b81526004016106b290612107565b6001600160a01b03831660009081526005602052604090205460ff166111855760405162461bcd60e51b81526004016106b29061213e565b61118e84611581565b6001600160a01b0384166000908152600c60205260409020548281101561120b5760405162461bcd60e51b815260206004820152602b60248201527f526577617264547261636b65723a205f616d6f756e742065786365656473207360448201526a1d185ad959105b5bdd5b9d60aa1b60648201526084016106b2565b61121581846117fd565b6001600160a01b038087166000908152600c6020908152604080832094909455600681528382209288168252919091522054838110156112ad5760405162461bcd60e51b815260206004820152602d60248201527f526577617264547261636b65723a205f616d6f756e742065786365656473206460448201526c65706f73697442616c616e636560981b60648201526084016106b2565b6112b781856117fd565b6001600160a01b038088166000908152600660209081526040808320938a1683529281528282209390935560079092529020546112f490856117fd565b6001600160a01b0386166000908152600760205260409020556113178685611a13565b61132b6001600160a01b0386168486610eed565b505050505050565b600061133e83611581565b6001600160a01b0383166000908152600d60205260408120805491905580156108f25761137e838261136e610e65565b6001600160a01b03169190610eed565b7f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d484826040516113af9291906120bb565b60405180910390a19392505050565b6001600160a01b03831661142a5760405162461bcd60e51b815260206004820152602d60248201527f526577617264547261636b65723a207472616e736665722066726f6d2074686560448201526c207a65726f206164647265737360981b60648201526084016106b2565b6001600160a01b0382166114945760405162461bcd60e51b815260206004820152602b60248201527f526577617264547261636b65723a207472616e7366657220746f20746865207a60448201526a65726f206164647265737360a81b60648201526084016106b2565b60115460ff16156114a7576114a76110d3565b6114e4816040518060600160405280602e81526020016123c7602e91396001600160a01b0386166000908152600960205260409020549190611555565b6001600160a01b03808516600090815260096020526040808220939093559084168152205461151390826117f1565b6001600160a01b0380841660008181526009602052604090819020939093559151908516906000805160206123778339815191529061106c9085815260200190565b600081848411156115795760405162461bcd60e51b81526004016106b291906120d4565b505050900390565b6000600460009054906101000a90046001600160a01b03166001600160a01b031663e4fc6b6d6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156115d357600080fd5b505af11580156115e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160b9190612086565b600854600b549192509081158015906116245750600083115b156116555761164d61164683610a938668327cb2734119d3b7a9601e1b6117d9565b82906117f1565b600b81905590505b806116605750505050565b6001600160a01b0384161561079f576001600160a01b0384166000908152600c6020908152604080832054600e9092528220549091906116be9068327cb2734119d3b7a9601e1b90610a93906116b79087906117fd565b85906117d9565b6001600160a01b0387166000908152600d6020526040812054919250906116e590836117f1565b6001600160a01b0388166000908152600d60209081526040808320849055600e90915290208590559050801580159061173557506001600160a01b0387166000908152600c602052604090205415155b156117d0576001600160a01b0387166000908152600f602052604081205461175d90846117f1565b90506117aa61177082610a9387876117d9565b6001600160a01b038a166000908152600f60209081526040808320546010909252909120546117a4918591610a93916117d9565b906117f1565b6001600160a01b038916600090815260106020908152604080832093909355600f905220555b50505050505050565b60006108f2828461222c565b60006108f2828461220a565b60006108f282846121f2565b60006108f2828461224b565b600081116118295760405162461bcd60e51b81526004016106b290612107565b6001600160a01b03821660009081526005602052604090205460ff166118615760405162461bcd60e51b81526004016106b29061213e565b6118766001600160a01b038316853084611b15565b61187f83611581565b6001600160a01b0383166000908152600c60205260409020546118a290826117f1565b6001600160a01b038085166000908152600c60209081526040808320949094556006815283822092861682529190915220546118de90826117f1565b6001600160a01b038085166000908152600660209081526040808320938716835292815282822093909355600790925290205461191b90826117f1565b6001600160a01b03831660009081526007602052604090205561079f8382611b4d565b6000611993826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611c259092919063ffffffff16565b90508051600014806119b45750808060200190518101906119b49190612069565b6106cf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016106b2565b6001600160a01b038216611a7b5760405162461bcd60e51b815260206004820152602960248201527f526577617264547261636b65723a206275726e2066726f6d20746865207a65726044820152686f206164647265737360b81b60648201526084016106b2565b611ab8816040518060600160405280602a815260200161234d602a91396001600160a01b0385166000908152600960205260409020549190611555565b6001600160a01b038316600090815260096020526040902055600854611ade90826117fd565b6008556040518181526000906001600160a01b03841690600080516020612377833981519152906020015b60405180910390a35050565b6040516001600160a01b038085166024830152831660448201526064810182905261079f9085906323b872dd60e01b90608401610f0c565b6001600160a01b038216611bb35760405162461bcd60e51b815260206004820152602760248201527f526577617264547261636b65723a206d696e7420746f20746865207a65726f206044820152666164647265737360c81b60648201526084016106b2565b600854611bc090826117f1565b6008556001600160a01b038216600090815260096020526040902054611be690826117f1565b6001600160a01b03831660008181526009602052604080822093909355915190919060008051602061237783398151915290611b099085815260200190565b6060611c348484600085611c3c565b949350505050565b606082471015611c9d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016106b2565b600080866001600160a01b03168587604051611cb9919061209f565b60006040518083038185875af1925050503d8060008114611cf6576040519150601f19603f3d011682016040523d82523d6000602084013e611cfb565b606091505b5091509150611d0c87838387611d17565b979650505050505050565b60608315611d83578251611d7c576001600160a01b0385163b611d7c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016106b2565b5081611c34565b611c348383815115611d985781518083602001fd5b8060405162461bcd60e51b81526004016106b291906120d4565b803561085a81612326565b600060208284031215611dcf57600080fd5b81356108f281612326565b600060208284031215611dec57600080fd5b81516108f281612326565b60008060408385031215611e0a57600080fd5b8235611e1581612326565b91506020830135611e2581612326565b809150509250929050565b60008060008060808587031215611e4657600080fd5b8435611e5181612326565b93506020850135611e6181612326565b92506040850135611e7181612326565b9396929550929360600135925050565b600080600060608486031215611e9657600080fd5b8335611ea181612326565b92506020840135611eb181612326565b929592945050506040919091013590565b60008060008060808587031215611ed857600080fd5b8435611ee381612326565b93506020850135611ef381612326565b9250604085013591506060850135611f0a81612326565b939692955090935050565b60008060408385031215611f2857600080fd5b8235611f3381612326565b91506020830135611e258161233e565b60008060408385031215611f5657600080fd5b8235611f6181612326565b946020939093013593505050565b60008060408385031215611f8257600080fd5b82356001600160401b0380821115611f9957600080fd5b818501915085601f830112611fad57600080fd5b8135602082821115611fc157611fc1612310565b8160051b604051601f19603f83011681018181108682111715611fe657611fe6612310565b604052838152828101945085830182870184018b101561200557600080fd5b600096505b8487101561202f5761201b81611db2565b86526001969096019594830194830161200a565b50965061203f9050878201611db2565b9450505050509250929050565b60006020828403121561205e57600080fd5b81356108f28161233e565b60006020828403121561207b57600080fd5b81516108f28161233e565b60006020828403121561209857600080fd5b5051919050565b600082516120b1818460208701612262565b9190910192915050565b6001600160a01b03929092168252602082015260400190565b60208152600082518060208401526120f3816040850160208701612262565b601f01601f19169190910160400192915050565b6020808252601e908201527f526577617264547261636b65723a20696e76616c6964205f616d6f756e740000604082015260600190565b60208082526024908201527f526577617264547261636b65723a20696e76616c6964205f6465706f7369745460408201526337b5b2b760e11b606082015260800190565b60208082526015908201527423b7bb32b93730b136329d103337b93134b23232b760591b604082015260600190565b60208082526021908201527f526577617264547261636b65723a20616374696f6e206e6f7420656e61626c656040820152601960fa1b606082015260800190565b60008219821115612205576122056122e4565b500190565b60008261222757634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615612246576122466122e4565b500290565b60008282101561225d5761225d6122e4565b500390565b60005b8381101561227d578181015183820152602001612265565b8381111561079f5750506000910152565b600181811c908216806122a257607f821691505b602082108114156122c357634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156122dd576122dd6122e4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461233b57600080fd5b50565b801515811461233b57600080fdfe526577617264547261636b65723a206275726e20616d6f756e7420657863656564732062616c616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef526577617264547261636b65723a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365526577617264547261636b65723a207472616e7366657220616d6f756e7420657863656564732062616c616e6365a2646970667358221220e723f8f0900db65d5e4cabd04135373519ec83dd493e0abdfb7e0f0492f0c4b264736f6c63430008070033