MNT Price: $0.88 (+1.31%)

Contract

0x375bBeEdE908EF06bc11F3C4F9637F5b7B0D817E
 

Overview

MNT Balance

Mantle Mainnet Network LogoMantle Mainnet Network LogoMantle Mainnet Network Logo0 MNT

MNT Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Harvest All Divi...732629932024-12-20 0:58:18403 days ago1734656298IN
0x375bBeEd...b7B0D817E
0 MNT0.005937760.02
Harvest All Divi...725044222024-12-02 11:32:36421 days ago1733139156IN
0x375bBeEd...b7B0D817E
0 MNT0.007501630.02
Harvest All Divi...691537042024-09-15 22:02:00498 days ago1726437720IN
0x375bBeEd...b7B0D817E
0 MNT0.006637240.02
Harvest All Divi...666759172024-07-20 13:29:06556 days ago1721482146IN
0x375bBeEd...b7B0D817E
0 MNT0.007771120.02
Harvest All Divi...662474182024-07-10 15:25:48565 days ago1720625148IN
0x375bBeEd...b7B0D817E
0 MNT0.012175590.02
Add Dividends To...662035082024-07-09 15:02:08567 days ago1720537328IN
0x375bBeEd...b7B0D817E
0 MNT0.008872120.02
Harvest All Divi...659822062024-07-04 12:05:24572 days ago1720094724IN
0x375bBeEd...b7B0D817E
0 MNT0.008307850.02
Harvest All Divi...659154952024-07-02 23:01:42573 days ago1719961302IN
0x375bBeEd...b7B0D817E
0 MNT0.009363160.02
Harvest All Divi...658714892024-07-01 22:34:50574 days ago1719873290IN
0x375bBeEd...b7B0D817E
0 MNT0.011328990.03
Add Dividends To...656052012024-06-25 18:38:34580 days ago1719340714IN
0x375bBeEd...b7B0D817E
0 MNT0.007644540.02
Harvest All Divi...653794972024-06-20 13:15:06586 days ago1718889306IN
0x375bBeEd...b7B0D817E
0 MNT0.008668370.02
Harvest All Divi...653763562024-06-20 11:30:24586 days ago1718883024IN
0x375bBeEd...b7B0D817E
0 MNT0.008608380.02
Harvest All Divi...653763092024-06-20 11:28:50586 days ago1718882930IN
0x375bBeEd...b7B0D817E
0 MNT0.008964370.02
Harvest All Divi...653420942024-06-19 16:28:20586 days ago1718814500IN
0x375bBeEd...b7B0D817E
0 MNT0.010292950.02
Add Dividends To...653045962024-06-18 19:38:24587 days ago1718739504IN
0x375bBeEd...b7B0D817E
0 MNT0.007558590.02
Harvest All Divi...652524222024-06-17 14:39:16589 days ago1718635156IN
0x375bBeEd...b7B0D817E
0 MNT0.007855380.02
Harvest All Divi...652452172024-06-17 10:39:06589 days ago1718620746IN
0x375bBeEd...b7B0D817E
0 MNT0.00828570.02
Harvest All Divi...649056472024-06-09 14:00:06597 days ago1717941606IN
0x375bBeEd...b7B0D817E
0 MNT0.007319730.02
Harvest All Divi...649049822024-06-09 13:37:56597 days ago1717940276IN
0x375bBeEd...b7B0D817E
0 MNT0.008607560.03
Harvest All Divi...649049792024-06-09 13:37:50597 days ago1717940270IN
0x375bBeEd...b7B0D817E
0 MNT0.010719020.03
Harvest All Divi...647500282024-06-05 23:32:48600 days ago1717630368IN
0x375bBeEd...b7B0D817E
0 MNT0.008386920.02
Harvest All Divi...647491892024-06-05 23:04:50600 days ago1717628690IN
0x375bBeEd...b7B0D817E
0 MNT0.008677780.02
Harvest All Divi...647491622024-06-05 23:03:56600 days ago1717628636IN
0x375bBeEd...b7B0D817E
0 MNT0.008375350.02
Harvest All Divi...647491442024-06-05 23:03:20600 days ago1717628600IN
0x375bBeEd...b7B0D817E
0 MNT0.008404330.02
Harvest All Divi...647491212024-06-05 23:02:34600 days ago1717628554IN
0x375bBeEd...b7B0D817E
0 MNT0.008323660.02
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Dividends

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 99999 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "./interfaces/IDividends.sol";
import "./interfaces/ISeedsTokenUsage.sol";


/*
 * This contract is used to distribute dividends to users that allocated SEEDS here
 *
 * Dividends can be distributed in the form of one or more tokens
 * They are mainly managed to be received from the FeeManager contract, but other sources can be added (dev wallet for instance)
 *
 * The freshly received dividends are stored in a pending slot
 *
 * The content of this pending slot will be progressively transferred over time into a distribution slot
 * This distribution slot is the source of the dividends distribution to SEEDS allocators during the current cycle
 *
 * This transfer from the pending slot to the distribution slot is based on cycleDividendsPercent and CYCLE_PERIOD_SECONDS
 *
 */
contract Dividends is Ownable, ReentrancyGuard, ISeedsTokenUsage, IDividendsV2 {
  using SafeMath for uint256;
  using SafeERC20 for IERC20;
  using EnumerableSet for EnumerableSet.AddressSet;

  struct UserInfo {
    uint256 pendingDividends;
    uint256 rewardDebt;
  }

  struct DividendsInfo {
    uint256 currentDistributionAmount; // total amount to distribute during the current cycle
    uint256 currentCycleDistributedAmount; // amount already distributed for the current cycle (times 1e2)
    uint256 pendingAmount; // total amount in the pending slot, not distributed yet
    uint256 distributedAmount; // total amount that has been distributed since initialization
    uint256 accDividendsPerShare; // accumulated dividends per share (times 1e18)
    uint256 lastUpdateTime; // last time the dividends distribution occurred
    uint256 cycleDividendsPercent; // fixed part of the pending dividends to assign to currentDistributionAmount on every cycle
    bool distributionDisabled; // deactivate a token distribution (for temporary dividends)
  }

  // actively distributed tokens
  EnumerableSet.AddressSet private _distributedTokens;
  uint256 public constant MAX_DISTRIBUTED_TOKENS = 10;

  // dividends info for every dividends token
  mapping(address => DividendsInfo) public dividendsInfo;
  mapping(address => mapping(address => UserInfo)) public users;

  address public immutable seedsToken; // seedsToken contract

  mapping(address => uint256) public usersAllocation; // User's seeds allocation
  uint256 public totalAllocation; // Contract's total seeds allocation

  uint256 public constant MIN_CYCLE_DIVIDENDS_PERCENT = 1; // 0.01%
  uint256 public constant DEFAULT_CYCLE_DIVIDENDS_PERCENT = 100; // 1%
  uint256 public constant MAX_CYCLE_DIVIDENDS_PERCENT = 10000; // 100%
  // dividends will be added to the currentDistributionAmount on each new cycle
  uint256 internal _cycleDurationSeconds = 7 days;
  uint256 public currentCycleStartTime;

  constructor(address seedsToken_, uint256 startTime_) {
    require(seedsToken_ != address(0), "zero address");
    seedsToken = seedsToken_;
    currentCycleStartTime = startTime_;
  }

  /********************************************/
  /****************** EVENTS ******************/
  /********************************************/

  event UserUpdated(address indexed user, uint256 previousBalance, uint256 newBalance);
  event DividendsCollected(address indexed user, address indexed token, uint256 amount);
  event CycleDividendsPercentUpdated(address indexed token, uint256 previousValue, uint256 newValue);
  event DividendsAddedToPending(address indexed token, uint256 amount);
  event DistributedTokenDisabled(address indexed token);
  event DistributedTokenRemoved(address indexed token);
  event DistributedTokenEnabled(address indexed token);

  /***********************************************/
  /****************** MODIFIERS ******************/
  /***********************************************/

  /**
   * @dev Checks if an index exists
   */
  modifier validateDistributedTokensIndex(uint256 index) {
    require(index < _distributedTokens.length(), "validateDistributedTokensIndex: index exists?");
    _;
  }

  /**
   * @dev Checks if token exists
   */
  modifier validateDistributedToken(address token) {
    require(_distributedTokens.contains(token), "validateDistributedTokens: token does not exists");
    _;
  }

  /**
   * @dev Checks if caller is the seedsToken contract
   */
  modifier seedsTokenOnly() {
    require(msg.sender == seedsToken, "seedsTokenOnly: caller should be seedsToken");
    _;
  }

  /*******************************************/
  /****************** VIEWS ******************/
  /*******************************************/

  function cycleDurationSeconds() external view returns (uint256) {
    return _cycleDurationSeconds;
  }

  /**
   * @dev Returns the number of dividends tokens
   */
  function distributedTokensLength() external view override returns (uint256) {
    return _distributedTokens.length();
  }

  /**
   * @dev Returns dividends token address from given index
   */
  function distributedToken(uint256 index) external view override validateDistributedTokensIndex(index) returns (address){
    return address(_distributedTokens.at(index));
  }

  /**
   * @dev Returns true if given token is a dividends token
   */
  function isDistributedToken(address token) external view override returns (bool) {
    return _distributedTokens.contains(token);
  }

  /**
   * @dev Returns time at which the next cycle will start
   */
  function nextCycleStartTime() public view returns (uint256) {
    return currentCycleStartTime.add(_cycleDurationSeconds);
  }

  /**
   * @dev Returns user's dividends pending amount for a given token
   */
  function pendingDividendsAmount(address token, address userAddress) external view returns (uint256) {
    if (totalAllocation == 0) {
      return 0;
    }

    DividendsInfo storage dividendsInfo_ = dividendsInfo[token];

    uint256 accDividendsPerShare = dividendsInfo_.accDividendsPerShare;
    uint256 lastUpdateTime = dividendsInfo_.lastUpdateTime;
    uint256 dividendAmountPerSecond_ = _dividendsAmountPerSecond(token);

    // check if the current cycle has changed since last update
    if (_currentBlockTimestamp() > nextCycleStartTime()) {
      // get remaining rewards from last cycle
      accDividendsPerShare = accDividendsPerShare.add(
        (nextCycleStartTime().sub(lastUpdateTime)).mul(dividendAmountPerSecond_).mul(1e16).div(totalAllocation)
      );
      lastUpdateTime = nextCycleStartTime();
      dividendAmountPerSecond_ = dividendsInfo_.pendingAmount.mul(dividendsInfo_.cycleDividendsPercent).div(100).div(
        _cycleDurationSeconds
      );
    }

    // get pending rewards from current cycle
    accDividendsPerShare = accDividendsPerShare.add(
      (_currentBlockTimestamp().sub(lastUpdateTime)).mul(dividendAmountPerSecond_).mul(1e16).div(totalAllocation)
    );

    return usersAllocation[userAddress]
        .mul(accDividendsPerShare)
        .div(1e18)
        .sub(users[token][userAddress].rewardDebt)
        .add(users[token][userAddress].pendingDividends);
  }

  /**************************************************/
  /****************** PUBLIC FUNCTIONS **************/
  /**************************************************/

  /**
   * @dev Updates the current cycle start time if previous cycle has ended
   */
  function updateCurrentCycleStartTime() public {
    uint256 nextCycleStartTime_ = nextCycleStartTime();

    if (_currentBlockTimestamp() >= nextCycleStartTime_) {
      currentCycleStartTime = nextCycleStartTime_;
    }
  }

  /**
   * @dev Updates dividends info for a given token
   */
  function updateDividendsInfo(address token) external validateDistributedToken(token) {
    _updateDividendsInfo(token);
  }

  /****************************************************************/
  /****************** EXTERNAL PUBLIC FUNCTIONS  ******************/
  /****************************************************************/

  /**
   * @dev Updates all dividendsInfo
   */
  function massUpdateDividendsInfo() external {
    uint256 length = _distributedTokens.length();
    for (uint256 index = 0; index < length; ++index) {
      _updateDividendsInfo(_distributedTokens.at(index));
    }
  }

  /**
   * @dev Harvests caller's pending dividends of a given token
   */
  function harvestDividends(address token) external nonReentrant {
    if (!_distributedTokens.contains(token)) {
      require(dividendsInfo[token].distributedAmount > 0, "harvestDividends: invalid token");
    }

    _harvestDividends(token);
  }

  /**
   * @dev Harvests all caller's pending dividends
   */
  function harvestAllDividends() external nonReentrant {
    uint256 length = _distributedTokens.length();
    for (uint256 index = 0; index < length; ++index) {
      _harvestDividends(_distributedTokens.at(index));
    }
  }

  /**
   * @dev Transfers the given amount of token from caller to pendingAmount
   *
   * Must only be called by a trustable address
   */
  function addDividendsToPending(address token, uint256 amount) external override nonReentrant {
    uint256 prevTokenBalance = IERC20(token).balanceOf(address(this));
    DividendsInfo storage dividendsInfo_ = dividendsInfo[token];

    IERC20(token).safeTransferFrom(msg.sender, address(this), amount);

    // handle tokens with transfer tax
    uint256 receivedAmount = IERC20(token).balanceOf(address(this)).sub(prevTokenBalance);
    dividendsInfo_.pendingAmount = dividendsInfo_.pendingAmount.add(receivedAmount);

    emit DividendsAddedToPending(token, receivedAmount);
  }

  /**
   * @dev Emergency withdraw token's balance on the contract
   */
  function emergencyWithdraw(IERC20 token) public nonReentrant onlyOwner {
    uint256 balance = token.balanceOf(address(this));
    require(balance > 0, "emergencyWithdraw: token balance is null");
    _safeTokenTransfer(token, msg.sender, balance);
  }

  /**
   * @dev Emergency withdraw all dividend tokens' balances on the contract
   */
  function emergencyWithdrawAll() external nonReentrant onlyOwner {
    for (uint256 index = 0; index < _distributedTokens.length(); ++index) {
      emergencyWithdraw(IERC20(_distributedTokens.at(index)));
    }
  }

  /*****************************************************************/
  /****************** OWNABLE FUNCTIONS  ******************/
  /*****************************************************************/

  /**
   * Allocates "userAddress" user's "amount" of seeds to this dividends contract
   *
   * Can only be called by seedsToken contract, which is trusted to verify amounts
   * "data" is only here for compatibility reasons (ISeedsTokenUsage)
   */
  function allocate(address userAddress, uint256 amount, bytes calldata /*data*/) external override nonReentrant seedsTokenOnly {
    uint256 newUserAllocation = usersAllocation[userAddress].add(amount);
    uint256 newTotalAllocation = totalAllocation.add(amount);
    _updateUser(userAddress, newUserAllocation, newTotalAllocation);
  }

  /**
   * Deallocates "userAddress" user's "amount" of seeds allocation from this dividends contract
   *
   * Can only be called by seedsToken contract, which is trusted to verify amounts
   * "data" is only here for compatibility reasons (ISeedsTokenUsage)
   */
  function deallocate(address userAddress, uint256 amount, bytes calldata /*data*/) external override nonReentrant seedsTokenOnly {
    uint256 newUserAllocation = usersAllocation[userAddress].sub(amount);
    uint256 newTotalAllocation = totalAllocation.sub(amount);
    _updateUser(userAddress, newUserAllocation, newTotalAllocation);
  }

  /**
   * @dev Enables a given token to be distributed as dividends
   *
   * Effective from the next cycle
   */
  function enableDistributedToken(address token) external onlyOwner {
    DividendsInfo storage dividendsInfo_ = dividendsInfo[token];
    require(
      dividendsInfo_.lastUpdateTime == 0 || dividendsInfo_.distributionDisabled,
      "enableDistributedToken: Already enabled dividends token"
    );
    require(_distributedTokens.length() < MAX_DISTRIBUTED_TOKENS, "enableDistributedToken: too many distributedTokens");
    // initialize lastUpdateTime if never set before
    if (dividendsInfo_.lastUpdateTime == 0) {
      dividendsInfo_.lastUpdateTime = _currentBlockTimestamp();
    }
    // initialize cycleDividendsPercent to the minimum if never set before
    if (dividendsInfo_.cycleDividendsPercent == 0) {
      dividendsInfo_.cycleDividendsPercent = MAX_CYCLE_DIVIDENDS_PERCENT;
    }
    dividendsInfo_.distributionDisabled = false;
    _distributedTokens.add(token);
    emit DistributedTokenEnabled(token);
  }

  /**
   * @dev Disables distribution of a given token as dividends
   *
   * Effective from the next cycle
   */
  function disableDistributedToken(address token) external onlyOwner {
    DividendsInfo storage dividendsInfo_ = dividendsInfo[token];
    require(
      dividendsInfo_.lastUpdateTime > 0 && !dividendsInfo_.distributionDisabled,
      "disableDistributedToken: Already disabled dividends token"
    );
    dividendsInfo_.distributionDisabled = true;
    emit DistributedTokenDisabled(token);
  }

  /**
   * @dev Updates the percentage of pending dividends that will be distributed during the next cycle
   *
   * Must be a value between MIN_CYCLE_DIVIDENDS_PERCENT and MAX_CYCLE_DIVIDENDS_PERCENT
   */
  function updateCycleDividendsPercent(address token, uint256 percent) external onlyOwner {
    require(percent <= MAX_CYCLE_DIVIDENDS_PERCENT, "updateCycleDividendsPercent: percent mustn't exceed maximum");
    require(percent >= MIN_CYCLE_DIVIDENDS_PERCENT, "updateCycleDividendsPercent: percent mustn't exceed minimum");
    DividendsInfo storage dividendsInfo_ = dividendsInfo[token];
    uint256 previousPercent = dividendsInfo_.cycleDividendsPercent;
    dividendsInfo_.cycleDividendsPercent = percent;
    emit CycleDividendsPercentUpdated(token, previousPercent, dividendsInfo_.cycleDividendsPercent);
  }

  /**
  * @dev remove an address from _distributedTokens
  *
  * Can only be valid for a disabled dividends token and if the distribution has ended
  */
  function removeTokenFromDistributedTokens(address tokenToRemove) external onlyOwner {
    DividendsInfo storage _dividendsInfo = dividendsInfo[tokenToRemove];
    require(_dividendsInfo.distributionDisabled && _dividendsInfo.currentDistributionAmount == 0, "removeTokenFromDistributedTokens: cannot be removed");
    _distributedTokens.remove(tokenToRemove);
    emit DistributedTokenRemoved(tokenToRemove);
  }

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

  /**
   * @dev Returns the amount of dividends token distributed every second (times 1e2)
   */
  function _dividendsAmountPerSecond(address token) internal view returns (uint256) {
    if (!_distributedTokens.contains(token)) return 0;
    return dividendsInfo[token].currentDistributionAmount.mul(1e2).div(_cycleDurationSeconds);
  }

  /**
   * @dev Updates every user's rewards allocation for each distributed token
   */
  function _updateDividendsInfo(address token) internal {
    uint256 currentBlockTimestamp = _currentBlockTimestamp();
    DividendsInfo storage dividendsInfo_ = dividendsInfo[token];

    updateCurrentCycleStartTime();

    uint256 lastUpdateTime = dividendsInfo_.lastUpdateTime;
    uint256 accDividendsPerShare = dividendsInfo_.accDividendsPerShare;
    if (currentBlockTimestamp <= lastUpdateTime) {
      return;
    }

    // if no seeds is allocated or initial distribution has not started yet
    if (totalAllocation == 0 || currentBlockTimestamp < currentCycleStartTime) {
      dividendsInfo_.lastUpdateTime = currentBlockTimestamp;
      return;
    }

    uint256 currentDistributionAmount = dividendsInfo_.currentDistributionAmount; // gas saving
    uint256 currentCycleDistributedAmount = dividendsInfo_.currentCycleDistributedAmount; // gas saving

    // check if the current cycle has changed since last update
    if (lastUpdateTime < currentCycleStartTime) {
      // update accDividendPerShare for the end of the previous cycle
      accDividendsPerShare = accDividendsPerShare.add(
        (currentDistributionAmount.mul(1e2).sub(currentCycleDistributedAmount))
          .mul(1e16)
          .div(totalAllocation)
      );

      // check if distribution is enabled
      if (!dividendsInfo_.distributionDisabled) {
        // transfer the token's cycleDividendsPercent part from the pending slot to the distribution slot
        dividendsInfo_.distributedAmount = dividendsInfo_.distributedAmount.add(currentDistributionAmount);

        uint256 pendingAmount = dividendsInfo_.pendingAmount;
        currentDistributionAmount = pendingAmount.mul(dividendsInfo_.cycleDividendsPercent).div(
          10000
        );
        dividendsInfo_.currentDistributionAmount = currentDistributionAmount;
        dividendsInfo_.pendingAmount = pendingAmount.sub(currentDistributionAmount);
      } else {
        // stop the token's distribution on next cycle
        dividendsInfo_.distributedAmount = dividendsInfo_.distributedAmount.add(currentDistributionAmount);
        currentDistributionAmount = 0;
        dividendsInfo_.currentDistributionAmount = 0;
      }

      currentCycleDistributedAmount = 0;
      lastUpdateTime = currentCycleStartTime;
    }

    uint256 toDistribute = (currentBlockTimestamp.sub(lastUpdateTime)).mul(_dividendsAmountPerSecond(token));
    // ensure that we can't distribute more than currentDistributionAmount (for instance w/ a > 24h service interruption)
    if (currentCycleDistributedAmount.add(toDistribute) > currentDistributionAmount.mul(1e2)) {
      toDistribute = currentDistributionAmount.mul(1e2).sub(currentCycleDistributedAmount);
    }

    dividendsInfo_.currentCycleDistributedAmount = currentCycleDistributedAmount.add(toDistribute);
    dividendsInfo_.accDividendsPerShare = accDividendsPerShare.add(toDistribute.mul(1e16).div(totalAllocation));
    dividendsInfo_.lastUpdateTime = currentBlockTimestamp;
  }

  /**
   * Updates "userAddress" user's and total allocations for each distributed token
   */
  function _updateUser(address userAddress, uint256 newUserAllocation, uint256 newTotalAllocation) internal {
    uint256 previousUserAllocation = usersAllocation[userAddress];

    // for each distributedToken
    uint256 length = _distributedTokens.length();
    for (uint256 index = 0; index < length; ++index) {
      address token = _distributedTokens.at(index);
      _updateDividendsInfo(token);

      UserInfo storage user = users[token][userAddress];
      uint256 accDividendsPerShare = dividendsInfo[token].accDividendsPerShare;

      uint256 pending = previousUserAllocation.mul(accDividendsPerShare).div(1e18).sub(user.rewardDebt);
      user.pendingDividends = user.pendingDividends.add(pending);
      user.rewardDebt = newUserAllocation.mul(accDividendsPerShare).div(1e18);
    }

    usersAllocation[userAddress] = newUserAllocation;
    totalAllocation = newTotalAllocation;

    emit UserUpdated(userAddress, previousUserAllocation, newUserAllocation);
  }

  /**
   * @dev Harvests msg.sender's pending dividends of a given token
   */
  function _harvestDividends(address token) internal {
    _updateDividendsInfo(token);

    UserInfo storage user = users[token][msg.sender];
    uint256 accDividendsPerShare = dividendsInfo[token].accDividendsPerShare;

    uint256 userSeedsAllocation = usersAllocation[msg.sender];
    uint256 pending = user.pendingDividends.add(
      userSeedsAllocation.mul(accDividendsPerShare).div(1e18).sub(user.rewardDebt)
    );

    user.pendingDividends = 0;
    user.rewardDebt = userSeedsAllocation.mul(accDividendsPerShare).div(1e18);

    _safeTokenTransfer(IERC20(token), msg.sender, pending);
    emit DividendsCollected(msg.sender, token, pending);
  }

  /**
   * @dev Safe token transfer function, in case rounding error causes pool to not have enough tokens
   */
  function _safeTokenTransfer(
    IERC20 token,
    address to,
    uint256 amount
  ) internal {
    if (amount > 0) {
      uint256 tokenBal = token.balanceOf(address(this));
      if (amount > tokenBal) {
        token.safeTransfer(to, tokenBal);
      } else {
        token.safeTransfer(to, amount);
      }
    }
  }

  /**
   * @dev Utility function to get the current block timestamp
   */
  function _currentBlockTimestamp() internal view virtual returns (uint256) {
    /* solhint-disable not-rely-on-time */
    return block.timestamp;
  }
}

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

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IDividendsV2 {
  function distributedTokensLength() external view returns (uint256);

  function distributedToken(uint256 index) external view returns (address);

  function isDistributedToken(address token) external view returns (bool);

  function addDividendsToPending(address token, uint256 amount) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ISeedsTokenUsage {
    function allocate(address userAddress, uint256 amount, bytes calldata data) external;
    function deallocate(address userAddress, uint256 amount, bytes calldata data) external;
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"seedsToken_","type":"address"},{"internalType":"uint256","name":"startTime_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"CycleDividendsPercentUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"DistributedTokenDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"DistributedTokenEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"DistributedTokenRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DividendsAddedToPending","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DividendsCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"UserUpdated","type":"event"},{"inputs":[],"name":"DEFAULT_CYCLE_DIVIDENDS_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_CYCLE_DIVIDENDS_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DISTRIBUTED_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_CYCLE_DIVIDENDS_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addDividendsToPending","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"allocate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentCycleStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cycleDurationSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"deallocate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"disableDistributedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"distributedToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributedTokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"dividendsInfo","outputs":[{"internalType":"uint256","name":"currentDistributionAmount","type":"uint256"},{"internalType":"uint256","name":"currentCycleDistributedAmount","type":"uint256"},{"internalType":"uint256","name":"pendingAmount","type":"uint256"},{"internalType":"uint256","name":"distributedAmount","type":"uint256"},{"internalType":"uint256","name":"accDividendsPerShare","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"},{"internalType":"uint256","name":"cycleDividendsPercent","type":"uint256"},{"internalType":"bool","name":"distributionDisabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"enableDistributedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvestAllDividends","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"harvestDividends","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isDistributedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdateDividendsInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextCycleStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"userAddress","type":"address"}],"name":"pendingDividendsAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenToRemove","type":"address"}],"name":"removeTokenFromDistributedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"seedsToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateCurrentCycleStartTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"percent","type":"uint256"}],"name":"updateCycleDividendsPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"updateDividendsInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"users","outputs":[{"internalType":"uint256","name":"pendingDividends","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"usersAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60a060405262093a806008553480156200001857600080fd5b506040516200287e3803806200287e8339810160408190526200003b91620000fb565b6200004633620000ab565b600180556001600160a01b038216620000945760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b604482015260640160405180910390fd5b6001600160a01b0390911660805260095562000137565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156200010f57600080fd5b82516001600160a01b03811681146200012757600080fd5b6020939093015192949293505050565b60805161271d6200016160003960008181610443015281816105470152610b16015261271d6000f3fe608060405234801561001057600080fd5b506004361061020b5760003560e01c8063799fb9651161012a578063d2af0b94116100bd578063de9d477e1161008c578063eb141dcf11610071578063eb141dcf146104e6578063f2fde38b146104ee578063f494ec5a1461050157600080fd5b8063de9d477e146104c0578063e895cca3146104d357600080fd5b8063d2af0b94146104a0578063d637ff83146104a8578063dd191719146104b0578063ddd48f47146104b857600080fd5b8063a53c0f38116100f9578063a53c0f381461043e578063b989185a14610465578063bd394a8d14610478578063c4d3e0831461048057600080fd5b8063799fb965146103fc5780638da5cb5b14610405578063911c935c1461042357806393c563af1461042b57600080fd5b80635726d26e116101a25780636e34b818116101715780636e34b818146103cf5780636ff1c9bc146103d8578063715018a6146103eb57806379203dc4146103f357600080fd5b80635726d26e146102b75780635b2acf17146102bf5780635d9b436a146103505780635e80536a1461038857600080fd5b80633999a4e5116101de5780633999a4e51461028157806339f7df5f1461029457806347b32f281461029c578063549230c9146102a457600080fd5b8063034d7fcb146102105780631c75e369146102385780632d9c97a41461024d57806335d2506d1461026e575b600080fd5b61022361021e366004612382565b610514565b60405190151581526020015b60405180910390f35b61024b61024636600461239f565b610527565b005b61026061025b366004612428565b610660565b60405190815260200161022f565b61024b61027c366004612382565b6107d4565b61024b61028f366004612461565b610879565b61024b610a69565b61024b610aba565b61024b6102b236600461239f565b610af6565b61024b610c0c565b6103136102cd366004612382565b6004602081905260009182526040909120805460018201546002830154600384015494840154600585015460068601546007909601549496939592949192909160ff1688565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c0830152151560e08201526101000161022f565b61036361035e36600461248d565b610c28565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161022f565b6103ba610396366004612428565b60056020908152600092835260408084209091529082529020805460019091015482565b6040805192835260208301919091520161022f565b61026061271081565b61024b6103e6366004612382565b610cd5565b61024b610e2c565b61026060075481565b61026060095481565b60005473ffffffffffffffffffffffffffffffffffffffff16610363565b610260606481565b61024b610439366004612382565b610e3e565b6103637f000000000000000000000000000000000000000000000000000000000000000081565b61024b610473366004612382565b611042565b6102606110fa565b61026061048e366004612382565b60066020526000908152604090205481565b610260600a81565b61026061110b565b61024b611124565b600854610260565b61024b6104ce366004612382565b611170565b61024b6104e1366004612382565b61128d565b610260600181565b61024b6104fc366004612382565b6113d0565b61024b61050f366004612461565b611484565b600061052160028361162b565b92915050565b61052f61165a565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146105f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f7365656473546f6b656e4f6e6c793a2063616c6c65722073686f756c6420626560448201527f207365656473546f6b656e00000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526006602052604081205461062990856116ce565b90506000610642856007546116ce90919063ffffffff16565b905061064f8683836116da565b505061065a60018055565b50505050565b60006007546000141561067557506000610521565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600460208190526040822090810154600582015491929091906106b38761184a565b90506106bd61110b565b421115610736576107016106fa6007546106f4662386f26fc100006106ee866106ee896106e861110b565b9061189c565b906118a8565b906118b4565b84906116ce565b925061070b61110b565b91506107336008546106f460646106f4886006015489600201546118a890919063ffffffff16565b90505b6107596106fa6007546106f4662386f26fc100006106ee866106ee896106e84290565b73ffffffffffffffffffffffffffffffffffffffff8881166000908152600560209081526040808320938b1683529281528282208054600190910154600690925292909120549295506107c9926107c391906106e890670de0b6b3a7640000906106f4908a6118a8565b906116ce565b979650505050505050565b806107e060028261162b565b61086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f76616c69646174654469737472696275746564546f6b656e733a20746f6b656e60448201527f20646f6573206e6f74206578697374730000000000000000000000000000000060648201526084016105f0565b610875826118c0565b5050565b61088161165a565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a082319060240160206040518083038186803b1580156108e957600080fd5b505afa1580156108fd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092191906124a6565b73ffffffffffffffffffffffffffffffffffffffff8416600081815260046020526040902091925061095590333086611a69565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906109fb90849073ffffffffffffffffffffffffffffffffffffffff8816906370a082319060240160206040518083038186803b1580156109c357600080fd5b505afa1580156109d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e891906124a6565b6002830154909150610a0d90826116ce565b600283015560405181815273ffffffffffffffffffffffffffffffffffffffff8616907f28fd761b1b374f526d6eba05c1081e7547a7a6b978161fac6bded2f1dc7a99529060200160405180910390a250505061087560018055565b610a7161165a565b6000610a7d6002611b45565b905060005b81811015610aad57610a9d610a98600283611b4f565b611b5b565b610aa6816124ee565b9050610a82565b5050610ab860018055565b565b6000610ac66002611b45565b905060005b8181101561087557610ae6610ae1600283611b4f565b6118c0565b610aef816124ee565b9050610acb565b610afe61165a565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610bc3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f7365656473546f6b656e4f6e6c793a2063616c6c65722073686f756c6420626560448201527f207365656473546f6b656e00000000000000000000000000000000000000000060648201526084016105f0565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260066020526040812054610bf3908561189c565b905060006106428560075461189c90919063ffffffff16565b6000610c1661110b565b9050804210610c255760098190555b50565b600081610c356002611b45565b8110610cc3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f76616c69646174654469737472696275746564546f6b656e73496e6465783a2060448201527f696e646578206578697374733f0000000000000000000000000000000000000060648201526084016105f0565b610cce600284611b4f565b9392505050565b610cdd61165a565b610ce5611c5d565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a082319060240160206040518083038186803b158015610d4d57600080fd5b505afa158015610d61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8591906124a6565b905060008111610e17576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f656d657267656e637957697468647261773a20746f6b656e2062616c616e636560448201527f206973206e756c6c00000000000000000000000000000000000000000000000060648201526084016105f0565b610e22823383611cde565b50610c2560018055565b610e34611c5d565b610ab86000611dda565b610e46611c5d565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260046020526040902060058101541580610e805750600781015460ff165b610f0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f656e61626c654469737472696275746564546f6b656e3a20416c72656164792060448201527f656e61626c6564206469766964656e647320746f6b656e00000000000000000060648201526084016105f0565b600a610f186002611b45565b10610fa5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f656e61626c654469737472696275746564546f6b656e3a20746f6f206d616e7960448201527f206469737472696275746564546f6b656e73000000000000000000000000000060648201526084016105f0565b6005810154610fb5574260058201555b6006810154610fc75761271060068201555b6007810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055610ffc600283611e4f565b5060405173ffffffffffffffffffffffffffffffffffffffff8316907fefa645a0ab6703d2f2e7f177f50d16c90ce1c71e317bb91cbbdab430e0a3968290600090a25050565b61104a61165a565b61105560028261162b565b6110e85773ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020600301546110e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f686172766573744469766964656e64733a20696e76616c696420746f6b656e0060448201526064016105f0565b6110f181611b5b565b610c2560018055565b60006111066002611b45565b905090565b60006111066008546009546116ce90919063ffffffff16565b61112c61165a565b611134611c5d565b60005b6111416002611b45565b811015611166576111566103e6600283611b4f565b61115f816124ee565b9050611137565b50610ab860018055565b611178611c5d565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020600781015460ff1680156111b057508054155b61123c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f72656d6f7665546f6b656e46726f6d4469737472696275746564546f6b656e7360448201527f3a2063616e6e6f742062652072656d6f7665640000000000000000000000000060648201526084016105f0565b611247600283611e71565b5060405173ffffffffffffffffffffffffffffffffffffffff8316907f17cd3cc84c669de8c5c4218fd1d9814e647b547d1e7f59287ea6989aa4e032c290600090a25050565b611295611c5d565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604090206005810154158015906112d25750600781015460ff16155b61135e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f64697361626c654469737472696275746564546f6b656e3a20416c726561647960448201527f2064697361626c6564206469766964656e647320746f6b656e0000000000000060648201526084016105f0565b6007810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560405173ffffffffffffffffffffffffffffffffffffffff8316907f961f10509197d967c55f8720c2b6a80d48433ef36db1b12cf3bf6bcf66da434690600090a25050565b6113d8611c5d565b73ffffffffffffffffffffffffffffffffffffffff811661147b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016105f0565b610c2581611dda565b61148c611c5d565b61271081111561151e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f7570646174654379636c654469766964656e647350657263656e743a2070657260448201527f63656e74206d7573746e277420657863656564206d6178696d756d000000000060648201526084016105f0565b60018110156115af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f7570646174654379636c654469766964656e647350657263656e743a2070657260448201527f63656e74206d7573746e277420657863656564206d696e696d756d000000000060648201526084016105f0565b73ffffffffffffffffffffffffffffffffffffffff8216600081815260046020526040908190206006810180549085905591519092907f82ebda75a31dc518c1b711aab73005a4dddecaf297cee2cf545e72b6a799eb519061161d9084908790918252602082015260400190565b60405180910390a250505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515610cce565b600260015414156116c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105f0565b6002600155565b6000610cce8284612527565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600660205260408120549061170b6002611b45565b905060005b818110156117db576000611725600283611b4f565b9050611730816118c0565b73ffffffffffffffffffffffffffffffffffffffff8082166000818152600560209081526040808320948c16835293815283822092825260049081905292812090920154600182015491929091611797906106e8670de0b6b3a76400006106f48b876118a8565b83549091506117a690826116ce565b83556117be670de0b6b3a76400006106f48b856118a8565b836001018190555050505050806117d4906124ee565b9050611710565b5073ffffffffffffffffffffffffffffffffffffffff8516600081815260066020908152604091829020879055600786905581518581529081018790527f97ce9d7086176d6da45e4e7999788176e2629a7591ffe505b0c1b13fe8052cc6910160405180910390a25050505050565b600061185760028361162b565b61186357506000919050565b60085473ffffffffffffffffffffffffffffffffffffffff831660009081526004602052604090205461052191906106f49060646118a8565b6000610cce828461253f565b6000610cce8284612556565b6000610cce8284612593565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260046020526040902042906118ef610c0c565b60058101546004820154818411611907575050505050565b6007541580611917575060095484105b156119255750506005015550565b825460018401546009548410156119da5760075461195b906106fa906106f4662386f26fc100006106ee866106e88960646118a8565b600786015490935060ff166119b557600385015461197990836116ce565b60038601556002850154600686015461199b90612710906106f49084906118a8565b80875592506119aa818461189c565b6002870155506119d1565b60038501546119c490836116ce565b6003860155600080865591505b50600954925060005b60006119f26119e88961184a565b6106ee898861189c565b90506119ff8360646118a8565b611a0983836116ce565b1115611a2157611a1e826106e88560646118a8565b90505b611a2b82826116ce565b6001870155600754611a5390611a4c906106f484662386f26fc100006118a8565b85906116ce565b6004870155505050506005909101919091555050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261065a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611e93565b6000610521825490565b6000610cce8383611fa2565b611b64816118c0565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260056020908152604080832033808552908352818420948452600480845282852001549084526006909252822054600184015491929091611bdd90611bd5906106e8670de0b6b3a76400006106f487896118a8565b8554906116ce565b600085559050611bf9670de0b6b3a76400006106f484866118a8565b6001850155611c09853383611cde565b60405181815273ffffffffffffffffffffffffffffffffffffffff86169033907f45a4759e6c135135eaba72e35bf196d59fd6fe17e1772d731f05dc25ec5a96a29060200160405180910390a35050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ab8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105f0565b8015611dd5576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a082319060240160206040518083038186803b158015611d4c57600080fd5b505afa158015611d60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8491906124a6565b905080821115611db457611daf73ffffffffffffffffffffffffffffffffffffffff85168483611fcc565b61065a565b61065a73ffffffffffffffffffffffffffffffffffffffff85168484611fcc565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610cce8373ffffffffffffffffffffffffffffffffffffffff8416612022565b6000610cce8373ffffffffffffffffffffffffffffffffffffffff8416612071565b6000611ef5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166121649092919063ffffffff16565b9050805160001480611f16575080806020019051810190611f1691906125ce565b611dd5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105f0565b6000826000018281548110611fb957611fb96125f0565b9060005260206000200154905092915050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611dd59084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611ac3565b600081815260018301602052604081205461206957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610521565b506000610521565b6000818152600183016020526040812054801561215a57600061209560018361253f565b85549091506000906120a99060019061253f565b905081811461210e5760008660000182815481106120c9576120c96125f0565b90600052602060002001549050808760000184815481106120ec576120ec6125f0565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061211f5761211f61261f565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610521565b6000915050610521565b6060612173848460008561217b565b949350505050565b60608247101561220d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016105f0565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612236919061267a565b60006040518083038185875af1925050503d8060008114612273576040519150601f19603f3d011682016040523d82523d6000602084013e612278565b606091505b50915091506107c987838387606083156123175782516123105773ffffffffffffffffffffffffffffffffffffffff85163b612310576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105f0565b5081612173565b612173838381511561232c5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f09190612696565b73ffffffffffffffffffffffffffffffffffffffff81168114610c2557600080fd5b60006020828403121561239457600080fd5b8135610cce81612360565b600080600080606085870312156123b557600080fd5b84356123c081612360565b935060208501359250604085013567ffffffffffffffff808211156123e457600080fd5b818701915087601f8301126123f857600080fd5b81358181111561240757600080fd5b88602082850101111561241957600080fd5b95989497505060200194505050565b6000806040838503121561243b57600080fd5b823561244681612360565b9150602083013561245681612360565b809150509250929050565b6000806040838503121561247457600080fd5b823561247f81612360565b946020939093013593505050565b60006020828403121561249f57600080fd5b5035919050565b6000602082840312156124b857600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612520576125206124bf565b5060010190565b6000821982111561253a5761253a6124bf565b500190565b600082821015612551576125516124bf565b500390565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561258e5761258e6124bf565b500290565b6000826125c9577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156125e057600080fd5b81518015158114610cce57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b83811015612669578181015183820152602001612651565b8381111561065a5750506000910152565b6000825161268c81846020870161264e565b9190910192915050565b60208152600082518060208401526126b581604085016020870161264e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220afa360ba25c41639031bb7076b1a0aad4bc77d4682ca9e70fdfb1809d086af2164736f6c63430008090033000000000000000000000000fc734d145e2941d70bc5e178a8f946e58fa9618600000000000000000000000000000000000000000000000000000000665faa80

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061020b5760003560e01c8063799fb9651161012a578063d2af0b94116100bd578063de9d477e1161008c578063eb141dcf11610071578063eb141dcf146104e6578063f2fde38b146104ee578063f494ec5a1461050157600080fd5b8063de9d477e146104c0578063e895cca3146104d357600080fd5b8063d2af0b94146104a0578063d637ff83146104a8578063dd191719146104b0578063ddd48f47146104b857600080fd5b8063a53c0f38116100f9578063a53c0f381461043e578063b989185a14610465578063bd394a8d14610478578063c4d3e0831461048057600080fd5b8063799fb965146103fc5780638da5cb5b14610405578063911c935c1461042357806393c563af1461042b57600080fd5b80635726d26e116101a25780636e34b818116101715780636e34b818146103cf5780636ff1c9bc146103d8578063715018a6146103eb57806379203dc4146103f357600080fd5b80635726d26e146102b75780635b2acf17146102bf5780635d9b436a146103505780635e80536a1461038857600080fd5b80633999a4e5116101de5780633999a4e51461028157806339f7df5f1461029457806347b32f281461029c578063549230c9146102a457600080fd5b8063034d7fcb146102105780631c75e369146102385780632d9c97a41461024d57806335d2506d1461026e575b600080fd5b61022361021e366004612382565b610514565b60405190151581526020015b60405180910390f35b61024b61024636600461239f565b610527565b005b61026061025b366004612428565b610660565b60405190815260200161022f565b61024b61027c366004612382565b6107d4565b61024b61028f366004612461565b610879565b61024b610a69565b61024b610aba565b61024b6102b236600461239f565b610af6565b61024b610c0c565b6103136102cd366004612382565b6004602081905260009182526040909120805460018201546002830154600384015494840154600585015460068601546007909601549496939592949192909160ff1688565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c0830152151560e08201526101000161022f565b61036361035e36600461248d565b610c28565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161022f565b6103ba610396366004612428565b60056020908152600092835260408084209091529082529020805460019091015482565b6040805192835260208301919091520161022f565b61026061271081565b61024b6103e6366004612382565b610cd5565b61024b610e2c565b61026060075481565b61026060095481565b60005473ffffffffffffffffffffffffffffffffffffffff16610363565b610260606481565b61024b610439366004612382565b610e3e565b6103637f000000000000000000000000fc734d145e2941d70bc5e178a8f946e58fa9618681565b61024b610473366004612382565b611042565b6102606110fa565b61026061048e366004612382565b60066020526000908152604090205481565b610260600a81565b61026061110b565b61024b611124565b600854610260565b61024b6104ce366004612382565b611170565b61024b6104e1366004612382565b61128d565b610260600181565b61024b6104fc366004612382565b6113d0565b61024b61050f366004612461565b611484565b600061052160028361162b565b92915050565b61052f61165a565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000fc734d145e2941d70bc5e178a8f946e58fa9618616146105f9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f7365656473546f6b656e4f6e6c793a2063616c6c65722073686f756c6420626560448201527f207365656473546f6b656e00000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526006602052604081205461062990856116ce565b90506000610642856007546116ce90919063ffffffff16565b905061064f8683836116da565b505061065a60018055565b50505050565b60006007546000141561067557506000610521565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600460208190526040822090810154600582015491929091906106b38761184a565b90506106bd61110b565b421115610736576107016106fa6007546106f4662386f26fc100006106ee866106ee896106e861110b565b9061189c565b906118a8565b906118b4565b84906116ce565b925061070b61110b565b91506107336008546106f460646106f4886006015489600201546118a890919063ffffffff16565b90505b6107596106fa6007546106f4662386f26fc100006106ee866106ee896106e84290565b73ffffffffffffffffffffffffffffffffffffffff8881166000908152600560209081526040808320938b1683529281528282208054600190910154600690925292909120549295506107c9926107c391906106e890670de0b6b3a7640000906106f4908a6118a8565b906116ce565b979650505050505050565b806107e060028261162b565b61086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f76616c69646174654469737472696275746564546f6b656e733a20746f6b656e60448201527f20646f6573206e6f74206578697374730000000000000000000000000000000060648201526084016105f0565b610875826118c0565b5050565b61088161165a565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a082319060240160206040518083038186803b1580156108e957600080fd5b505afa1580156108fd573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092191906124a6565b73ffffffffffffffffffffffffffffffffffffffff8416600081815260046020526040902091925061095590333086611a69565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906109fb90849073ffffffffffffffffffffffffffffffffffffffff8816906370a082319060240160206040518083038186803b1580156109c357600080fd5b505afa1580156109d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e891906124a6565b6002830154909150610a0d90826116ce565b600283015560405181815273ffffffffffffffffffffffffffffffffffffffff8616907f28fd761b1b374f526d6eba05c1081e7547a7a6b978161fac6bded2f1dc7a99529060200160405180910390a250505061087560018055565b610a7161165a565b6000610a7d6002611b45565b905060005b81811015610aad57610a9d610a98600283611b4f565b611b5b565b610aa6816124ee565b9050610a82565b5050610ab860018055565b565b6000610ac66002611b45565b905060005b8181101561087557610ae6610ae1600283611b4f565b6118c0565b610aef816124ee565b9050610acb565b610afe61165a565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000fc734d145e2941d70bc5e178a8f946e58fa961861614610bc3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f7365656473546f6b656e4f6e6c793a2063616c6c65722073686f756c6420626560448201527f207365656473546f6b656e00000000000000000000000000000000000000000060648201526084016105f0565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260066020526040812054610bf3908561189c565b905060006106428560075461189c90919063ffffffff16565b6000610c1661110b565b9050804210610c255760098190555b50565b600081610c356002611b45565b8110610cc3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f76616c69646174654469737472696275746564546f6b656e73496e6465783a2060448201527f696e646578206578697374733f0000000000000000000000000000000000000060648201526084016105f0565b610cce600284611b4f565b9392505050565b610cdd61165a565b610ce5611c5d565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a082319060240160206040518083038186803b158015610d4d57600080fd5b505afa158015610d61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8591906124a6565b905060008111610e17576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f656d657267656e637957697468647261773a20746f6b656e2062616c616e636560448201527f206973206e756c6c00000000000000000000000000000000000000000000000060648201526084016105f0565b610e22823383611cde565b50610c2560018055565b610e34611c5d565b610ab86000611dda565b610e46611c5d565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260046020526040902060058101541580610e805750600781015460ff165b610f0c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f656e61626c654469737472696275746564546f6b656e3a20416c72656164792060448201527f656e61626c6564206469766964656e647320746f6b656e00000000000000000060648201526084016105f0565b600a610f186002611b45565b10610fa5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f656e61626c654469737472696275746564546f6b656e3a20746f6f206d616e7960448201527f206469737472696275746564546f6b656e73000000000000000000000000000060648201526084016105f0565b6005810154610fb5574260058201555b6006810154610fc75761271060068201555b6007810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055610ffc600283611e4f565b5060405173ffffffffffffffffffffffffffffffffffffffff8316907fefa645a0ab6703d2f2e7f177f50d16c90ce1c71e317bb91cbbdab430e0a3968290600090a25050565b61104a61165a565b61105560028261162b565b6110e85773ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020600301546110e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f686172766573744469766964656e64733a20696e76616c696420746f6b656e0060448201526064016105f0565b6110f181611b5b565b610c2560018055565b60006111066002611b45565b905090565b60006111066008546009546116ce90919063ffffffff16565b61112c61165a565b611134611c5d565b60005b6111416002611b45565b811015611166576111566103e6600283611b4f565b61115f816124ee565b9050611137565b50610ab860018055565b611178611c5d565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020600781015460ff1680156111b057508054155b61123c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f72656d6f7665546f6b656e46726f6d4469737472696275746564546f6b656e7360448201527f3a2063616e6e6f742062652072656d6f7665640000000000000000000000000060648201526084016105f0565b611247600283611e71565b5060405173ffffffffffffffffffffffffffffffffffffffff8316907f17cd3cc84c669de8c5c4218fd1d9814e647b547d1e7f59287ea6989aa4e032c290600090a25050565b611295611c5d565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604090206005810154158015906112d25750600781015460ff16155b61135e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f64697361626c654469737472696275746564546f6b656e3a20416c726561647960448201527f2064697361626c6564206469766964656e647320746f6b656e0000000000000060648201526084016105f0565b6007810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560405173ffffffffffffffffffffffffffffffffffffffff8316907f961f10509197d967c55f8720c2b6a80d48433ef36db1b12cf3bf6bcf66da434690600090a25050565b6113d8611c5d565b73ffffffffffffffffffffffffffffffffffffffff811661147b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016105f0565b610c2581611dda565b61148c611c5d565b61271081111561151e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f7570646174654379636c654469766964656e647350657263656e743a2070657260448201527f63656e74206d7573746e277420657863656564206d6178696d756d000000000060648201526084016105f0565b60018110156115af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f7570646174654379636c654469766964656e647350657263656e743a2070657260448201527f63656e74206d7573746e277420657863656564206d696e696d756d000000000060648201526084016105f0565b73ffffffffffffffffffffffffffffffffffffffff8216600081815260046020526040908190206006810180549085905591519092907f82ebda75a31dc518c1b711aab73005a4dddecaf297cee2cf545e72b6a799eb519061161d9084908790918252602082015260400190565b60405180910390a250505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515610cce565b600260015414156116c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105f0565b6002600155565b6000610cce8284612527565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600660205260408120549061170b6002611b45565b905060005b818110156117db576000611725600283611b4f565b9050611730816118c0565b73ffffffffffffffffffffffffffffffffffffffff8082166000818152600560209081526040808320948c16835293815283822092825260049081905292812090920154600182015491929091611797906106e8670de0b6b3a76400006106f48b876118a8565b83549091506117a690826116ce565b83556117be670de0b6b3a76400006106f48b856118a8565b836001018190555050505050806117d4906124ee565b9050611710565b5073ffffffffffffffffffffffffffffffffffffffff8516600081815260066020908152604091829020879055600786905581518581529081018790527f97ce9d7086176d6da45e4e7999788176e2629a7591ffe505b0c1b13fe8052cc6910160405180910390a25050505050565b600061185760028361162b565b61186357506000919050565b60085473ffffffffffffffffffffffffffffffffffffffff831660009081526004602052604090205461052191906106f49060646118a8565b6000610cce828461253f565b6000610cce8284612556565b6000610cce8284612593565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260046020526040902042906118ef610c0c565b60058101546004820154818411611907575050505050565b6007541580611917575060095484105b156119255750506005015550565b825460018401546009548410156119da5760075461195b906106fa906106f4662386f26fc100006106ee866106e88960646118a8565b600786015490935060ff166119b557600385015461197990836116ce565b60038601556002850154600686015461199b90612710906106f49084906118a8565b80875592506119aa818461189c565b6002870155506119d1565b60038501546119c490836116ce565b6003860155600080865591505b50600954925060005b60006119f26119e88961184a565b6106ee898861189c565b90506119ff8360646118a8565b611a0983836116ce565b1115611a2157611a1e826106e88560646118a8565b90505b611a2b82826116ce565b6001870155600754611a5390611a4c906106f484662386f26fc100006118a8565b85906116ce565b6004870155505050506005909101919091555050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261065a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611e93565b6000610521825490565b6000610cce8383611fa2565b611b64816118c0565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260056020908152604080832033808552908352818420948452600480845282852001549084526006909252822054600184015491929091611bdd90611bd5906106e8670de0b6b3a76400006106f487896118a8565b8554906116ce565b600085559050611bf9670de0b6b3a76400006106f484866118a8565b6001850155611c09853383611cde565b60405181815273ffffffffffffffffffffffffffffffffffffffff86169033907f45a4759e6c135135eaba72e35bf196d59fd6fe17e1772d731f05dc25ec5a96a29060200160405180910390a35050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ab8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105f0565b8015611dd5576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a082319060240160206040518083038186803b158015611d4c57600080fd5b505afa158015611d60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8491906124a6565b905080821115611db457611daf73ffffffffffffffffffffffffffffffffffffffff85168483611fcc565b61065a565b61065a73ffffffffffffffffffffffffffffffffffffffff85168484611fcc565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610cce8373ffffffffffffffffffffffffffffffffffffffff8416612022565b6000610cce8373ffffffffffffffffffffffffffffffffffffffff8416612071565b6000611ef5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166121649092919063ffffffff16565b9050805160001480611f16575080806020019051810190611f1691906125ce565b611dd5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105f0565b6000826000018281548110611fb957611fb96125f0565b9060005260206000200154905092915050565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611dd59084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611ac3565b600081815260018301602052604081205461206957508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610521565b506000610521565b6000818152600183016020526040812054801561215a57600061209560018361253f565b85549091506000906120a99060019061253f565b905081811461210e5760008660000182815481106120c9576120c96125f0565b90600052602060002001549050808760000184815481106120ec576120ec6125f0565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061211f5761211f61261f565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610521565b6000915050610521565b6060612173848460008561217b565b949350505050565b60608247101561220d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016105f0565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612236919061267a565b60006040518083038185875af1925050503d8060008114612273576040519150601f19603f3d011682016040523d82523d6000602084013e612278565b606091505b50915091506107c987838387606083156123175782516123105773ffffffffffffffffffffffffffffffffffffffff85163b612310576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105f0565b5081612173565b612173838381511561232c5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f09190612696565b73ffffffffffffffffffffffffffffffffffffffff81168114610c2557600080fd5b60006020828403121561239457600080fd5b8135610cce81612360565b600080600080606085870312156123b557600080fd5b84356123c081612360565b935060208501359250604085013567ffffffffffffffff808211156123e457600080fd5b818701915087601f8301126123f857600080fd5b81358181111561240757600080fd5b88602082850101111561241957600080fd5b95989497505060200194505050565b6000806040838503121561243b57600080fd5b823561244681612360565b9150602083013561245681612360565b809150509250929050565b6000806040838503121561247457600080fd5b823561247f81612360565b946020939093013593505050565b60006020828403121561249f57600080fd5b5035919050565b6000602082840312156124b857600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612520576125206124bf565b5060010190565b6000821982111561253a5761253a6124bf565b500190565b600082821015612551576125516124bf565b500390565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561258e5761258e6124bf565b500290565b6000826125c9577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156125e057600080fd5b81518015158114610cce57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b83811015612669578181015183820152602001612651565b8381111561065a5750506000910152565b6000825161268c81846020870161264e565b9190910192915050565b60208152600082518060208401526126b581604085016020870161264e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220afa360ba25c41639031bb7076b1a0aad4bc77d4682ca9e70fdfb1809d086af2164736f6c63430008090033

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

000000000000000000000000fc734d145e2941d70bc5e178a8f946e58fa9618600000000000000000000000000000000000000000000000000000000665faa80

-----Decoded View---------------
Arg [0] : seedsToken_ (address): 0xFc734d145E2941d70bC5e178A8f946E58FA96186
Arg [1] : startTime_ (uint256): 1717545600

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000fc734d145e2941d70bc5e178a8f946e58fa96186
Arg [1] : 00000000000000000000000000000000000000000000000000000000665faa80


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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