Contract 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 2

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x9422dfb95c4ef9944527e46af806eb988036aec2e27547d1cd719a4738851fd7Withdraw332849242022-09-19 2:39:5415 days 18 hrs ago0x2d39fa81134f21c50a5bfef911e83b569c833ae1 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.003196349667 36.304828011
0xc8112dde163f36a230092e2694a4ff298865f70be6415d1893bbf15e4e3fe8e2Harvest Multiple...327297132022-09-05 17:12:5629 days 3 hrs ago0x6a5ad0f69790cf5deeff0289f24b563cf900eba1 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.0025355550
0xa13cc1016d6165417cda67341dcbafbe6a9c2e22645d7574ad9ed8f344cbba99Withdraw327297032022-09-05 17:12:3629 days 3 hrs ago0x6a5ad0f69790cf5deeff0289f24b563cf900eba1 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.011802750
0x7bceac39329ff100b48402766e70e15678d7efb873166ace3951af3e6831dc0eHarvest300766272022-06-27 23:39:2098 days 21 hrs ago0x54d4e81950dbef227cfc329e29e6d2faf01a7526 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.001367001321 34.117034092
0xd84d7fa0fec47ed82f337910c59fb51e9c2dfaec84a04d915302737456e284a3Withdraw300766242022-06-27 23:39:1498 days 21 hrs ago0x54d4e81950dbef227cfc329e29e6d2faf01a7526 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.00708126039 30.000001654
0xa9096a2099d08bf276c1c867db9a36b0d02031de46530c3513bbcfc38e9a7057Harvest300734012022-06-27 21:33:2898 days 23 hrs ago0xee5c256721abe58af6f582c0efd6774dd2765038 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.001338302858 33.400790117
0xed2b01bc3993b048f5da2abd5acc5e9bf1c00d134a29d2b7ff26009c21cd734fWithdraw300733862022-06-27 21:32:5898 days 23 hrs ago0xee5c256721abe58af6f582c0efd6774dd2765038 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.009892680799 32.979999999
0x09bd868bd8f75c3e13e9f44f2982db8c351176830fb4ac5adb8d3aa83dbb4781Withdraw292730172022-06-07 11:11:09119 days 9 hrs ago0x43b34da57716a660a746abc7916b2373f4efbaf4 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.010434150573 34.786531577
0xb2fa7558742e71251a4c4d97fa262ee385d398bd395c9e526f9eae3690f4d537Withdraw292058152022-06-05 18:25:36121 days 2 hrs ago0x29a4abe5cd0f23af03ae9022212583ea991aed73 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.002640900001 30.000000016
0x4f338850b51abd6cc0325ca97287532ca6eaaa5fa70ef4045049d2427c615fc1Withdraw289592562022-05-30 16:33:51127 days 4 hrs ago0x1b72bac3772050fdcaf468cce7e20deb3cb02d89 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.003020252202 34.300000023
0x57e59bded4142ba046dd561176d5fae982185bb11f0d4264bac03e67c691393aWithdraw288317492022-05-27 12:19:32130 days 8 hrs ago0xe15c174a0a57747a9816f45d5dec9a1d6d56e980 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.003400525948 38.629171288
0xea39ac11fbad6581120edac51f66b0a8b4e667a33d095f932e7c5e4c3e1c4a49Harvest288317422022-05-27 12:19:14130 days 8 hrs ago0xe15c174a0a57747a9816f45d5dec9a1d6d56e980 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.009828200568 38.19832786
0x01bd3fd99fc87a70cc544028d903fe523fcebd1724f3e1544652a7e8e1866acfWithdraw286021322022-05-21 20:23:25136 days 40 mins ago0x2623d9c00947c465b89f14bfa00b29c5b342833e IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.017530268294199.166855583
0x5bdf57aabdcc6f523324244bb93f41827ed7720e117419db9c7f430f650b010bDeposit286021072022-05-21 20:22:31136 days 40 mins ago0x2623d9c00947c465b89f14bfa00b29c5b342833e IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.011784190588130.558282608
0x57f852c8c2a2c58b0ea1f8deb1bfd4911fa0fec58d64ffe9f980a97dd4c774a6Withdraw286016492022-05-21 20:06:47136 days 56 mins ago0x2623d9c00947c465b89f14bfa00b29c5b342833e IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.00272855831
0x4cfcea04cda595df4e4caee872d308d4dfa48557e9f753e71c3e6e5b07315875Deposit286016372022-05-21 20:06:23136 days 57 mins ago0x2623d9c00947c465b89f14bfa00b29c5b342833e IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.0040318631
0x0c55cd6cee1b0e3d7150cc0d1337ba30a8a0d9abfece6996dc53eefd111b5fc8Withdraw281835472022-05-11 8:12:53146 days 12 hrs ago0xaf7b7abc272a3ae6dd6da41b9832c758477a85f2 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.06903228469 784.083558879
0x6c2c52e91fce52f15c2146ef2bc0c248dbcc8657d5bc514d366b25e21553880eWithdraw280413612022-05-07 17:59:58150 days 3 hrs ago0x26dc3f258767b34cf213a60a1b2e7d1f008cfb48 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.002612547154 29.677918369
0x119027c772423632345bee5d9682298fdb547b8b3a67f5d2c168e82eeeee2318Harvest Multiple...280413612022-05-07 17:59:58150 days 3 hrs ago0x26dc3f258767b34cf213a60a1b2e7d1f008cfb48 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.005903007285 29.604144902
0x31061b72a92f6432d7fdff9f335ed9eb34468ac7ae99b7bff74c8c74bdadc793Withdraw277406732022-04-30 3:27:13157 days 17 hrs ago0x4cc883a27a74996b8351f8cd8d3bd48f9cfe2775 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.013631004478 50.439992592
0x557403f0535fa7ad02af7a723772ddb3915c4529a981006bdbc4c17564e7a484Withdraw277385122022-04-30 2:10:18157 days 18 hrs ago0xd2aeb4a9fcae61a98214c03e8b45ffdf62463325 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.009194965806 38.952806587
0x82eb7c30dfe81ac6c634a2ebeb1bcbd9703c2f4343586300cf7aa22172fcc038Harvest274839812022-04-23 14:33:26164 days 6 hrs ago0x56874fe3f49f552ed6e7765783c02d70ec3ba0db IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.001343364842 33.537169033
0x429b4e20ac94dc5867b7d52a7f12d112b5bad8633a95c45bcb5dec065845bbf4Withdraw274839622022-04-23 14:32:44164 days 6 hrs ago0x56874fe3f49f552ed6e7765783c02d70ec3ba0db IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.027009689058 116.400001114
0x6769e2537059cd5e2788e97129308103c80414b078130959f32d9ea89208dd09Harvest Multiple...272658632022-04-18 1:21:18169 days 19 hrs ago0xc349d5cf4ec1e9e5c8bbf9c45048b088bfbccea4 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.001813131236 35.7542
0xb3c9c54c9026cd4bd842aa2a21b5a4798378a477ab933266d4a8df95c44dbf5cWithdraw272658472022-04-18 1:20:42169 days 19 hrs ago0xc349d5cf4ec1e9e5c8bbf9c45048b088bfbccea4 IN  0x829c27fd3013b944cbe76e92c3d6c45767c0c7890 MATIC0.008587872192 32.25443446
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xa13cc1016d6165417cda67341dcbafbe6a9c2e22645d7574ad9ed8f344cbba99327297032022-09-05 17:12:3629 days 3 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker4.120905373816757969 MATIC
0xd84d7fa0fec47ed82f337910c59fb51e9c2dfaec84a04d915302737456e284a3300766242022-06-27 23:39:1498 days 21 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker0.007456037735332756 MATIC
0xed2b01bc3993b048f5da2abd5acc5e9bf1c00d134a29d2b7ff26009c21cd734f300733862022-06-27 21:32:5898 days 23 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker2.182954534651869848 MATIC
0x09bd868bd8f75c3e13e9f44f2982db8c351176830fb4ac5adb8d3aa83dbb4781292730172022-06-07 11:11:09119 days 9 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker1.450690502401374551 MATIC
0xea39ac11fbad6581120edac51f66b0a8b4e667a33d095f932e7c5e4c3e1c4a49288317422022-05-27 12:19:14130 days 8 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker10.001628979834219132 MATIC
0x119027c772423632345bee5d9682298fdb547b8b3a67f5d2c168e82eeeee2318280413612022-05-07 17:59:58150 days 3 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker232.093374968617477731 MATIC
0x31061b72a92f6432d7fdff9f335ed9eb34468ac7ae99b7bff74c8c74bdadc793277406732022-04-30 3:27:13157 days 17 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker5.163818784120322314 MATIC
0x557403f0535fa7ad02af7a723772ddb3915c4529a981006bdbc4c17564e7a484277385122022-04-30 2:10:18157 days 18 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker4.078721756978366912 MATIC
0x429b4e20ac94dc5867b7d52a7f12d112b5bad8633a95c45bcb5dec065845bbf4274839622022-04-23 14:32:44164 days 6 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker56.715603509618224305 MATIC
0xb3c9c54c9026cd4bd842aa2a21b5a4798378a477ab933266d4a8df95c44dbf5c272658472022-04-18 1:20:42169 days 19 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker5.813511192778003823 MATIC
0x07f841f95dd9045d28711f04918d21d1de5250e21a2d87cc59eb6969bc5048d3270108402022-04-11 14:06:16176 days 6 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker21.120582935992449497 MATIC
0x2ea0fe5a3265974b819571282703289b57f0196aac970c71ca08652c4cbcd019269865002022-04-10 23:32:11176 days 21 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker1.216088004526008685 MATIC
0x22b1a6ae24a01ea97eac6ccb8c8e70149be8a4bcce6782f2dd31ab3c40ea1f5f248547402022-02-12 13:45:41234 days 7 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker89.327340493112121854 MATIC
0x1691614fa2dd427c3be962373298fa3339de38d9b140fb4c16f88fc3ca807054248124502022-02-11 12:20:40235 days 8 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker36.568827665557262454 MATIC
0x2354853b57f939ce0741c8441216a6d2b7a194e17d9989f1f294e08ed355cb4c246320272022-02-06 21:54:46239 days 23 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker1.028146672113013752 MATIC
0x7187d22992f4fa68150758378cce6c13ab0d2ff30836c58a57dadd91eed23fe4244618262022-02-02 13:07:23244 days 7 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker31.95100210923126735 MATIC
0x66794955757591603710ffc8d6530158e86ed09766a469ca70dbb0763e83a0a3242486152022-01-28 2:24:40249 days 18 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker401.934338277102412993 MATIC
0xb058697e1176335592b9b264640bc1a008f57e3f46731e2d30c8a1674e360d55233052042022-01-03 15:45:56274 days 5 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker57.248950524943056467 MATIC
0x33244093bff5426b049598c222140f18dd642bc64921bd22823a2f624a61ab37232399162022-01-01 23:37:56275 days 21 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker0.854798283655304095 MATIC
0x7a0a225599c93e1fae6f9f5964d1763176e471a2767f6dbf72f3e45dafc23e70231458302021-12-30 15:04:07278 days 5 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker1.05604219402536571 MATIC
0x4e68e792e2a2ddb165b603c7ab89f36144cea3da83671a6f2d935300079dfd2f230235352021-12-27 12:29:11281 days 8 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker9.987805248676871181 MATIC
0x522c76fbcba941f7b62b7c0fee53abeb59e3b61e6a39822ef58e3913801dae65230109372021-12-27 4:48:10281 days 16 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker167.261507856472443301 MATIC
0x7946e74cb3db1b81bcca35831ed0c95ed14cb5a52968cbcc98a77d55ceda4bfd228973352021-12-24 7:06:41284 days 13 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker4,886.341835741816594635 MATIC
0x584901e3b1752b219c7a1220a66eb3d14f2718513344eed9dab1bf920390887b228973222021-12-24 7:06:15284 days 13 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker2,615.844479644141572736 MATIC
0x85f2e97db03af19657cf1db850d213244a2f140a48983b4c6f6bdba4f50568cf228971832021-12-24 7:01:29284 days 14 hrs ago 0x829c27fd3013b944cbe76e92c3d6c45767c0c789 Kyber Swap: Reward Locker4,886.341835741816594635 MATIC
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
KyberFairLaunch

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 11 : KyberFairLaunch.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

import {ReentrancyGuard} from '@openzeppelin/contracts/utils/ReentrancyGuard.sol';
import {SafeMath} from '@openzeppelin/contracts/math/SafeMath.sol';
import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol';
import {SafeCast} from '@openzeppelin/contracts/utils/SafeCast.sol';
import {IERC20Ext} from '@kyber.network/utils-sc/contracts/IERC20Ext.sol';
import {PermissionAdmin} from '@kyber.network/utils-sc/contracts/PermissionAdmin.sol';
import {IKyberFairLaunch} from '../interfaces/liquidityMining/IKyberFairLaunch.sol';
import {IKyberRewardLocker} from '../interfaces/liquidityMining/IKyberRewardLocker.sol';

/// FairLaunch contract for Kyber DMM Liquidity Mining program
/// Allow stakers to stake LP tokens and receive reward tokens
/// Allow extend or renew a pool to continue/restart the LM program
/// When harvesting, rewards will be transferred to a RewardLocker
/// Support multiple reward tokens, reward tokens must be distinct and immutable
contract KyberFairLaunch is IKyberFairLaunch, PermissionAdmin, ReentrancyGuard {
  using SafeMath for uint256;
  using SafeCast for uint256;
  using SafeERC20 for IERC20Ext;

  uint256 internal constant PRECISION = 1e12;

  struct UserRewardData {
    uint256 unclaimedReward;
    uint256 lastRewardPerShare;
  }
  // Info of each user.
  struct UserInfo {
    uint256 amount; // How many Staking tokens the user has provided.
    mapping (uint256 => UserRewardData) userRewardData;
    //
    // Basically, any point in time, the amount of reward token
    // entitled to a user but is pending to be distributed is:
    //
    //   pending reward = user.unclaimAmount + (user.amount * (pool.accRewardPerShare - user.lastRewardPerShare)
    //
    // Whenever a user deposits or withdraws Staking tokens to a pool. Here's what happens:
    //   1. The pool's `accRewardPerShare` (and `lastRewardBlock`) gets updated.
    //   2. User receives the pending reward sent to his/her address.
    //   3. User's `lastRewardPerShare` gets updated.
    //   4. User's `amount` gets updated.
  }

  struct PoolRewardData {
    uint256 rewardPerBlock;
    uint256 accRewardPerShare;
  }
  // Info of each pool
  // poolRewardData: reward data for each reward token
  //      rewardPerBlock: amount of reward token per block
  //      accRewardPerShare: accumulated reward per share of token
  // totalStake: total amount of stakeToken has been staked
  // stakeToken: token to stake, should be an ERC20 token
  // startBlock: the block that the reward starts
  // endBlock: the block that the reward ends
  // lastRewardBlock: last block number that rewards distribution occurs
  struct PoolInfo {
    uint256 totalStake;
    address stakeToken;
    uint32 startBlock;
    uint32 endBlock;
    uint32 lastRewardBlock;
    mapping (uint256 => PoolRewardData) poolRewardData;
  }

  // check if a pool exists for a stakeToken
  mapping(address => bool) public poolExists;
  // contract for locking reward
  IKyberRewardLocker public immutable rewardLocker;
  // list reward tokens, use 0x0 for native token, shouldn't be too many reward tokens
  // don't validate values or length by trusting the deployer
  address[] public rewardTokens;

  // Info of each pool.
  uint256 public override poolLength;
  mapping(uint256 => PoolInfo) internal poolInfo;
  // Info of each user that stakes Staking tokens.
  mapping(uint256 => mapping(address => UserInfo)) internal userInfo;

  event AddNewPool(
    address indexed stakeToken,
    uint32 indexed startBlock,
    uint32 indexed endBlock,
    uint256[] rewardPerBlocks
  );
  event RenewPool(
    uint256 indexed pid,
    uint32 indexed startBlock,
    uint32 indexed endBlock,
    uint256[] rewardPerBlocks
  );
  event UpdatePool(
    uint256 indexed pid,
    uint32 indexed endBlock,
    uint256[] rewardPerBlocks
  );
  event Deposit(
    address indexed user,
    uint256 indexed pid,
    uint256 indexed blockNumber,
    uint256 amount
  );
  event Withdraw(
    address indexed user,
    uint256 indexed pid,
    uint256 indexed blockNumber,
    uint256 amount
  );
  event Harvest(
    address indexed user,
    uint256 indexed pid,
    address indexed rewardToken,
    uint256 lockedAmount,
    uint256 blockNumber
  );
  event EmergencyWithdraw(
    address indexed user,
    uint256 indexed pid,
    uint256 indexed blockNumber,
    uint256 amount
  );

  constructor(
    address _admin,
    address[] memory _rewardTokens,
    IKyberRewardLocker _rewardLocker
  ) PermissionAdmin(_admin) {
    rewardTokens = _rewardTokens;
    rewardLocker = _rewardLocker;

    // approve allowance to reward locker
    for(uint256 i = 0; i < _rewardTokens.length; i++) {
      if (_rewardTokens[i] != address(0)) {
        IERC20Ext(_rewardTokens[i]).safeApprove(address(_rewardLocker), type(uint256).max);
      }
    }
  }

  receive() external payable {}

  /**
   * @dev Allow admin to withdraw only reward tokens
   */
  function adminWithdraw(uint256 rewardTokenIndex, uint256 amount) external onlyAdmin {
    IERC20Ext rewardToken = IERC20Ext(rewardTokens[rewardTokenIndex]);
    if (rewardToken == IERC20Ext(0)) {
      (bool success, ) = msg.sender.call{ value: amount }('');
      require(success, 'transfer reward token failed');
    } else {
      rewardToken.safeTransfer(msg.sender, amount);
    }
  }

  /**
   * @dev Add a new lp to the pool. Can only be called by the admin.
   * @param _stakeToken: token to be staked to the pool
   * @param _startBlock: block where the reward starts
   * @param _endBlock: block where the reward ends
   * @param _rewardPerBlocks: amount of reward token per block for the pool for each reward token
   */
  function addPool(
    address _stakeToken,
    uint32 _startBlock,
    uint32 _endBlock,
    uint256[] calldata _rewardPerBlocks
  ) external override onlyAdmin {
    require(!poolExists[_stakeToken], 'add: duplicated pool');
    require(_stakeToken != address(0), 'add: invalid stake token');
    require(rewardTokens.length == _rewardPerBlocks.length, 'add: invalid length');

    require(_startBlock > block.number && _endBlock > _startBlock, 'add: invalid blocks');

    poolInfo[poolLength].stakeToken = _stakeToken;
    poolInfo[poolLength].startBlock = _startBlock;
    poolInfo[poolLength].endBlock = _endBlock;
    poolInfo[poolLength].lastRewardBlock = _startBlock;

    for(uint256 i = 0; i < _rewardPerBlocks.length; i++) {
      poolInfo[poolLength].poolRewardData[i] = PoolRewardData({
        rewardPerBlock: _rewardPerBlocks[i],
        accRewardPerShare: 0
      });
    }

    poolLength++;

    poolExists[_stakeToken] = true;

    emit AddNewPool(_stakeToken, _startBlock, _endBlock, _rewardPerBlocks);
  }

  /**
   * @dev Renew a pool to start another liquidity mining program
   * @param _pid: id of the pool to renew, must be pool that has not started or already ended
   * @param _startBlock: block where the reward starts
   * @param _endBlock: block where the reward ends
   * @param _rewardPerBlocks: amount of reward token per block for the pool
   *   0 if we want to stop the pool from accumulating rewards
   */
  function renewPool(
    uint256 _pid,
    uint32 _startBlock,
    uint32 _endBlock,
    uint256[] calldata _rewardPerBlocks
  ) external override onlyAdmin {
    updatePoolRewards(_pid);

    PoolInfo storage pool = poolInfo[_pid];
    // check if pool has not started or already ended
    require(
      pool.startBlock > block.number || pool.endBlock < block.number,
      'renew: invalid pool state to renew'
    );
    // checking data of new pool
    require(rewardTokens.length == _rewardPerBlocks.length, 'renew: invalid length');
    require(_startBlock > block.number && _endBlock > _startBlock, 'renew: invalid blocks');

    pool.startBlock = _startBlock;
    pool.endBlock = _endBlock;
    pool.lastRewardBlock = _startBlock;

    for(uint256 i = 0; i < _rewardPerBlocks.length; i++) {
      pool.poolRewardData[i].rewardPerBlock = _rewardPerBlocks[i];
    }

    emit RenewPool(_pid, _startBlock, _endBlock, _rewardPerBlocks);
  }

  /**
   * @dev Update a pool, allow to change end block, reward per block
   * @param _pid: pool id to be renew
   * @param _endBlock: block where the reward ends
   * @param _rewardPerBlocks: amount of reward token per block for the pool,
   *   0 if we want to stop the pool from accumulating rewards
   */
  function updatePool(
    uint256 _pid,
    uint32 _endBlock,
    uint256[] calldata _rewardPerBlocks
  ) external override onlyAdmin {
    updatePoolRewards(_pid);

    PoolInfo storage pool = poolInfo[_pid];

    // should call renew pool if the pool has ended
    require(pool.endBlock > block.number, 'update: pool already ended');
    require(rewardTokens.length == _rewardPerBlocks.length, 'update: invalid length');
    require(_endBlock > block.number && _endBlock > pool.startBlock, 'update: invalid end block');

    pool.endBlock = _endBlock;
    for(uint256 i = 0; i < _rewardPerBlocks.length; i++) {
      pool.poolRewardData[i].rewardPerBlock = _rewardPerBlocks[i];
    }

    emit UpdatePool(_pid, _endBlock, _rewardPerBlocks);
  }

  /**
   * @dev Deposit tokens to accumulate rewards
   * @param _pid: id of the pool
   * @param _amount: amount of stakeToken to be deposited
   * @param _shouldHarvest: whether to harvest the reward or not
   */
  function deposit(
    uint256 _pid,
    uint256 _amount,
    bool _shouldHarvest
  ) external override nonReentrant {
    // update pool rewards, user's rewards
    updatePoolRewards(_pid);
    _updateUserReward(msg.sender, _pid, _shouldHarvest);

    PoolInfo storage pool = poolInfo[_pid];
    UserInfo storage user = userInfo[_pid][msg.sender];

    // collect stakeToken
    IERC20Ext(pool.stakeToken).safeTransferFrom(msg.sender, address(this), _amount);

    // update user staked amount, and total staked amount for the pool
    user.amount = user.amount.add(_amount);
    pool.totalStake = pool.totalStake.add(_amount);

    emit Deposit(msg.sender, _pid, block.number, _amount);
  }

  /**
   * @dev Withdraw token (of the sender) from pool, also harvest rewards
   * @param _pid: id of the pool
   * @param _amount: amount of stakeToken to withdraw
   */
  function withdraw(uint256 _pid, uint256 _amount) external override nonReentrant {
    _withdraw(_pid, _amount);
  }

  /**
   * @dev Withdraw all tokens (of the sender) from pool, also harvest reward
   * @param _pid: id of the pool
   */
  function withdrawAll(uint256 _pid) external override nonReentrant {
    _withdraw(_pid, userInfo[_pid][msg.sender].amount);
  }

  /**
   * @notice EMERGENCY USAGE ONLY, USER'S REWARDS WILL BE RESET
   * @dev Emergency withdrawal function to allow withdraw all deposited tokens (of the sender)
   *   and reset all rewards
   * @param _pid: id of the pool
   */
  function emergencyWithdraw(uint256 _pid) external override nonReentrant {
    PoolInfo storage pool = poolInfo[_pid];
    UserInfo storage user = userInfo[_pid][msg.sender];
    uint256 amount = user.amount;

    user.amount = 0;
    for(uint256 i = 0; i < rewardTokens.length; i++) {
      UserRewardData storage rewardData = user.userRewardData[i];
      rewardData.lastRewardPerShare = 0;
      rewardData.unclaimedReward = 0;
    }

    pool.totalStake = pool.totalStake.sub(amount);

    if (amount > 0) {
      IERC20Ext(pool.stakeToken).safeTransfer(msg.sender, amount);
    }

    emit EmergencyWithdraw(msg.sender, _pid, block.number, amount);
  }

  /**
   * @dev Harvest rewards from multiple pools for the sender
   *   combine rewards from all pools and only transfer once to save gas
   */
  function harvestMultiplePools(uint256[] calldata _pids) external override {
    address[] memory rTokens = rewardTokens;
    uint256[] memory totalRewards = new uint256[](rTokens.length);
    address account = msg.sender;
    uint256 pid;

    for (uint256 i = 0; i < _pids.length; i++) {
      pid = _pids[i];
      updatePoolRewards(pid);
      // update user reward without harvesting
      _updateUserReward(account, pid, false);

      for(uint256 j = 0; j < rTokens.length; j++) {
        uint256 reward = userInfo[pid][account].userRewardData[j].unclaimedReward;
        if (reward > 0) {
          totalRewards[j] = totalRewards[j].add(reward);
          userInfo[pid][account].userRewardData[j].unclaimedReward = 0;
          emit Harvest(account, pid, rTokens[j], reward, block.number);
        }
      }
    }

    for(uint256 i = 0; i < totalRewards.length; i++) {
      if (totalRewards[i] > 0) {
        _lockReward(IERC20Ext(rTokens[i]), account, totalRewards[i]);
      }
    }
  }

  /**
   * @dev Get pending rewards of a user from a pool, mostly for front-end
   * @param _pid: id of the pool
   * @param _user: user to check for pending rewards
   */
  function pendingRewards(uint256 _pid, address _user)
    external
    override
    view
    returns (uint256[] memory rewards)
  {
    uint256 rTokensLength = rewardTokens.length;
    rewards = new uint256[](rTokensLength);
    PoolInfo storage pool = poolInfo[_pid];
    UserInfo storage user = userInfo[_pid][_user];
    uint256 _totalStake = pool.totalStake;
    uint256 _poolLastRewardBlock = pool.lastRewardBlock;
    uint32 lastAccountedBlock = _lastAccountedRewardBlock(_pid);
    for(uint256 i = 0; i < rTokensLength; i++) {
      uint256 _accRewardPerShare = pool.poolRewardData[i].accRewardPerShare;
      if (lastAccountedBlock > _poolLastRewardBlock && _totalStake != 0) {
        uint256 reward = (lastAccountedBlock - _poolLastRewardBlock)
          .mul(pool.poolRewardData[i].rewardPerBlock);
        _accRewardPerShare = _accRewardPerShare.add(reward.mul(PRECISION) / _totalStake);
      }

      rewards[i] = user.amount.mul(
        _accRewardPerShare.sub(user.userRewardData[i].lastRewardPerShare)
        ) / PRECISION;
      rewards[i] = rewards[i].add(user.userRewardData[i].unclaimedReward);
    }
  }

  /**
   * @dev Return list reward tokens
   */
  function getRewardTokens() external override view returns (address[] memory) {
    return rewardTokens;
  }

  /**
   * @dev Return full details of a pool
   */
  function getPoolInfo(uint256 _pid)
    external override view
    returns (
      uint256 totalStake,
      address stakeToken,
      uint32 startBlock,
      uint32 endBlock,
      uint32 lastRewardBlock,
      uint256[] memory rewardPerBlocks,
      uint256[] memory accRewardPerShares
    )
  {
    PoolInfo storage pool = poolInfo[_pid];
    (
      totalStake,
      stakeToken,
      startBlock,
      endBlock,
      lastRewardBlock
    ) = (
      pool.totalStake,
      pool.stakeToken,
      pool.startBlock,
      pool.endBlock,
      pool.lastRewardBlock
    );
    rewardPerBlocks = new uint256[](rewardTokens.length);
    accRewardPerShares = new uint256[](rewardTokens.length);
    for(uint256 i = 0; i < rewardTokens.length; i++) {
      rewardPerBlocks[i] = pool.poolRewardData[i].rewardPerBlock;
      accRewardPerShares[i] = pool.poolRewardData[i].accRewardPerShare;
    }
  }

  /**
   * @dev Return user's info including deposited amount and reward data
   */
  function getUserInfo(uint256 _pid, address _account)
    external override view
    returns (
      uint256 amount,
      uint256[] memory unclaimedRewards,
      uint256[] memory lastRewardPerShares
    )
  {
    UserInfo storage user = userInfo[_pid][_account];
    amount = user.amount;
    unclaimedRewards = new uint256[](rewardTokens.length);
    lastRewardPerShares = new uint256[](rewardTokens.length);
    for(uint256 i = 0; i < rewardTokens.length; i++) {
      unclaimedRewards[i] = user.userRewardData[i].unclaimedReward;
      lastRewardPerShares[i] = user.userRewardData[i].lastRewardPerShare;
    }
  }

  /**
   * @dev Harvest rewards from a pool for the sender
   * @param _pid: id of the pool
   */
  function harvest(uint256 _pid) public override {
    updatePoolRewards(_pid);
    _updateUserReward(msg.sender, _pid, true);
  }

  /**
   * @dev Update rewards for one pool
   */
  function updatePoolRewards(uint256 _pid) public override {
    require(_pid < poolLength, 'invalid pool id');
    PoolInfo storage pool = poolInfo[_pid];
    uint32 lastAccountedBlock = _lastAccountedRewardBlock(_pid);
    if (lastAccountedBlock <= pool.lastRewardBlock) return;
    uint256 _totalStake = pool.totalStake;
    if (_totalStake == 0) {
      pool.lastRewardBlock = lastAccountedBlock;
      return;
    }
    uint256 numberBlocks = lastAccountedBlock - pool.lastRewardBlock;
    for(uint256 i = 0; i < rewardTokens.length; i++) {
      PoolRewardData storage rewardData = pool.poolRewardData[i];
      uint256 reward = numberBlocks.mul(rewardData.rewardPerBlock);
      rewardData.accRewardPerShare = rewardData.accRewardPerShare.add(reward.mul(PRECISION) / _totalStake);
    }
    pool.lastRewardBlock = lastAccountedBlock;
  }

  /**
   * @dev Withdraw _amount of stakeToken from pool _pid, also harvest reward for the sender
   */
  function _withdraw(uint256 _pid, uint256 _amount) internal {
    PoolInfo storage pool = poolInfo[_pid];
    UserInfo storage user = userInfo[_pid][msg.sender];
    require(user.amount >= _amount, 'withdraw: insufficient amount');

    // update pool reward and harvest
    updatePoolRewards(_pid);
    _updateUserReward(msg.sender, _pid, true);

    user.amount = user.amount.sub(_amount);
    pool.totalStake = pool.totalStake.sub(_amount);

    IERC20Ext(pool.stakeToken).safeTransfer(msg.sender, _amount);

    emit Withdraw(msg.sender, _pid, block.number, _amount);
  }

  /**
   * @dev Update reward of _to address from pool _pid, harvest if needed
   */
  function _updateUserReward(
    address _to,
    uint256 _pid,
    bool shouldHarvest
  ) internal {
    uint256 userAmount = userInfo[_pid][_to].amount;
    uint256 rTokensLength = rewardTokens.length;

    if (userAmount == 0) {
      // update user last reward per share to the latest pool reward per share
      // by right if user.amount is 0, user.unclaimedReward should be 0 as well,
      // except when user uses emergencyWithdraw function
      for(uint256 i = 0; i < rTokensLength; i++) {
        userInfo[_pid][_to].userRewardData[i].lastRewardPerShare =
          poolInfo[_pid].poolRewardData[i].accRewardPerShare;
      }
      return;
    }

    for(uint256 i = 0; i < rTokensLength; i++) {
      uint256 lastAccRewardPerShare = poolInfo[_pid].poolRewardData[i].accRewardPerShare;
      UserRewardData storage rewardData = userInfo[_pid][_to].userRewardData[i];
      // user's unclaim reward + user's amount * (pool's accRewardPerShare - user's lastRewardPerShare) / precision
      uint256 _pending = userAmount.mul(lastAccRewardPerShare.sub(rewardData.lastRewardPerShare)) / PRECISION;
      _pending = _pending.add(rewardData.unclaimedReward);

      rewardData.unclaimedReward = shouldHarvest ? 0 : _pending;
      // update user last reward per share to the latest pool reward per share
      rewardData.lastRewardPerShare = lastAccRewardPerShare;

      if (shouldHarvest && _pending > 0) {
        _lockReward(IERC20Ext(rewardTokens[i]), _to, _pending);
        emit Harvest(_to, _pid, rewardTokens[i], _pending, block.number);
      }
    }
  }

  /**
   * @dev Returns last accounted reward block, either the current block number or the endBlock of the pool
   */
  function _lastAccountedRewardBlock(uint256 _pid) internal view returns (uint32 _value) {
    _value = poolInfo[_pid].endBlock;
    if (_value > block.number) _value = block.number.toUint32();
  }

  /**
   * @dev Call locker contract to lock rewards
   */
  function _lockReward(IERC20Ext token, address _account, uint256 _amount) internal {
    uint256 value = token == IERC20Ext(0) ? _amount : 0;
    rewardLocker.lock{ value: value }(token, _account, _amount);
  }
}

File 2 of 11 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

    uint256 private _status;

    constructor () {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 3 of 11 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 4 of 11 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 5 of 11 : SafeCast.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;


/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        require(value < 2**255, "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 6 of 11 : IERC20Ext.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";


/**
 * @dev Interface extending ERC20 standard to include decimals() as
 *      it is optional in the OpenZeppelin IERC20 interface.
 */
interface IERC20Ext is IERC20 {
    /**
     * @dev This function is required as Kyber requires to interact
     *      with token.decimals() with many of its operations.
     */
    function decimals() external view returns (uint8 digits);
}

File 7 of 11 : PermissionAdmin.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;


abstract contract PermissionAdmin {
    address public admin;
    address public pendingAdmin;

    event AdminClaimed(address newAdmin, address previousAdmin);

    event TransferAdminPending(address pendingAdmin);

    constructor(address _admin) {
        require(_admin != address(0), "admin 0");
        admin = _admin;
    }

    modifier onlyAdmin() {
        require(msg.sender == admin, "only admin");
        _;
    }

    /**
     * @dev Allows the current admin to set the pendingAdmin address.
     * @param newAdmin The address to transfer ownership to.
     */
    function transferAdmin(address newAdmin) public onlyAdmin {
        require(newAdmin != address(0), "new admin 0");
        emit TransferAdminPending(newAdmin);
        pendingAdmin = newAdmin;
    }

    /**
     * @dev Allows the current admin to set the admin in one tx. Useful initial deployment.
     * @param newAdmin The address to transfer ownership to.
     */
    function transferAdminQuickly(address newAdmin) public onlyAdmin {
        require(newAdmin != address(0), "admin 0");
        emit TransferAdminPending(newAdmin);
        emit AdminClaimed(newAdmin, admin);
        admin = newAdmin;
    }

    /**
     * @dev Allows the pendingAdmin address to finalize the change admin process.
     */
    function claimAdmin() public {
        require(pendingAdmin == msg.sender, "not pending");
        emit AdminClaimed(pendingAdmin, admin);
        admin = pendingAdmin;
        pendingAdmin = address(0);
    }
}

File 8 of 11 : IKyberFairLaunch.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

interface IKyberFairLaunch {
  /**
   * @dev Add a new lp to the pool. Can only be called by the admin.
   * @param _stakeToken: token to be staked to the pool
   * @param _startBlock: block where the reward starts
   * @param _endBlock: block where the reward ends
   * @param _rewardPerBlocks: amount of reward token per block for the pool
   */
  function addPool(
    address _stakeToken,
    uint32 _startBlock,
    uint32 _endBlock,
    uint256[] calldata _rewardPerBlocks
  ) external;

  /**
   * @dev Renew a pool to start another liquidity mining program
   * @param _pid: id of the pool to renew, must be pool that has not started or already ended
   * @param _startBlock: block where the reward starts
   * @param _endBlock: block where the reward ends
   * @param _rewardPerBlocks: amount of reward token per block for the pool
   *   0 if we want to stop the pool from accumulating rewards
   */
  function renewPool(
    uint256 _pid,
    uint32 _startBlock,
    uint32 _endBlock,
    uint256[] calldata _rewardPerBlocks
  ) external;

  /**
   * @dev Update a pool, allow to change end block, reward per block
   * @param _pid: pool id to be renew
   * @param _endBlock: block where the reward ends
   * @param _rewardPerBlocks: amount of reward token per block for the pool
   *   0 if we want to stop the pool from accumulating rewards
   */
  function updatePool(
    uint256 _pid,
    uint32 _endBlock,
    uint256[] calldata _rewardPerBlocks
  ) external;

  /**
   * @dev deposit to tokens to accumulate rewards
   * @param _pid: id of the pool
   * @param _amount: amount of stakeToken to be deposited
   * @param _shouldHarvest: whether to harvest the reward or not
   */
  function deposit(
    uint256 _pid,
    uint256 _amount,
    bool _shouldHarvest
  ) external;

  /**
   * @dev withdraw token (of the sender) from pool, also harvest reward
   * @param _pid: id of the pool
   * @param _amount: amount of stakeToken to withdraw
   */
  function withdraw(uint256 _pid, uint256 _amount) external;

  /**
   * @dev withdraw all tokens (of the sender) from pool, also harvest reward
   * @param _pid: id of the pool
   */
  function withdrawAll(uint256 _pid) external;

  /**
   * @dev emergency withdrawal function to allow withdraw all deposited token (of the sender)
   *   without harvesting the reward
   * @param _pid: id of the pool
   */
  function emergencyWithdraw(uint256 _pid) external;

  /**
   * @dev harvest reward from pool for the sender
   * @param _pid: id of the pool
   */
  function harvest(uint256 _pid) external;

  /**
   * @dev harvest rewards from multiple pools for the sender
   */
  function harvestMultiplePools(uint256[] calldata _pids) external;

  /**
   * @dev update reward for one pool
   */
  function updatePoolRewards(uint256 _pid) external;

  /**
   * @dev return the total of pools that have been added
   */
  function poolLength() external view returns (uint256);

  /**
   * @dev return full details of a pool
   */
  function getPoolInfo(uint256 _pid)
    external view
    returns(
      uint256 totalStake,
      address stakeToken,
      uint32 startBlock,
      uint32 endBlock,
      uint32 lastRewardBlock,
      uint256[] memory rewardPerBlocks,
      uint256[] memory accRewardPerShares);

  /**
   * @dev get user's info
   */
  function getUserInfo(uint256 _pid, address _account)
    external view
    returns (
      uint256 amount,
      uint256[] memory unclaimedRewards,
      uint256[] memory lastRewardPerShares);

  /**
  * @dev return list reward tokens
  */
  function getRewardTokens() external view returns (address[] memory);
  /**
   * @dev get pending reward of a user from a pool, mostly for front-end
   * @param _pid: id of the pool
   * @param _user: user to check for pending rewards
   */
  function pendingRewards(
    uint256 _pid,
    address _user
   )
    external view
    returns (uint256[] memory rewards);
}

File 9 of 11 : IKyberRewardLocker.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.6;
pragma abicoder v2;

import {IERC20Ext} from '@kyber.network/utils-sc/contracts/IERC20Ext.sol';

interface IKyberRewardLocker {
  struct VestingSchedule {
    uint64 startBlock;
    uint64 endBlock;
    uint128 quantity;
    uint128 vestedQuantity;
  }

  event VestingEntryCreated(
    IERC20Ext indexed token,
    address indexed beneficiary,
    uint256 startBlock,
    uint256 endBlock,
    uint256 quantity,
    uint256 index
  );

  event VestingEntryQueued(
    uint256 indexed index,
    IERC20Ext indexed token,
    address indexed beneficiary,
    uint256 quantity
  );

  event Vested(
    IERC20Ext indexed token,
    address indexed beneficiary,
    uint256 vestedQuantity,
    uint256 index
  );

  /**
   * @dev queue a vesting schedule starting from now
   */
  function lock(
    IERC20Ext token,
    address account,
    uint256 amount
  ) external payable;

  /**
   * @dev queue a vesting schedule
   */
  function lockWithStartBlock(
    IERC20Ext token,
    address account,
    uint256 quantity,
    uint256 startBlock
  ) external payable;

  /**
   * @dev vest all completed schedules for multiple tokens
   */
  function vestCompletedSchedulesForMultipleTokens(IERC20Ext[] calldata tokens)
    external
    returns (uint256[] memory vestedAmounts);

  /**
   * @dev claim multiple tokens for specific vesting schedule,
   *      if schedule has not ended yet, claiming amounts are linear with vesting blocks
   */
  function vestScheduleForMultipleTokensAtIndices(
    IERC20Ext[] calldata tokens,
    uint256[][] calldata indices
  )
    external
    returns (uint256[] memory vestedAmounts);

  /**
   * @dev for all completed schedule, claim token
   */
  function vestCompletedSchedules(IERC20Ext token) external returns (uint256);

  /**
   * @dev claim token for specific vesting schedule,
   * @dev if schedule has not ended yet, claiming amount is linear with vesting blocks
   */
  function vestScheduleAtIndices(IERC20Ext token, uint256[] calldata indexes)
    external
    returns (uint256);

  /**
   * @dev claim token for specific vesting schedule from startIndex to endIndex
   */
  function vestSchedulesInRange(
    IERC20Ext token,
    uint256 startIndex,
    uint256 endIndex
  ) external returns (uint256);

  /**
   * @dev length of vesting schedules array
   */
  function numVestingSchedules(address account, IERC20Ext token) external view returns (uint256);

  /**
   * @dev get detailed of each vesting schedule
   */
  function getVestingScheduleAtIndex(
    address account,
    IERC20Ext token,
    uint256 index
  ) external view returns (VestingSchedule memory);

  /**
   * @dev get vesting shedules array
   */
  function getVestingSchedules(address account, IERC20Ext token)
    external
    view
    returns (VestingSchedule[] memory schedules);
}

File 10 of 11 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 11 of 11 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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);
            }
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address[]","name":"_rewardTokens","type":"address[]"},{"internalType":"contract IKyberRewardLocker","name":"_rewardLocker","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakeToken","type":"address"},{"indexed":true,"internalType":"uint32","name":"startBlock","type":"uint32"},{"indexed":true,"internalType":"uint32","name":"endBlock","type":"uint32"},{"indexed":false,"internalType":"uint256[]","name":"rewardPerBlocks","type":"uint256[]"}],"name":"AddNewPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"}],"name":"AdminClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"blockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"blockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"lockedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"}],"name":"Harvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"uint32","name":"startBlock","type":"uint32"},{"indexed":true,"internalType":"uint32","name":"endBlock","type":"uint32"},{"indexed":false,"internalType":"uint256[]","name":"rewardPerBlocks","type":"uint256[]"}],"name":"RenewPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pendingAdmin","type":"address"}],"name":"TransferAdminPending","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"uint32","name":"endBlock","type":"uint32"},{"indexed":false,"internalType":"uint256[]","name":"rewardPerBlocks","type":"uint256[]"}],"name":"UpdatePool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"blockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"address","name":"_stakeToken","type":"address"},{"internalType":"uint32","name":"_startBlock","type":"uint32"},{"internalType":"uint32","name":"_endBlock","type":"uint32"},{"internalType":"uint256[]","name":"_rewardPerBlocks","type":"uint256[]"}],"name":"addPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardTokenIndex","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"adminWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_shouldHarvest","type":"bool"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"getPoolInfo","outputs":[{"internalType":"uint256","name":"totalStake","type":"uint256"},{"internalType":"address","name":"stakeToken","type":"address"},{"internalType":"uint32","name":"startBlock","type":"uint32"},{"internalType":"uint32","name":"endBlock","type":"uint32"},{"internalType":"uint32","name":"lastRewardBlock","type":"uint32"},{"internalType":"uint256[]","name":"rewardPerBlocks","type":"uint256[]"},{"internalType":"uint256[]","name":"accRewardPerShares","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewardTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_account","type":"address"}],"name":"getUserInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256[]","name":"unclaimedRewards","type":"uint256[]"},{"internalType":"uint256[]","name":"lastRewardPerShares","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_pids","type":"uint256[]"}],"name":"harvestMultiplePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingRewards","outputs":[{"internalType":"uint256[]","name":"rewards","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"poolExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint32","name":"_startBlock","type":"uint32"},{"internalType":"uint32","name":"_endBlock","type":"uint32"},{"internalType":"uint256[]","name":"_rewardPerBlocks","type":"uint256[]"}],"name":"renewPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardLocker","outputs":[{"internalType":"contract IKyberRewardLocker","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"transferAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAdmin","type":"address"}],"name":"transferAdminQuickly","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint32","name":"_endBlock","type":"uint32"},{"internalType":"uint256[]","name":"_rewardPerBlocks","type":"uint256[]"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePoolRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523480156200001157600080fd5b5060405162003554380380620035548339810160408190526200003491620005f6565b826001600160a01b0381166200007b576040805162461bcd60e51b8152602060048201526007602482015266061646d696e20360cc1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b039290921691909117905560016002558151620000b590600490602085019062000568565b506001600160601b0319606082901b1660805260005b8251811015620001485760006001600160a01b0316838281518110620000ed57fe5b60200260200101516001600160a01b0316146200013f576200013f826000198584815181106200011957fe5b60200260200101516001600160a01b03166200015260201b62001b7e179092919060201c565b600101620000cb565b50505050620006f8565b801580620001dc575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015620001ac57600080fd5b505afa158015620001c1573d6000803e3d6000fd5b505050506040513d6020811015620001d857600080fd5b5051155b620002195760405162461bcd60e51b81526004018080602001828103825260368152602001806200351e6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620002719185916200027616565b505050565b6000620002d2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200033260201b62001cc3179092919060201c565b8051909150156200027157808060200190516020811015620002f357600080fd5b5051620002715760405162461bcd60e51b815260040180806020018281038252602a815260200180620034f4602a913960400191505060405180910390fd5b60606200034384846000856200034d565b90505b9392505050565b606082471015620003905760405162461bcd60e51b8152600401808060200182810382526026815260200180620034ce6026913960400191505060405180910390fd5b6200039b85620004b4565b620003ed576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106200042d5780518252601f1990920191602091820191016200040c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811462000491576040519150601f19603f3d011682016040523d82523d6000602084013e62000496565b606091505b509092509050620004a9828286620004be565b979650505050505050565b803b15155b919050565b60608315620004cf57508162000346565b825115620004e05782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156200052c57818101518382015260200162000512565b50505050905090810190601f1680156200055a5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b828054828255906000526020600020908101928215620005c0579160200282015b82811115620005c057825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000589565b50620005ce929150620005d2565b5090565b5b80821115620005ce5760008155600101620005d3565b8051620004b981620006df565b6000806000606084860312156200060b578283fd5b83516200061881620006df565b602085810151919450906001600160401b038082111562000637578485fd5b818701915087601f8301126200064b578485fd5b8151818111156200065857fe5b838102604051858282010181811085821117156200067257fe5b604052828152858101935084860182860187018c101562000691578889fd5b8895505b83861015620006be57620006a981620005e9565b85526001959095019493860193860162000695565b50809750505050505050620006d660408501620005e9565b90509250925092565b6001600160a01b0381168114620006f557600080fd5b50565b60805160601c612db36200071b60003980610a20528061209a5250612db36000f3fe60806040526004361061018f5760003560e01c806377f50f97116100d6578063b43c62701161007f578063d18df53c11610059578063d18df53c14610465578063ddc6326214610492578063f851a440146104b257610196565b8063b43c627014610403578063c4f59f9b14610423578063d12e4ceb1461044557610196565b8063958e2d31116100b0578063958e2d31146103a3578063adb82b31146103c3578063affb9fc8146103e357610196565b806377f50f971461034e5780637acc8678146103635780637bb7bed11461038357610196565b80633892601c1161013857806352fd9f2f1161011257806352fd9f2f146102ee5780635312ea8e1461030e57806375829def1461032e57610196565b80633892601c1461029957806343a0d066146102ae578063441a3e70146102ce57610196565b8063267822471161016957806326782247146102225780632f380b35146102445780632fb40ce11461027757610196565b8063081e3eda1461019b5780631069f3b5146101c65780631e1c6a07146101f557610196565b3661019657005b600080fd5b3480156101a757600080fd5b506101b06104c7565b6040516101bd9190612bfe565b60405180910390f35b3480156101d257600080fd5b506101e66101e13660046126d3565b6104cd565b6040516101bd93929190612c6d565b34801561020157600080fd5b506102156102103660046125ed565b6105ff565b6040516101bd91906128de565b34801561022e57600080fd5b50610237610614565b6040516101bd9190612817565b34801561025057600080fd5b5061026461025f3660046126bb565b610623565b6040516101bd9796959493929190612c07565b34801561028357600080fd5b50610297610292366004612607565b610779565b005b3480156102a557600080fd5b50610237610a1e565b3480156102ba57600080fd5b506102976102c936600461271f565b610a42565b3480156102da57600080fd5b506102976102e93660046126fe565b610b53565b3480156102fa57600080fd5b5061029761030936600461267b565b610bc1565b34801561031a57600080fd5b506102976103293660046126bb565b610e2c565b34801561033a57600080fd5b506102976103493660046125ed565b610f59565b34801561035a57600080fd5b5061029761106b565b34801561036f57600080fd5b5061029761037e3660046125ed565b61114a565b34801561038f57600080fd5b5061023761039e3660046126bb565b6112a4565b3480156103af57600080fd5b506102976103be3660046126bb565b6112ce565b3480156103cf57600080fd5b506102976103de3660046126bb565b611356565b3480156103ef57600080fd5b506102976103fe36600461275b565b61148f565b34801561040f57600080fd5b5061029761041e3660046127b3565b61162f565b34801561042f57600080fd5b5061043861181d565b6040516101bd919061282b565b34801561045157600080fd5b506102976104603660046126fe565b61187f565b34801561047157600080fd5b506104856104803660046126d3565b611991565b6040516101bd91906128cb565b34801561049e57600080fd5b506102976104ad3660046126bb565b611b5a565b3480156104be57600080fd5b50610237611b6f565b60055481565b60008281526007602090815260408083206001600160a01b038516845290915290208054600454909160609182919067ffffffffffffffff8111801561051257600080fd5b5060405190808252806020026020018201604052801561053c578160200160208202803683370190505b5060045490935067ffffffffffffffff8111801561055957600080fd5b50604051908082528060200260200182016040528015610583578160200160208202803683370190505b50915060005b6004548110156105f657600081815260018301602052604090205484518590839081106105b257fe5b602002602001018181525050816001016000828152602001908152602001600020600101548382815181106105e357fe5b6020908102919091010152600101610589565b50509250925092565b60036020526000908152604090205460ff1681565b6001546001600160a01b031681565b60008181526006602052604090208054600182015460045491926001600160a01b0382169263ffffffff600160a01b8404811693600160c01b8104821693600160e01b90910490911691606091829167ffffffffffffffff8111801561068857600080fd5b506040519080825280602002602001820160405280156106b2578160200160208202803683370190505b5060045490935067ffffffffffffffff811180156106cf57600080fd5b506040519080825280602002602001820160405280156106f9578160200160208202803683370190505b50915060005b60045481101561076c576000818152600283016020526040902054845185908390811061072857fe5b6020026020010181815250508160020160008281526020019081526020016000206001015483828151811061075957fe5b60209081029190910101526001016106ff565b5050919395979092949650565b6000546001600160a01b031633146107c5576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b03851660009081526003602052604090205460ff16156108075760405162461bcd60e51b81526004016107fe90612afc565b60405180910390fd5b6001600160a01b03851661082d5760405162461bcd60e51b81526004016107fe9061290d565b600454811461084e5760405162461bcd60e51b81526004016107fe906129e9565b438463ffffffff1611801561086e57508363ffffffff168363ffffffff16115b61088a5760405162461bcd60e51b81526004016107fe90612bc7565b600580546000908152600660205260408082206001908101805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038b16179055835483528183208101805463ffffffff60a01b1916600160a01b63ffffffff8b811691820292909217909255855485528385208301805463ffffffff60c01b1916600160c01b928b1692909202919091179055935483529082200180546001600160e01b0316600160e01b909302929092179091555b8181101561099e57604051806040016040528084848481811061095d57fe5b60209081029290920135835250600091810182905260055482526006815260408083208584526002018252909120825181559101516001918201550161093e565b506005805460019081019091556001600160a01b03861660008181526003602052604090819020805460ff1916909317909255905163ffffffff80861692908716917feb19e76b03b99eff4d0329a19e44569c131f242c9590234f19b76f2c56a817a190610a0f9087908790612878565b60405180910390a45050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600280541415610a99576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60028055610aa683611356565b610ab1338483611cdc565b600083815260066020908152604080832060078352818420338086529352922060018301549091610aed916001600160a01b0316903087611ecb565b8054610af99085611f44565b81558154610b079085611f44565b82556040514390869033907f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e90610b3f908990612bfe565b60405180910390a450506001600255505050565b600280541415610baa576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60028055610bb88282611fa7565b50506001600255565b60006004805480602002602001604051908101604052809291908181526020018280548015610c1957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610bfb575b505050505090506000815167ffffffffffffffff81118015610c3a57600080fd5b50604051908082528060200260200182016040528015610c64578160200160208202803683370190505b509050336000805b85811015610dc157868682818110610c8057fe5b905060200201359150610c9282611356565b610c9e83836000611cdc565b60005b8551811015610db85760008381526007602090815260408083206001600160a01b038816845282528083208484526001019091529020548015610daf57610d0481878481518110610cee57fe5b6020026020010151611f4490919063ffffffff16565b868381518110610d1057fe5b60209081029190910181019190915260008581526007825260408082206001600160a01b03891683528352808220858352600101909252908120558651879083908110610d5957fe5b60200260200101516001600160a01b031684866001600160a01b03167ff75f3d433c6628e04e01a0be1a2c6692a6011ce4b00389824cfa8b8a12f3c1c48443604051610da6929190612ca2565b60405180910390a45b50600101610ca1565b50600101610c6c565b5060005b8351811015610e23576000848281518110610ddc57fe5b60200260200101511115610e1b57610e1b858281518110610df957fe5b602002602001015184868481518110610e0e57fe5b602002602001015161207c565b600101610dc5565b50505050505050565b600280541415610e83576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b600280556000818152600660209081526040808320600783528184203385529092528220805483825591929091905b600454811015610edd5760008181526001808501602052604082208082018390559190915501610eb2565b508254610eea9082612121565b83558015610f0b576001830154610f0b906001600160a01b0316338361217e565b4384336001600160a01b03167f2369db1bafee945aee5630782f4a170682e3f8188d8dc247a4c73eb8c9e692d284604051610f469190612bfe565b60405180910390a4505060016002555050565b6000546001600160a01b03163314610fa5576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b038116611000576040805162461bcd60e51b815260206004820152600b60248201527f6e65772061646d696e2030000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a16001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6001546001600160a01b031633146110ca576040805162461bcd60e51b815260206004820152600b60248201527f6e6f742070656e64696e67000000000000000000000000000000000000000000604482015290519081900360640190fd5b600154600054604080516001600160a01b03938416815292909116602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a1600180546000805473ffffffffffffffffffffffffffffffffffffffff199081166001600160a01b03841617909155169055565b6000546001600160a01b03163314611196576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6001600160a01b0381166111f1576040805162461bcd60e51b815260206004820152600760248201527f61646d696e203000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b604080516001600160a01b038316815290517f3b81caf78fa51ecbc8acb482fd7012a277b428d9b80f9d156e8a54107496cc409181900360200190a1600054604080516001600160a01b038085168252909216602083015280517f65da1cfc2c2e81576ad96afb24a581f8e109b7a403b35cbd3243a1c99efdb9ed9281900390910190a16000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600481815481106112b457600080fd5b6000918252602090912001546001600160a01b0316905081565b600280541415611325576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60028055600081815260076020908152604080832033845290915290205461134e908290611fa7565b506001600255565b60055481106113775760405162461bcd60e51b81526004016107fe906129b2565b60008181526006602052604081209061138f836121e9565b600183015490915063ffffffff600160e01b9091048116908216116113b557505061148c565b8154806113e857506001909101805463ffffffff909216600160e01b026001600160e01b0390921691909117905561148c565b600183015463ffffffff600160e01b909104811683031660005b6004548110156114625760008181526002860160205260408120805490919061142c908590612221565b9050611455856114418364e8d4a51000612221565b8161144857fe5b6001850154919004611f44565b6001928301555001611402565b5050506001909101805463ffffffff909216600160e01b026001600160e01b039092169190911790555b50565b6000546001600160a01b031633146114db576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6114e484611356565b6000848152600660205260409020600181015443600160c01b90910463ffffffff16116115235760405162461bcd60e51b81526004016107fe90612b90565b60045482146115445760405162461bcd60e51b81526004016107fe9061297b565b438463ffffffff1611801561156d5750600181015463ffffffff600160a01b9091048116908516115b6115895760405162461bcd60e51b81526004016107fe90612a8e565b60018101805463ffffffff60c01b1916600160c01b63ffffffff87160217905560005b828110156115e6578383828181106115c057fe5b6000848152600286016020908152604090912091029290920135909155506001016115ac565b508363ffffffff16857fba2d8506275d684e80223910f1065a195ea279f37e27eb97ac24f4107eba6cf98585604051611620929190612878565b60405180910390a35050505050565b6000546001600160a01b0316331461167b576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b61168485611356565b6000858152600660205260409020600181015443600160a01b90910463ffffffff1611806116c35750600181015443600160c01b90910463ffffffff16105b6116df5760405162461bcd60e51b81526004016107fe90612b33565b60045482146117005760405162461bcd60e51b81526004016107fe90612a20565b438563ffffffff1611801561172057508463ffffffff168463ffffffff16115b61173c5760405162461bcd60e51b81526004016107fe90612944565b60018101805463ffffffff60a01b1916600160a01b63ffffffff8881169182029290921763ffffffff60c01b1916600160c01b92881692909202919091176001600160e01b0316600160e01b9190910217905560005b828110156117cc578383828181106117a657fe5b600084815260028601602090815260409091209102929092013590915550600101611792565b508363ffffffff168563ffffffff16877f4f863dc93468acf71ff8f5770599fbead4d0ff8ea6bd0c3251576f68fdad0904868660405161180d929190612878565b60405180910390a4505050505050565b6060600480548060200260200160405190810160405280929190818152602001828054801561187557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611857575b5050505050905090565b6000546001600160a01b031633146118cb576040805162461bcd60e51b815260206004820152600a60248201526937b7363c9030b236b4b760b11b604482015290519081900360640190fd5b6000600483815481106118da57fe5b6000918252602090912001546001600160a01b0316905080611978576000336001600160a01b03168360405161190f90612814565b60006040518083038185875af1925050503d806000811461194c576040519150601f19603f3d011682016040523d82523d6000602084013e611951565b606091505b50509050806119725760405162461bcd60e51b81526004016107fe90612ac5565b5061198c565b61198c6001600160a01b038216338461217e565b505050565b6004546060908067ffffffffffffffff811180156119ae57600080fd5b506040519080825280602002602001820160405280156119d8578160200160208202803683370190505b506000858152600660209081526040808320600783528184206001600160a01b038916855290925282208154600183015494965091939092600160e01b90910463ffffffff1690611a28896121e9565b905060005b86811015611b4d57600081815260028701602052604090206001015463ffffffff831684108015611a5d57508415155b15611ab3576000828152600288016020526040812054611a8a9063ffffffff808716889003919061222116565b9050611aaf86611a9f8364e8d4a51000612221565b81611aa657fe5b84919004611f44565b9150505b600082815260018088016020526040909120015464e8d4a5100090611ae590611add908490612121565b885490612221565b81611aec57fe5b04898381518110611af957fe5b602002602001018181525050611b2d866001016000848152602001908152602001600020600001548a8481518110610cee57fe5b898381518110611b3957fe5b602090810291909101015250600101611a2d565b5050505050505092915050565b611b6381611356565b61148c33826001611cdc565b6000546001600160a01b031681565b801580611c1d5750604080517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015611bef57600080fd5b505afa158015611c03573d6000803e3d6000fd5b505050506040513d6020811015611c1957600080fd5b5051155b611c585760405162461bcd60e51b8152600401808060200182810382526036815260200180612d486036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b03167f095ea7b30000000000000000000000000000000000000000000000000000000017905261198c90849061227a565b6060611cd2848460008561232b565b90505b9392505050565b60008281526007602090815260408083206001600160a01b038716845290915290205460045481611d6a5760005b81811015611d625760008581526006602090815260408083208484526002018252808320600190810154898552600784528285206001600160a01b038c16865284528285208686528201909352922082015501611d0a565b50505061198c565b60005b81811015611ec35760008581526006602090815260408083208484526002018252808320600190810154898552600784528285206001600160a01b038c16865284528285208686528201909352908320908101549192909164e8d4a5100090611de290611ddb908690612121565b8890612221565b81611de957fe5b83549190049150611dfb908290611f44565b905086611e085780611e0b565b60005b825560018201839055868015611e215750600081115b15611eb857611e5260048581548110611e3657fe5b6000918252602090912001546001600160a01b03168a8361207c565b60048481548110611e5f57fe5b6000918252602090912001546040516001600160a01b03918216918a91908c16907ff75f3d433c6628e04e01a0be1a2c6692a6011ce4b00389824cfa8b8a12f3c1c490611eaf9086904390612ca2565b60405180910390a45b505050600101611d6d565b505050505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03167f23b872dd00000000000000000000000000000000000000000000000000000000179052611f3e90859061227a565b50505050565b600082820183811015611f9e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b6000828152600660209081526040808320600783528184203385529092529091208054831115611fe95760405162461bcd60e51b81526004016107fe90612a57565b611ff284611356565b611ffe33856001611cdc565b805461200a9084612121565b815581546120189084612121565b82556001820154612033906001600160a01b0316338561217e565b4384336001600160a01b03167f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca948660405161206e9190612bfe565b60405180910390a450505050565b60006001600160a01b03841615612094576000612096565b815b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637750c9f0828686866040518563ffffffff1660e01b81526004016120e9939291906128e9565b6000604051808303818588803b15801561210257600080fd5b505af1158015612116573d6000803e3d6000fd5b505050505050505050565b600082821115612178576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b03167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261198c90849061227a565b600081815260066020526040902060010154600160c01b900463ffffffff164381111561221c5761221943612486565b90505b919050565b60008261223057506000611fa1565b8282028284828161223d57fe5b0414611f9e5760405162461bcd60e51b8152600401808060200182810382526021815260200180612cd76021913960400191505060405180910390fd5b60006122cf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611cc39092919063ffffffff16565b80519091501561198c578080602001905160208110156122ee57600080fd5b505161198c5760405162461bcd60e51b815260040180806020018281038252602a815260200180612d1e602a913960400191505060405180910390fd5b60608247101561236c5760405162461bcd60e51b8152600401808060200182810382526026815260200180612cb16026913960400191505060405180910390fd5b612375856124cf565b6123c6576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106124045780518252601f1990920191602091820191016123e5565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612466576040519150601f19603f3d011682016040523d82523d6000602084013e61246b565b606091505b509150915061247b8282866124d5565b979650505050505050565b600064010000000082106124cb5760405162461bcd60e51b8152600401808060200182810382526026815260200180612cf86026913960400191505060405180910390fd5b5090565b3b151590565b606083156124e4575081611cd5565b8251156124f45782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561253e578181015183820152602001612526565b50505050905090810190601f16801561256b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b80356001600160a01b038116811461221c57600080fd5b60008083601f8401126125a1578182fd5b50813567ffffffffffffffff8111156125b8578182fd5b60208301915083602080830285010111156125d257600080fd5b9250929050565b803563ffffffff8116811461221c57600080fd5b6000602082840312156125fe578081fd5b611cd582612579565b60008060008060006080868803121561261e578081fd5b61262786612579565b9450612635602087016125d9565b9350612643604087016125d9565b9250606086013567ffffffffffffffff81111561265e578182fd5b61266a88828901612590565b969995985093965092949392505050565b6000806020838503121561268d578182fd5b823567ffffffffffffffff8111156126a3578283fd5b6126af85828601612590565b90969095509350505050565b6000602082840312156126cc578081fd5b5035919050565b600080604083850312156126e5578182fd5b823591506126f560208401612579565b90509250929050565b60008060408385031215612710578182fd5b50508035926020909101359150565b600080600060608486031215612733578283fd5b833592506020840135915060408401358015158114612750578182fd5b809150509250925092565b60008060008060608587031215612770578384fd5b84359350612780602086016125d9565b9250604085013567ffffffffffffffff81111561279b578283fd5b6127a787828801612590565b95989497509550505050565b6000806000806000608086880312156127ca578081fd5b85359450612635602087016125d9565b6000815180845260208085019450808401835b83811015612809578151875295820195908201906001016127ed565b509495945050505050565b90565b6001600160a01b0391909116815260200190565b6020808252825182820181905260009190848201906040850190845b8181101561286c5783516001600160a01b031683529284019291840191600101612847565b50909695505050505050565b6000602082528260208301527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8311156128b0578081fd5b60208302808560408501379190910160400190815292915050565b600060208252611cd560208301846127da565b901515815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60208082526018908201527f6164643a20696e76616c6964207374616b6520746f6b656e0000000000000000604082015260600190565b60208082526015908201527f72656e65773a20696e76616c696420626c6f636b730000000000000000000000604082015260600190565b60208082526016908201527f7570646174653a20696e76616c6964206c656e67746800000000000000000000604082015260600190565b6020808252600f908201527f696e76616c696420706f6f6c2069640000000000000000000000000000000000604082015260600190565b60208082526013908201527f6164643a20696e76616c6964206c656e67746800000000000000000000000000604082015260600190565b60208082526015908201527f72656e65773a20696e76616c6964206c656e6774680000000000000000000000604082015260600190565b6020808252601d908201527f77697468647261773a20696e73756666696369656e7420616d6f756e74000000604082015260600190565b60208082526019908201527f7570646174653a20696e76616c696420656e6420626c6f636b00000000000000604082015260600190565b6020808252601c908201527f7472616e736665722072657761726420746f6b656e206661696c656400000000604082015260600190565b60208082526014908201527f6164643a206475706c69636174656420706f6f6c000000000000000000000000604082015260600190565b60208082526022908201527f72656e65773a20696e76616c696420706f6f6c20737461746520746f2072656e60408201527f6577000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601a908201527f7570646174653a20706f6f6c20616c726561647920656e646564000000000000604082015260600190565b60208082526013908201527f6164643a20696e76616c696420626c6f636b7300000000000000000000000000604082015260600190565b90815260200190565b60008882526001600160a01b038816602083015263ffffffff8088166040840152808716606084015280861660808401525060e060a0830152612c4d60e08301856127da565b82810360c0840152612c5f81856127da565b9a9950505050505050505050565b600084825260606020830152612c8660608301856127da565b8281036040840152612c9881856127da565b9695505050505050565b91825260208201526040019056fe416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7753616665436173743a2076616c756520646f65736e27742066697420696e20333220626974735361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220054662d22351d9239642634594fec6e88d0f6e402f0afe3f9becdfe4472d074a64736f6c63430007060033416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000000004bd6037e5cf0cadb0cce85691a5723bc94ae2fae0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000063dd8b5a42aae93a014ce5fabb5b7047466796100000000000000000000000000000000000000000000000000000000000000020000000000000000000000001c954e8fe737f99f68fa1ccda3e51ebdb291948c0000000000000000000000000000000000000000000000000000000000000000

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

0000000000000000000000004bd6037e5cf0cadb0cce85691a5723bc94ae2fae0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000063dd8b5a42aae93a014ce5fabb5b7047466796100000000000000000000000000000000000000000000000000000000000000020000000000000000000000001c954e8fe737f99f68fa1ccda3e51ebdb291948c0000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _admin (address): 0x4bd6037e5cf0cadb0cce85691a5723bc94ae2fae
Arg [1] : _rewardTokens (address[]): 0x1c954e8fe737f99f68fa1ccda3e51ebdb291948c,0x0000000000000000000000000000000000000000
Arg [2] : _rewardLocker (address): 0x063dd8b5a42aae93a014ce5fabb5b70474667961

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000004bd6037e5cf0cadb0cce85691a5723bc94ae2fae
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [2] : 000000000000000000000000063dd8b5a42aae93a014ce5fabb5b70474667961
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [4] : 0000000000000000000000001c954e8fe737f99f68fa1ccda3e51ebdb291948c
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000000


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