ETH Price: $3,244.38 (-0.18%)

Contract

0x726FF99C3f2aa0B0debadE809D2Ac75C5DfA3736
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw213598932024-12-08 19:34:1132 days ago1733686451IN
0x726FF99C...C5DfA3736
0 ETH0.0029011313.7
Exit197114622024-04-22 14:13:35263 days ago1713795215IN
0x726FF99C...C5DfA3736
0 ETH0.0032028317.69631617
Withdraw194638082024-03-18 19:38:47297 days ago1710790727IN
0x726FF99C...C5DfA3736
0 ETH0.0071878139.69129164
Exit189178902024-01-02 6:22:47374 days ago1704176567IN
0x726FF99C...C5DfA3736
0 ETH0.0018520812.8
Get Reward189178902024-01-02 6:22:47374 days ago1704176567IN
0x726FF99C...C5DfA3736
0 ETH0.0019435212.8
Exit187811702023-12-14 1:39:59393 days ago1702517999IN
0x726FF99C...C5DfA3736
0 ETH0.0077699742.9306557
Exit186055332023-11-19 11:22:59418 days ago1700392979IN
0x726FF99C...C5DfA3736
0 ETH0.003607218.21000008
Exit185209712023-11-07 15:28:23430 days ago1699370903IN
0x726FF99C...C5DfA3736
0 ETH0.0071493439.50154057
Exit181330672023-09-14 7:35:47484 days ago1694676947IN
0x726FF99C...C5DfA3736
0 ETH0.0019700510.88492769
Exit179486292023-08-19 11:49:35510 days ago1692445775IN
0x726FF99C...C5DfA3736
0 ETH0.0021159311.69095884
Exit170933642023-04-21 7:43:35630 days ago1682063015IN
0x726FF99C...C5DfA3736
0 ETH0.0069728438.52635148
Exit168650122023-03-19 23:25:47662 days ago1679268347IN
0x726FF99C...C5DfA3736
0 ETH0.0040503920.44736332
Exit168323392023-03-15 9:13:47667 days ago1678871627IN
0x726FF99C...C5DfA3736
0 ETH0.0046422523.43520168
Exit167401172023-03-02 9:53:35680 days ago1677750815IN
0x726FF99C...C5DfA3736
0 ETH0.0036577320.12397037
Exit166014502023-02-10 22:50:11699 days ago1676069411IN
0x726FF99C...C5DfA3736
0 ETH0.0047122322.569496
Get Reward165970282023-02-10 8:01:23700 days ago1676016083IN
0x726FF99C...C5DfA3736
0 ETH0.0049104829.45278661
Exit165970252023-02-10 8:00:47700 days ago1676016047IN
0x726FF99C...C5DfA3736
0 ETH0.0048496323.22754974
Exit165348192023-02-01 15:20:23709 days ago1675264823IN
0x726FF99C...C5DfA3736
0 ETH0.003887420.27984917
Exit164919312023-01-26 15:37:35715 days ago1674747455IN
0x726FF99C...C5DfA3736
0 ETH0.0056408926.83623216
Exit157310072022-10-12 9:01:59821 days ago1665565319IN
0x726FF99C...C5DfA3736
0 ETH0.003675113.48443671
Get Reward153821042022-08-21 5:27:14873 days ago1661059634IN
0x726FF99C...C5DfA3736
0 ETH0.000650382.6256278
Exit153313002022-08-13 4:30:17881 days ago1660365017IN
0x726FF99C...C5DfA3736
0 ETH0.0054427121.90799576
Exit152909122022-08-06 20:35:20887 days ago1659818120IN
0x726FF99C...C5DfA3736
0 ETH0.001425085.7038819
Exit151309072022-07-12 23:44:09912 days ago1657669449IN
0x726FF99C...C5DfA3736
0 ETH0.0028603211.23421215
Get Reward151307812022-07-12 23:18:03912 days ago1657667883IN
0x726FF99C...C5DfA3736
0 ETH0.0029434213.56605852
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MultiplierPool

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
File 1 of 16 : MultiplierPool.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity =0.7.6;
pragma abicoder v2;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "synthetix/contracts/interfaces/IStakingRewards.sol";

import "../interfaces/multiplier/IMultiStake.sol";

import "./MultiplierMath.sol";
import "./FundablePool.sol";

/**
 * @title Multiplier Pool for Float Protocol
 * @dev The Multiplier Pool provides `rewardTokens` for `stakeTokens` with a
 * token-over-time distribution, with the function being equal to their
 * "stake-seconds" divided by the global "stake-seconds".
 * This is designed to align token distribution with long term stakers.
 * The longer the hold, the higher the proportion of the pool; and the higher
 * the multiplier.
 *
 * THIS DOES NOT WORK WITH FEE TOKENS / REBASING TOKENS - Use Token Geyser V2 instead.
 *
 * This contract was only possible due to a number of existing
 * open-source contracts including:
 * - The original [Synthetix rewards contract](https://etherscan.io/address/0xDCB6A51eA3CA5d3Fd898Fd6564757c7aAeC3ca92#code) developed by k06a
 * - Ampleforth's Token Geyser [V1](https://github.com/ampleforth/token-geyser) and [V2](https://github.com/ampleforth/token-geyser-v2)
 * - [GYSR.io Token Geyser](https://github.com/gysr-io/core)
 * - [Alchemist's Aludel](https://github.com/alchemistcoin/alchemist/tree/main/contracts/aludel)
 */
contract MultiplierPool is
  IMultiStake,
  AccessControl,
  MultiplierMath,
  FundablePool
{
  using SafeMath for uint256;
  using SafeERC20 for IERC20;

  /* ========== CONSTANTS ========== */
  bytes32 public constant RECOVER_ROLE = keccak256("RECOVER_ROLE");
  bytes32 public constant ADJUSTER_ROLE = keccak256("ADJUSTER_ROLE");

  /* ========== STATE VARIABLES ========== */
  IERC20 public immutable stakeToken;

  IBonusScaling.BonusScaling public bonusScaling;

  uint256 public hardLockPeriod;

  uint256 public lastUpdateTime;

  /// @dev {cached} total staked
  uint256 internal _totalStaked;

  /// @dev {cached} total staked seconds
  uint256 internal _totalStakeSeconds;

  struct UserData {
    // [eD] {cached} total stake from individual stakes
    uint256 totalStake;
    Stake[] stakes;
  }

  mapping(address => UserData) internal _users;

  /* ========== CONSTRUCTOR ========== */

  /**
   * @notice Construct a new MultiplierPool
   * @param _admin The default role controller
   * @param _funder The reward distributor
   * @param _rewardToken The reward token to distribute
   * @param _stakingToken The staking token used to qualify for rewards
   * @param _bonusScaling The starting bonus scaling amount
   * @param _hardLockPeriod The period for a hard lock to apply (no unstake)
   */
  constructor(
    address _admin,
    address _funder,
    address _rewardToken,
    address _stakingToken,
    IBonusScaling.BonusScaling memory _bonusScaling,
    uint256 _hardLockPeriod
  ) FundablePool(_funder, _rewardToken) {
    stakeToken = IERC20(_stakingToken);
    bonusScaling = _bonusScaling;
    hardLockPeriod = _hardLockPeriod;

    _setupRole(DEFAULT_ADMIN_ROLE, _admin);
    _setupRole(ADJUSTER_ROLE, _admin);
    _setupRole(RECOVER_ROLE, _admin);
  }

  /* ========== EVENTS ========== */

  event Staked(address indexed user, uint256 amount);
  event Withdrawn(address indexed user, uint256 amount);
  event Recovered(address token, uint256 amount);

  /* ========== VIEWS ========== */

  /**
   * @notice The total reward producing staked supply (total quantity to distribute)
   */
  function totalSupply() public view virtual returns (uint256) {
    return _totalStaked;
  }

  function getUserData(address user)
    external
    view
    returns (UserData memory userData)
  {
    return _users[user];
  }

  function getCurrentTotalStakeSeconds() public view returns (uint256) {
    return getFutureTotalStakeSeconds(block.timestamp);
  }

  function getFutureTotalStakeSeconds(uint256 timestamp)
    public
    view
    returns (uint256 totalStakeSeconds)
  {
    totalStakeSeconds = calculateTotalStakeSeconds(
      _totalStaked,
      _totalStakeSeconds,
      lastUpdateTime,
      timestamp
    );
  }

  /**
   * @notice The total staked balance of the staker.
   */
  function balanceOf(address staker) public view virtual returns (uint256) {
    return _users[staker].totalStake;
  }

  function earned(address staker) external view virtual returns (uint256) {
    UnstakeOutput memory out =
      simulateUnstake(
        _users[staker].stakes,
        balanceOf(staker),
        getCurrentTotalStakeSeconds(),
        unlockedRewardAmount().add(pendingRewardAmount(block.timestamp)),
        block.timestamp,
        bonusScaling
      );
    return out.rewardDue;
  }

  /* ========== MUTATIVE FUNCTIONS ========== */

  /**
   * @notice Stakes `amount` tokens from `msg.sender`
   *
   * Emits a {Staked} event.
   * Can emit a {RewardsUnlocked} event if additional rewards are now available.
   */
  function stake(uint256 amount) external virtual {
    _update();
    _stakeFor(msg.sender, msg.sender, amount);
  }

  /**
   * @notice Stakes `amount` tokens from `msg.sender` on behalf of `staker`
   *
   * Emits a {Staked} event.
   * Can emit a {RewardsUnlocked} event if additional rewards are now available.
   */
  function stakeFor(address staker, uint256 amount) external virtual {
    _update();
    _stakeFor(msg.sender, staker, amount);
  }

  /**
   * @notice Withdraw an `amount` from the pool including any rewards due for that stake
   *
   * Emits a {Withdrawn} event.
   * Can emit a {RewardsPaid} event if due rewards.
   * Can emit a {RewardsUnlocked} event if additional rewards are now available.
   */
  function withdraw(uint256 amount) external virtual {
    _update();
    _unstake(msg.sender, amount);
  }

  /**
   * @notice Exit the pool, taking any rewards due and any staked tokens
   *
   * Emits a {Withdrawn} event.
   * Can emit a {RewardsPaid} event if due rewards.
   * Can emit a {RewardsUnlocked} event if additional rewards are now available.
   */
  function exit() external virtual {
    _update();
    _unstake(msg.sender, balanceOf(msg.sender));
  }

  /**
   * @notice Retrieve any rewards due to `msg.sender`
   *
   * Can emit a {RewardsPaid} event if due rewards.
   * Can emit a {RewardsUnlocked} event if additional rewards are now available.
   *
   * Requirements:
   * - `msg.sender` must have some tokens staked
   */
  function getReward() external virtual {
    _update();
    address staker = msg.sender;
    uint256 totalStake = balanceOf(staker);
    uint256 reward = _unstakeAccounting(staker, totalStake);
    _stakeAccounting(staker, totalStake);

    if (reward != 0) {
      _distributeRewards(staker, reward);
    }
  }

  /**
   * @dev Stakes `amount` tokens from `payer` to `staker`, increasing the total supply.
   *
   * Emits a {Staked} event.
   *
   * Requirements:
   * - `staker` cannot be zero address.
   * - `payer` must have at least `amount` tokens
   * - `payer` must approve this contract for at least `amount`
   */
  function _stakeFor(
    address payer,
    address staker,
    uint256 amount
  ) internal virtual {
    require(staker != address(0), "MultiplierPool/ZeroAddressS");
    require(amount != 0, "MultiplierPool/NoAmount");

    _beforeStake(payer, staker, amount);

    _stakeAccounting(staker, amount);

    emit Staked(staker, amount);
    stakeToken.safeTransferFrom(payer, address(this), amount);
  }

  /**
   * @dev Withdraws `amount` tokens from `staker`, reducing the total supply.
   *
   * Emits a {Withdrawn} event.
   *
   * Requirements:
   * - `staker` cannot be zero address.
   * - `staker` must have at least `amount` staked.
   */
  function _unstake(address staker, uint256 amount) internal virtual {
    // Sense check input
    require(staker != address(0), "MultiplierPool/ZeroAddressW");
    require(amount != 0, "MultiplierPool/NoAmount");

    _beforeWithdraw(staker, amount);

    uint256 reward = _unstakeAccounting(staker, amount);

    if (reward != 0) {
      _distributeRewards(staker, reward);
    }

    emit Withdrawn(staker, amount);
    stakeToken.safeTransfer(staker, amount);
  }

  /**
   * @dev Performs necessary accounting for unstake operation
   * Assumes:
   * - `staker` is a valid address
   * - `amount` is non-zero
   * - `_update` has been called (and hence `_totalStakeSeconds` / `lockedRewardAmount` / `lastUpdateTime`)
   * - `rewardDue` will be transfered to `staker` after accounting
   * - `amount` will be transfered back to `staker` after accounting
   * - `Withdraw` / `RewardsPaid` will be emitted
   *
   * State:
   * - `_users[staker].stakes` will remove entries necessary to cover amount
   * - `_users[staker].totalStake` will be decreased
   * - `_totalStaked` will be reduced by amount
   * - `_totalStakeSeconds` will be reduced by unstaked stake seconds
   * @param staker Staker address to unstake from
   * @param amount Stake Tokens to be unstaked
   */
  function _unstakeAccounting(address staker, uint256 amount)
    internal
    virtual
    returns (uint256 rewardDue)
  {
    // Fetch User storage reference
    UserData storage userData = _users[staker];

    require(userData.totalStake >= amount, "MultiplierPool/ExceedsStake");
    // {cached} value would be de-synced
    assert(_totalStaked >= amount);

    UnstakeOutput memory out =
      simulateUnstake(
        userData.stakes,
        amount,
        getCurrentTotalStakeSeconds(),
        unlockedRewardAmount(),
        block.timestamp,
        bonusScaling
      );

    // Update storage data
    if (out.newStakesCount == 0) {
      delete userData.stakes;
    } else {
      // Remove all fully unstaked amounts
      while (userData.stakes.length > out.newStakesCount) {
        userData.stakes.pop();
      }

      if (out.lastStakeAmount != 0) {
        userData.stakes[out.newStakesCount.sub(1)].amount = out.lastStakeAmount;
      }
    }

    // Update {cached} totals
    userData.totalStake = userData.totalStake.sub(amount);
    _totalStaked = _totalStaked.sub(amount);
    _totalStakeSeconds = out.newTotalStakeSeconds;

    // Calculate rewards
    rewardDue = out.rewardDue;
  }

  /**
   * @dev Performs necessary accounting for stake operation
   * Assumes:
   * - `staker` is a valid address
   * - `amount` is non-zero
   * - `_update` has been called (and hence `_totalStakeSeconds` / `lockedRewardAmount` / `lastUpdateTime` are modified)
   * - `amount` has been transfered to the contract
   *
   * State:
   * - `_users[staker].stakes` will add a new entry for amount
   * - `_users[staker].totalStake` will be increased
   * - `_totalStaked` will be increased by amount
   * @param staker Staker address to stake for
   * @param amount Stake tokens to be staked
   */
  function _stakeAccounting(address staker, uint256 amount) internal {
    UserData storage userData = _users[staker];

    // Add new stake entry
    userData.stakes.push(Stake(amount, block.timestamp));

    // Update {cached} totals
    _totalStaked = _totalStaked.add(amount);
    userData.totalStake = userData.totalStake.add(amount);
  }

  /**
   * @dev Updates the Pool to:
   * - Releases token rewards for the current timestamp
   * - Updates the `_totalStakeSeconds` for the entire `_totalStake`
   * - Set `lastUpdateTime` to be block.timestamp
   */
  function _update() internal {
    _unlockRewards();

    _totalStakeSeconds = _totalStakeSeconds.add(
      calculateStakeSeconds(_totalStaked, lastUpdateTime, block.timestamp)
    );
    lastUpdateTime = block.timestamp;
  }

  /* ========== RESTRICTED FUNCTIONS ========== */

  /* ----- FUNDER_ROLE ----- */

  /**
   * @notice Fund pool by locking up reward tokens for future distribution
   * @param amount number of reward tokens to lock up as funding
   * @param duration period (seconds) over which funding will be unlocked
   * @param start time (seconds) at which funding begins to unlock
   */
  function fund(
    uint256 amount,
    uint256 duration,
    uint256 start
  ) external onlyFunder {
    _update();
    if (rewardToken == stakeToken) {
      uint256 allowed =
        rewardToken.balanceOf(address(this)).sub(totalRewardAmount).sub(
          _totalStaked
        );

      require(allowed >= amount, "FundablePool/InsufficentBalance");
    }
    _fund(amount, duration, start);
  }

  /**
   * @notice Clean a pool by expiring old rewards
   */
  function clean() external onlyFunder {
    _cleanRewardSchedules();
  }

  /* ----- ADJUSTER_ROLE ----- */
  /**
   * @notice Modify the bonus scaling once started
   * @dev Adjusters should be timelocked.
   * @param _bonusScaling Bonus Scaling parameters (min, max, period)
   */
  function modifyBonusScaling(BonusScaling memory _bonusScaling) external {
    require(hasRole(ADJUSTER_ROLE, msg.sender), "MultiplierPool/AdjusterRole");
    bonusScaling = _bonusScaling;
  }

  /**
   * @notice Modify the hard lock (allows release after a set period)
   * @dev Adjusters should be timelocked.
   * @param _hardLockPeriod [seconds] length of time to refuse release of staked funds
   */
  function modifyHardLock(uint256 _hardLockPeriod) external {
    require(hasRole(ADJUSTER_ROLE, msg.sender), "MultiplierPool/AdjusterRole");
    hardLockPeriod = _hardLockPeriod;
  }

  /* ----- RECOVER_ROLE ----- */

  /**
   * @notice Provide accidental token retrieval.
   * @dev Sourced from synthetix/contracts/StakingRewards.sol
   */
  function recoverERC20(address tokenAddress, uint256 tokenAmount) external {
    require(hasRole(RECOVER_ROLE, msg.sender), "MultiplierPool/RecoverRole");
    require(
      tokenAddress != address(stakeToken),
      "MultiplierPool/NoRecoveryOfStake"
    );
    require(
      tokenAddress != address(rewardToken),
      "MultiplierPool/NoRecoveryOfReward"
    );

    emit Recovered(tokenAddress, tokenAmount);

    IERC20(tokenAddress).safeTransfer(msg.sender, tokenAmount);
  }

  /* ========== HOOKS ========== */

  /**
   * @dev Hook that is called before any staking of tokens.
   *
   * Calling conditions:
   *
   * - `amount` of `payer`'s tokens will be staked into the pool
   * - `staker` can withdraw.
   * N.B. this is not called on claiming rewards
   */
  function _beforeStake(
    address payer,
    address staker,
    uint256 amount
  ) internal virtual {}

  /**
   * @dev Hook that is called before any withdrawal of tokens.
   *
   * Calling conditions:
   *
   * - `amount` of ``from``'s tokens will be withdrawn into the pool
   * N.B. this is not called on claiming rewards
   */
  function _beforeWithdraw(address from, uint256) internal virtual {
    // Check hard lock - was the last stake > hardLockPeriod
    Stake[] memory userStakes = _users[from].stakes;
    Stake memory lastStake = userStakes[userStakes.length.sub(1)];
    require(
      lastStake.timestamp.add(hardLockPeriod) <= block.timestamp,
      "MultiplierPool/HardLockNotPassed"
    );
  }
}

File 2 of 16 : AccessControl.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context {
    using EnumerableSet for EnumerableSet.AddressSet;
    using Address for address;

    struct RoleData {
        EnumerableSet.AddressSet members;
        bytes32 adminRole;
    }

    mapping (bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role].members.contains(account);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view returns (uint256) {
        return _roles[role].members.length();
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view returns (address) {
        return _roles[role].members.at(index);
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to grant");

        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual {
        require(hasRole(_roles[role].adminRole, _msgSender()), "AccessControl: sender must be an admin to revoke");

        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        emit RoleAdminChanged(role, _roles[role].adminRole, adminRole);
        _roles[role].adminRole = adminRole;
    }

    function _grantRole(bytes32 role, address account) private {
        if (_roles[role].members.add(account)) {
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (_roles[role].members.remove(account)) {
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 16 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

File 4 of 16 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
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) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        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) {
        // 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) {
        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) {
        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) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @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) {
        require(b <= a, "SafeMath: subtraction overflow");
        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) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @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. 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) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        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) {
        require(b > 0, "SafeMath: modulo by zero");
        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) {
        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.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * 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) {
        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) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 5 of 16 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    using Address for address;

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

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

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

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

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

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

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

File 6 of 16 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor () internal {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 7 of 16 : IStakingRewards.sol
pragma solidity >=0.4.24;


// https://docs.synthetix.io/contracts/source/interfaces/istakingrewards
interface IStakingRewards {
    // Views
    function lastTimeRewardApplicable() external view returns (uint256);

    function rewardPerToken() external view returns (uint256);

    function earned(address account) external view returns (uint256);

    function getRewardForDuration() external view returns (uint256);

    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);

    // Mutative

    function stake(uint256 amount) external;

    function withdraw(uint256 amount) external;

    function getReward() external;

    function exit() external;
}

File 8 of 16 : IMultiStake.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

interface IMultiStake {
  struct Stake {
    // [e18] Staked token amount
    uint256 amount;
    // [seconds] block timestamp at point of stake
    uint256 timestamp;
  }
}

File 9 of 16 : MultiplierMath.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity =0.7.6;

import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "../../external-lib/SafeDecimalMath.sol";

import "../interfaces/multiplier/IMultiStake.sol";
import "../interfaces/multiplier/IBonusScaling.sol";

contract MultiplierMath is IBonusScaling, IMultiStake {
  using SafeMath for uint256;
  using SafeDecimalMath for uint256;

  struct UnstakeOutput {
    // [e18] amount left staked in last stake array
    uint256 lastStakeAmount;
    // [e18] number of stakes left
    uint256 newStakesCount;
    // [e18] stake seconds
    uint256 rawStakeSeconds;
    // [e18] bonus weighted stake seconds
    uint256 bonusWeightedStakeSeconds;
    // [e18] reward tokens due
    uint256 rewardDue;
    // [e18] total stake seconds adjusting for new unstaking
    uint256 newTotalStakeSeconds;
  }

  /**
   * @notice Calculate accrued stake seconds given a period
   * @param amount [eD] token amount
   * @param start [seconds] epoch timestamp
   * @param end [seconds] epoch timestamp up to
   * @return stakeSeconds accrued stake seconds
   */
  function calculateStakeSeconds(
    uint256 amount,
    uint256 start,
    uint256 end
  ) internal pure returns (uint256 stakeSeconds) {
    uint256 duration = end.sub(start);
    stakeSeconds = duration.mul(amount);
    return stakeSeconds;
  }

  /**
   * @dev Calculate the time bonus
   * @param bs BonusScaling used to calculate time bonus
   * @param duration length of time staked for
   * @return bonus [e18] fixed point fraction, UNIT = +100%
   */
  function timeBonus(BonusScaling memory bs, uint256 duration)
    internal
    pure
    returns (uint256 bonus)
  {
    if (duration >= bs.period) {
      return bs.max;
    }

    uint256 bonusScale = bs.max.sub(bs.min);
    uint256 bonusAddition = bonusScale.mul(duration).div(bs.period);
    bonus = bs.min.add(bonusAddition);
  }

  /**
   * @dev Calculate total stake seconds
   */
  function calculateTotalStakeSeconds(
    uint256 cachedTotalStakeAmount,
    uint256 cachedTotalStakeSeconds,
    uint256 lastUpdateTimestamp,
    uint256 timestamp
  ) internal pure returns (uint256 totalStakeSeconds) {
    if (timestamp == lastUpdateTimestamp) return cachedTotalStakeSeconds;

    uint256 additionalStakeSeconds =
      calculateStakeSeconds(
        cachedTotalStakeAmount,
        lastUpdateTimestamp,
        timestamp
      );

    totalStakeSeconds = cachedTotalStakeSeconds.add(additionalStakeSeconds);
  }

  /**
   * @dev Calculates reward from a given set of stakes
   * - Should check for total stake before calling
   * @param stakes Set of stakes
   */
  function simulateUnstake(
    Stake[] memory stakes,
    uint256 amountToUnstake,
    uint256 totalStakeSeconds,
    uint256 unlockedRewardAmount,
    uint256 timestamp,
    BonusScaling memory bs
  ) internal pure returns (UnstakeOutput memory out) {
    uint256 stakesToDrop = 0;
    while (amountToUnstake > 0) {
      uint256 targetIndex = stakes.length.sub(stakesToDrop).sub(1);
      Stake memory lastStake = stakes[targetIndex];

      uint256 currentAmount;
      if (lastStake.amount > amountToUnstake) {
        // set current amount to remaining unstake amount
        currentAmount = amountToUnstake;
        // amount of last stake is reduced
        out.lastStakeAmount = lastStake.amount.sub(amountToUnstake);
      } else {
        // set current amount to amount of last stake
        currentAmount = lastStake.amount;
        // add to stakes to drop
        stakesToDrop += 1;
      }

      amountToUnstake = amountToUnstake.sub(currentAmount);

      // Calculate staked seconds from amount
      uint256 stakeSeconds =
        calculateStakeSeconds(currentAmount, lastStake.timestamp, timestamp);

      // [e18] fixed point time bonus, 100% + X%
      uint256 bonus =
        SafeDecimalMath.UNIT.add(
          timeBonus(bs, timestamp.sub(lastStake.timestamp))
        );

      out.rawStakeSeconds = out.rawStakeSeconds.add(stakeSeconds);
      out.bonusWeightedStakeSeconds = out.bonusWeightedStakeSeconds.add(
        stakeSeconds.multiplyDecimal(bonus)
      );
    }

    // Update virtual caches
    out.newTotalStakeSeconds = totalStakeSeconds.sub(out.rawStakeSeconds);

    //              M_time * h
    // R = K *  ------------------
    //          H - h + M_time * h
    //
    // R - rewards due
    // K - total unlocked rewards
    // M_time - bonus related to time
    // h - user stake seconds
    // H - total stake seconds
    // H-h - new total stake seconds
    // R = 0 if H = 0
    if (totalStakeSeconds != 0) {
      out.rewardDue = unlockedRewardAmount
        .mul(out.bonusWeightedStakeSeconds)
        .div(out.newTotalStakeSeconds.add(out.bonusWeightedStakeSeconds));
    }

    return
      UnstakeOutput(
        out.lastStakeAmount,
        stakes.length.sub(stakesToDrop),
        out.rawStakeSeconds,
        out.bonusWeightedStakeSeconds,
        out.rewardDue,
        out.newTotalStakeSeconds
      );
  }
}

File 10 of 16 : FundablePool.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity =0.7.6;
pragma abicoder v2;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

abstract contract FundablePool is AccessControl {
  using SafeMath for uint256;
  using SafeERC20 for IERC20;

  struct RewardSchedule {
    // [eR] Amount of reward token contributed. (immutable)
    uint256 amount;
    // [seconds] Duration of funding round (immutable)
    uint256 duration;
    // [seconds] Epoch timestamp for start time (immutable)
    uint256 start;
    // [eR] Amount still locked
    uint256 amountLocked;
    // [seconds] Last updated epoch timestamp
    uint256 updated;
  }

  /* ========== CONSTANTS ========== */
  bytes32 public constant FUNDER_ROLE = keccak256("FUNDER_ROLE");

  /* ========== STATE VARIABLES ========== */
  IERC20 public immutable rewardToken;

  /// @notice [eR] {cached} total reward amount <=> rewardToken.balanceOf
  uint256 public totalRewardAmount;

  /// @notice [eR] {cached} locked reward amount
  uint256 public lockedRewardAmount;

  /// @dev All non-expired reward schedules
  RewardSchedule[] internal _rewardSchedules;

  /* ========== CONSTRUCTOR ========== */
  /**
   * @notice Construct a new FundablePool
   */
  constructor(address _funder, address _rewardToken) {
    rewardToken = IERC20(_rewardToken);
    _setupRole(FUNDER_ROLE, _funder);
  }

  /* ========== EVENTS ========== */
  event RewardsFunded(uint256 amount, uint256 start, uint256 duration);
  event RewardsUnlocked(uint256 amount);
  event RewardsPaid(address indexed user, uint256 reward);
  event RewardsExpired(uint256 amount, uint256 start);

  /* ========== MODIFIERS ========== */

  modifier onlyFunder() {
    require(hasRole(FUNDER_ROLE, msg.sender), "FundablePool/OnlyFunder");
    _;
  }

  /* ========== VIEWS ========== */

  /**
   * @notice All active/pending reward schedules
   */
  function rewardSchedules() external view returns (RewardSchedule[] memory) {
    return _rewardSchedules;
  }

  /**
   * @notice Rewards that are unlocked
   */
  function unlockedRewardAmount() public view returns (uint256) {
    return totalRewardAmount.sub(lockedRewardAmount);
  }

  /**
   * @notice Rewards that are pending unlock (will be unlocked on next update)
   */
  function pendingRewardAmount(uint256 timestamp)
    public
    view
    returns (uint256 unlockedRewards)
  {
    for (uint256 i = 0; i < _rewardSchedules.length; i++) {
      unlockedRewards = unlockedRewards.add(unlockable(i, timestamp));
    }
  }

  /**
   * @notice Compute the number of unlockable rewards for the given RewardSchedule
   * @param idx index of RewardSchedule
   * @return the number of unlockable rewards
   */
  function unlockable(uint256 idx, uint256 timestamp)
    public
    view
    returns (uint256)
  {
    RewardSchedule memory rs = _rewardSchedules[idx];

    // If still to start, then 0 unlocked
    if (timestamp <= rs.start) {
      return 0;
    }
    // If all used of rs used up, there is 0 left to unlock
    if (rs.amountLocked == 0) {
      return 0;
    }

    // if there is dust left, use it up.
    if (timestamp >= rs.start.add(rs.duration)) {
      return rs.amountLocked;
    }

    // N.B. rs.update >= rs.start;
    // => rs.start <= timeElapsed < rs.start + rs.duration
    uint256 timeElapsed = timestamp.sub(rs.updated);
    return timeElapsed.mul(rs.amount).div(rs.duration);
  }

  /* ========== MUTATIVE FUNCTIONS ========== */

  /* ========== RESTRICTED FUNCTIONS ========== */

  /* ----- Funder ----- */

  /**
   * @notice Fund pool using locked up reward tokens for future distribution
   * @dev Assumes: onlyFunder
   * @param amount number of reward tokens to lock up as funding
   * @param duration period (seconds) over which funding will be unlocked
   * @param start time (seconds) at which funding begins to unlock
   */
  function _fund(
    uint256 amount,
    uint256 duration,
    uint256 start
  ) internal {
    require(duration != 0, "FundablePool/ZeroDuration");
    require(start >= block.timestamp, "FundablePool/HistoricFund");

    uint256 allowed =
      rewardToken.balanceOf(address(this)).sub(totalRewardAmount);

    require(allowed >= amount, "FundablePool/InsufficentBalance");

    // Update {cached} values
    totalRewardAmount = totalRewardAmount.add(amount);
    lockedRewardAmount = lockedRewardAmount.add(amount);

    // create new funding
    _rewardSchedules.push(
      RewardSchedule({
        amount: amount,
        amountLocked: amount,
        updated: start,
        start: start,
        duration: duration
      })
    );

    emit RewardsFunded(amount, start, duration);
  }

  /**
   * @notice Clean up stale reward schedules
   * @dev Assumes: onlyFunder
   */
  function _cleanRewardSchedules() internal {
    // check for stale reward schedules to expire
    uint256 removed = 0;
    // Gas will hit cap before this becomes an overflow problem
    uint256 originalSize = _rewardSchedules.length;
    for (uint256 i = 0; i < originalSize; i++) {
      uint256 idx = i - removed;
      RewardSchedule storage funding = _rewardSchedules[idx];

      if (
        unlockable(idx, block.timestamp) == 0 &&
        block.timestamp >= funding.start.add(funding.duration)
      ) {
        emit RewardsExpired(funding.amount, funding.start);

        // remove at idx by copying last element here, then popping off last
        // (we don't care about order)
        _rewardSchedules[idx] = _rewardSchedules[_rewardSchedules.length - 1];
        _rewardSchedules.pop();
        removed++;
      }
    }
  }

  /* ========== INTERNAL FUNCTIONS ========== */

  /**
   * @dev Unlocks reward tokens based on funding schedules
   * @return unlockedRewards number of rewards unlocked
   */
  function _unlockRewards() internal returns (uint256 unlockedRewards) {
    // get unlockable rewards for each funding schedule
    for (uint256 i = 0; i < _rewardSchedules.length; i++) {
      uint256 unlockableRewardAtIdx = unlockable(i, block.timestamp);
      RewardSchedule storage funding = _rewardSchedules[i];
      if (unlockableRewardAtIdx != 0) {
        funding.amountLocked = funding.amountLocked.sub(unlockableRewardAtIdx);
        funding.updated = block.timestamp;
        unlockedRewards = unlockedRewards.add(unlockableRewardAtIdx);
      }
    }

    if (unlockedRewards != 0) {
      // Update {cached} lockedRewardAmount
      lockedRewardAmount = lockedRewardAmount.sub(unlockedRewards);
      emit RewardsUnlocked(unlockedRewards);
    }
  }

  /**
   * @dev Distribute reward tokens to user
   *
   * Assumptions:
   * - `user` deserves this amount
   *
   * @param user address of user receiving reward
   * @param amount number of reward tokens to be distributed
   */
  function _distributeRewards(address user, uint256 amount) internal {
    assert(amount <= totalRewardAmount);

    // update {cached} totalRewardAmount
    totalRewardAmount = totalRewardAmount.sub(amount);

    rewardToken.safeTransfer(user, amount);
    emit RewardsPaid(user, amount);
  }
}

File 11 of 16 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

File 12 of 16 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{ value: amount }("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 13 of 16 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 14 of 16 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);

    /**
     * @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);
}

File 15 of 16 : SafeDecimalMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

import "@openzeppelin/contracts/math/SafeMath.sol";

// https://docs.synthetix.io/contracts/source/libraries/safedecimalmath
library SafeDecimalMath {
  using SafeMath for uint256;

  /* Number of decimal places in the representations. */
  uint8 public constant decimals = 18;
  uint8 public constant highPrecisionDecimals = 27;

  /* The number representing 1.0. */
  uint256 public constant UNIT = 10**uint256(decimals);

  /* The number representing 1.0 for higher fidelity numbers. */
  uint256 public constant PRECISE_UNIT = 10**uint256(highPrecisionDecimals);
  uint256 private constant UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR =
    10**uint256(highPrecisionDecimals - decimals);

  /**
   * @return Provides an interface to UNIT.
   */
  function unit() external pure returns (uint256) {
    return UNIT;
  }

  /**
   * @return Provides an interface to PRECISE_UNIT.
   */
  function preciseUnit() external pure returns (uint256) {
    return PRECISE_UNIT;
  }

  /**
   * @return The result of multiplying x and y, interpreting the operands as fixed-point
   * decimals.
   *
   * @dev A unit factor is divided out after the product of x and y is evaluated,
   * so that product must be less than 2**256. As this is an integer division,
   * the internal division always rounds down. This helps save on gas. Rounding
   * is more expensive on gas.
   */
  function multiplyDecimal(uint256 x, uint256 y)
    internal
    pure
    returns (uint256)
  {
    /* Divide by UNIT to remove the extra factor introduced by the product. */
    return x.mul(y) / UNIT;
  }

  /**
   * @return The result of safely multiplying x and y, interpreting the operands
   * as fixed-point decimals of the specified precision unit.
   *
   * @dev The operands should be in the form of a the specified unit factor which will be
   * divided out after the product of x and y is evaluated, so that product must be
   * less than 2**256.
   *
   * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
   * Rounding is useful when you need to retain fidelity for small decimal numbers
   * (eg. small fractions or percentages).
   */
  function _multiplyDecimalRound(
    uint256 x,
    uint256 y,
    uint256 precisionUnit
  ) private pure returns (uint256) {
    /* Divide by UNIT to remove the extra factor introduced by the product. */
    uint256 quotientTimesTen = x.mul(y) / (precisionUnit / 10);

    if (quotientTimesTen % 10 >= 5) {
      quotientTimesTen += 10;
    }

    return quotientTimesTen / 10;
  }

  /**
   * @return The result of safely multiplying x and y, interpreting the operands
   * as fixed-point decimals of a precise unit.
   *
   * @dev The operands should be in the precise unit factor which will be
   * divided out after the product of x and y is evaluated, so that product must be
   * less than 2**256.
   *
   * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
   * Rounding is useful when you need to retain fidelity for small decimal numbers
   * (eg. small fractions or percentages).
   */
  function multiplyDecimalRoundPrecise(uint256 x, uint256 y)
    internal
    pure
    returns (uint256)
  {
    return _multiplyDecimalRound(x, y, PRECISE_UNIT);
  }

  /**
   * @return The result of safely multiplying x and y, interpreting the operands
   * as fixed-point decimals of a standard unit.
   *
   * @dev The operands should be in the standard unit factor which will be
   * divided out after the product of x and y is evaluated, so that product must be
   * less than 2**256.
   *
   * Unlike multiplyDecimal, this function rounds the result to the nearest increment.
   * Rounding is useful when you need to retain fidelity for small decimal numbers
   * (eg. small fractions or percentages).
   */
  function multiplyDecimalRound(uint256 x, uint256 y)
    internal
    pure
    returns (uint256)
  {
    return _multiplyDecimalRound(x, y, UNIT);
  }

  /**
   * @return The result of safely dividing x and y. The return value is a high
   * precision decimal.
   *
   * @dev y is divided after the product of x and the standard precision unit
   * is evaluated, so the product of x and UNIT must be less than 2**256. As
   * this is an integer division, the result is always rounded down.
   * This helps save on gas. Rounding is more expensive on gas.
   */
  function divideDecimal(uint256 x, uint256 y) internal pure returns (uint256) {
    /* Reintroduce the UNIT factor that will be divided out by y. */
    return x.mul(UNIT).div(y);
  }

  /**
   * @return The result of safely dividing x and y. The return value is as a rounded
   * decimal in the precision unit specified in the parameter.
   *
   * @dev y is divided after the product of x and the specified precision unit
   * is evaluated, so the product of x and the specified precision unit must
   * be less than 2**256. The result is rounded to the nearest increment.
   */
  function _divideDecimalRound(
    uint256 x,
    uint256 y,
    uint256 precisionUnit
  ) private pure returns (uint256) {
    uint256 resultTimesTen = x.mul(precisionUnit * 10).div(y);

    if (resultTimesTen % 10 >= 5) {
      resultTimesTen += 10;
    }

    return resultTimesTen / 10;
  }

  /**
   * @return The result of safely dividing x and y. The return value is as a rounded
   * standard precision decimal.
   *
   * @dev y is divided after the product of x and the standard precision unit
   * is evaluated, so the product of x and the standard precision unit must
   * be less than 2**256. The result is rounded to the nearest increment.
   */
  function divideDecimalRound(uint256 x, uint256 y)
    internal
    pure
    returns (uint256)
  {
    return _divideDecimalRound(x, y, UNIT);
  }

  /**
   * @return The result of safely dividing x and y. The return value is as a rounded
   * high precision decimal.
   *
   * @dev y is divided after the product of x and the high precision unit
   * is evaluated, so the product of x and the high precision unit must
   * be less than 2**256. The result is rounded to the nearest increment.
   */
  function divideDecimalRoundPrecise(uint256 x, uint256 y)
    internal
    pure
    returns (uint256)
  {
    return _divideDecimalRound(x, y, PRECISE_UNIT);
  }

  /**
   * @dev Convert a standard decimal representation to a high precision one.
   */
  function decimalToPreciseDecimal(uint256 i) internal pure returns (uint256) {
    return i.mul(UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR);
  }

  /**
   * @dev Convert a high precision decimal to a standard decimal representation.
   */
  function preciseDecimalToDecimal(uint256 i) internal pure returns (uint256) {
    uint256 quotientTimesTen =
      i / (UNIT_TO_HIGH_PRECISION_CONVERSION_FACTOR / 10);

    if (quotientTimesTen % 10 >= 5) {
      quotientTimesTen += 10;
    }

    return quotientTimesTen / 10;
  }
}

File 16 of 16 : IBonusScaling.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

interface IBonusScaling {
  /**
   * Scale staked seconds according to multiplier
   */
  struct BonusScaling {
    // [e18] Minimum bonus amount
    uint256 min;
    // [e18] Maximum bonus amount
    uint256 max;
    // [seconds] Period over which to apply bonus scaling
    uint256 period;
  }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 999999
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_funder","type":"address"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"address","name":"_stakingToken","type":"address"},{"components":[{"internalType":"uint256","name":"min","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"}],"internalType":"struct IBonusScaling.BonusScaling","name":"_bonusScaling","type":"tuple"},{"internalType":"uint256","name":"_hardLockPeriod","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"}],"name":"RewardsExpired","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"start","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"duration","type":"uint256"}],"name":"RewardsFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardsPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsUnlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"ADJUSTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNDER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RECOVER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusScaling","outputs":[{"internalType":"uint256","name":"min","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"clean","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"exit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"}],"name":"fund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getCurrentTotalStakeSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"getFutureTotalStakeSeconds","outputs":[{"internalType":"uint256","name":"totalStakeSeconds","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserData","outputs":[{"components":[{"internalType":"uint256","name":"totalStake","type":"uint256"},{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"internalType":"struct IMultiStake.Stake[]","name":"stakes","type":"tuple[]"}],"internalType":"struct MultiplierPool.UserData","name":"userData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"hardLockPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockedRewardAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"min","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"}],"internalType":"struct IBonusScaling.BonusScaling","name":"_bonusScaling","type":"tuple"}],"name":"modifyBonusScaling","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_hardLockPeriod","type":"uint256"}],"name":"modifyHardLock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"pendingRewardAmount","outputs":[{"internalType":"uint256","name":"unlockedRewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardSchedules","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"amountLocked","type":"uint256"},{"internalType":"uint256","name":"updated","type":"uint256"}],"internalType":"struct FundablePool.RewardSchedule[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakeToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewardAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"idx","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"unlockable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unlockedRewardAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b50604051620032fb380380620032fb833981016040819052620000349162000244565b6001600160601b0319606085901b166080528484620000747f0914bb97ca83e85ef385857d9d418f187ff630589e0c9f44db92976d8e4519cb8362000113565b50506001600160601b0319606084901b1660a0528151600455602082015160055560408201516006556007819055620000af60008762000113565b620000db7f5a85a0f64f37f856e98a3a47dd5f5e0179117cb59b2e7d7e4df98674eff98c2b8762000113565b620001077f62b337eaefec74dadf1a62e856bf9db4f14a0f27d4f48156a95a9f98e7d5e0668762000113565b50505050505062000301565b6200011f828262000123565b5050565b60008281526020818152604090912062000148918390620011176200019c821b17901c565b156200011f5762000158620001bc565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620001b3836001600160a01b038416620001c0565b90505b92915050565b3390565b6000620001ce83836200020f565b6200020657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620001b6565b506000620001b6565b60009081526001919091016020526040902054151590565b80516001600160a01b03811681146200023f57600080fd5b919050565b6000806000806000808688036101008112156200025f578283fd5b6200026a8862000227565b96506200027a6020890162000227565b95506200028a6040890162000227565b94506200029a6060890162000227565b93506060607f1982011215620002ae578283fd5b50604051606081016001600160401b0381118282101715620002cc57fe5b80604052506080880151815260a0880151602082015260c088015160408201528092505060e087015190509295509295509295565b60805160601c60a05160601c612fa3620003586000398061066452806109ef5280610b7c528061177c52806118a452508061069b52806106e65280610c025280610fd9528061147a5280611c6a5250612fa36000f3fe608060405234801561001057600080fd5b50600436106102915760003560e01c80638e73064f11610160578063a9aa0ebc116100d8578063d547741f1161008c578063f7c618c111610071578063f7c618c1146104cd578063fc4333cd146104d5578063ffc9896b146104dd57610291565b8063d547741f146104b2578063e9fad8ee146104c557610291565b8063c0b728e9116100bd578063c0b728e91461048f578063c8f33c9114610497578063ca15c8731461049f57610291565b8063a9aa0ebc14610470578063b9b3dff01461047857610291565b80639e50c11b1161012f578063a3bca5e211610114578063a3bca5e214610442578063a5bae98c14610455578063a694fc3a1461045d57610291565b80639e50c11b14610425578063a217fddf1461043a57610291565b80638e73064f146103e25780639010d07c146103ea57806391d14854146103fd578063939bcbc91461041d57610291565b806334aedecd1161020e57806370a08231116101c25780638923de2b116101a75780638923de2b146103b45780638980f11f146103bc5780638e2631ab146103cf57610291565b806370a082311461038e578063816c4d61146103a157610291565b80633d18b912116101f35780633d18b9121461035e57806351ed6a3014610366578063702714981461037b57610291565b806334aedecd1461034357806336568abe1461034b57610291565b80632a8776a4116102655780632e40d6441161024a5780632e40d6441461030a5780632ee409081461031d5780632f2ff15d1461033057610291565b80632a8776a4146102ef5780632e1a7d4d146102f757610291565b80628cc26214610296578063111d7d50146102bf57806318160ddd146102d4578063248a9ca3146102dc575b600080fd5b6102a96102a436600461291e565b6104fd565b6040516102b69190612b1d565b60405180910390f35b6102d26102cd366004612a32565b6105f1565b005b6102a96107e1565b6102a96102ea366004612961565b6107e8565b6102a96107fd565b6102d2610305366004612961565b61081b565b6102a9610318366004612961565b610830565b6102d261032b366004612938565b610862565b6102d261033e366004612979565b610879565b6102a96108f6565b6102d2610359366004612979565b61091a565b6102d26109af565b61036e6109ed565b6040516102b69190612a5d565b6102d2610389366004612961565b610a11565b6102a961039c36600461291e565b610a76565b6102d26103af3660046129c5565b610a9e565b6102a9610b14565b6102d26103ca366004612938565b610b1a565b6102a96103dd3660046129a4565b610ce0565b6102a9610dcc565b61036e6103f83660046129a4565b610dd2565b61041061040b366004612979565b610df1565b6040516102b69190612b12565b6102a9610e09565b61042d610e2d565b6040516102b69190612aa4565b6102a9610ebe565b6102a9610450366004612961565b610ec3565b6102a9610ed7565b6102d261046b366004612961565b610ee2565b6102a9610ef5565b610480610f19565b6040516102b693929190612e85565b6102a9610f25565b6102a9610f2b565b6102a96104ad366004612961565b610f31565b6102d26104c0366004612979565b610f48565b6102d2610fbb565b61036e610fd7565b6102d2610ffb565b6104f06104eb36600461291e565b611063565b6040516102b69190612e13565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b60209081526040808320600101805482518185028101850190935280835284936105e493929190859084015b8282101561058d57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610547565b5050505061059a85610a76565b6105a2610ed7565b6105bc6105ae42610830565b6105b66107fd565b90611139565b60408051606081018252600454815260055460208201526006549181019190915242906111ad565b608001519150505b919050565b61061b7f0914bb97ca83e85ef385857d9d418f187ff630589e0c9f44db92976d8e4519cb33610df1565b61065a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612da5565b60405180910390fd5b61066261135b565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1614156107d157600061079360095461078d6001547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161073d9190612a5d565b60206040518083038186803b15801561075557600080fd5b505afa158015610769573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078d9190612a1a565b90611388565b9050838110156107cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612ddc565b505b6107dc8383836113ff565b505050565b6009545b90565b60009081526020819052604090206002015490565b600061081660025460015461138890919063ffffffff16565b905090565b61082361135b565b61082d3382611668565b50565b6000805b60035481101561085c5761085261084b8285610ce0565b8390611139565b9150600101610834565b50919050565b61086a61135b565b6108753383836117a3565b5050565b6000828152602081905260409020600201546108979061040b6118cc565b6108ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180612ebe602f913960400191505060405180910390fd5b61087582826118d0565b7f0914bb97ca83e85ef385857d9d418f187ff630589e0c9f44db92976d8e4519cb81565b6109226118cc565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146109a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180612f68602f913960400191505060405180910390fd5b6108758282611953565b6109b761135b565b3360006109c382610a76565b905060006109d183836119d6565b90506109dd8383611bb1565b80156107dc576107dc8382611c34565b7f000000000000000000000000000000000000000000000000000000000000000081565b610a3b7f5a85a0f64f37f856e98a3a47dd5f5e0179117cb59b2e7d7e4df98674eff98c2b33610df1565b610a71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612c35565b600755565b73ffffffffffffffffffffffffffffffffffffffff166000908152600b602052604090205490565b610ac87f5a85a0f64f37f856e98a3a47dd5f5e0179117cb59b2e7d7e4df98674eff98c2b33610df1565b610afe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612c35565b8051600455602081015160055560400151600655565b60025481565b610b447f62b337eaefec74dadf1a62e856bf9db4f14a0f27d4f48156a95a9f98e7d5e06633610df1565b610b7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612d00565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612b5d565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612c6c565b7f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa288282604051610cb7929190612a7e565b60405180910390a161087573ffffffffffffffffffffffffffffffffffffffff83163383611ce3565b60008060038481548110610cf057fe5b90600052602060002090600502016040518060a001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481525050905080604001518311610d52576000915050610dc6565b6060810151610d65576000915050610dc6565b60208101516040820151610d7891611139565b8310610d8957606001519050610dc6565b6000610da282608001518561138890919063ffffffff16565b60208301518351919250610dc191610dbb908490611d70565b90611de3565b925050505b92915050565b60015481565b6000828152602081905260408120610dea9083611e64565b9392505050565b6000828152602081905260408120610dea9083611e70565b7f62b337eaefec74dadf1a62e856bf9db4f14a0f27d4f48156a95a9f98e7d5e06681565b60606003805480602002602001604051908101604052809291908181526020016000905b82821015610eb557838290600052602060002090600502016040518060a00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152505081526020019060010190610e51565b50505050905090565b600081565b6000610dc6600954600a5460085485611e92565b600061081642610ec3565b610eea61135b565b61082d3333836117a3565b7f5a85a0f64f37f856e98a3a47dd5f5e0179117cb59b2e7d7e4df98674eff98c2b81565b60045460055460065483565b60075481565b60085481565b6000818152602081905260408120610dc690611ec8565b600082815260208190526040902060020154610f669061040b6118cc565b6109a5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612eed6030913960400191505060405180910390fd5b610fc361135b565b610fd533610fd033610a76565b611668565b565b7f000000000000000000000000000000000000000000000000000000000000000081565b6110257f0914bb97ca83e85ef385857d9d418f187ff630589e0c9f44db92976d8e4519cb33610df1565b61105b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612da5565b610fd5611ed3565b61106b61286f565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832081518083018352815481526001820180548451818702810187019095528085529195929486810194939192919084015b82821015611109578382906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050815260200190600101906110c3565b505050915250909392505050565b6000610dea8373ffffffffffffffffffffffffffffffffffffffff8416612076565b600082820183811015610dea57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6111b5612889565b60005b86156112b45760006111d9600161078d848c5161138890919063ffffffff16565b905060008982815181106111e957fe5b60200260200101519050600089826000015111156112175750805189906112109082611388565b8552611222565b508051600193909301925b61122c8a82611388565b9950600061123f8284602001518a6120c0565b905060006112756112668961126187602001518d61138890919063ffffffff16565b6120e2565b670de0b6b3a764000090611139565b60408801519091506112879083611139565b60408801526112a4611299838361213c565b606089015190611139565b6060880152506111b89350505050565b60408201516112c4908790611388565b60a08301528515611303576112fd6112ed83606001518460a0015161113990919063ffffffff16565b6060840151610dbb908890611d70565b60808301525b6040805160c0810190915282518152885160208201906113239084611388565b81526020018360400151815260200183606001518152602001836080015181526020018360a001518152509150509695505050505050565b611363612158565b5061137f611376600954600854426120c0565b600a5490611139565b600a5542600855565b6000828211156113f957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b81611436576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612b26565b42811015611470576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612d37565b60006114d16001547f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161073d9190612a5d565b90508381101561150d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612ddc565b60015461151a9085611139565b60015560025461152a9085611139565b6002556040805160a0810182528581526020810185815281830185815260608301888152608084018781526003805460018101825560009190915294517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b60059096029586015592517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c85015590517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d840155517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e830155517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85f90910155517f7ac7fc57ee882d63e227562151d4c9d2267bed521cfc40a319986cdbeec8da7c9061165a90869085908790612e85565b60405180910390a150505050565b73ffffffffffffffffffffffffffffffffffffffff82166116b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612bfe565b806116ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612d6e565b6116f6828261221e565b600061170283836119d6565b90508015611714576117148382611c34565b8273ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d58360405161175a9190612b1d565b60405180910390a26107dc73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168484611ce3565b73ffffffffffffffffffffffffffffffffffffffff82166117f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612b92565b80611827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612d6e565b6118328383836107dc565b61183c8282611bb1565b8173ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d826040516118829190612b1d565b60405180910390a26107dc73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016843084612334565b3390565b60008281526020819052604090206118e89082611117565b15610875576118f56118cc565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260208190526040902061196b90826123c9565b15610875576119786118cc565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b602052604081208054831115611a36576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612cc9565b826009541015611a4257fe5b6000611ac682600101805480602002602001604051908101604052809291908181526020016000905b82821015611ab157838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611a6b565b5050505085611abe610ed7565b6105bc6107fd565b9050806020015160001415611ae857611ae36001830160006128bf565b611b7f565b602081015160018301541115611b465781600101805480611b0557fe5b60008281526020812060027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90930192830201818155600101559055611ae8565b805115611b7f5780516020820151600180850191611b6391611388565b81548110611b6d57fe5b60009182526020909120600290910201555b8154611b8b9085611388565b8255600954611b9a9085611388565b60095560a0810151600a5560800151949350505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b60209081526040808320815180830190925284825242828401908152600180830180548083018255908752949095209251600290940290920192835590519190920155600954611c1f9083611139565b6009558054611c2e9083611139565b90555050565b600154811115611c4057fe5b600154611c4d9082611388565b600155611c9173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168383611ce3565b8173ffffffffffffffffffffffffffffffffffffffff167fd5ec1b97fc4d048ade361b013c285a0a5c1c40ae32579013ad3798ee657d9de782604051611cd79190612b1d565b60405180910390a25050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526107dc9084906123eb565b600082611d7f57506000610dc6565b82820282848281611d8c57fe5b0414610dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612f1d6021913960400191505060405180910390fd5b6000808211611e5357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611e5c57fe5b049392505050565b6000610dea83836124c3565b6000610dea8373ffffffffffffffffffffffffffffffffffffffff8416612541565b600082821415611ea3575082611ec0565b6000611eb08685856120c0565b9050611ebc8582611139565b9150505b949350505050565b6000610dc682612559565b600354600090815b818110156107dc5760008382039050600060038281548110611ef957fe5b90600052602060002090600502019050611f138242610ce0565b158015611f32575060018101546002820154611f2e91611139565b4210155b1561206c57805460028201546040517f32a96e1cf1e533fa60087738afdc6d21653efb358b1aa3a9599296a2c4ba9e4392611f6e929091612e77565b60405180910390a1600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110611fa657fe5b906000526020600020906005020160038381548110611fc157fe5b90600052602060002090600502016000820154816000015560018201548160010155600282015481600201556003820154816003015560048201548160040155905050600380548061200f57fe5b60008281526020812060057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9093019283020181815560018181018390556002820183905560038201839055600490910191909155915594909401935b5050600101611edb565b60006120828383612541565b6120b857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610dc6565b506000610dc6565b6000806120cd8385611388565b90506120d98186611d70565b95945050505050565b6000826040015182106120fa57506020820151610dc6565b8251602084015160009161210e9190611388565b9050600061212d8560400151610dbb8685611d7090919063ffffffff16565b8551909150610dc19082611139565b6000670de0b6b3a76400006121518484611d70565b81611e5c57fe5b6000805b6003548110156121cc5760006121728242610ce0565b905060006003838154811061218357fe5b90600052602060002090600502019050816000146121c25760038101546121aa9083611388565b60038201554260048201556121bf8483611139565b93505b505060010161215c565b5080156107e5576002546121e09082611388565b6002556040517f01feb0f24c52736758ca404486734e6287175eb5c93aa090f0ab371665231d7290612213908390612b1d565b60405180910390a190565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832060010180548251818502810185019093528083529192909190849084015b828210156122aa57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190612264565b5050505090506000816122c86001845161138890919063ffffffff16565b815181106122d257fe5b60200260200101519050426122f6600754836020015161113990919063ffffffff16565b111561232e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612bc9565b50505050565b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261232e9085906123eb565b6000610dea8373ffffffffffffffffffffffffffffffffffffffff841661255d565b600061244d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166126419092919063ffffffff16565b8051909150156107dc5780806020019051602081101561246c57600080fd5b50516107dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612f3e602a913960400191505060405180910390fd5b8154600090821061251f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612e9c6022913960400191505060405180910390fd5b82600001828154811061252e57fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b600081815260018301602052604081205480156126375783547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80830191908101906000908790839081106125ae57fe5b90600052602060002001549050808760000184815481106125cb57fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806125fb57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610dc6565b6000915050610dc6565b6060611ec0848460008585612655856127ab565b6126c057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b6020831061272957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016126ec565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461278b576040519150601f19603f3d011682016040523d82523d6000602084013e612790565b606091505b50915091506127a08282866127b1565b979650505050505050565b3b151590565b606083156127c0575081610dea565b8251156127d05782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561283457818101518382015260200161281c565b50505050905090810190601f1680156128615780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604051806040016040528060008152602001606081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b508054600082556002029060005260206000209081019061082d91905b808211156128f657600080825560018201556002016128dc565b5090565b803573ffffffffffffffffffffffffffffffffffffffff811681146105ec57600080fd5b60006020828403121561292f578081fd5b610dea826128fa565b6000806040838503121561294a578081fd5b612953836128fa565b946020939093013593505050565b600060208284031215612972578081fd5b5035919050565b6000806040838503121561298b578182fd5b8235915061299b602084016128fa565b90509250929050565b600080604083850312156129b6578182fd5b50508035926020909101359150565b6000606082840312156129d6578081fd5b6040516060810181811067ffffffffffffffff821117156129f357fe5b80604052508235815260208301356020820152604083013560408201528091505092915050565b600060208284031215612a2b578081fd5b5051919050565b600080600060608486031215612a46578081fd5b505081359360208301359350604090920135919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b602080825282518282018190526000919060409081850190868401855b82811015612b055781518051855286810151878601528581015186860152606080820151908601526080908101519085015260a09093019290850190600101612ac1565b5091979650505050505050565b901515815260200190565b90815260200190565b60208082526019908201527f46756e6461626c65506f6f6c2f5a65726f4475726174696f6e00000000000000604082015260600190565b6020808252818101527f4d756c7469706c696572506f6f6c2f4e6f5265636f766572794f665374616b65604082015260600190565b6020808252601b908201527f4d756c7469706c696572506f6f6c2f5a65726f41646472657373530000000000604082015260600190565b6020808252818101527f4d756c7469706c696572506f6f6c2f486172644c6f636b4e6f74506173736564604082015260600190565b6020808252601b908201527f4d756c7469706c696572506f6f6c2f5a65726f41646472657373570000000000604082015260600190565b6020808252601b908201527f4d756c7469706c696572506f6f6c2f41646a7573746572526f6c650000000000604082015260600190565b60208082526021908201527f4d756c7469706c696572506f6f6c2f4e6f5265636f766572794f66526577617260408201527f6400000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601b908201527f4d756c7469706c696572506f6f6c2f457863656564735374616b650000000000604082015260600190565b6020808252601a908201527f4d756c7469706c696572506f6f6c2f5265636f766572526f6c65000000000000604082015260600190565b60208082526019908201527f46756e6461626c65506f6f6c2f486973746f72696346756e6400000000000000604082015260600190565b60208082526017908201527f4d756c7469706c696572506f6f6c2f4e6f416d6f756e74000000000000000000604082015260600190565b60208082526017908201527f46756e6461626c65506f6f6c2f4f6e6c7946756e646572000000000000000000604082015260600190565b6020808252601f908201527f46756e6461626c65506f6f6c2f496e737566666963656e7442616c616e636500604082015260600190565b602080825282518282015282810151604080840181905281516060850181905260009392830191849160808701905b80841015612e6b5784518051835286015186830152938501936001939093019290820190612e42565b50979650505050505050565b918252602082015260400190565b928352602083019190915260408201526060019056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a164736f6c6343000706000a000000000000000000000000de4b9cbad10cdff96ee4b1f9c7568283e96c0089000000000000000000000000383df49ad1f0219759a46399fe33cb7a63cd051c00000000000000000000000024a6a37576377f63f194caa5f518a60f45b42921000000000000000000000000938625591adb4e865b882377e2c965f9f9b85e3400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001bc16d674ec8000000000000000000000000000000000000000000000000000000000000004f1a000000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102915760003560e01c80638e73064f11610160578063a9aa0ebc116100d8578063d547741f1161008c578063f7c618c111610071578063f7c618c1146104cd578063fc4333cd146104d5578063ffc9896b146104dd57610291565b8063d547741f146104b2578063e9fad8ee146104c557610291565b8063c0b728e9116100bd578063c0b728e91461048f578063c8f33c9114610497578063ca15c8731461049f57610291565b8063a9aa0ebc14610470578063b9b3dff01461047857610291565b80639e50c11b1161012f578063a3bca5e211610114578063a3bca5e214610442578063a5bae98c14610455578063a694fc3a1461045d57610291565b80639e50c11b14610425578063a217fddf1461043a57610291565b80638e73064f146103e25780639010d07c146103ea57806391d14854146103fd578063939bcbc91461041d57610291565b806334aedecd1161020e57806370a08231116101c25780638923de2b116101a75780638923de2b146103b45780638980f11f146103bc5780638e2631ab146103cf57610291565b806370a082311461038e578063816c4d61146103a157610291565b80633d18b912116101f35780633d18b9121461035e57806351ed6a3014610366578063702714981461037b57610291565b806334aedecd1461034357806336568abe1461034b57610291565b80632a8776a4116102655780632e40d6441161024a5780632e40d6441461030a5780632ee409081461031d5780632f2ff15d1461033057610291565b80632a8776a4146102ef5780632e1a7d4d146102f757610291565b80628cc26214610296578063111d7d50146102bf57806318160ddd146102d4578063248a9ca3146102dc575b600080fd5b6102a96102a436600461291e565b6104fd565b6040516102b69190612b1d565b60405180910390f35b6102d26102cd366004612a32565b6105f1565b005b6102a96107e1565b6102a96102ea366004612961565b6107e8565b6102a96107fd565b6102d2610305366004612961565b61081b565b6102a9610318366004612961565b610830565b6102d261032b366004612938565b610862565b6102d261033e366004612979565b610879565b6102a96108f6565b6102d2610359366004612979565b61091a565b6102d26109af565b61036e6109ed565b6040516102b69190612a5d565b6102d2610389366004612961565b610a11565b6102a961039c36600461291e565b610a76565b6102d26103af3660046129c5565b610a9e565b6102a9610b14565b6102d26103ca366004612938565b610b1a565b6102a96103dd3660046129a4565b610ce0565b6102a9610dcc565b61036e6103f83660046129a4565b610dd2565b61041061040b366004612979565b610df1565b6040516102b69190612b12565b6102a9610e09565b61042d610e2d565b6040516102b69190612aa4565b6102a9610ebe565b6102a9610450366004612961565b610ec3565b6102a9610ed7565b6102d261046b366004612961565b610ee2565b6102a9610ef5565b610480610f19565b6040516102b693929190612e85565b6102a9610f25565b6102a9610f2b565b6102a96104ad366004612961565b610f31565b6102d26104c0366004612979565b610f48565b6102d2610fbb565b61036e610fd7565b6102d2610ffb565b6104f06104eb36600461291e565b611063565b6040516102b69190612e13565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b60209081526040808320600101805482518185028101850190935280835284936105e493929190859084015b8282101561058d57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190610547565b5050505061059a85610a76565b6105a2610ed7565b6105bc6105ae42610830565b6105b66107fd565b90611139565b60408051606081018252600454815260055460208201526006549181019190915242906111ad565b608001519150505b919050565b61061b7f0914bb97ca83e85ef385857d9d418f187ff630589e0c9f44db92976d8e4519cb33610df1565b61065a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612da5565b60405180910390fd5b61066261135b565b7f000000000000000000000000938625591adb4e865b882377e2c965f9f9b85e3473ffffffffffffffffffffffffffffffffffffffff167f00000000000000000000000024a6a37576377f63f194caa5f518a60f45b4292173ffffffffffffffffffffffffffffffffffffffff1614156107d157600061079360095461078d6001547f00000000000000000000000024a6a37576377f63f194caa5f518a60f45b4292173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161073d9190612a5d565b60206040518083038186803b15801561075557600080fd5b505afa158015610769573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078d9190612a1a565b90611388565b9050838110156107cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612ddc565b505b6107dc8383836113ff565b505050565b6009545b90565b60009081526020819052604090206002015490565b600061081660025460015461138890919063ffffffff16565b905090565b61082361135b565b61082d3382611668565b50565b6000805b60035481101561085c5761085261084b8285610ce0565b8390611139565b9150600101610834565b50919050565b61086a61135b565b6108753383836117a3565b5050565b6000828152602081905260409020600201546108979061040b6118cc565b6108ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180612ebe602f913960400191505060405180910390fd5b61087582826118d0565b7f0914bb97ca83e85ef385857d9d418f187ff630589e0c9f44db92976d8e4519cb81565b6109226118cc565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146109a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180612f68602f913960400191505060405180910390fd5b6108758282611953565b6109b761135b565b3360006109c382610a76565b905060006109d183836119d6565b90506109dd8383611bb1565b80156107dc576107dc8382611c34565b7f000000000000000000000000938625591adb4e865b882377e2c965f9f9b85e3481565b610a3b7f5a85a0f64f37f856e98a3a47dd5f5e0179117cb59b2e7d7e4df98674eff98c2b33610df1565b610a71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612c35565b600755565b73ffffffffffffffffffffffffffffffffffffffff166000908152600b602052604090205490565b610ac87f5a85a0f64f37f856e98a3a47dd5f5e0179117cb59b2e7d7e4df98674eff98c2b33610df1565b610afe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612c35565b8051600455602081015160055560400151600655565b60025481565b610b447f62b337eaefec74dadf1a62e856bf9db4f14a0f27d4f48156a95a9f98e7d5e06633610df1565b610b7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612d00565b7f000000000000000000000000938625591adb4e865b882377e2c965f9f9b85e3473ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612b5d565b7f00000000000000000000000024a6a37576377f63f194caa5f518a60f45b4292173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612c6c565b7f8c1256b8896378cd5044f80c202f9772b9d77dc85c8a6eb51967210b09bfaa288282604051610cb7929190612a7e565b60405180910390a161087573ffffffffffffffffffffffffffffffffffffffff83163383611ce3565b60008060038481548110610cf057fe5b90600052602060002090600502016040518060a001604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481525050905080604001518311610d52576000915050610dc6565b6060810151610d65576000915050610dc6565b60208101516040820151610d7891611139565b8310610d8957606001519050610dc6565b6000610da282608001518561138890919063ffffffff16565b60208301518351919250610dc191610dbb908490611d70565b90611de3565b925050505b92915050565b60015481565b6000828152602081905260408120610dea9083611e64565b9392505050565b6000828152602081905260408120610dea9083611e70565b7f62b337eaefec74dadf1a62e856bf9db4f14a0f27d4f48156a95a9f98e7d5e06681565b60606003805480602002602001604051908101604052809291908181526020016000905b82821015610eb557838290600052602060002090600502016040518060a00160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152505081526020019060010190610e51565b50505050905090565b600081565b6000610dc6600954600a5460085485611e92565b600061081642610ec3565b610eea61135b565b61082d3333836117a3565b7f5a85a0f64f37f856e98a3a47dd5f5e0179117cb59b2e7d7e4df98674eff98c2b81565b60045460055460065483565b60075481565b60085481565b6000818152602081905260408120610dc690611ec8565b600082815260208190526040902060020154610f669061040b6118cc565b6109a5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180612eed6030913960400191505060405180910390fd5b610fc361135b565b610fd533610fd033610a76565b611668565b565b7f00000000000000000000000024a6a37576377f63f194caa5f518a60f45b4292181565b6110257f0914bb97ca83e85ef385857d9d418f187ff630589e0c9f44db92976d8e4519cb33610df1565b61105b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612da5565b610fd5611ed3565b61106b61286f565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832081518083018352815481526001820180548451818702810187019095528085529195929486810194939192919084015b82821015611109578382906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050815260200190600101906110c3565b505050915250909392505050565b6000610dea8373ffffffffffffffffffffffffffffffffffffffff8416612076565b600082820183811015610dea57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6111b5612889565b60005b86156112b45760006111d9600161078d848c5161138890919063ffffffff16565b905060008982815181106111e957fe5b60200260200101519050600089826000015111156112175750805189906112109082611388565b8552611222565b508051600193909301925b61122c8a82611388565b9950600061123f8284602001518a6120c0565b905060006112756112668961126187602001518d61138890919063ffffffff16565b6120e2565b670de0b6b3a764000090611139565b60408801519091506112879083611139565b60408801526112a4611299838361213c565b606089015190611139565b6060880152506111b89350505050565b60408201516112c4908790611388565b60a08301528515611303576112fd6112ed83606001518460a0015161113990919063ffffffff16565b6060840151610dbb908890611d70565b60808301525b6040805160c0810190915282518152885160208201906113239084611388565b81526020018360400151815260200183606001518152602001836080015181526020018360a001518152509150509695505050505050565b611363612158565b5061137f611376600954600854426120c0565b600a5490611139565b600a5542600855565b6000828211156113f957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b81611436576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612b26565b42811015611470576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612d37565b60006114d16001547f00000000000000000000000024a6a37576377f63f194caa5f518a60f45b4292173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161073d9190612a5d565b90508381101561150d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612ddc565b60015461151a9085611139565b60015560025461152a9085611139565b6002556040805160a0810182528581526020810185815281830185815260608301888152608084018781526003805460018101825560009190915294517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b60059096029586015592517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85c85015590517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85d840155517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85e830155517fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85f90910155517f7ac7fc57ee882d63e227562151d4c9d2267bed521cfc40a319986cdbeec8da7c9061165a90869085908790612e85565b60405180910390a150505050565b73ffffffffffffffffffffffffffffffffffffffff82166116b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612bfe565b806116ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612d6e565b6116f6828261221e565b600061170283836119d6565b90508015611714576117148382611c34565b8273ffffffffffffffffffffffffffffffffffffffff167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d58360405161175a9190612b1d565b60405180910390a26107dc73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000938625591adb4e865b882377e2c965f9f9b85e34168484611ce3565b73ffffffffffffffffffffffffffffffffffffffff82166117f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612b92565b80611827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612d6e565b6118328383836107dc565b61183c8282611bb1565b8173ffffffffffffffffffffffffffffffffffffffff167f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d826040516118829190612b1d565b60405180910390a26107dc73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000938625591adb4e865b882377e2c965f9f9b85e3416843084612334565b3390565b60008281526020819052604090206118e89082611117565b15610875576118f56118cc565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260208190526040902061196b90826123c9565b15610875576119786118cc565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b602052604081208054831115611a36576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612cc9565b826009541015611a4257fe5b6000611ac682600101805480602002602001604051908101604052809291908181526020016000905b82821015611ab157838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190611a6b565b5050505085611abe610ed7565b6105bc6107fd565b9050806020015160001415611ae857611ae36001830160006128bf565b611b7f565b602081015160018301541115611b465781600101805480611b0557fe5b60008281526020812060027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90930192830201818155600101559055611ae8565b805115611b7f5780516020820151600180850191611b6391611388565b81548110611b6d57fe5b60009182526020909120600290910201555b8154611b8b9085611388565b8255600954611b9a9085611388565b60095560a0810151600a5560800151949350505050565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b60209081526040808320815180830190925284825242828401908152600180830180548083018255908752949095209251600290940290920192835590519190920155600954611c1f9083611139565b6009558054611c2e9083611139565b90555050565b600154811115611c4057fe5b600154611c4d9082611388565b600155611c9173ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000024a6a37576377f63f194caa5f518a60f45b42921168383611ce3565b8173ffffffffffffffffffffffffffffffffffffffff167fd5ec1b97fc4d048ade361b013c285a0a5c1c40ae32579013ad3798ee657d9de782604051611cd79190612b1d565b60405180910390a25050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526107dc9084906123eb565b600082611d7f57506000610dc6565b82820282848281611d8c57fe5b0414610dea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612f1d6021913960400191505060405180910390fd5b6000808211611e5357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381611e5c57fe5b049392505050565b6000610dea83836124c3565b6000610dea8373ffffffffffffffffffffffffffffffffffffffff8416612541565b600082821415611ea3575082611ec0565b6000611eb08685856120c0565b9050611ebc8582611139565b9150505b949350505050565b6000610dc682612559565b600354600090815b818110156107dc5760008382039050600060038281548110611ef957fe5b90600052602060002090600502019050611f138242610ce0565b158015611f32575060018101546002820154611f2e91611139565b4210155b1561206c57805460028201546040517f32a96e1cf1e533fa60087738afdc6d21653efb358b1aa3a9599296a2c4ba9e4392611f6e929091612e77565b60405180910390a1600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110611fa657fe5b906000526020600020906005020160038381548110611fc157fe5b90600052602060002090600502016000820154816000015560018201548160010155600282015481600201556003820154816003015560048201548160040155905050600380548061200f57fe5b60008281526020812060057fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9093019283020181815560018181018390556002820183905560038201839055600490910191909155915594909401935b5050600101611edb565b60006120828383612541565b6120b857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610dc6565b506000610dc6565b6000806120cd8385611388565b90506120d98186611d70565b95945050505050565b6000826040015182106120fa57506020820151610dc6565b8251602084015160009161210e9190611388565b9050600061212d8560400151610dbb8685611d7090919063ffffffff16565b8551909150610dc19082611139565b6000670de0b6b3a76400006121518484611d70565b81611e5c57fe5b6000805b6003548110156121cc5760006121728242610ce0565b905060006003838154811061218357fe5b90600052602060002090600502019050816000146121c25760038101546121aa9083611388565b60038201554260048201556121bf8483611139565b93505b505060010161215c565b5080156107e5576002546121e09082611388565b6002556040517f01feb0f24c52736758ca404486734e6287175eb5c93aa090f0ab371665231d7290612213908390612b1d565b60405180910390a190565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832060010180548251818502810185019093528083529192909190849084015b828210156122aa57838290600052602060002090600202016040518060400160405290816000820154815260200160018201548152505081526020019060010190612264565b5050505090506000816122c86001845161138890919063ffffffff16565b815181106122d257fe5b60200260200101519050426122f6600754836020015161113990919063ffffffff16565b111561232e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612bc9565b50505050565b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261232e9085906123eb565b6000610dea8373ffffffffffffffffffffffffffffffffffffffff841661255d565b600061244d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166126419092919063ffffffff16565b8051909150156107dc5780806020019051602081101561246c57600080fd5b50516107dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180612f3e602a913960400191505060405180910390fd5b8154600090821061251f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180612e9c6022913960400191505060405180910390fd5b82600001828154811061252e57fe5b9060005260206000200154905092915050565b60009081526001919091016020526040902054151590565b5490565b600081815260018301602052604081205480156126375783547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80830191908101906000908790839081106125ae57fe5b90600052602060002001549050808760000184815481106125cb57fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806125fb57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610dc6565b6000915050610dc6565b6060611ec0848460008585612655856127ab565b6126c057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b6020831061272957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016126ec565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461278b576040519150601f19603f3d011682016040523d82523d6000602084013e612790565b606091505b50915091506127a08282866127b1565b979650505050505050565b3b151590565b606083156127c0575081610dea565b8251156127d05782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561283457818101518382015260200161281c565b50505050905090810190601f1680156128615780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b604051806040016040528060008152602001606081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b508054600082556002029060005260206000209081019061082d91905b808211156128f657600080825560018201556002016128dc565b5090565b803573ffffffffffffffffffffffffffffffffffffffff811681146105ec57600080fd5b60006020828403121561292f578081fd5b610dea826128fa565b6000806040838503121561294a578081fd5b612953836128fa565b946020939093013593505050565b600060208284031215612972578081fd5b5035919050565b6000806040838503121561298b578182fd5b8235915061299b602084016128fa565b90509250929050565b600080604083850312156129b6578182fd5b50508035926020909101359150565b6000606082840312156129d6578081fd5b6040516060810181811067ffffffffffffffff821117156129f357fe5b80604052508235815260208301356020820152604083013560408201528091505092915050565b600060208284031215612a2b578081fd5b5051919050565b600080600060608486031215612a46578081fd5b505081359360208301359350604090920135919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b602080825282518282018190526000919060409081850190868401855b82811015612b055781518051855286810151878601528581015186860152606080820151908601526080908101519085015260a09093019290850190600101612ac1565b5091979650505050505050565b901515815260200190565b90815260200190565b60208082526019908201527f46756e6461626c65506f6f6c2f5a65726f4475726174696f6e00000000000000604082015260600190565b6020808252818101527f4d756c7469706c696572506f6f6c2f4e6f5265636f766572794f665374616b65604082015260600190565b6020808252601b908201527f4d756c7469706c696572506f6f6c2f5a65726f41646472657373530000000000604082015260600190565b6020808252818101527f4d756c7469706c696572506f6f6c2f486172644c6f636b4e6f74506173736564604082015260600190565b6020808252601b908201527f4d756c7469706c696572506f6f6c2f5a65726f41646472657373570000000000604082015260600190565b6020808252601b908201527f4d756c7469706c696572506f6f6c2f41646a7573746572526f6c650000000000604082015260600190565b60208082526021908201527f4d756c7469706c696572506f6f6c2f4e6f5265636f766572794f66526577617260408201527f6400000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601b908201527f4d756c7469706c696572506f6f6c2f457863656564735374616b650000000000604082015260600190565b6020808252601a908201527f4d756c7469706c696572506f6f6c2f5265636f766572526f6c65000000000000604082015260600190565b60208082526019908201527f46756e6461626c65506f6f6c2f486973746f72696346756e6400000000000000604082015260600190565b60208082526017908201527f4d756c7469706c696572506f6f6c2f4e6f416d6f756e74000000000000000000604082015260600190565b60208082526017908201527f46756e6461626c65506f6f6c2f4f6e6c7946756e646572000000000000000000604082015260600190565b6020808252601f908201527f46756e6461626c65506f6f6c2f496e737566666963656e7442616c616e636500604082015260600190565b602080825282518282015282810151604080840181905281516060850181905260009392830191849160808701905b80841015612e6b5784518051835286015186830152938501936001939093019290820190612e42565b50979650505050505050565b918252602082015260400190565b928352602083019190915260408201526060019056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f206772616e74416363657373436f6e74726f6c3a2073656e646572206d75737420626520616e2061646d696e20746f207265766f6b65536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636520726f6c657320666f722073656c66a164736f6c6343000706000a

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

000000000000000000000000de4b9cbad10cdff96ee4b1f9c7568283e96c0089000000000000000000000000383df49ad1f0219759a46399fe33cb7a63cd051c00000000000000000000000024a6a37576377f63f194caa5f518a60f45b42921000000000000000000000000938625591adb4e865b882377e2c965f9f9b85e3400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001bc16d674ec8000000000000000000000000000000000000000000000000000000000000004f1a000000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _admin (address): 0xdE4B9cBaD10cdFf96eE4b1f9C7568283e96C0089
Arg [1] : _funder (address): 0x383dF49ad1f0219759a46399fE33Cb7A63cd051c
Arg [2] : _rewardToken (address): 0x24A6A37576377F63f194Caa5F518a60f45b42921
Arg [3] : _stakingToken (address): 0x938625591ADb4e865b882377e2c965F9f9b85E34
Arg [4] : _bonusScaling (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
Arg [5] : _hardLockPeriod (uint256): 0

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000de4b9cbad10cdff96ee4b1f9c7568283e96c0089
Arg [1] : 000000000000000000000000383df49ad1f0219759a46399fe33cb7a63cd051c
Arg [2] : 00000000000000000000000024a6a37576377f63f194caa5f518a60f45b42921
Arg [3] : 000000000000000000000000938625591adb4e865b882377e2c965f9f9b85e34
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000001bc16d674ec80000
Arg [6] : 00000000000000000000000000000000000000000000000000000000004f1a00
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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