Contract 0x1CfA1b1809b9fF6bDCE1d4c5fCc842eAA31a836d

Contract Overview

Balance:
0 AVAX

Token:
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xc7ce1f4ab0221f9a9787915e17f689323964beb20351ec41efb9cbcc53f564f5Add Admin118107752022-07-21 12:58:2077 days 16 hrs ago0x1ff808e34e4df60326a3fc4c2b0f80748a3d60c2 IN 0x1cfa1b1809b9ff6bdce1d4c5fcc842eaa31a836d0 AVAX0.001199172 26
0xc635f1206ec433dcc0a35c37c52cd5ef7ffde245ea7b64437f2d6c05528ceeb60x60c06040118048072022-07-21 9:25:4077 days 20 hrs ago0x1ff808e34e4df60326a3fc4c2b0f80748a3d60c2 IN  Create: Pool0 AVAX0.591802875225
[ Download CSV Export 
Latest 2 internal transactions
Parent Txn Hash Block From To Value
0xc635f1206ec433dcc0a35c37c52cd5ef7ffde245ea7b64437f2d6c05528ceeb6118048072022-07-21 9:25:4077 days 20 hrs ago 0x1cfa1b1809b9ff6bdce1d4c5fcc842eaa31a836d0x48c427e7cef42399e9e8300fc47875772309e9950 AVAX
0xc635f1206ec433dcc0a35c37c52cd5ef7ffde245ea7b64437f2d6c05528ceeb6118048072022-07-21 9:25:4077 days 20 hrs ago 0x1cfa1b1809b9ff6bdce1d4c5fcc842eaa31a836d0x48c427e7cef42399e9e8300fc47875772309e9950 AVAX
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Pool

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 8 : Pool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@airswap/staking/contracts/interfaces/IStaking.sol";
import "./interfaces/IPool.sol";

/**
 * @title AirSwap: Rewards Pool
 * @notice https://www.airswap.io/
 */
contract Pool is IPool, Ownable {
  using SafeERC20 for IERC20;

  bytes32 public constant DOMAIN_TYPEHASH =
    keccak256(
      abi.encodePacked(
        "EIP712Domain(",
        "string name,",
        "string version,",
        "uint256 chainId,",
        "address verifyingContract",
        ")"
      )
    );

  bytes32 public constant CLAIM_TYPEHASH =
    keccak256(
      abi.encodePacked(
        "Claim(",
        "uint256 nonce,",
        "uint256 expiry,",
        "address participant,",
        "uint256 score",
        ")"
      )
    );

  bytes32 public constant DOMAIN_NAME = keccak256("POOL");
  bytes32 public constant DOMAIN_VERSION = keccak256("1");
  uint256 public immutable DOMAIN_CHAIN_ID;
  bytes32 public immutable DOMAIN_SEPARATOR;

  uint256 internal constant MAX_PERCENTAGE = 100;
  uint256 internal constant MAX_SCALE = 77;

  // Larger the scale, lower the output for a claim
  uint256 public scale;

  // Max percentage for a claim with infinite score
  uint256 public max;

  // Mapping of address to boolean to enable admin accounts
  mapping(address => bool) public admins;

  /**
   * @notice Double mapping of signers to nonce groups to nonce states
   * @dev The nonce group is computed as nonce / 256, so each group of 256 sequential nonces uses the same key
   * @dev The nonce states are encoded as 256 bits, for each nonce in the group 0 means available and 1 means used
   */
  mapping(address => mapping(uint256 => uint256)) internal noncesClaimed;

  // Staking contract address
  address public stakingContract;

  // Staking token address
  address public stakingToken;

  /**
   * @notice Constructor
   * @param _scale uint256
   * @param _max uint256
   * @param _stakingContract address
   * @param _stakingToken address
   */
  constructor(
    uint256 _scale,
    uint256 _max,
    address _stakingContract,
    address _stakingToken
  ) {
    require(_max <= MAX_PERCENTAGE, "MAX_TOO_HIGH");
    require(_scale <= MAX_SCALE, "SCALE_TOO_HIGH");
    scale = _scale;
    max = _max;
    stakingContract = _stakingContract;
    stakingToken = _stakingToken;
    admins[msg.sender] = true;

    uint256 currentChainId = getChainId();
    DOMAIN_CHAIN_ID = currentChainId;
    DOMAIN_SEPARATOR = keccak256(
      abi.encode(
        DOMAIN_TYPEHASH,
        DOMAIN_NAME,
        DOMAIN_VERSION,
        currentChainId,
        this
      )
    );

    IERC20(stakingToken).safeApprove(stakingContract, 2**256 - 1);
  }

  /**
   * @notice Set scale
   * @dev Only owner
   * @param _scale uint256
   */
  function setScale(uint256 _scale) external override onlyOwner {
    require(_scale <= MAX_SCALE, "SCALE_TOO_HIGH");
    scale = _scale;
    emit SetScale(scale);
  }

  /**
   * @notice Set max
   * @dev Only owner
   * @param _max uint256
   */
  function setMax(uint256 _max) external override onlyOwner {
    require(_max <= MAX_PERCENTAGE, "MAX_TOO_HIGH");
    max = _max;
    emit SetMax(max);
  }

  /**
   * @notice Add admin address
   * @dev Only owner
   * @param _admin address
   */
  function addAdmin(address _admin) external override onlyOwner {
    require(_admin != address(0), "INVALID_ADDRESS");
    admins[_admin] = true;
  }

  /**
   * @notice Remove admin address
   * @dev Only owner
   * @param _admin address
   */
  function removeAdmin(address _admin) external override onlyOwner {
    require(admins[_admin] == true, "ADMIN_NOT_SET");
    admins[_admin] = false;
  }

  /**
   * @notice Set staking contract address
   * @dev Only owner
   * @param _stakingContract address
   */
  function setStakingContract(address _stakingContract)
    external
    override
    onlyOwner
  {
    require(_stakingContract != address(0), "INVALID_ADDRESS");
    // set allowance on old staking contract to zero
    IERC20(stakingToken).safeApprove(stakingContract, 0);
    stakingContract = _stakingContract;
    IERC20(stakingToken).safeApprove(stakingContract, 2**256 - 1);
  }

  /**
   * @notice Set staking token address
   * @dev Only owner
   * @param _stakingToken address
   */
  function setStakingToken(address _stakingToken) external override onlyOwner {
    require(_stakingToken != address(0), "INVALID_ADDRESS");
    // set allowance on old staking token to zero
    IERC20(stakingToken).safeApprove(stakingContract, 0);
    stakingToken = _stakingToken;
    IERC20(stakingToken).safeApprove(stakingContract, 2**256 - 1);
  }

  /**
   * @notice Admin function to migrate funds
   * @dev Only owner
   * @param tokens address[]
   * @param dest address
   */
  function drainTo(address[] calldata tokens, address dest)
    external
    override
    onlyOwner
  {
    for (uint256 i = 0; i < tokens.length; i++) {
      uint256 bal = IERC20(tokens[i]).balanceOf(address(this));
      IERC20(tokens[i]).safeTransfer(dest, bal);
    }
    emit DrainTo(tokens, dest);
  }

  /**
   * @notice Withdraw tokens from the pool using a signed claim
   * @param recipient address
   * @param minimum uint256
   * @param token address
   * @param nonce uint256
   * @param expiry uint256
   * @param score uint256
   * @param v uint8 "v" value of the ECDSA signature
   * @param r bytes32 "r" value of the ECDSA signature
   * @param s bytes32 "s" value of the ECDSA signature
   */
  function withdraw(
    address recipient,
    uint256 minimum,
    address token,
    uint256 nonce,
    uint256 expiry,
    uint256 score,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external override returns (uint256) {
    _checkValidClaim(nonce, expiry, score, v, r, s);
    uint256 amount = _withdrawCheck(score, token, minimum);
    IERC20(token).safeTransfer(recipient, amount);
    emit Withdraw(nonce, expiry, msg.sender, token, amount, score);
    return amount;
  }

  /**
   * @notice Withdraw tokens from the pool using signature and stake for a recipient
   * @param recipient address
   * @param minimum uint256
   * @param token address
   * @param nonce uint256
   * @param expiry uint256
   * @param score uint256
   * @param v uint8 "v" value of the ECDSA signature
   * @param r bytes32 "r" value of the ECDSA signature
   * @param s bytes32 "s" value of the ECDSA signature
   */
  function withdrawAndStake(
    address recipient,
    uint256 minimum,
    address token,
    uint256 nonce,
    uint256 expiry,
    uint256 score,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external override returns (uint256) {
    require(token == address(stakingToken), "INVALID_TOKEN");
    _checkValidClaim(nonce, expiry, score, v, r, s);
    uint256 amount = _withdrawCheck(score, token, minimum);
    IStaking(stakingContract).stakeFor(recipient, amount);
    emit Withdraw(nonce, expiry, msg.sender, token, amount, score);
    return amount;
  }

  /**
   * @notice Calculate output amount for an input score
   * @param score uint256
   * @param token address
   * @return amount uint256 amount to claim based on balance, scale, and max
   */
  function calculate(uint256 score, address token)
    public
    view
    override
    returns (uint256 amount)
  {
    uint256 balance = IERC20(token).balanceOf(address(this));
    uint256 divisor = (uint256(10)**scale) + score;
    return (max * score * balance) / divisor / 100;
  }

  /**
   * @notice Verify a signature
   * @param nonce uint256
   * @param expiry uint256
   * @param participant address
   * @param score uint256
   * @param v uint8 "v" value of the ECDSA signature
   * @param r bytes32 "r" value of the ECDSA signature
   * @param s bytes32 "s" value of the ECDSA signature
   */
  function verify(
    uint256 nonce,
    uint256 expiry,
    address participant,
    uint256 score,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) public view override returns (bool valid) {
    require(DOMAIN_CHAIN_ID == getChainId(), "CHAIN_ID_CHANGED");
    require(expiry > block.timestamp, "EXPIRY_PASSED");
    bytes32 claimHash = keccak256(
      abi.encode(CLAIM_TYPEHASH, nonce, expiry, participant, score)
    );
    address signatory = ecrecover(
      keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, claimHash)),
      v,
      r,
      s
    );
    admins[signatory] && !nonceUsed(participant, nonce)
      ? valid = true
      : valid = false;
  }

  /**
   * @notice Returns true if the nonce has been used
   * @param participant address
   * @param nonce uint256
   */
  function nonceUsed(address participant, uint256 nonce)
    public
    view
    override
    returns (bool)
  {
    uint256 groupKey = nonce / 256;
    uint256 indexInGroup = nonce % 256;
    return (noncesClaimed[participant][groupKey] >> indexInGroup) & 1 == 1;
  }

  /**
   * @notice Returns the current chainId using the chainid opcode
   * @return id uint256 The chain id
   */
  function getChainId() public view returns (uint256 id) {
    // no-inline-assembly
    assembly {
      id := chainid()
    }
  }

  /**
   * @notice Checks Claim Nonce, Expiry, Participant, Score, Signature
   * @param nonce uint256
   * @param expiry uint256
   * @param score uint256
   * @param v uint8 "v" value of the ECDSA signature
   * @param r bytes32 "r" value of the ECDSA signature
   * @param s bytes32 "s" value of the ECDSA signature
   */
  function _checkValidClaim(
    uint256 nonce,
    uint256 expiry,
    uint256 score,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) internal {
    require(DOMAIN_CHAIN_ID == getChainId(), "CHAIN_ID_CHANGED");
    require(expiry > block.timestamp, "EXPIRY_PASSED");
    bytes32 claimHash = keccak256(
      abi.encode(CLAIM_TYPEHASH, nonce, expiry, msg.sender, score)
    );
    address signatory = ecrecover(
      keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, claimHash)),
      v,
      r,
      s
    );
    require(admins[signatory], "UNAUTHORIZED");
    require(_markNonceAsUsed(msg.sender, nonce), "NONCE_ALREADY_USED");
  }

  /**
   * @notice Marks a nonce as used for the given participant
   * @param participant address
   * @param nonce uint256
   * @return bool True if nonce was not marked as used already
   */
  function _markNonceAsUsed(address participant, uint256 nonce)
    internal
    returns (bool)
  {
    uint256 groupKey = nonce / 256;
    uint256 indexInGroup = nonce % 256;
    uint256 group = noncesClaimed[participant][groupKey];

    // If it is already used, return false
    if ((group >> indexInGroup) & 1 == 1) {
      return false;
    }

    noncesClaimed[participant][groupKey] = group | (uint256(1) << indexInGroup);

    return true;
  }

  /**
   * @notice Withdraw tokens from the pool using a score
   * @param score uint256
   * @param token address
   * @param minimumAmount uint256
   */
  function _withdrawCheck(
    uint256 score,
    address token,
    uint256 minimumAmount
  ) internal view returns (uint256) {
    require(score > 0, "SCORE_MUST_BE_PROVIDED");
    uint256 amount = calculate(score, token);
    require(amount >= minimumAmount, "INSUFFICIENT_AMOUNT");
    return amount;
  }
}

File 2 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 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 {
        _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);
    }
}

File 3 of 8 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 4 of 8 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.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;

    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'
        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) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    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");
            uint256 newAllowance = oldAllowance - value;
            _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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 5 of 8 : IStaking.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IStaking {
  struct Stake {
    uint256 duration;
    uint256 balance;
    uint256 timestamp;
  }

  // ERC-20 Transfer event
  event Transfer(address indexed from, address indexed to, uint256 tokens);

  // Schedule timelock event
  event ScheduleDurationChange(uint256 indexed unlockTimestamp);

  // Cancel timelock event
  event CancelDurationChange();

  // Complete timelock event
  event CompleteDurationChange(uint256 indexed newDuration);

  // Propose Delegate event
  event ProposeDelegate(address indexed delegate, address indexed account);

  // Set Delegate event
  event SetDelegate(address indexed delegate, address indexed account);

  /**
   * @notice Stake tokens
   * @param amount uint256
   */
  function stake(uint256 amount) external;

  /**
   * @notice Unstake tokens
   * @param amount uint256
   */
  function unstake(uint256 amount) external;

  /**
   * @notice Receive stakes for an account
   * @param account address
   */
  function getStakes(address account)
    external
    view
    returns (Stake memory accountStake);

  /**
   * @notice Total balance of all accounts (ERC-20)
   */
  function totalSupply() external view returns (uint256);

  /**
   * @notice Balance of an account (ERC-20)
   */
  function balanceOf(address account) external view returns (uint256);

  /**
   * @notice Decimals of underlying token (ERC-20)
   */
  function decimals() external view returns (uint8);

  /**
   * @notice Stake tokens for an account
   * @param account address
   * @param amount uint256
   */
  function stakeFor(address account, uint256 amount) external;

  /**
   * @notice Available amount for an account
   * @param account uint256
   */
  function available(address account) external view returns (uint256);
}

File 6 of 8 : IPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IPool {
  event Withdraw(
    uint256 indexed nonce,
    uint256 indexed expiry,
    address indexed account,
    address token,
    uint256 amount,
    uint256 score
  );
  event SetScale(uint256 scale);
  event SetMax(uint256 max);
  event DrainTo(address[] tokens, address dest);

  function setScale(uint256 _scale) external;

  function setMax(uint256 _max) external;

  function addAdmin(address _admin) external;

  function removeAdmin(address _admin) external;

  function setStakingContract(address _stakingContract) external;

  function setStakingToken(address _stakingToken) external;

  function drainTo(address[] calldata tokens, address dest) external;

  function withdraw(
    address recipient,
    uint256 minimum,
    address token,
    uint256 nonce,
    uint256 expiry,
    uint256 score,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external returns (uint256);

  function withdrawAndStake(
    address recipient,
    uint256 minimum,
    address token,
    uint256 nonce,
    uint256 expiry,
    uint256 score,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external returns (uint256);

  function calculate(uint256 score, address token)
    external
    view
    returns (uint256 amount);

  function verify(
    uint256 nonce,
    uint256 expiry,
    address participant,
    uint256 score,
    uint8 v,
    bytes32 r,
    bytes32 s
  ) external view returns (bool valid);

  function nonceUsed(address participant, uint256 nonce)
    external
    view
    returns (bool);
}

File 7 of 8 : Context.sol
// 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;
    }
}

File 8 of 8 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

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

        uint256 size;
        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");

        (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");

        (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");

        (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");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_scale","type":"uint256"},{"internalType":"uint256","name":"_max","type":"uint256"},{"internalType":"address","name":"_stakingContract","type":"address"},{"internalType":"address","name":"_stakingToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"address","name":"dest","type":"address"}],"name":"DrainTo","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":false,"internalType":"uint256","name":"max","type":"uint256"}],"name":"SetMax","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"scale","type":"uint256"}],"name":"SetScale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"expiry","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"score","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"CLAIM_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_CHAIN_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_NAME","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_VERSION","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"addAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"admins","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"score","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"name":"calculate","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"address","name":"dest","type":"address"}],"name":"drainTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"max","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"participant","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"nonceUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"removeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"scale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_max","type":"uint256"}],"name":"setMax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_scale","type":"uint256"}],"name":"setScale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_stakingContract","type":"address"}],"name":"setStakingContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_stakingToken","type":"address"}],"name":"setStakingToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"address","name":"participant","type":"address"},{"internalType":"uint256","name":"score","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"verify","outputs":[{"internalType":"bool","name":"valid","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"minimum","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"score","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"minimum","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"score","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"withdrawAndStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b506040516200338e3803806200338e833981016040819052620000349162000700565b6200003f336200028c565b6064831115620000855760405162461bcd60e51b815260206004820152600c60248201526b09a82b0bea89e9ebe90928e960a31b60448201526064015b60405180910390fd5b604d841115620000c95760405162461bcd60e51b815260206004820152600e60248201526d0a68682988abea89e9ebe90928e960931b60448201526064016200007c565b60018481556002849055600580546001600160a01b038086166001600160a01b0319928316179092556006805492851692909116919091179055336000908152600360205260408120805460ff1916909217909155620001264690565b60808190526040516c08a92a06e626488dedac2d2dc5609b1b60208201526b1cdd1c9a5b99c81b985b594b60a21b602d8201526e1cdd1c9a5b99c81d995c9cda5bdb8b608a1b60398201526f1d5a5b9d0c8d4d8818da185a5b92590b60821b60488201527f6164647265737320766572696679696e67436f6e7472616374000000000000006058820152602960f81b607182015290915060720160408051601f198184030181528282528051602091820120908301527f5d5c2d2522b7f6ec8d1c86f44956b9ecd4376b1842cd263d54a5368aa149486d908201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018290523060a082015260c00160408051601f19818403018152919052805160209182012060a05260055460065462000281926001600160a01b03918216929190911690600019906200198d620002dc821b17901c565b5050505050620007d1565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8015806200036a5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b1580156200032d57600080fd5b505afa15801562000342573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003689190620006e6565b155b620003de5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016200007c565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620004369185916200043b16565b505050565b600062000497826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200051960201b62001ba1179092919060201c565b805190915015620004365780806020019051810190620004b89190620006c2565b620004365760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016200007c565b60606200052a848460008562000534565b90505b9392505050565b606082471015620005975760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016200007c565b843b620005e75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016200007c565b600080866001600160a01b031685876040516200060591906200074b565b60006040518083038185875af1925050503d806000811462000644576040519150601f19603f3d011682016040523d82523d6000602084013e62000649565b606091505b5090925090506200065c82828662000667565b979650505050505050565b60608315620006785750816200052d565b825115620006895782518084602001fd5b8160405162461bcd60e51b81526004016200007c919062000769565b80516001600160a01b0381168114620006bd57600080fd5b919050565b600060208284031215620006d557600080fd5b815180151581146200052d57600080fd5b600060208284031215620006f957600080fd5b5051919050565b600080600080608085870312156200071757600080fd5b84519350602085015192506200073060408601620006a5565b91506200074060608601620006a5565b905092959194509250565b600082516200075f8184602087016200079e565b9190910192915050565b60208152600082518060208401526200078a8160408501602087016200079e565b601f01601f19169190910160400192915050565b60005b83811015620007bb578181015183820152602001620007a1565b83811115620007cb576000848401525b50505050565b60805160a051612b7b620008136000396000818161025501528181610c4c0152611e8201526000818161028f015281816109e60152611c320152612b7b6000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636b0509b1116100f95780639dd373b911610097578063ee99205c11610071578063ee99205c146103fd578063f2fde38b1461041d578063f51e181a14610430578063f7c828aa1461043957600080fd5b80639dd373b9146103b0578063acb8cc49146103c3578063b09013a2146103ea57600080fd5b806372f702f3116100d357806372f702f314610313578063796f077b146103585780638da5cb5b1461037f5780638df32af51461039d57600080fd5b80636b0509b1146102f057806370480275146102f8578063715018a61461030b57600080fd5b80633408e47011610166578063416f281d11610140578063416f281d1461028a578063429b62e5146102b15780635a1d249d146102d45780636ac5db19146102e757600080fd5b80633408e4701461024a5780633644e515146102505780633edc35191461027757600080fd5b80631fe9eabc116101975780631fe9eabc1461020e57806320606b70146102215780632e0f54291461023757600080fd5b80631647795e146101be5780631785f53c146101e65780631e9b12ef146101fb575b600080fd5b6101d16101cc3660046125b7565b61044c565b60405190151581526020015b60405180910390f35b6101f96101f436600461259c565b6104b1565b005b6101f961020936600461259c565b610617565b6101f961021c366004612705565b6107b5565b6102296108dd565b6040519081526020016101dd565b6101d1610245366004612763565b6109e1565b46610229565b6102297f000000000000000000000000000000000000000000000000000000000000000081565b6101f9610285366004612705565b610db6565b6102297f000000000000000000000000000000000000000000000000000000000000000081565b6101d16102bf36600461259c565b60036020526000908152604090205460ff1681565b6102296102e2366004612737565b610ed7565b61022960025481565b610229610fd2565b6101f961030636600461259c565b6110c1565b6101f961120e565b6006546103339073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101dd565b6102297f5d5c2d2522b7f6ec8d1c86f44956b9ecd4376b1842cd263d54a5368aa149486d81565b60005473ffffffffffffffffffffffffffffffffffffffff16610333565b6102296103ab3660046125e1565b61129b565b6101f96103be36600461259c565b611437565b6102297fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc681565b6101f96103f836600461265f565b6115d3565b6005546103339073ffffffffffffffffffffffffffffffffffffffff1681565b6101f961042b36600461259c565b6117c6565b61022960015481565b6102296104473660046125e1565b6118f3565b60008061045b610100846128c3565b9050600061046b61010085612aa4565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260046020908152604080832095835294905292909220546001921c82169091149150505b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602052604090205460ff1615156001146105cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f41444d494e5f4e4f545f53455400000000000000000000000000000000000000604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff16600090815260036020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610698576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff8116610715576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f494e56414c49445f414444524553530000000000000000000000000000000000604482015260640161052e565b6005546006546107409173ffffffffffffffffffffffffffffffffffffffff9182169116600061198d565b600680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8381169182179092556005546107b292167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61198d565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610836576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161052e565b60648111156108a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4d41585f544f4f5f484947480000000000000000000000000000000000000000604482015260640161052e565b60028190556040518181527fc2c862cda8964d16d060904e01f55bf7e4ea5e59759ca1c20db551079e0d5eed906020015b60405180910390a150565b6040517f454950373132446f6d61696e280000000000000000000000000000000000000060208201527f737472696e67206e616d652c0000000000000000000000000000000000000000602d8201527f737472696e672076657273696f6e2c000000000000000000000000000000000060398201527f75696e7432353620636861696e49642c0000000000000000000000000000000060488201527f6164647265737320766572696679696e67436f6e74726163740000000000000060588201527f290000000000000000000000000000000000000000000000000000000000000060718201526072015b6040516020818303038152906040528051906020012081565b6000467f000000000000000000000000000000000000000000000000000000000000000014610a6c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f434841494e5f49445f4348414e47454400000000000000000000000000000000604482015260640161052e565b428711610ad5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4558504952595f50415353454400000000000000000000000000000000000000604482015260640161052e565b6040517f436c61696d28000000000000000000000000000000000000000000000000000060208201527f75696e74323536206e6f6e63652c00000000000000000000000000000000000060268201527f75696e74323536206578706972792c000000000000000000000000000000000060348201527f61646472657373207061727469636970616e742c00000000000000000000000060438201527f75696e743235362073636f72650000000000000000000000000000000000000060578201527f29000000000000000000000000000000000000000000000000000000000000006064820152600090606501604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201209083015281018a90526060810189905273ffffffffffffffffffffffffffffffffffffffff8816608082015260a0810187905260c001604051602081830303815290604052805190602001209050600060017f000000000000000000000000000000000000000000000000000000000000000083604051602001610cae9291907f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600084529083018083525260ff891690820152606081018790526080810186905260a0016020604051602081039080840390855afa158015610d2a573d6000803e3d6000fd5b5050604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff811660009081526003602052919091205490925060ff1690508015610d945750610d92888b61044c565b155b610da2576000925082610da8565b60019250825b505050979650505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610e37576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161052e565b604d811115610ea2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5343414c455f544f4f5f48494748000000000000000000000000000000000000604482015260640161052e565b60018190556040518181527fb7f1dd786998967316283c7e129a0bbeaf046b77f2f51afe39bb89a10f29a00e906020016108d2565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8416906370a082319060240160206040518083038186803b158015610f4157600080fd5b505afa158015610f55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f79919061271e565b9050600084600154600a610f8d9190612938565b610f9791906128ab565b90506064818387600254610fab91906129fe565b610fb591906129fe565b610fbf91906128c3565b610fc991906128c3565b95945050505050565b6040517f436c61696d28000000000000000000000000000000000000000000000000000060208201527f75696e74323536206e6f6e63652c00000000000000000000000000000000000060268201527f75696e74323536206578706972792c000000000000000000000000000000000060348201527f61646472657373207061727469636970616e742c00000000000000000000000060438201527f75696e743235362073636f72650000000000000000000000000000000000000060578201527f290000000000000000000000000000000000000000000000000000000000000060648201526065016109c8565b60005473ffffffffffffffffffffffffffffffffffffffff163314611142576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff81166111bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f494e56414c49445f414444524553530000000000000000000000000000000000604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff16600090815260036020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b60005473ffffffffffffffffffffffffffffffffffffffff16331461128f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161052e565b6112996000611bba565b565b60065460009073ffffffffffffffffffffffffffffffffffffffff898116911614611322576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f494e56414c49445f544f4b454e00000000000000000000000000000000000000604482015260640161052e565b611330878787878787611c2f565b600061133d868a8c612097565b6005546040517f2ee4090800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e8116600483015260248201849052929350911690632ee4090890604401600060405180830381600087803b1580156113b357600080fd5b505af11580156113c7573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff8d168152602081018590529081018990523392508991508a907faaf3e8be924534753bc291b29aca3f9e644a7ece9fd26c95e3390ec71870a892906060015b60405180910390a49a9950505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146114b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff8116611535576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f494e56414c49445f414444524553530000000000000000000000000000000000604482015260640161052e565b6005546006546115609173ffffffffffffffffffffffffffffffffffffffff9182169116600061198d565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8381169182179092556006546107b29216907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61198d565b60005473ffffffffffffffffffffffffffffffffffffffff163314611654576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161052e565b60005b8281101561178557600084848381811061167357611673612b16565b9050602002016020810190611688919061259c565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a082319060240160206040518083038186803b1580156116ef57600080fd5b505afa158015611703573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611727919061271e565b9050611772838287878681811061174057611740612b16565b9050602002016020810190611755919061259c565b73ffffffffffffffffffffffffffffffffffffffff16919061217a565b508061177d81612a6b565b915050611657565b507f4b713dd63c7c270b811762a754d42e5d79ea1ba9d3a0899d73eab3e38b50cd6f8383836040516117b9939291906127e2565b60405180910390a1505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611847576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161052e565b73ffffffffffffffffffffffffffffffffffffffff81166118ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161052e565b6107b281611bba565b6000611903878787878787611c2f565b6000611910868a8c612097565b905061193373ffffffffffffffffffffffffffffffffffffffff8a168c8361217a565b6040805173ffffffffffffffffffffffffffffffffffffffff8b16815260208101839052908101879052339088908a907faaf3e8be924534753bc291b29aca3f9e644a7ece9fd26c95e3390ec71870a89290606001611421565b801580611a3c57506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e9060440160206040518083038186803b158015611a0257600080fd5b505afa158015611a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3a919061271e565b155b611ac8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000606482015260840161052e565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611b9c9084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526121d0565b505050565b6060611bb084846000856122dc565b90505b9392505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b467f000000000000000000000000000000000000000000000000000000000000000014611cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f434841494e5f49445f4348414e47454400000000000000000000000000000000604482015260640161052e565b428511611d21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4558504952595f50415353454400000000000000000000000000000000000000604482015260640161052e565b6040517f436c61696d28000000000000000000000000000000000000000000000000000060208201527f75696e74323536206e6f6e63652c00000000000000000000000000000000000060268201527f75696e74323536206578706972792c000000000000000000000000000000000060348201527f61646472657373207061727469636970616e742c00000000000000000000000060438201527f75696e743235362073636f72650000000000000000000000000000000000000060578201527f29000000000000000000000000000000000000000000000000000000000000006064820152600090606501604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201209083015281018890526060810187905233608082015260a0810186905260c001604051602081830303815290604052805190602001209050600060017f000000000000000000000000000000000000000000000000000000000000000083604051602001611ee49291907f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600084529083018083525260ff881690820152606081018690526080810185905260a0016020604051602081039080840390855afa158015611f60573d6000803e3d6000fd5b5050604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff811660009081526003602052919091205490925060ff16905061201d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a45440000000000000000000000000000000000000000604482015260640161052e565b612027338961245c565b61208d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4e4f4e43455f414c52454144595f555345440000000000000000000000000000604482015260640161052e565b5050505050505050565b6000808411612102576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f53434f52455f4d5553545f42455f50524f564944454400000000000000000000604482015260640161052e565b600061210e8585610ed7565b905082811015611bb0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e53554646494349454e545f414d4f554e5400000000000000000000000000604482015260640161052e565b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611b9c9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611b1a565b6000612232826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611ba19092919063ffffffff16565b805190915015611b9c578080602001905181019061225091906126e3565b611b9c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161052e565b60608247101561236e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161052e565b843b6123d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161052e565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516123ff91906127c6565b60006040518083038185875af1925050503d806000811461243c576040519150601f19603f3d011682016040523d82523d6000602084013e612441565b606091505b509150915061245182828661250f565b979650505050505050565b60008061246b610100846128c3565b9050600061247b61010085612aa4565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600460209081526040808320868452909152902054909150600181831c811614156124c857600093505050506104ab565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602090815260408083209583529490529290922060019182901b92909217909155905092915050565b6060831561251e575081611bb3565b82511561252e5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161052e919061285a565b803573ffffffffffffffffffffffffffffffffffffffff8116811461258657600080fd5b919050565b803560ff8116811461258657600080fd5b6000602082840312156125ae57600080fd5b611bb382612562565b600080604083850312156125ca57600080fd5b6125d383612562565b946020939093013593505050565b60008060008060008060008060006101208a8c03121561260057600080fd5b6126098a612562565b985060208a0135975061261e60408b01612562565b965060608a0135955060808a0135945060a08a0135935061264160c08b0161258b565b925060e08a013591506101008a013590509295985092959850929598565b60008060006040848603121561267457600080fd5b833567ffffffffffffffff8082111561268c57600080fd5b818601915086601f8301126126a057600080fd5b8135818111156126af57600080fd5b8760208260051b85010111156126c457600080fd5b6020928301955093506126da9186019050612562565b90509250925092565b6000602082840312156126f557600080fd5b81518015158114611bb357600080fd5b60006020828403121561271757600080fd5b5035919050565b60006020828403121561273057600080fd5b5051919050565b6000806040838503121561274a57600080fd5b8235915061275a60208401612562565b90509250929050565b600080600080600080600060e0888a03121561277e57600080fd5b873596506020880135955061279560408901612562565b9450606088013593506127aa6080890161258b565b925060a0880135915060c0880135905092959891949750929550565b600082516127d8818460208701612a3b565b9190910192915050565b6040808252810183905260008460608301825b868110156128305773ffffffffffffffffffffffffffffffffffffffff61281b84612562565b168252602092830192909101906001016127f5565b50809250505073ffffffffffffffffffffffffffffffffffffffff83166020830152949350505050565b6020815260008251806020840152612879816040850160208701612a3b565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b600082198211156128be576128be612ab8565b500190565b6000826128d2576128d2612ae7565b500490565b600181815b8085111561293057817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561291657612916612ab8565b8085161561292357918102915b93841c93908002906128dc565b509250929050565b6000611bb3838360008261294e575060016104ab565b8161295b575060006104ab565b8160018114612971576002811461297b57612997565b60019150506104ab565b60ff84111561298c5761298c612ab8565b50506001821b6104ab565b5060208310610133831016604e8410600b84101617156129ba575081810a6104ab565b6129c483836128d7565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156129f6576129f6612ab8565b029392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612a3657612a36612ab8565b500290565b60005b83811015612a56578181015183820152602001612a3e565b83811115612a65576000848401525b50505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612a9d57612a9d612ab8565b5060010190565b600082612ab357612ab3612ae7565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea2646970667358221220cbb6fa972168164ec3a96b183f6bb03e74d331a4a19d693ca6c9585d8408877564736f6c63430008070033000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000006400000000000000000000000050c13b3763075c9da5dfc4e88e77c3dab4bf6af200000000000000000000000048c427e7cef42399e9e8300fc47875772309e995

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

000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000006400000000000000000000000050c13b3763075c9da5dfc4e88e77c3dab4bf6af200000000000000000000000048c427e7cef42399e9e8300fc47875772309e995

-----Decoded View---------------
Arg [0] : _scale (uint256): 10
Arg [1] : _max (uint256): 100
Arg [2] : _stakingContract (address): 0x50c13b3763075c9da5dfc4e88e77c3dab4bf6af2
Arg [3] : _stakingToken (address): 0x48c427e7cef42399e9e8300fc47875772309e995

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [2] : 00000000000000000000000050c13b3763075c9da5dfc4e88e77c3dab4bf6af2
Arg [3] : 00000000000000000000000048c427e7cef42399e9e8300fc47875772309e995


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading