Contract 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xf5cdd9a2da425b11fa9f17cd33e3f0c7afa0d1d807650267bc3fa3cf6f5069a5Transfer Ownersh...436793002022-12-05 0:49:0359 days 13 hrs agoCamelot: Deployer IN  0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40 ETH0.00001526
0xa29a3f6c3c138108e3e2b2e543746610e3c8c44927af4bd613d324d5290b5252Set Yield Booste...393412352022-11-19 14:29:4774 days 23 hrs agoCamelot: Deployer IN  0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40 ETH0.00045881
0x61d6f0aa08e691f8d67fb1964bef70e0e15caf939955102c63aa9e59c0900deb0x60c06040393389932022-11-19 14:20:4074 days 23 hrs agoCamelot: Deployer IN  Create: CamelotMaster0 ETH0.01352845
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xf143352a0902d01b8d756dedef114dd48da22c6a0d68ffa6627d27e2f1527370574446052023-02-02 14:14:2722 secs ago 0x6bc938aba940fb828d39daa23a94dfc522120c11 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40 ETH
0xf143352a0902d01b8d756dedef114dd48da22c6a0d68ffa6627d27e2f1527370574446052023-02-02 14:14:2722 secs ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0xf143352a0902d01b8d756dedef114dd48da22c6a0d68ffa6627d27e2f1527370574446052023-02-02 14:14:2722 secs ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0xf143352a0902d01b8d756dedef114dd48da22c6a0d68ffa6627d27e2f1527370574446052023-02-02 14:14:2722 secs ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0xf143352a0902d01b8d756dedef114dd48da22c6a0d68ffa6627d27e2f1527370574446052023-02-02 14:14:2722 secs ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0xf143352a0902d01b8d756dedef114dd48da22c6a0d68ffa6627d27e2f1527370574446052023-02-02 14:14:2722 secs ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40x6bc938aba940fb828d39daa23a94dfc522120c110 ETH
0xf143352a0902d01b8d756dedef114dd48da22c6a0d68ffa6627d27e2f1527370574446052023-02-02 14:14:2722 secs ago 0x6bc938aba940fb828d39daa23a94dfc522120c11 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40 ETH
0x80933e9e9a2f18de2afe95efec626152749bf0819af7335a91bef8fb2e073c24574433942023-02-02 14:08:116 mins ago 0x978e469e8242cd18af5926a1b60b8d93a550a391 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40 ETH
0x80933e9e9a2f18de2afe95efec626152749bf0819af7335a91bef8fb2e073c24574433942023-02-02 14:08:116 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0x80933e9e9a2f18de2afe95efec626152749bf0819af7335a91bef8fb2e073c24574433942023-02-02 14:08:116 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0x80933e9e9a2f18de2afe95efec626152749bf0819af7335a91bef8fb2e073c24574433942023-02-02 14:08:116 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0x80933e9e9a2f18de2afe95efec626152749bf0819af7335a91bef8fb2e073c24574433942023-02-02 14:08:116 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0x80933e9e9a2f18de2afe95efec626152749bf0819af7335a91bef8fb2e073c24574433942023-02-02 14:08:116 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40x978e469e8242cd18af5926a1b60b8d93a550a3910 ETH
0x80933e9e9a2f18de2afe95efec626152749bf0819af7335a91bef8fb2e073c24574433942023-02-02 14:08:116 mins ago 0x978e469e8242cd18af5926a1b60b8d93a550a391 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40 ETH
0x85fdb039b99f5f510228d65d11f69871dea0f3bd3227d81c19b257ed3d11c01d574405042023-02-02 13:53:0921 mins ago 0xd694913af87292b2a664f4478ac390638b371d25 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40 ETH
0x85fdb039b99f5f510228d65d11f69871dea0f3bd3227d81c19b257ed3d11c01d574405042023-02-02 13:53:0921 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0x85fdb039b99f5f510228d65d11f69871dea0f3bd3227d81c19b257ed3d11c01d574405042023-02-02 13:53:0921 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0x85fdb039b99f5f510228d65d11f69871dea0f3bd3227d81c19b257ed3d11c01d574405042023-02-02 13:53:0921 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0x85fdb039b99f5f510228d65d11f69871dea0f3bd3227d81c19b257ed3d11c01d574405042023-02-02 13:53:0921 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0x85fdb039b99f5f510228d65d11f69871dea0f3bd3227d81c19b257ed3d11c01d574405042023-02-02 13:53:0921 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40xd694913af87292b2a664f4478ac390638b371d250 ETH
0x85fdb039b99f5f510228d65d11f69871dea0f3bd3227d81c19b257ed3d11c01d574405042023-02-02 13:53:0921 mins ago 0xd694913af87292b2a664f4478ac390638b371d25 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40 ETH
0xcf6a8374ae853957c8ae16492e419a2efe96f8fa0a54cfb2c1b0016e1670de69574393092023-02-02 13:47:0927 mins ago 0x579942f9cce581ee83fae0b51cb40fc01391a169 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f40 ETH
0xcf6a8374ae853957c8ae16492e419a2efe96f8fa0a54cfb2c1b0016e1670de69574393092023-02-02 13:47:0927 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0xcf6a8374ae853957c8ae16492e419a2efe96f8fa0a54cfb2c1b0016e1670de69574393092023-02-02 13:47:0927 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
0xcf6a8374ae853957c8ae16492e419a2efe96f8fa0a54cfb2c1b0016e1670de69574393092023-02-02 13:47:0927 mins ago 0x55401a4f396b3655f66bf6948a1a4dc61dfc21f4 Camelot: GRAIL Token0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CamelotMaster

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 50000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 14 : CamelotMaster.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

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

import "./interfaces/ICamelotMaster.sol";
import "./interfaces/INFTPool.sol";
import "./interfaces/IYieldBooster.sol";
import "./interfaces/tokens/IGrailTokenV2.sol";


/*
 * This contract centralizes Camelot's yield incentives distribution.
 * Pools that should receive those incentives are defined here, along with their allocation.
 * All rewards are claimed from the GRAILToken contract.
 */
contract CamelotMaster is Ownable, ICamelotMaster {
  using SafeERC20 for IGrailTokenV2;
  using SafeMath for uint256;
  using EnumerableSet for EnumerableSet.AddressSet;

  // Info of each NFT pool
  struct PoolInfo {
    uint256 allocPoint; // How many allocation points assigned to this NFT pool
    uint256 lastRewardTime; // Last time that distribution to this NFT pool occurs
    uint256 reserve; // Pending rewards to distribute to the NFT pool
  }

  IGrailTokenV2 private immutable _grailToken; // Address of the GRAIL token contract
  IYieldBooster private _yieldBooster; // Contract address handling yield boosts

  mapping(address => PoolInfo) private _poolInfo; // Pools' information
  EnumerableSet.AddressSet private _pools; // All existing pool addresses
  EnumerableSet.AddressSet private _activePools; // Only contains pool addresses w/ allocPoints > 0

  uint256 public totalAllocPoint; // Total allocation points. Must be the sum of all allocation points in all pools
  uint256 public immutable startTime; // The time at which farming starts

  bool public override emergencyUnlock; // Used by pools to release all their locks at once in case of emergency

  constructor(
    IGrailTokenV2 grailToken_,
    uint256 startTime_
  ) {
    require(address(grailToken_) != address(0), "CamelotMaster: grailToken cannot be set to zero address");
    require(_currentBlockTimestamp() < startTime_ && startTime_ >= grailToken_.lastEmissionTime(), "CamelotMaster: invalid startTime");
    _grailToken = grailToken_;
    startTime = startTime_; // Must be set with the same time as GrailToken emission start
  }


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

  event ClaimRewards(address indexed poolAddress, uint256 amount);
  event PoolAdded(address indexed poolAddress, uint256 allocPoint);
  event PoolSet(address indexed poolAddress, uint256 allocPoint);
  event SetYieldBooster(address previousYieldBooster, address newYieldBooster);
  event PoolUpdated(address indexed poolAddress, uint256 reserve, uint256 lastRewardTime);
  event SetEmergencyUnlock(bool emergencyUnlock);


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

  /*
   * @dev Check if a pool exists
   */
  modifier validatePool(address poolAddress) {
    require(_pools.contains(poolAddress), "validatePool: pool does not exist");
    _;
  }


  /**************************************************/
  /****************** PUBLIC VIEWS ******************/
  /**************************************************/

  /*
   * @dev Returns GrailToken address
   */
  function grailToken() external view override returns (address) {
    return address(_grailToken);
  }

  /*
   * @dev Returns GrailToken's emission rate (allocated to this contract)
   */
  function emissionRate() public view returns (uint256) {
    return _grailToken.masterEmissionRate();
  }

  /**
   * @dev Returns current owner's address
   */
  function owner() public view virtual override(ICamelotMaster, Ownable) returns (address) {
    return Ownable.owner();
  }

  /**
   * @dev Returns YieldBooster's address
   */
  function yieldBooster() external view override returns (address) {
    return address(_yieldBooster);
  }

  /**
   * @dev Returns the number of available pools
   */
  function poolsLength() external view returns (uint256) {
    return _pools.length();
  }

  /**
   * @dev Returns a pool from its "index"
   */
  function getPoolAddressByIndex(uint256 index) external view returns (address) {
    if (index >= _pools.length()) return address(0);
    return _pools.at(index);
  }

  /**
   * @dev Returns the number of active pools
   */
  function activePoolsLength() external view returns (uint256) {
    return _activePools.length();
  }

  /**
   * @dev Returns an active pool from its "index"
   */
  function getActivePoolAddressByIndex(uint256 index) external view returns (address) {
    if (index >= _activePools.length()) return address(0);
    return _activePools.at(index);
  }

  /**
   * @dev Returns data of a given pool
   */
  function getPoolInfo(address poolAddress_) external view override returns (
    address poolAddress, uint256 allocPoint, uint256 lastRewardTime, uint256 reserve, uint256 poolEmissionRate
  ) {
    PoolInfo memory pool = _poolInfo[poolAddress_];

    poolAddress = poolAddress_;
    allocPoint = pool.allocPoint;
    lastRewardTime = pool.lastRewardTime;
    reserve = pool.reserve;

    if (totalAllocPoint == 0) {
      poolEmissionRate = 0;
    } else {
      poolEmissionRate = emissionRate().mul(allocPoint).div(totalAllocPoint);
    }
  }


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

  /**
   * @dev Set YieldBooster contract's address
   *
   * Must only be called by the owner
   */
  function setYieldBooster(IYieldBooster yieldBooster_) external onlyOwner {
    require(address(yieldBooster_) != address(0), "setYieldBooster: cannot be set to zero address");
    emit SetYieldBooster(address(_yieldBooster), address(yieldBooster_));
    _yieldBooster = yieldBooster_;
  }

  /**
   * @dev Set emergency unlock status for all pools
   *
   * Must only be called by the owner
   */
  function setEmergencyUnlock(bool emergencyUnlock_) external onlyOwner {
    emergencyUnlock = emergencyUnlock_;
    emit SetEmergencyUnlock(emergencyUnlock);
  }

  /**
   * @dev Adds a new pool
   * param withUpdate should be set to true every time it's possible
   *
   * Must only be called by the owner
   */
  function add(INFTPool nftPool, uint256 allocPoint, bool withUpdate) external onlyOwner {
    address poolAddress = address(nftPool);
    require(!_pools.contains(poolAddress), "add: pool already exists");
    uint256 currentBlockTimestamp = _currentBlockTimestamp();

    if (allocPoint > 0) {
      if (withUpdate) {
        // Update all pools if new pool allocPoint > 0
        _massUpdatePools();
      }
      _activePools.add(poolAddress);
    }

    // update lastRewardTime if startTime has already been passed
    uint256 lastRewardTime = currentBlockTimestamp > startTime ? currentBlockTimestamp : startTime;

    // update totalAllocPoint with the new pool's points
    totalAllocPoint = totalAllocPoint.add(allocPoint);

    // add new pool
    _poolInfo[poolAddress] = PoolInfo({
    allocPoint : allocPoint,
    lastRewardTime : lastRewardTime,
    reserve : 0
    });
    _pools.add(poolAddress);

    emit PoolAdded(poolAddress, allocPoint);
  }

  /**
   * @dev Updates configuration on existing pool
   * param withUpdate should be set to true every time it's possible
   *
   * Must only be called by the owner
   */
  function set(address poolAddress, uint256 allocPoint, bool withUpdate) external validatePool(poolAddress) onlyOwner {
    PoolInfo storage pool = _poolInfo[poolAddress];
    uint256 prevAllocPoint = pool.allocPoint;

    if (withUpdate) {
      _massUpdatePools();
    }
    _updatePool(poolAddress);

    // update (pool's and total) allocPoints
    pool.allocPoint = allocPoint;
    totalAllocPoint = totalAllocPoint.sub(prevAllocPoint).add(allocPoint);

    // if request is activating the pool
    if (prevAllocPoint == 0 && allocPoint > 0) {
      _activePools.add(poolAddress);
    }
    // if request is deactivating the pool
    else if (prevAllocPoint > 0 && allocPoint == 0) {
      _activePools.remove(poolAddress);
    }

    emit PoolSet(poolAddress, allocPoint);
  }


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

  /**
   * @dev Updates rewards states of the given pool to be up-to-date
   */
  function updatePool(address nftPool) external validatePool(nftPool) {
    _updatePool(nftPool);
  }

  /**
   * @dev Updates rewards states for all pools
   *
   * Be careful of gas spending
   */
  function massUpdatePools() external {
    _massUpdatePools();
  }

  /**
   * @dev Transfer to a pool its pending rewards in reserve, can only be called by the NFT pool contract itself
   */
  function claimRewards() external override returns (uint256 rewardsAmount) {
    // check if caller is a listed pool
    if (!_pools.contains(msg.sender)) {
      return 0;
    }

    _updatePool(msg.sender);

    // updates caller's reserve
    PoolInfo storage pool = _poolInfo[msg.sender];
    uint256 reserve = pool.reserve;
    if (reserve == 0) {
      return 0;
    }
    pool.reserve = 0;

    emit ClaimRewards(msg.sender, reserve);
    return _safeRewardsTransfer(msg.sender, reserve);
  }


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

  /**
   * @dev Safe token transfer function, in case rounding error causes pool to not have enough tokens
   */
  function _safeRewardsTransfer(address to, uint256 amount) internal returns (uint256 effectiveAmount) {
    uint256 grailBalance = _grailToken.balanceOf(address(this));

    if (amount > grailBalance) {
      amount = grailBalance;
    }

    _grailToken.safeTransfer(to, amount);
    return amount;
  }

  /**
   * @dev Updates rewards states of the given pool to be up-to-date
   *
   * Pool should be validated prior to calling this
   */
  function _updatePool(address poolAddress) internal {
    PoolInfo storage pool = _poolInfo[poolAddress];

    uint256 currentBlockTimestamp = _currentBlockTimestamp();

    uint256 lastRewardTime = pool.lastRewardTime; // gas saving
    uint256 allocPoint = pool.allocPoint; // gas saving

    if (currentBlockTimestamp <= lastRewardTime) {
      return;
    }

    // do not allocate rewards if pool is not active
    if (allocPoint > 0 && INFTPool(poolAddress).hasDeposits()) {
      // calculate how much GRAIL rewards are expected to be received for this pool
      uint256 rewards = currentBlockTimestamp.sub(lastRewardTime) // nbSeconds
        .mul(emissionRate()).mul(allocPoint).div(totalAllocPoint);

      // claim expected rewards from the token
      // use returns effective minted amount instead of expected amount
      (rewards) = _grailToken.claimMasterRewards(rewards);

      // updates pool data
      pool.reserve = pool.reserve.add(rewards);
    }

    pool.lastRewardTime = currentBlockTimestamp;

    emit PoolUpdated(poolAddress, pool.reserve, currentBlockTimestamp);
  }

  /**
   * @dev Updates rewards states for all pools
   *
   * Be careful of gas spending
   */
  function _massUpdatePools() internal {
    uint256 length = _activePools.length();
    for (uint256 index = 0; index < length; ++index) {
      _updatePool(_activePools.at(index));
    }
  }

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

File 2 of 14 : IGrailTokenV2.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

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

interface IGrailTokenV2 is IERC20{
  function lastEmissionTime() external view returns (uint256);

  function claimMasterRewards(uint256 amount) external returns (uint256 effectiveAmount);
  function masterEmissionRate() external view returns (uint256);
  function burn(uint256 amount) external;
}

File 3 of 14 : IYieldBooster.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

interface IYieldBooster {
  function deallocateAllFromPool(address userAddress, uint256 tokenId) external;
  function getMultiplier(address poolAddress, uint256 maxBoostMultiplier, uint256 amount, uint256 totalPoolSupply, uint256 allocatedAmount) external view returns (uint256);
}

File 4 of 14 : INFTPool.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

interface INFTPool is IERC721 {
  function exists(uint256 tokenId) external view returns (bool);
  function hasDeposits() external view returns (bool);
  function getPoolInfo() external view returns (
    address lpToken, address grailToken, address sbtToken, uint256 lastRewardTime, uint256 accRewardsPerShare,
    uint256 lpSupply, uint256 lpSupplyWithMultiplier, uint256 allocPoint
  );
  function getStakingPosition(uint256 tokenId) external view returns (
    uint256 amount, uint256 amountWithMultiplier, uint256 startLockTime,
    uint256 lockDuration, uint256 lockMultiplier, uint256 rewardDebt,
    uint256 boostPoints, uint256 totalMultiplier
  );

  function boost(uint256 userAddress, uint256 amount) external;
  function unboost(uint256 userAddress, uint256 amount) external;
}

File 5 of 14 : ICamelotMaster.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;

interface ICamelotMaster {

  function grailToken() external view returns (address);
  function yieldBooster() external view returns (address);
  function owner() external view returns (address);
  function emergencyUnlock() external view returns (bool);

  function getPoolInfo(address _poolAddress) external view returns (address poolAddress, uint256 allocPoint, uint256 lastRewardTime, uint256 reserve, uint256 poolEmissionRate);

  function claimRewards() external returns (uint256);
}

File 6 of 14 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

            bytes32 lastvalue = set._values[lastIndex];

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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


    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

File 7 of 14 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

File 8 of 14 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 9 of 14 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../../introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
      * @dev Safely transfers `tokenId` token from `from` to `to`.
      *
      * Requirements:
      *
      * - `from` cannot be the zero address.
      * - `to` cannot be the zero address.
      * - `tokenId` token must exist and be owned by `from`.
      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
      *
      * Emits a {Transfer} event.
      */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}

File 10 of 14 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.7.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

File 12 of 14 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

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

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

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

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

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

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

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

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

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

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

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

File 13 of 14 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

pragma solidity ^0.7.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 () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

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

Contract ABI

[{"inputs":[{"internalType":"contract IGrailTokenV2","name":"grailToken_","type":"address"},{"internalType":"uint256","name":"startTime_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"poolAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ClaimRewards","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":"poolAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"}],"name":"PoolAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"poolAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"}],"name":"PoolSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"poolAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"reserve","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastRewardTime","type":"uint256"}],"name":"PoolUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"emergencyUnlock","type":"bool"}],"name":"SetEmergencyUnlock","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousYieldBooster","type":"address"},{"indexed":false,"internalType":"address","name":"newYieldBooster","type":"address"}],"name":"SetYieldBooster","type":"event"},{"inputs":[],"name":"activePoolsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract INFTPool","name":"nftPool","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"bool","name":"withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimRewards","outputs":[{"internalType":"uint256","name":"rewardsAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyUnlock","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emissionRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getActivePoolAddressByIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getPoolAddressByIndex","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"poolAddress_","type":"address"}],"name":"getPoolInfo","outputs":[{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardTime","type":"uint256"},{"internalType":"uint256","name":"reserve","type":"uint256"},{"internalType":"uint256","name":"poolEmissionRate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"grailToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"bool","name":"withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"emergencyUnlock_","type":"bool"}],"name":"setEmergencyUnlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IYieldBooster","name":"yieldBooster_","type":"address"}],"name":"setYieldBooster","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","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":[{"internalType":"address","name":"nftPool","type":"address"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"yieldBooster","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60c06040523480156200001157600080fd5b506040516200203838038062002038833981810160405260408110156200003757600080fd5b50805160209091015160006200004c620001cb565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001600160a01b038216620000dd5760405162461bcd60e51b8152600401808060200182810382526037815260200180620020016037913960400191505060405180910390fd5b80620000e8620001cf565b1080156200015d5750816001600160a01b031663439af45e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156200012b57600080fd5b505afa15801562000140573d6000803e3d6000fd5b505050506040513d60208110156200015757600080fd5b50518110155b620001af576040805162461bcd60e51b815260206004820181905260248201527f43616d656c6f744d61737465723a20696e76616c696420737461727454696d65604482015290519081900360640190fd5b60609190911b6001600160601b03191660805260a052620001d3565b3390565b4290565b60805160601c60a051611de962000218600039806107f052806108175280610c36525080610cd45280610f1b528061135452806115be52806116975250611de96000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806368e5dab5116100d857806396afc4501161008c578063f2c3999211610066578063f2c39992146103aa578063f2fde38b146103c6578063f501d10c146103f957610177565b806396afc45014610367578063a2a4284b1461036f578063c414c584146103a257610177565b806378e97925116100bd57806378e97925146103245780637b46c54f1461032c5780638da5cb5b1461035f57610177565b806368e5dab514610314578063715018a61461031c57610177565b80632716ae661161012f578063372500ab11610114578063372500ab146102fc5780634584736514610304578063630b5ba11461030c57610177565b80632716ae66146102d55780632f38e042146102dd57610177565b80630dec2312116101605780630dec231214610234578063179671831461027557806317caf6f1146102bb57610177565b806306bfa9381461017c5780630b139194146101f1575b600080fd5b6101af6004803603602081101561019257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610416565b6040805173ffffffffffffffffffffffffffffffffffffffff909616865260208601949094528484019290925260608401526080830152519081900360a00190f35b6102326004803603606081101561020757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020810135906040013515156104a1565b005b6102326004803603606081101561024a57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060208101359060400135151561069f565b6102926004803603602081101561028b57600080fd5b50356108fe565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6102c361092b565b60408051918252519081900360200190f35b6102c3610931565b610232600480360360208110156102f357600080fd5b50351515610943565b6102c3610a55565b6102c3610aeb565b610232610af7565b610292610b01565b610232610b1d565b6102c3610c34565b6102326004803603602081101561034257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610c58565b610292610cc6565b6102c3610cd0565b6102326004803603602081101561038557600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610d69565b610292610f19565b6103b2610f3d565b604080519115158252519081900360200190f35b610232600480360360208110156103dc57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610f46565b6102926004803603602081101561040f57600080fd5b50356110e7565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600260208181526040808420815160608101835281548082526001830154948201859052919094015491840182905260075486959194906104765760009150610497565b61049460075461048e87610488610cd0565b9061110c565b90611188565b91505b5091939590929450565b826104ad600382611209565b610502576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611d3b6021913960400191505060405180910390fd5b61050a61122b565b73ffffffffffffffffffffffffffffffffffffffff16610528610cc6565b73ffffffffffffffffffffffffffffffffffffffff16146105aa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff84166000908152600260205260409020805483156105df576105df61122f565b6105e886611263565b8482556007546106049086906105fe908461146f565b906114e6565b600755801580156106155750600085115b1561062b5761062560058761155a565b5061064b565b600081118015610639575084155b1561064b5761064960058761157c565b505b60408051868152905173ffffffffffffffffffffffffffffffffffffffff8816917f766454cf266311018043fed7121567eca6b8f60d59bc0262dc5f2224734128a1919081900360200190a2505050505050565b6106a761122b565b73ffffffffffffffffffffffffffffffffffffffff166106c5610cc6565b73ffffffffffffffffffffffffffffffffffffffff161461074757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b82610753600382611209565b156107bf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f6164643a20706f6f6c20616c7265616479206578697374730000000000000000604482015290519081900360640190fd5b60006107c961159e565b905083156107ec5782156107df576107df61122f565b6107ea60058361155a565b505b60007f0000000000000000000000000000000000000000000000000000000000000000821161083b577f000000000000000000000000000000000000000000000000000000000000000061083d565b815b60075490915061084d90866114e6565b600755604080516060810182528681526020808201848152600083850181815273ffffffffffffffffffffffffffffffffffffffff891682526002938490529490209251835551600183015591519101556108a960038461155a565b5060408051868152905173ffffffffffffffffffffffffffffffffffffffff8516917f0c98febfffcec480c66a977e13f14bafdb5199ea9603591a0715b0cabe0c3ae2919081900360200190a2505050505050565b600061090a60036115a2565b821061091857506000610926565b6109236003836115ad565b90505b919050565b60075481565b600061093d60036115a2565b90505b90565b61094b61122b565b73ffffffffffffffffffffffffffffffffffffffff16610969610cc6565b73ffffffffffffffffffffffffffffffffffffffff16146109eb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001682151517908190556040805160ff90921615158252517f1545be19b3ba6f2e76454d1b8b59529cbbbdf7af9046fd49bd86c17314a5509d916020908290030190a150565b6000610a62600333611209565b610a6e57506000610940565b610a7733611263565b3360009081526002602081905260409091209081015480610a9d57600092505050610940565b6000600283015560408051828152905133917f1f89f96333d3133000ee447473151fa9606543368f02271c9d95ae14f13bcc67919081900360200190a2610ae433826115b9565b9250505090565b600061093d60056115a2565b610aff61122f565b565b60015473ffffffffffffffffffffffffffffffffffffffff1690565b610b2561122b565b73ffffffffffffffffffffffffffffffffffffffff16610b43610cc6565b73ffffffffffffffffffffffffffffffffffffffff1614610bc557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b7f000000000000000000000000000000000000000000000000000000000000000081565b80610c64600382611209565b610cb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611d3b6021913960400191505060405180910390fd5b610cc282611263565b5050565b600061093d6116c6565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166339eb41896040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3857600080fd5b505afa158015610d4c573d6000803e3d6000fd5b505050506040513d6020811015610d6257600080fd5b5051905090565b610d7161122b565b73ffffffffffffffffffffffffffffffffffffffff16610d8f610cc6565b73ffffffffffffffffffffffffffffffffffffffff1614610e1157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610e7d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180611d86602e913960400191505060405180910390fd5b6001546040805173ffffffffffffffffffffffffffffffffffffffff9283168152918316602083015280517f7318a5c0c2124d6236f6ff6c5970bd58080848fefd17871fb15b8ea976c08a109281900390910190a1600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b7f000000000000000000000000000000000000000000000000000000000000000090565b60085460ff1681565b610f4e61122b565b73ffffffffffffffffffffffffffffffffffffffff16610f6c610cc6565b73ffffffffffffffffffffffffffffffffffffffff1614610fee57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811661105a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611cce6026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60006110f360056115a2565b821061110157506000610926565b6109236005836115ad565b60008261111b57506000611182565b8282028284828161112857fe5b041461117f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611d1a6021913960400191505060405180910390fd5b90505b92915050565b60008082116111f857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161120157fe5b049392505050565b600061117f8373ffffffffffffffffffffffffffffffffffffffff84166116e2565b3390565b600061123b60056115a2565b905060005b81811015610cc25761125b6112566005836115ad565b611263565b600101611240565b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604081209061129161159e565b60018301548354919250908183116112ac575050505061146c565b60008111801561132a57508473ffffffffffffffffffffffffffffffffffffffff1663e61f927d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156112fd57600080fd5b505afa158015611311573d6000803e3d6000fd5b505050506040513d602081101561132757600080fd5b50515b1561140a57600061135060075461048e84610488611346610cd0565b6104888a8a61146f565b90507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166378135705826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b1580156113c557600080fd5b505af11580156113d9573d6000803e3d6000fd5b505050506040513d60208110156113ef57600080fd5b5051600286015490915061140390826114e6565b6002860155505b6001840183905560028401546040805191825260208201859052805173ffffffffffffffffffffffffffffffffffffffff8816927ffe9371d05ef5f3f0e1c8bd622b21d0c06aa6b7b6a2ce7d07ad9f5e526979ffcc92908290030190a2505050505b50565b6000828211156114e057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b60008282018381101561117f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061117f8373ffffffffffffffffffffffffffffffffffffffff84166116fa565b600061117f8373ffffffffffffffffffffffffffffffffffffffff8416611744565b4290565b600061092382611828565b600061117f838361182c565b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561164357600080fd5b505afa158015611657573d6000803e3d6000fd5b505050506040513d602081101561166d57600080fd5b505190508083111561167d578092505b6116be73ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001685856118aa565b509092915050565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b60009081526001919091016020526040902054151590565b600061170683836116e2565b61173c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611182565b506000611182565b6000818152600183016020526040812054801561181e5783547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808301919081019060009087908390811061179557fe5b90600052602060002001549050808760000184815481106117b257fe5b6000918252602080832090910192909255828152600189810190925260409020908401905586548790806117e257fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050611182565b6000915050611182565b5490565b81546000908210611888576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611cac6022913960400191505060405180910390fd5b82600001828154811061189757fe5b9060005260206000200154905092915050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261193790849061193c565b505050565b600061199e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611a149092919063ffffffff16565b805190915015611937578080602001905160208110156119bd57600080fd5b5051611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611d5c602a913960400191505060405180910390fd5b6060611a238484600085611a2d565b90505b9392505050565b606082471015611a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611cf46026913960400191505060405180910390fd5b611a9185611be7565b611afc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b60208310611b6557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611b28565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611bc7576040519150601f19603f3d011682016040523d82523d6000602084013e611bcc565b606091505b5091509150611bdc828286611bed565b979650505050505050565b3b151590565b60608315611bfc575081611a26565b825115611c0c5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c70578181015183820152602001611c58565b50505050905090810190601f168015611c9d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7776616c6964617465506f6f6c3a20706f6f6c20646f6573206e6f742065786973745361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565647365745969656c64426f6f737465723a2063616e6e6f742062652073657420746f207a65726f2061646472657373a26469706673582212201e807a4fec3f422c10ffda9a2097f7397e951d7c3c9510c6241a633b2b2c879064736f6c6343000706003343616d656c6f744d61737465723a20677261696c546f6b656e2063616e6e6f742062652073657420746f207a65726f20616464726573730000000000000000000000003d9907f9a368ad0a51be60f7da3b97cf940982d8000000000000000000000000000000000000000000000000000000006390c690

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

0000000000000000000000003d9907f9a368ad0a51be60f7da3b97cf940982d8000000000000000000000000000000000000000000000000000000006390c690

-----Decoded View---------------
Arg [0] : grailToken_ (address): 0x3d9907f9a368ad0a51be60f7da3b97cf940982d8
Arg [1] : startTime_ (uint256): 1670432400

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000003d9907f9a368ad0a51be60f7da3b97cf940982d8
Arg [1] : 000000000000000000000000000000000000000000000000000000006390c690


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