Contract 0xb1b586afa8a2aab42826fb2ab9896cd0c686d0f4 6

 

Contract Overview

Balance:
0 MATIC

MATIC Value:
$0.00

Token:
 
Txn Hash
Method
Block
From
To
Value [Txn Fee]
0x90955d50967d283c3fd5789d0b070d2f52ce8265605e76a4fb6d9f479e792012Transfer Ownersh...364614182022-12-05 16:22:46110 days 7 hrs ago0x5dc34c5aed185484a46cbe522118a6d5a1946583 IN  0xb1b586afa8a2aab42826fb2ab9896cd0c686d0f40 MATIC0.001197565559 41.919824977
0x143ba681ede29cc128db98f3110b95b14d78905d1ba9a2b472358958b3dbff150x60c06040364613232022-12-05 16:19:32110 days 7 hrs ago0x5dc34c5aed185484a46cbe522118a6d5a1946583 IN  Create: Pool0 MATIC0.08344020066634.267445047
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Pool

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 9 : 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;
    emit AddAdmin(_admin);
  }

  /**
   * @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;
    emit RemoveAdmin(_admin);
  }

  /**
   * @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 9 : 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 AddAdmin(address admin);
  event RemoveAdmin(address admin);
  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 3 of 9 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions 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 4 of 9 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 5 of 9 : 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 9 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    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));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

File 7 of 9 : 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 9 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 9 of 9 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://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
                /// @solidity memory-safe-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 Security Audit

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":"admin","type":"address"}],"name":"AddAdmin","type":"event"},{"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":"address","name":"admin","type":"address"}],"name":"RemoveAdmin","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"}]

60c06040523480156200001157600080fd5b5060405162002fd038038062002fd08339810160408190526200003491620006bb565b6200003f336200028c565b6064831115620000855760405162461bcd60e51b815260206004820152600c60248201526b09a82b0bea89e9ebe90928e960a31b60448201526064015b60405180910390fd5b604d841115620000c95760405162461bcd60e51b815260206004820152600e60248201526d0a68682988abea89e9ebe90928e960931b60448201526064016200007c565b60018481556002849055600580546001600160a01b038086166001600160a01b0319928316179092556006805492851692909116919091179055336000908152600360205260408120805460ff1916909217909155620001264690565b60808190526040516c08a92a06e626488dedac2d2dc5609b1b60208201526b1cdd1c9a5b99c81b985b594b60a21b602d8201526e1cdd1c9a5b99c81d995c9cda5bdb8b608a1b60398201526f1d5a5b9d0c8d4d8818da185a5b92590b60821b60488201527f6164647265737320766572696679696e67436f6e7472616374000000000000006058820152602960f81b607182015290915060720160408051601f198184030181528282528051602091820120908301527f5d5c2d2522b7f6ec8d1c86f44956b9ecd4376b1842cd263d54a5368aa149486d908201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018290523060a082015260c00160408051601f19818403018152919052805160209182012060a05260055460065462000281926001600160a01b03918216929190911690600019906200158e620002dc821b17901c565b5050505050620007bd565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8015806200035a5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801562000332573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000358919062000706565b155b620003ce5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016200007c565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620004269185916200042b16565b505050565b600062000487826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200050960201b62001793179092919060201c565b805190915015620004265780806020019051810190620004a8919062000720565b620004265760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016200007c565b60606200051a848460008562000524565b90505b9392505050565b606082471015620005875760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016200007c565b6001600160a01b0385163b620005e05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016200007c565b600080866001600160a01b03168587604051620005fe91906200076a565b60006040518083038185875af1925050503d80600081146200063d576040519150601f19603f3d011682016040523d82523d6000602084013e62000642565b606091505b5090925090506200065582828662000660565b979650505050505050565b60608315620006715750816200051d565b825115620006825782518084602001fd5b8160405162461bcd60e51b81526004016200007c919062000788565b80516001600160a01b0381168114620006b657600080fd5b919050565b60008060008060808587031215620006d257600080fd5b8451935060208501519250620006eb604086016200069e565b9150620006fb606086016200069e565b905092959194509250565b6000602082840312156200071957600080fd5b5051919050565b6000602082840312156200073357600080fd5b815180151581146200051d57600080fd5b60005b838110156200076157818101518382015260200162000747565b50506000910152565b600082516200077e81846020870162000744565b9190910192915050565b6020815260008251806020840152620007a981604085016020870162000744565b601f01601f19169190910160400192915050565b60805160a0516127d1620007ff6000396000818161025501528181610b110152611af501526000818161028f015281816108ab01526118a501526127d16000f3fe608060405234801561001057600080fd5b50600436106101b95760003560e01c80636b0509b1116100f95780639dd373b911610097578063ee99205c11610071578063ee99205c146103fd578063f2fde38b1461041d578063f51e181a14610430578063f7c828aa1461043957600080fd5b80639dd373b9146103b0578063acb8cc49146103c3578063b09013a2146103ea57600080fd5b806372f702f3116100d357806372f702f314610313578063796f077b146103585780638da5cb5b1461037f5780638df32af51461039d57600080fd5b80636b0509b1146102f057806370480275146102f8578063715018a61461030b57600080fd5b80633408e47011610166578063416f281d11610140578063416f281d1461028a578063429b62e5146102b15780635a1d249d146102d45780636ac5db19146102e757600080fd5b80633408e4701461024a5780633644e515146102505780633edc35191461027757600080fd5b80631fe9eabc116101975780631fe9eabc1461020e57806320606b70146102215780632e0f54291461023757600080fd5b80631647795e146101be5780631785f53c146101e65780631e9b12ef146101fb575b600080fd5b6101d16101cc366004612214565b61044c565b60405190151581526020015b60405180910390f35b6101f96101f436600461223e565b6104b1565b005b6101f961020936600461223e565b6105d5565b6101f961021c366004612259565b6106fa565b6102296107a2565b6040519081526020016101dd565b6101d1610245366004612283565b6108a6565b46610229565b6102297f000000000000000000000000000000000000000000000000000000000000000081565b6101f9610285366004612259565b610c7b565b6102297f000000000000000000000000000000000000000000000000000000000000000081565b6101d16102bf36600461223e565b60036020526000908152604090205460ff1681565b6102296102e23660046122e6565b610d23565b61022960025481565b610229610e0f565b6101f961030636600461223e565b610efe565b6101f9611002565b6006546103339073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101dd565b6102297f5d5c2d2522b7f6ec8d1c86f44956b9ecd4376b1842cd263d54a5368aa149486d81565b60005473ffffffffffffffffffffffffffffffffffffffff16610333565b6102296103ab366004612312565b611016565b6101f96103be36600461223e565b6111b2565b6102297fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc681565b6101f96103f8366004612390565b6112d5565b6005546103339073ffffffffffffffffffffffffffffffffffffffff1681565b6101f961042b36600461223e565b611440565b61022960015481565b610229610447366004612312565b6114f4565b60008061045b61010084612472565b9050600061046b61010085612486565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260046020908152604080832095835294905292909220546001921c82169091149150505b92915050565b6104b96117ac565b73ffffffffffffffffffffffffffffffffffffffff811660009081526003602052604090205460ff161515600114610552576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f41444d494e5f4e4f545f5345540000000000000000000000000000000000000060448201526064015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905590519182527f753f40ca3312b2408759a67875b367955e7baa221daf08aa3d643d96202ac12b91015b60405180910390a150565b6105dd6117ac565b73ffffffffffffffffffffffffffffffffffffffff811661065a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f494e56414c49445f4144445245535300000000000000000000000000000000006044820152606401610549565b6005546006546106859173ffffffffffffffffffffffffffffffffffffffff9182169116600061158e565b600680547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8381169182179092556005546106f792167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61158e565b50565b6107026117ac565b606481111561076d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f4d41585f544f4f5f4849474800000000000000000000000000000000000000006044820152606401610549565b60028190556040518181527fc2c862cda8964d16d060904e01f55bf7e4ea5e59759ca1c20db551079e0d5eed906020016105ca565b6040517f454950373132446f6d61696e280000000000000000000000000000000000000060208201527f737472696e67206e616d652c0000000000000000000000000000000000000000602d8201527f737472696e672076657273696f6e2c000000000000000000000000000000000060398201527f75696e7432353620636861696e49642c0000000000000000000000000000000060488201527f6164647265737320766572696679696e67436f6e74726163740000000000000060588201527f290000000000000000000000000000000000000000000000000000000000000060718201526072015b6040516020818303038152906040528051906020012081565b6000467f000000000000000000000000000000000000000000000000000000000000000014610931576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f434841494e5f49445f4348414e474544000000000000000000000000000000006044820152606401610549565b42871161099a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4558504952595f504153534544000000000000000000000000000000000000006044820152606401610549565b6040517f436c61696d28000000000000000000000000000000000000000000000000000060208201527f75696e74323536206e6f6e63652c00000000000000000000000000000000000060268201527f75696e74323536206578706972792c000000000000000000000000000000000060348201527f61646472657373207061727469636970616e742c00000000000000000000000060438201527f75696e743235362073636f72650000000000000000000000000000000000000060578201527f29000000000000000000000000000000000000000000000000000000000000006064820152600090606501604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201209083015281018a90526060810189905273ffffffffffffffffffffffffffffffffffffffff8816608082015260a0810187905260c001604051602081830303815290604052805190602001209050600060017f000000000000000000000000000000000000000000000000000000000000000083604051602001610b739291907f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600084529083018083525260ff891690820152606081018790526080810186905260a0016020604051602081039080840390855afa158015610bef573d6000803e3d6000fd5b5050604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff811660009081526003602052919091205490925060ff1690508015610c595750610c57888b61044c565b155b610c67576000925082610c6d565b60019250825b505050979650505050505050565b610c836117ac565b604d811115610cee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5343414c455f544f4f5f484947480000000000000000000000000000000000006044820152606401610549565b60018190556040518181527fb7f1dd786998967316283c7e129a0bbeaf046b77f2f51afe39bb89a10f29a00e906020016105ca565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610d92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db6919061249a565b9050600084600154600a610dca91906125d3565b610dd491906125df565b90506064818387600254610de891906125f2565b610df291906125f2565b610dfc9190612472565b610e069190612472565b95945050505050565b6040517f436c61696d28000000000000000000000000000000000000000000000000000060208201527f75696e74323536206e6f6e63652c00000000000000000000000000000000000060268201527f75696e74323536206578706972792c000000000000000000000000000000000060348201527f61646472657373207061727469636970616e742c00000000000000000000000060438201527f75696e743235362073636f72650000000000000000000000000000000000000060578201527f2900000000000000000000000000000000000000000000000000000000000000606482015260650161088d565b610f066117ac565b73ffffffffffffffffffffffffffffffffffffffff8116610f83576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f494e56414c49445f4144445245535300000000000000000000000000000000006044820152606401610549565b73ffffffffffffffffffffffffffffffffffffffff811660008181526003602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905590519182527fad6de4452a631e641cb59902236607946ce9272b9b981f2f80e8d129cb9084ba91016105ca565b61100a6117ac565b611014600061182d565b565b60065460009073ffffffffffffffffffffffffffffffffffffffff89811691161461109d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f494e56414c49445f544f4b454e000000000000000000000000000000000000006044820152606401610549565b6110ab8787878787876118a2565b60006110b8868a8c611d0a565b6005546040517f2ee4090800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e8116600483015260248201849052929350911690632ee4090890604401600060405180830381600087803b15801561112e57600080fd5b505af1158015611142573d6000803e3d6000fd5b50506040805173ffffffffffffffffffffffffffffffffffffffff8d168152602081018590529081018990523392508991508a907faaf3e8be924534753bc291b29aca3f9e644a7ece9fd26c95e3390ec71870a892906060015b60405180910390a49a9950505050505050505050565b6111ba6117ac565b73ffffffffffffffffffffffffffffffffffffffff8116611237576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f494e56414c49445f4144445245535300000000000000000000000000000000006044820152606401610549565b6005546006546112629173ffffffffffffffffffffffffffffffffffffffff9182169116600061158e565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8381169182179092556006546106f79216907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61158e565b6112dd6117ac565b60005b828110156113ff5760008484838181106112fc576112fc612609565b9050602002016020810190611311919061223e565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa15801561137d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a1919061249a565b90506113ec83828787868181106113ba576113ba612609565b90506020020160208101906113cf919061223e565b73ffffffffffffffffffffffffffffffffffffffff169190611ded565b50806113f781612638565b9150506112e0565b507f4b713dd63c7c270b811762a754d42e5d79ea1ba9d3a0899d73eab3e38b50cd6f83838360405161143393929190612670565b60405180910390a1505050565b6114486117ac565b73ffffffffffffffffffffffffffffffffffffffff81166114eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610549565b6106f78161182d565b60006115048787878787876118a2565b6000611511868a8c611d0a565b905061153473ffffffffffffffffffffffffffffffffffffffff8a168c83611ded565b6040805173ffffffffffffffffffffffffffffffffffffffff8b16815260208101839052908101879052339088908a907faaf3e8be924534753bc291b29aca3f9e644a7ece9fd26c95e3390ec71870a8929060600161119c565b80158061162e57506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611608573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162c919061249a565b155b6116ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610549565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261178e9084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611e43565b505050565b60606117a28484600085611f4f565b90505b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611014576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610549565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b467f00000000000000000000000000000000000000000000000000000000000000001461192b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f434841494e5f49445f4348414e474544000000000000000000000000000000006044820152606401610549565b428511611994576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4558504952595f504153534544000000000000000000000000000000000000006044820152606401610549565b6040517f436c61696d28000000000000000000000000000000000000000000000000000060208201527f75696e74323536206e6f6e63652c00000000000000000000000000000000000060268201527f75696e74323536206578706972792c000000000000000000000000000000000060348201527f61646472657373207061727469636970616e742c00000000000000000000000060438201527f75696e743235362073636f72650000000000000000000000000000000000000060578201527f29000000000000000000000000000000000000000000000000000000000000006064820152600090606501604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201209083015281018890526060810187905233608082015260a0810186905260c001604051602081830303815290604052805190602001209050600060017f000000000000000000000000000000000000000000000000000000000000000083604051602001611b579291907f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600084529083018083525260ff881690820152606081018690526080810185905260a0016020604051602081039080840390855afa158015611bd3573d6000803e3d6000fd5b5050604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff811660009081526003602052919091205490925060ff169050611c90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f554e415554484f52495a454400000000000000000000000000000000000000006044820152606401610549565b611c9a33896120e5565b611d00576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4e4f4e43455f414c52454144595f5553454400000000000000000000000000006044820152606401610549565b5050505050505050565b6000808411611d75576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f53434f52455f4d5553545f42455f50524f5649444544000000000000000000006044820152606401610549565b6000611d818585610d23565b9050828110156117a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e53554646494349454e545f414d4f554e54000000000000000000000000006044820152606401610549565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261178e9084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161170c565b6000611ea5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166117939092919063ffffffff16565b80519091501561178e5780806020019051810190611ec391906126e8565b61178e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610549565b606082471015611fe1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610549565b73ffffffffffffffffffffffffffffffffffffffff85163b61205f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610549565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612088919061272e565b60006040518083038185875af1925050503d80600081146120c5576040519150601f19603f3d011682016040523d82523d6000602084013e6120ca565b606091505b50915091506120da828286612198565b979650505050505050565b6000806120f461010084612472565b9050600061210461010085612486565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600460209081526040808320868452909152902054909150600181831c8116900361215157600093505050506104ab565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602090815260408083209583529490529290922060019182901b92909217909155905092915050565b606083156121a75750816117a5565b8251156121b75782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610549919061274a565b803573ffffffffffffffffffffffffffffffffffffffff8116811461220f57600080fd5b919050565b6000806040838503121561222757600080fd5b612230836121eb565b946020939093013593505050565b60006020828403121561225057600080fd5b6117a5826121eb565b60006020828403121561226b57600080fd5b5035919050565b803560ff8116811461220f57600080fd5b600080600080600080600060e0888a03121561229e57600080fd5b87359650602088013595506122b5604089016121eb565b9450606088013593506122ca60808901612272565b925060a0880135915060c0880135905092959891949750929550565b600080604083850312156122f957600080fd5b82359150612309602084016121eb565b90509250929050565b60008060008060008060008060006101208a8c03121561233157600080fd5b61233a8a6121eb565b985060208a0135975061234f60408b016121eb565b965060608a0135955060808a0135945060a08a0135935061237260c08b01612272565b925060e08a013591506101008a013590509295985092959850929598565b6000806000604084860312156123a557600080fd5b833567ffffffffffffffff808211156123bd57600080fd5b818601915086601f8301126123d157600080fd5b8135818111156123e057600080fd5b8760208260051b85010111156123f557600080fd5b60209283019550935061240b91860190506121eb565b90509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008261248157612481612414565b500490565b60008261249557612495612414565b500690565b6000602082840312156124ac57600080fd5b5051919050565b600181815b8085111561250c57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156124f2576124f2612443565b808516156124ff57918102915b93841c93908002906124b8565b509250929050565b600082612523575060016104ab565b81612530575060006104ab565b816001811461254657600281146125505761256c565b60019150506104ab565b60ff84111561256157612561612443565b50506001821b6104ab565b5060208310610133831016604e8410600b841016171561258f575081810a6104ab565b61259983836124b3565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156125cb576125cb612443565b029392505050565b60006117a58383612514565b808201808211156104ab576104ab612443565b80820281158282048414176104ab576104ab612443565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361266957612669612443565b5060010190565b6040808252810183905260008460608301825b868110156126be5773ffffffffffffffffffffffffffffffffffffffff6126a9846121eb565b16825260209283019290910190600101612683565b50809250505073ffffffffffffffffffffffffffffffffffffffff83166020830152949350505050565b6000602082840312156126fa57600080fd5b815180151581146117a557600080fd5b60005b8381101561272557818101518382015260200161270d565b50506000910152565b6000825161274081846020870161270a565b9190910192915050565b602081526000825180602084015261276981604085016020870161270a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220e6402463120e977d689af4f58df66aeaccd92330572ac47183da16781ccb901164736f6c63430008110033000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000006400000000000000000000000071070c5607358fc25e3b4aaf4fb0a580c190252a00000000000000000000000004bea9fce76943e90520489ccab84e84c0198e29

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

000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000006400000000000000000000000071070c5607358fc25e3b4aaf4fb0a580c190252a00000000000000000000000004bea9fce76943e90520489ccab84e84c0198e29

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

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000064
Arg [2] : 00000000000000000000000071070c5607358fc25e3b4aaf4fb0a580c190252a
Arg [3] : 00000000000000000000000004bea9fce76943e90520489ccab84e84c0198e29


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