ETH Price: $3,058.20 (+2.55%)
Gas: 1 Gwei

Contract

0x3C9d5Ac3BC21436989bDf54067a2c58AA65e5111
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Withdraw Pool190203452024-01-16 15:27:47172 days ago1705418867IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0024659438.35487272
Withdraw184668772023-10-31 1:34:47249 days ago1698716087IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0037933627.78352719
Withdraw146240242022-04-20 20:22:14808 days ago1650486134IN
0x3C9d5Ac3...AA65e5111
0 ETH0.01396201102.2611325
Withdraw144815442022-03-29 14:09:39830 days ago1648562979IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0064702947.38998851
Withdraw144797022022-03-29 7:16:38830 days ago1648538198IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0036483126.72115227
Withdraw143099672022-03-02 21:12:44857 days ago1646255564IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0090975166.63233775
Withdraw140106602022-01-15 14:48:15903 days ago1642258095IN
0x3C9d5Ac3...AA65e5111
0 ETH0.01542957113.00984852
Withdraw139459712022-01-05 14:23:38913 days ago1641392618IN
0x3C9d5Ac3...AA65e5111
0 ETH0.01195081100.06288375
Withdraw139162252022-01-01 0:11:06918 days ago1640995866IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0097018771.05884429
Withdraw137832362021-12-11 10:09:11938 days ago1639217351IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0054305639.77473251
Withdraw137285662021-12-02 17:11:17947 days ago1638465077IN
0x3C9d5Ac3...AA65e5111
0 ETH0.01731447144.97231593
Withdraw137253312021-12-02 4:41:03947 days ago1638420063IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0125811592.14733779
Withdraw137012452021-11-28 8:07:30951 days ago1638086850IN
0x3C9d5Ac3...AA65e5111
0 ETH0.009421769.00676429
Withdraw136574732021-11-21 9:54:43958 days ago1637488483IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0098602672.21888946
Withdraw135884642021-11-10 12:23:50969 days ago1636547030IN
0x3C9d5Ac3...AA65e5111
0 ETH0.01769345148.14544215
Withdraw135682372021-11-07 8:11:47972 days ago1636272707IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0085287662.46668895
Withdraw135562332021-11-05 11:09:07974 days ago1636110547IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0118507486.79767925
Withdraw135308182021-11-01 11:10:35978 days ago1635765035IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0172208126.12927275
Withdraw135307692021-11-01 10:59:52978 days ago1635764392IN
0x3C9d5Ac3...AA65e5111
0 ETH0.01114198111.41987483
Withdraw135307422021-11-01 10:53:24978 days ago1635764004IN
0x3C9d5Ac3...AA65e5111
0 ETH0.00283405118.08553754
Withdraw135085602021-10-28 23:02:52982 days ago1635462172IN
0x3C9d5Ac3...AA65e5111
0 ETH0.02368314173.46099145
Withdraw134634232021-10-21 21:31:50989 days ago1634851910IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0104834187.77657681
Withdraw134618402021-10-21 15:34:56989 days ago1634830496IN
0x3C9d5Ac3...AA65e5111
0 ETH0.01275027106.75672387
Withdraw134573492021-10-20 22:51:34990 days ago1634770294IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0081102559.40144274
Withdraw134542602021-10-20 11:08:24990 days ago1634728104IN
0x3C9d5Ac3...AA65e5111
0 ETH0.0013305456.3575462
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Staking

Compiler Version
v0.8.3+commit.8d00100c

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 8 : Staking.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

import "./Staking/CappedRewardCalculator.sol";
import "./ClaimsRegistry.sol";

/// @title A staking contract which allows only verified users (by checking a separate contract for a valid signature)
/// @author Miguel Palhas <[email protected]>
contract Staking is CappedRewardCalculator, Ownable {
  /// @notice the token to stake
  ERC20 public immutable erc20;

  /// @notice claim registry where signatures are to be stored and verified
  IClaimsRegistryVerifier public immutable registry;

  /// @notice The expected attester address against which claims will be verified
  ///   (i.e. they must be signed by this address)
  address public immutable claimAttester;

  /// @notice The minimum staking amount per account
  uint public immutable minAmount;

  /// @notice The maximum staking amount per account
  uint public immutable maxAmount;

  /// @notice Locked rewards pending withdrawal
  uint public lockedReward = 0;

  /// @notice Rewards already distributed
  uint public distributedReward = 0;

  /// @notice How much is currently staked
  uint public stakedAmount = 0;

  /// @notice Subscription details for each account
  mapping(address => Subscription) public subscriptions;

  /// @notice Emitted when an account stakes tokens and creates a new subscription
  event Subscribed(
    address subscriber,
    uint date,
    uint stakedAmount,
    uint maxReward
  );

  /// @notice Emitted when an account withdraws an existing stake
  event Withdrawn(
    address subscriber,
    uint date,
    uint withdrawAmount
  );

  /// @notice Details of a particular subscription
  struct Subscription {
    bool active;
    address subscriberAddress; // addres the subscriptions refers to
    uint startDate;      // Block timestamp at which the subscription was made
    uint stakedAmount;   // How much was staked
    uint maxReward;      // Maximum reward given if user stays until the end of the staking period
    uint withdrawAmount; // Total amount withdrawn (initial amount + final calculated reward)
    uint withdrawDate;   // Block timestamp at which the subscription was withdrawn (or 0 while staking is in progress)
  }

  /// @notice Staking constructor
  /// @param _token ERC20 token address to use
  /// @param _registry ClaimsRegistry address to use
  /// @param _attester expected attester of claims when verifying them
  /// @param _startDate timestamp starting at which stakes are allowed. Must be greater than instantiation timestamp
  /// @param _endDate timestamp at which staking is over (no more rewards are given, and new stakes are not allowed)
  /// @param _minAmount minimum staking amount for each account
  /// @param _maxAmount maximum staking amount for each account
  /// @param _cap max % of individual reward for curve period
  constructor(
    address _token,
    address _registry,
    address _attester,
    uint _startDate,
    uint _endDate,
    uint _minAmount,
    uint _maxAmount,
    uint _cap
  ) CappedRewardCalculator(_startDate, _endDate, _cap) {
    require(_token != address(0), "Staking: token address cannot be 0x0");
    require(_registry != address(0), "Staking: claims registry address cannot be 0x0");
    require(_attester != address(0), "Staking: claim attester cannot be 0x0");
    require(block.timestamp <= _startDate, "Staking: start date must be in the future");
    require(_minAmount > 0, "Staking: invalid individual min amount");
    require(_maxAmount > _minAmount, "Staking: max amount must be higher than min amount");

    erc20 = ERC20(_token);
    registry = IClaimsRegistryVerifier(_registry);
    claimAttester = _attester;

    minAmount = _minAmount;
    maxAmount = _maxAmount;
  }

  /// @notice Get the total size of the reward pool
  /// @return Returns the total size of the reward pool, including locked and distributed tokens
  function totalPool() public view returns (uint) {
    return erc20.balanceOf(address(this)) - stakedAmount + distributedReward;
  }

  /// @notice Get the available size of the reward pool
  /// @return Returns the available size of the reward pool, no including locked or distributed rewards
  function availablePool() public view returns (uint) {
    return erc20.balanceOf(address(this)) - stakedAmount - lockedReward;
  }

  /// @notice Requests a new stake to be created. Only one stake per account is
  ///   created, maximum rewards are calculated upfront, and a valid claim
  ///   signature needs to be provided, which will be checked against the expected
  ///   attester on the registry contract
  /// @param _amount Amount of tokens to stake
  /// @param claimSig Signature to check against the registry contract
  function stake(uint _amount, bytes calldata claimSig) external {
    uint time = block.timestamp;
    address subscriber = msg.sender;

    require(registry.verifyClaim(msg.sender, claimAttester, claimSig), "Staking: could not verify claim");
    require(_amount >= minAmount, "Staking: staked amount needs to be greater than or equal to minimum amount");
    require(_amount <= maxAmount, "Staking: staked amount needs to be lower than or equal to maximum amount");
    require(time >= startDate, "Staking: staking period not started");
    require(time < endDate, "Staking: staking period finished");
    require(subscriptions[subscriber].active == false, "Staking: this account has already staked");


    uint maxReward = calculateReward(time, endDate, _amount);
    require(maxReward <= availablePool(), "Staking: not enough tokens available in the pool");
    lockedReward += maxReward;
    stakedAmount += _amount;

    subscriptions[subscriber] = Subscription(
      true,
      subscriber,
      time,
      _amount,
      maxReward,
      0,
      0
    );

    // transfer tokens from subscriber to the contract
    require(erc20.transferFrom(subscriber, address(this), _amount),
      "Staking: Could not transfer tokens from subscriber");

    emit Subscribed(subscriber, time, _amount, maxReward);
  }

  /// @notice Withdrawn the stake belonging to `msg.sender`
  function withdraw() external {
    address subscriber = msg.sender;
    uint time = block.timestamp;

    require(subscriptions[subscriber].active == true, "Staking: no active subscription found for this address");

    Subscription memory sub = subscriptions[subscriber];

    uint actualReward = calculateReward(sub.startDate, time, sub.stakedAmount);
    uint total = sub.stakedAmount + actualReward;

    // update subscription state
    sub.withdrawAmount = total;
    sub.withdrawDate = time;
    sub.active = false;
    subscriptions[subscriber] = sub;

    // update locked amount
    lockedReward -= sub.maxReward;
    distributedReward += actualReward;
    stakedAmount -= sub.stakedAmount;

    // transfer tokens back to subscriber
    require(erc20.transfer(subscriber, total), "Staking: Transfer has failed");

    emit Withdrawn(subscriber, time, total);
  }

  /// @notice returns the initial amount staked by a given account
  /// @param _subscriber The account to check
  /// @return The amount that was staked by the given account
  function getStakedAmount(address _subscriber) external view returns (uint) {
    if (subscriptions[_subscriber].stakedAmount > 0 && subscriptions[_subscriber].withdrawDate == 0) {
      return subscriptions[_subscriber].stakedAmount;
    } else {
      return 0;
    }
  }

  /// @notice Gets the maximum reward for an existing subscription
  /// @param _subscriber address of the subscription to check
  /// @return Maximum amount of tokens the subscriber can get by staying until the end of the staking period
  function getMaxStakeReward(address _subscriber) external view returns (uint) {
    Subscription memory sub = subscriptions[_subscriber];

    if (sub.active) {
      return subscriptions[_subscriber].maxReward;
    } else {
      return 0;
    }
  }

  /// @notice Gets the amount already earned by an existing subscription
  /// @param _subscriber address of the subscription to check
  /// @return Amount the subscriber has earned to date
  function getCurrentReward(address _subscriber) external view returns (uint) {
    Subscription memory sub = subscriptions[_subscriber];

    if (sub.active) {
      return calculateReward(sub.startDate, block.timestamp, sub.stakedAmount);
    } else {
      return 0;
    }
  }

  /// @notice Withdraws all unlocked tokens from the pool to the owner. Only works if staking period has already ended
  function withdrawPool() external onlyOwner {
    require(block.timestamp > endDate, "Staking: staking not over yet");

    erc20.transfer(owner(), availablePool());
  }
}

File 2 of 8 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The defaut value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overloaded;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);

        uint256 currentAllowance = _allowances[sender][_msgSender()];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        _approve(sender, _msgSender(), currentAllowance - amount);

        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        uint256 currentAllowance = _allowances[_msgSender()][spender];
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        _approve(_msgSender(), spender, currentAllowance - subtractedValue);

        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        uint256 senderBalance = _balances[sender];
        require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
        _balances[sender] = senderBalance - amount;
        _balances[recipient] += amount;

        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        _balances[account] = accountBalance - amount;
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}

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

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

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

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

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

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

File 4 of 8 : CappedRewardCalculator.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.3;

/// @title Calculates rewards based on an initial downward curve period, and a second constant period
/// @notice Calculation of the reward is based on a few rules:
///   * start and end date of the staking period (the earlier you enter, and
///     the longer you stay, the greater your overall reward)
///
///   * At each point, the the current reward is described by a downward curve
///     (https://www.desmos.com/calculator/dz8vk1urep)
///
///   * Computing your total reward (which is done upfront in order to lock and
///     guarantee your reward) means computing the integral of the curve period from
///     your enter date until the end
///     (https://www.wolframalpha.com/input/?i=integrate+%28100-x%29%5E2)
///
///   * This integral is the one being calculated in the `integralAtPoint` function
///
///   * Besides this rule, rewards are also capped by a maximum percentage
///     provided at contract instantiation time (a cap of 40 means your maximum
///     possible reward is 40% of your initial stake
///
/// @author Miguel Palhas <[email protected]>
contract CappedRewardCalculator {
  /// @notice start of the staking period
  uint public immutable startDate;
  /// @notice end of the staking period
  uint public immutable endDate;
  /// @notice Reward cap for curve period
  uint public immutable cap;

  uint constant private year = 365 days;
  uint constant private day = 1 days;
  uint private constant mul = 1000000;

  /// @notice constructor
  /// @param _start The start timestamp for staking
  /// @param _start The end timestamp for staking
  /// @param _cap The cap percentage of the reward (40 == maximum of 40% of your initial stake)
  constructor(
    uint _start,
    uint _end,
    uint _cap
  ) {
    require(block.timestamp <= _start, "CappedRewardCalculator: start date must be in the future");
    require(
      _start < _end,
      "CappedRewardCalculator: end date must be after start date"
    );

    require(_cap > 0, "CappedRewardCalculator: curve cap cannot be 0");

    startDate = _start;
    endDate = _end;
    cap = _cap;
  }

  /// @notice Given a timestamp range and an amount, calculates the expected nominal return
  /// @param _start The start timestamp to consider
  /// @param _end The end timestamp to consider
  /// @param _amount The amount to stake
  /// @return The nominal amount of the reward
  function calculateReward(
    uint _start,
    uint _end,
    uint _amount
  ) public view returns (uint) {
    (uint start, uint end) = truncatePeriod(_start, _end);
    (uint startPercent, uint endPercent) = toPeriodPercents(start, end);

    uint percentage = curvePercentage(startPercent, endPercent);

    uint reward = _amount * cap * percentage / (mul * 100);

    return reward;
  }

  /// @notice Estimates the current offered APY
  /// @return The estimated APY (40 == 40%)
  function currentAPY() public view returns (uint) {
    uint amount = 100 ether;
    uint today = block.timestamp;

    if (today < startDate) {
      today = startDate;
    }

    uint todayReward = calculateReward(startDate, today, amount);

    uint tomorrow = today + day;
    uint tomorrowReward = calculateReward(startDate, tomorrow, amount);

    uint delta = tomorrowReward - todayReward;
    uint apy = delta * 365 * 100 / amount;

    return apy;
  }

  function toPeriodPercents(
    uint _start,
    uint _end
  ) internal view returns (uint, uint) {
    uint totalDuration = endDate - startDate;

    if (totalDuration == 0) {
      return (0, mul);
    }

    uint startPercent = (_start - startDate) * mul / totalDuration;
    uint endPercent = (_end - startDate) * mul / totalDuration;

    return (startPercent, endPercent);
  }

  function truncatePeriod(
    uint _start,
    uint _end
  ) internal view returns (uint, uint) {
    if (_end <= startDate || _start >= endDate) {
      return (startDate, startDate);
    }

    uint start = _start < startDate ? startDate : _start;
    uint end = _end > endDate ? endDate : _end;

    return (start, end);
  }

  function curvePercentage(uint _start, uint _end) internal pure returns (uint) {
    int maxArea = integralAtPoint(mul) - integralAtPoint(0);
    int actualArea = integralAtPoint(_end) - integralAtPoint(_start);

    uint ratio = uint(actualArea * int(mul) / maxArea);

    return ratio;
  }


  function integralAtPoint(uint _x) internal pure returns (int) {
    int x = int(_x);
    int p1 = ((x - int(mul)) ** 3) / (3 * int(mul));

    return p1;
  }
}

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

pragma solidity ^0.8.3;

import "./ClaimsRegistry/Verifier.sol";

/// @title The claim verification interface expected by the Staking contract
/// @author Miguel Palhas <[email protected]>
interface IClaimsRegistryVerifier {
  /// @notice Verifies that the given `sig` corresponds to a claim about `subject`, signed by `attester`
  /// @param subject The subject the claim refers to
  /// @param attester The account that is expected to have signed the claim
  /// @param sig The signature
  /// @return Whether a claim about `subject` and signed by `attester` does exist and matches `sig`
  function verifyClaim(address subject, address attester, bytes calldata sig) external view returns (bool);
}

/// @title A claim registry. Does not actually store data, but only signatures of claims and their subjects
/// @author Miguel Palhas <[email protected]>
contract ClaimsRegistry is IClaimsRegistryVerifier, Verifier {
  /// @notice The mapping of keys to claims
  mapping(bytes32 => Claim) public registry;

  /// @notice Struct containing all public data about a claim (currently only the subject)
  struct Claim {
    address subject; // Subject the claim refers to
    bool revoked;    // Whether the claim is revoked or not
  }

  /// @notice Emitted when a signed claim is successfuly stored
  event ClaimStored(
    bytes sig
  );

  /// @notice Emitted when a previously stored claim is successfuly revoked by the attester
  event ClaimRevoked(
    bytes sig
  );

  /// @notice Stores a claim about `subject`, signed by `attester`. Instead of
  ///   actual data, receives only `claimHash` and `sig`, and checks whether the
  ///   signature matches the expected key, and is signed by `attester`
  /// @param subject Account the claim refers to
  /// @param attester Account that signed the claim
  /// @param claimHash the claimHash that was signed along with the subject
  /// @param sig The given signature that must match (`subject`, `claimhash`)
  function setClaimWithSignature(
    address subject,
    address attester,
    bytes32 claimHash,
    bytes calldata sig
  ) public {
    bytes32 signable = computeSignableKey(subject, claimHash);

    require(verifyWithPrefix(signable, sig, attester), "ClaimsRegistry: Claim signature does not match attester");

    bytes32 key = computeKey(attester, sig);

    registry[key] = Claim(subject, false);

    emit ClaimStored(sig);
  }

  /// @notice Checks if a claim signature is valid and stored, and returns the corresponding subject
  /// @param attester Account that signed the claim
  /// @param sig The given signature that must match keccak256([`subject`, `claimhash`])
  /// @return The subject of the claim, or address(0) if none was found
  function getClaim(
    address attester,
    bytes calldata sig
  ) public view returns (address) {
    bytes32 key = keccak256(abi.encodePacked(attester, sig));

    if (registry[key].revoked) {
      return address(0);
    } else {
      return registry[key].subject;
    }

  }

  /// @notice Checks if a claim signature is valid, and corresponds to the given subject
  /// @param subject Account the claim refers to
  /// @param attester Account that signed the claim
  /// @param sig The given signature that must match keccak256([`subject`, `claimhash`])
  /// @return The subject of the claim, or address(0) if none was found
  function verifyClaim(
    address subject,
    address attester,
    bytes calldata sig
  ) override external view returns (bool) {
    return getClaim(attester, sig) == subject;
  }

  /// @notice Callable by an attester, to revoke previously signed claims about a subject
  /// @param sig The given signature that must match keccak256([`subject`, `claimhash`])
  function revokeClaim(
    bytes calldata sig
  ) public {
    bytes32 key = computeKey(msg.sender, sig);

    require(registry[key].subject != address(0), "ClaimsRegistry: Claim not found");

    registry[key].revoked = true;

    emit ClaimRevoked(sig);
  }

  /// @notice computes the hash that must be signed by the attester before storing a claim
  /// @param subject Account the claim refers to
  /// @param claimHash the claimHash that was signed along with the subject
  /// @return The hash to be signed by the attester
  function computeSignableKey(address subject, bytes32 claimHash) public pure returns (bytes32) {
    return keccak256(abi.encodePacked(subject, claimHash));
  }

  function computeKey(address attester, bytes calldata sig) internal pure returns (bytes32) {
    return keccak256(abi.encodePacked(attester, sig));
  }
}

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

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 7 of 8 : Context.sol
// SPDX-License-Identifier: MIT

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) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

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

pragma solidity ^0.8.3;

/// @title A set of helper functions to verify signatures, to be used in the ClaimsRegistry
/// @author Miguel Palhas <[email protected]>
contract Verifier {

  /// @notice Verifies that the given signature matches the provided data, and
  ///   was signed by the provided issuer. Assumes data was signed using the
  ///   Ethereum prefix to protect against unkonwingly signing transactions
  /// @param hash The data to verify
  /// @param sig The signature of the data
  /// @param signer The expected signer of the data
  /// @return `true` if `signer` and `hash` match `sig`
  function verifyWithPrefix(bytes32 hash, bytes calldata sig, address signer) public pure returns (bool) {
    return verify(addPrefix(hash), sig, signer);
  }

  /// @notice Recovers the signer of the given signature and data. Assumes data
  ///  was signed using the Ethereum prefix to protect against unknowingly signing
  ///  transaction.s
  /// @param hash The data to verify
  /// @param sig The signature of the data
  /// @return The address recovered by checking the signature against the data
  function recoverWithPrefix(bytes32 hash, bytes calldata sig) public pure returns (address) {
    return recover(addPrefix(hash), sig);
  }

  function verify(bytes32 hash, bytes calldata sig, address signer) internal pure returns (bool) {
    return recover(hash, sig) == signer;
  }

  function recover(bytes32 hash, bytes calldata _sig) internal pure returns (address) {
    bytes memory sig = _sig;
    bytes32 r;
    bytes32 s;
    uint8 v;

    if (sig.length != 65) {
      return address(0);
    }

    assembly {
      r := mload(add(sig, 32))
      s := mload(add(sig, 64))
      v := and(mload(add(sig, 65)), 255)
    }

    if (v < 27) {
      v += 27;
    }

    if (v != 27 && v != 28) {
      return address(0);
    }

    return ecrecover(hash, v, r, s);
  }

  function addPrefix(bytes32 hash) private pure returns (bytes32) {
    bytes memory prefix = "\x19Ethereum Signed Message:\n32";

    return keccak256(abi.encodePacked(prefix, hash));
  }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_registry","type":"address"},{"internalType":"address","name":"_attester","type":"address"},{"internalType":"uint256","name":"_startDate","type":"uint256"},{"internalType":"uint256","name":"_endDate","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"},{"internalType":"uint256","name":"_cap","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"subscriber","type":"address"},{"indexed":false,"internalType":"uint256","name":"date","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxReward","type":"uint256"}],"name":"Subscribed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"subscriber","type":"address"},{"indexed":false,"internalType":"uint256","name":"date","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"withdrawAmount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"availablePool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"calculateReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimAttester","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentAPY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributedReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc20","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subscriber","type":"address"}],"name":"getCurrentReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subscriber","type":"address"}],"name":"getMaxStakeReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_subscriber","type":"address"}],"name":"getStakedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockedReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract IClaimsRegistryVerifier","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"claimSig","type":"bytes"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"subscriptions","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"address","name":"subscriberAddress","type":"address"},{"internalType":"uint256","name":"startDate","type":"uint256"},{"internalType":"uint256","name":"stakedAmount","type":"uint256"},{"internalType":"uint256","name":"maxReward","type":"uint256"},{"internalType":"uint256","name":"withdrawAmount","type":"uint256"},{"internalType":"uint256","name":"withdrawDate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPool","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawPool","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101806040526000600155600060025560006003553480156200002157600080fd5b5060405162002505380380620025058339810160408190526200004491620004b1565b84848282421115620000c35760405162461bcd60e51b815260206004820152603860248201527f43617070656452657761726443616c63756c61746f723a20737461727420646160448201527f7465206d75737420626520696e2074686520667574757265000000000000000060648201526084015b60405180910390fd5b8183106200013a5760405162461bcd60e51b815260206004820152603960248201527f43617070656452657761726443616c63756c61746f723a20656e64206461746560448201527f206d7573742062652061667465722073746172742064617465000000000000006064820152608401620000ba565b60008111620001a25760405162461bcd60e51b815260206004820152602d60248201527f43617070656452657761726443616c63756c61746f723a20637572766520636160448201526c0702063616e6e6f74206265203609c1b6064820152608401620000ba565b60809290925260a05260c052600080546001600160a01b031916339081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001600160a01b038816620002535760405162461bcd60e51b8152602060048201526024808201527f5374616b696e673a20746f6b656e20616464726573732063616e6e6f742062656044820152630203078360e41b6064820152608401620000ba565b6001600160a01b038716620002c25760405162461bcd60e51b815260206004820152602e60248201527f5374616b696e673a20636c61696d73207265676973747279206164647265737360448201526d02063616e6e6f74206265203078360941b6064820152608401620000ba565b6001600160a01b038616620003285760405162461bcd60e51b815260206004820152602560248201527f5374616b696e673a20636c61696d2061747465737465722063616e6e6f742062604482015264065203078360dc1b6064820152608401620000ba565b844211156200038c5760405162461bcd60e51b815260206004820152602960248201527f5374616b696e673a2073746172742064617465206d75737420626520696e207460448201526868652066757475726560b81b6064820152608401620000ba565b60008311620003ed5760405162461bcd60e51b815260206004820152602660248201527f5374616b696e673a20696e76616c696420696e646976696475616c206d696e20604482015265185b5bdd5b9d60d21b6064820152608401620000ba565b828211620004595760405162461bcd60e51b815260206004820152603260248201527f5374616b696e673a206d617820616d6f756e74206d7573742062652068696768604482015271195c881d1a185b881b5a5b88185b5bdd5b9d60721b6064820152608401620000ba565b506001600160601b0319606097881b811660e05295871b8616610100529390951b90931661012052506101409290925250610160526200052b565b80516001600160a01b0381168114620004ac57600080fd5b919050565b600080600080600080600080610100898b031215620004ce578384fd5b620004d98962000494565b9750620004e960208a0162000494565b9650620004f960408a0162000494565b9550606089015194506080890151935060a0890151925060c0890151915060e089015190509295985092959890939650565b60805160a05160c05160e05160601c6101005160601c6101205160601c6101405161016051611ea062000665600039600081816102bc015261065f01526000818161035201526105a301526000818161024701526104d401526000818161031201526104a50152600081816102eb01528181610a8901528181610ca101528181610f8e0152818161127801526115c50152600081816102170152611556015260008181610395015281816107b1015281816108b501528181611209015281816117c0015281816118690152818161189601526118ef0152600081816101ad0152818161071b015281816114180152818161144101528181611468015281816114a801528181611796015281816117eb0152818161181601528181611843015281816118ce01528181611936015261197d0152611ea06000f3fe608060405234801561001057600080fd5b50600436106101a35760003560e01c8063715018a6116100ee5780639edf8c8411610097578063d22c2a6811610071578063d22c2a68146103b7578063ecfb49a3146103c0578063f046395a146103c8578063f2fde38b1461045e576101a3565b80639edf8c8414610374578063a8e62b971461037d578063c24a0f8b14610390576101a3565b80638da5cb5b116100c85780638da5cb5b146103345780639a79d32b146103455780639b2cb5d81461034d576101a3565b8063715018a6146102de578063785e9e86146102e65780637b1039991461030d576101a3565b80633759f975116101505780634da6a5561161012a5780634da6a5561461029c5780635c42c733146102af5780635f48f393146102b7576101a3565b80633759f975146102425780633ccfd60b146102815780634d307e3f14610289576101a3565b80632af674dd116101815780632af674dd1461020a578063355274ea14610212578063373d613214610239576101a3565b80630b97bc86146101a85780630e89439b146101e257806319163374146101f7575b600080fd5b6101cf7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6101f56101f0366004611ad0565b610471565b005b6101cf610205366004611a6a565b610bd2565b6101cf610c79565b6101cf7f000000000000000000000000000000000000000000000000000000000000000081565b6101cf60035481565b6102697f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101d9565b6101f5610d34565b6101cf610297366004611a6a565b6110a7565b6101cf6102aa366004611a6a565b61113b565b6101f56111ad565b6101cf7f000000000000000000000000000000000000000000000000000000000000000081565b6101f5611358565b6102697f000000000000000000000000000000000000000000000000000000000000000081565b6102697f000000000000000000000000000000000000000000000000000000000000000081565b6000546001600160a01b0316610269565b6101cf611409565b6101cf7f000000000000000000000000000000000000000000000000000000000000000081565b6101cf60025481565b6101cf61038b366004611b47565b61150e565b6101cf7f000000000000000000000000000000000000000000000000000000000000000081565b6101cf60015481565b6101cf61159d565b61041f6103d6366004611a6a565b600460208190526000918252604090912080546001820154600283015460038401549484015460059094015460ff8416956101009094046001600160a01b031694929391929087565b6040805197151588526001600160a01b039096166020880152948601939093526060850191909152608084015260a083015260c082015260e0016101d9565b6101f561046c366004611a6a565b611653565b6040517fdbaf7984000000000000000000000000000000000000000000000000000000008152429033906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063dbaf7984906105009084907f00000000000000000000000000000000000000000000000000000000000000009089908990600401611b72565b60206040518083038186803b15801561051857600080fd5b505afa15801561052c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105509190611a98565b6105a15760405162461bcd60e51b815260206004820152601f60248201527f5374616b696e673a20636f756c64206e6f742076657269667920636c61696d0060448201526064015b60405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000085101561065d5760405162461bcd60e51b815260206004820152604a60248201527f5374616b696e673a207374616b656420616d6f756e74206e6565647320746f2060448201527f62652067726561746572207468616e206f7220657175616c20746f206d696e6960648201527f6d756d20616d6f756e7400000000000000000000000000000000000000000000608482015260a401610598565b7f00000000000000000000000000000000000000000000000000000000000000008511156107195760405162461bcd60e51b815260206004820152604860248201527f5374616b696e673a207374616b656420616d6f756e74206e6565647320746f2060448201527f6265206c6f776572207468616e206f7220657175616c20746f206d6178696d7560648201527f6d20616d6f756e74000000000000000000000000000000000000000000000000608482015260a401610598565b7f00000000000000000000000000000000000000000000000000000000000000008210156107af5760405162461bcd60e51b815260206004820152602360248201527f5374616b696e673a207374616b696e6720706572696f64206e6f74207374617260448201527f74656400000000000000000000000000000000000000000000000000000000006064820152608401610598565b7f0000000000000000000000000000000000000000000000000000000000000000821061081e5760405162461bcd60e51b815260206004820181905260248201527f5374616b696e673a207374616b696e6720706572696f642066696e69736865646044820152606401610598565b6001600160a01b03811660009081526004602052604090205460ff16156108ad5760405162461bcd60e51b815260206004820152602860248201527f5374616b696e673a2074686973206163636f756e742068617320616c7265616460448201527f79207374616b65640000000000000000000000000000000000000000000000006064820152608401610598565b60006108da837f00000000000000000000000000000000000000000000000000000000000000008861150e565b90506108e4610c79565b8111156109595760405162461bcd60e51b815260206004820152603060248201527f5374616b696e673a206e6f7420656e6f75676820746f6b656e7320617661696c60448201527f61626c6520696e2074686520706f6f6c000000000000000000000000000000006064820152608401610598565b806001600082825461096b9190611bbc565b9250508190555085600360008282546109849190611bbc565b90915550506040805160e08101825260018082526001600160a01b0385811660208085018281528587018a8152606087018e8152608088018a8152600060a08a0181815260c08b01828152888352600497889052918c90209a518b54965174ffffffffffffffffffffffffffffffffffffffffff1990971690151574ffffffffffffffffffffffffffffffffffffffff00191617610100968a1696909602959095178a55925197890197909755516002880155945160038701555185820155925160059094019390935592517f23b872dd00000000000000000000000000000000000000000000000000000000815290810191909152306024820152604481018890527f0000000000000000000000000000000000000000000000000000000000000000909116906323b872dd90606401602060405180830381600087803b158015610acf57600080fd5b505af1158015610ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b079190611a98565b610b795760405162461bcd60e51b815260206004820152603260248201527f5374616b696e673a20436f756c64206e6f74207472616e7366657220746f6b6560448201527f6e732066726f6d207375627363726962657200000000000000000000000000006064820152608401610598565b604080516001600160a01b038416815260208101859052908101879052606081018290527f5ad333a6d56a7ddb1e78d9ecb8047e9dafcb890a41a227ede8d950259a1f0f759060800160405180910390a1505050505050565b6001600160a01b038082166000908152600460208181526040808420815160e081018352815460ff811615801583526101009091049097169381019390935260018101549183019190915260028101546060830152600381015460808301529182015460a082015260059091015460c08201529091610c6e5750506001600160a01b038116600090815260046020526040902060030154610c74565b60009150505b919050565b6001546003546040516370a0823160e01b815230600482015260009291906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b158015610ce357600080fd5b505afa158015610cf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1b9190611ab8565b610d259190611e27565b610d2f9190611e27565b905090565b33600081815260046020526040902054429060ff161515600114610dc05760405162461bcd60e51b815260206004820152603660248201527f5374616b696e673a206e6f2061637469766520737562736372697074696f6e2060448201527f666f756e6420666f7220746869732061646472657373000000000000000000006064820152608401610598565b6001600160a01b038083166000908152600460208181526040808420815160e081018352815460ff8116151582526101009004909616928601929092526001820154908501819052600282015460608601819052600383015460808701529282015460a086015260059091015460c0850152610e3d91859061150e565b90506000818360600151610e519190611bbc565b60a0840181815260c0850186815260008087526001600160a01b0389811682526004602081815260408085208b518154938d015174ffffffffffffffffffffffffffffffffffffffffff1990941690151574ffffffffffffffffffffffffffffffffffffffff0019161761010093909516929092029390931781559189015160018084019190915560608a0151600284015560808a015160038401819055955191830191909155925160059091015581549394509192909190610f15908490611e27565b925050819055508160026000828254610f2e9190611bbc565b9091555050606083015160038054600090610f4a908490611e27565b90915550506040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb90604401602060405180830381600087803b158015610fd257600080fd5b505af1158015610fe6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100a9190611a98565b6110565760405162461bcd60e51b815260206004820152601c60248201527f5374616b696e673a205472616e7366657220686173206661696c6564000000006044820152606401610598565b604080516001600160a01b0387168152602081018690529081018290527f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc69060600160405180910390a15050505050565b6001600160a01b038082166000908152600460208181526040808420815160e081018352815460ff811615801583526101009091049097169381019390935260018101549183019190915260028101546060830152600381015460808301529182015460a082015260059091015460c08201529091610c6e57611133816040015142836060015161150e565b915050610c74565b6001600160a01b0381166000908152600460205260408120600201541580159061117e57506001600160a01b038216600090815260046020526040902060050154155b156111a557506001600160a01b038116600090815260046020526040902060020154610c74565b506000610c74565b6000546001600160a01b031633146112075760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610598565b7f000000000000000000000000000000000000000000000000000000000000000042116112765760405162461bcd60e51b815260206004820152601d60248201527f5374616b696e673a207374616b696e67206e6f74206f766572207965740000006044820152606401610598565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb6112b76000546001600160a01b031690565b6112bf610c79565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561131d57600080fd5b505af1158015611331573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113559190611a98565b50565b6000546001600160a01b031633146113b25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610598565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600068056bc75e2d63100000427f000000000000000000000000000000000000000000000000000000000000000081101561146157507f00000000000000000000000000000000000000000000000000000000000000005b600061148e7f0000000000000000000000000000000000000000000000000000000000000000838561150e565b9050600061149f6201518084611bbc565b905060006114ce7f0000000000000000000000000000000000000000000000000000000000000000838761150e565b905060006114dc8483611e27565b90506000866114ed8361016d611dc9565b6114f8906064611dc9565b6115029190611c02565b97505050505050505090565b600080600061151d8686611791565b9150915060008061152e84846118c5565b91509150600061153e83836119c4565b90506000611550620f42406064611dc9565b8261157b7f00000000000000000000000000000000000000000000000000000000000000008b611dc9565b6115859190611dc9565b61158f9190611c02565b9a9950505050505050505050565b6002546003546040516370a0823160e01b815230600482015260009291906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b15801561160757600080fd5b505afa15801561161b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163f9190611ab8565b6116499190611e27565b610d2f9190611bbc565b6000546001600160a01b031633146116ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610598565b6001600160a01b0381166117295760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610598565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000807f0000000000000000000000000000000000000000000000000000000000000000831115806117e357507f00000000000000000000000000000000000000000000000000000000000000008410155b1561181257507f00000000000000000000000000000000000000000000000000000000000000009050806118be565b60007f000000000000000000000000000000000000000000000000000000000000000085106118415784611863565b7f00000000000000000000000000000000000000000000000000000000000000005b905060007f0000000000000000000000000000000000000000000000000000000000000000851161189457846118b6565b7f00000000000000000000000000000000000000000000000000000000000000005b919350909150505b9250929050565b600080806119137f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611e27565b90508061192a576000620f424092509250506118be565b600081620f424061195b7f000000000000000000000000000000000000000000000000000000000000000089611e27565b6119659190611dc9565b61196f9190611c02565b9050600082620f42406119a27f000000000000000000000000000000000000000000000000000000000000000089611e27565b6119ac9190611dc9565b6119b69190611c02565b919791965090945050505050565b6000806119d16000611a2d565b6119dd620f4240611a2d565b6119e79190611de8565b905060006119f485611a2d565b6119fd85611a2d565b611a079190611de8565b9050600082611a19620f424084611d46565b611a239190611bd4565b9695505050505050565b60008181611a3f620f42406003611d46565b6003611a4e620f424085611de8565b611a589190611d2a565b611a629190611bd4565b949350505050565b600060208284031215611a7b578081fd5b81356001600160a01b0381168114611a91578182fd5b9392505050565b600060208284031215611aa9578081fd5b81518015158114611a91578182fd5b600060208284031215611ac9578081fd5b5051919050565b600080600060408486031215611ae4578182fd5b83359250602084013567ffffffffffffffff80821115611b02578384fd5b818601915086601f830112611b15578384fd5b813581811115611b23578485fd5b876020828501011115611b34578485fd5b6020830194508093505050509250925092565b600080600060608486031215611b5b578283fd5b505081359360208301359350604090920135919050565b60006001600160a01b0380871683528086166020840152506060604083015282606083015282846080840137818301608090810191909152601f909201601f191601019392505050565b60008219821115611bcf57611bcf611e3e565b500190565b600082611be357611be3611e54565b600160ff1b821460001984141615611bfd57611bfd611e3e565b500590565b600082611c1157611c11611e54565b500490565b80825b6001808611611c285750611c53565b818704821115611c3a57611c3a611e3e565b80861615611c4757918102915b9490941c938002611c19565b94509492505050565b6000828015611c725760018114611c7c57611c85565b6001915050611a62565b82915050611a62565b5081611c9357506000611a62565b50600160008213808214611cac578015611cc357611cd5565b828604831115611cbe57611cbe611e3e565b611cd5565b828605831215611cd557611cd5611e3e565b5080831615611ce15750805b611cf2858460011c84850284611c16565b8087048211600083131615611d0957611d09611e3e565b8086058212600083121615611d2057611d20611e3e565b0295945050505050565b6000611a916001600160ff1b03600160ff1b60ff861685611c5c565b60006001600160ff1b0381841382841385830485118282161615611d6c57611d6c611e3e565b600160ff1b84871286820588128184161615611d8a57611d8a611e3e565b858712925087820587128484161615611da557611da5611e3e565b87850587128184161615611dbb57611dbb611e3e565b505050929093029392505050565b6000816000190483118215151615611de357611de3611e3e565b500290565b600080831283600160ff1b01831281151615611e0657611e06611e3e565b836001600160ff1b03018313811615611e2157611e21611e3e565b50500390565b600082821015611e3957611e39611e3e565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fdfea2646970667358221220a608fe17ad014b675fd16d235d747ccdf1f96499344e0788469b5c8903cdb4bb64736f6c63430008030033000000000000000000000000f4d861575ecc9493420a3f5a14f85b13f0b50eb30000000000000000000000001a5fa65e50d503a29ec57cd102f2e7970a6963bb000000000000000000000000a3015543ce7da7b9708076c1171e242c36452f1000000000000000000000000000000000000000000000000000000000609bca480000000000000000000000000000000000000000000000000000000060d329480000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000043c33c19375648000000000000000000000000000000000000000000000000000000000000000000028

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101a35760003560e01c8063715018a6116100ee5780639edf8c8411610097578063d22c2a6811610071578063d22c2a68146103b7578063ecfb49a3146103c0578063f046395a146103c8578063f2fde38b1461045e576101a3565b80639edf8c8414610374578063a8e62b971461037d578063c24a0f8b14610390576101a3565b80638da5cb5b116100c85780638da5cb5b146103345780639a79d32b146103455780639b2cb5d81461034d576101a3565b8063715018a6146102de578063785e9e86146102e65780637b1039991461030d576101a3565b80633759f975116101505780634da6a5561161012a5780634da6a5561461029c5780635c42c733146102af5780635f48f393146102b7576101a3565b80633759f975146102425780633ccfd60b146102815780634d307e3f14610289576101a3565b80632af674dd116101815780632af674dd1461020a578063355274ea14610212578063373d613214610239576101a3565b80630b97bc86146101a85780630e89439b146101e257806319163374146101f7575b600080fd5b6101cf7f00000000000000000000000000000000000000000000000000000000609bca4881565b6040519081526020015b60405180910390f35b6101f56101f0366004611ad0565b610471565b005b6101cf610205366004611a6a565b610bd2565b6101cf610c79565b6101cf7f000000000000000000000000000000000000000000000000000000000000002881565b6101cf60035481565b6102697f000000000000000000000000a3015543ce7da7b9708076c1171e242c36452f1081565b6040516001600160a01b0390911681526020016101d9565b6101f5610d34565b6101cf610297366004611a6a565b6110a7565b6101cf6102aa366004611a6a565b61113b565b6101f56111ad565b6101cf7f00000000000000000000000000000000000000000000043c33c193756480000081565b6101f5611358565b6102697f000000000000000000000000f4d861575ecc9493420a3f5a14f85b13f0b50eb381565b6102697f0000000000000000000000001a5fa65e50d503a29ec57cd102f2e7970a6963bb81565b6000546001600160a01b0316610269565b6101cf611409565b6101cf7f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b6101cf60025481565b6101cf61038b366004611b47565b61150e565b6101cf7f0000000000000000000000000000000000000000000000000000000060d3294881565b6101cf60015481565b6101cf61159d565b61041f6103d6366004611a6a565b600460208190526000918252604090912080546001820154600283015460038401549484015460059094015460ff8416956101009094046001600160a01b031694929391929087565b6040805197151588526001600160a01b039096166020880152948601939093526060850191909152608084015260a083015260c082015260e0016101d9565b6101f561046c366004611a6a565b611653565b6040517fdbaf7984000000000000000000000000000000000000000000000000000000008152429033906001600160a01b037f0000000000000000000000001a5fa65e50d503a29ec57cd102f2e7970a6963bb169063dbaf7984906105009084907f000000000000000000000000a3015543ce7da7b9708076c1171e242c36452f109089908990600401611b72565b60206040518083038186803b15801561051857600080fd5b505afa15801561052c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105509190611a98565b6105a15760405162461bcd60e51b815260206004820152601f60248201527f5374616b696e673a20636f756c64206e6f742076657269667920636c61696d0060448201526064015b60405180910390fd5b7f0000000000000000000000000000000000000000000000000de0b6b3a764000085101561065d5760405162461bcd60e51b815260206004820152604a60248201527f5374616b696e673a207374616b656420616d6f756e74206e6565647320746f2060448201527f62652067726561746572207468616e206f7220657175616c20746f206d696e6960648201527f6d756d20616d6f756e7400000000000000000000000000000000000000000000608482015260a401610598565b7f00000000000000000000000000000000000000000000043c33c19375648000008511156107195760405162461bcd60e51b815260206004820152604860248201527f5374616b696e673a207374616b656420616d6f756e74206e6565647320746f2060448201527f6265206c6f776572207468616e206f7220657175616c20746f206d6178696d7560648201527f6d20616d6f756e74000000000000000000000000000000000000000000000000608482015260a401610598565b7f00000000000000000000000000000000000000000000000000000000609bca488210156107af5760405162461bcd60e51b815260206004820152602360248201527f5374616b696e673a207374616b696e6720706572696f64206e6f74207374617260448201527f74656400000000000000000000000000000000000000000000000000000000006064820152608401610598565b7f0000000000000000000000000000000000000000000000000000000060d32948821061081e5760405162461bcd60e51b815260206004820181905260248201527f5374616b696e673a207374616b696e6720706572696f642066696e69736865646044820152606401610598565b6001600160a01b03811660009081526004602052604090205460ff16156108ad5760405162461bcd60e51b815260206004820152602860248201527f5374616b696e673a2074686973206163636f756e742068617320616c7265616460448201527f79207374616b65640000000000000000000000000000000000000000000000006064820152608401610598565b60006108da837f0000000000000000000000000000000000000000000000000000000060d329488861150e565b90506108e4610c79565b8111156109595760405162461bcd60e51b815260206004820152603060248201527f5374616b696e673a206e6f7420656e6f75676820746f6b656e7320617661696c60448201527f61626c6520696e2074686520706f6f6c000000000000000000000000000000006064820152608401610598565b806001600082825461096b9190611bbc565b9250508190555085600360008282546109849190611bbc565b90915550506040805160e08101825260018082526001600160a01b0385811660208085018281528587018a8152606087018e8152608088018a8152600060a08a0181815260c08b01828152888352600497889052918c90209a518b54965174ffffffffffffffffffffffffffffffffffffffffff1990971690151574ffffffffffffffffffffffffffffffffffffffff00191617610100968a1696909602959095178a55925197890197909755516002880155945160038701555185820155925160059094019390935592517f23b872dd00000000000000000000000000000000000000000000000000000000815290810191909152306024820152604481018890527f000000000000000000000000f4d861575ecc9493420a3f5a14f85b13f0b50eb3909116906323b872dd90606401602060405180830381600087803b158015610acf57600080fd5b505af1158015610ae3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b079190611a98565b610b795760405162461bcd60e51b815260206004820152603260248201527f5374616b696e673a20436f756c64206e6f74207472616e7366657220746f6b6560448201527f6e732066726f6d207375627363726962657200000000000000000000000000006064820152608401610598565b604080516001600160a01b038416815260208101859052908101879052606081018290527f5ad333a6d56a7ddb1e78d9ecb8047e9dafcb890a41a227ede8d950259a1f0f759060800160405180910390a1505050505050565b6001600160a01b038082166000908152600460208181526040808420815160e081018352815460ff811615801583526101009091049097169381019390935260018101549183019190915260028101546060830152600381015460808301529182015460a082015260059091015460c08201529091610c6e5750506001600160a01b038116600090815260046020526040902060030154610c74565b60009150505b919050565b6001546003546040516370a0823160e01b815230600482015260009291906001600160a01b037f000000000000000000000000f4d861575ecc9493420a3f5a14f85b13f0b50eb316906370a082319060240160206040518083038186803b158015610ce357600080fd5b505afa158015610cf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1b9190611ab8565b610d259190611e27565b610d2f9190611e27565b905090565b33600081815260046020526040902054429060ff161515600114610dc05760405162461bcd60e51b815260206004820152603660248201527f5374616b696e673a206e6f2061637469766520737562736372697074696f6e2060448201527f666f756e6420666f7220746869732061646472657373000000000000000000006064820152608401610598565b6001600160a01b038083166000908152600460208181526040808420815160e081018352815460ff8116151582526101009004909616928601929092526001820154908501819052600282015460608601819052600383015460808701529282015460a086015260059091015460c0850152610e3d91859061150e565b90506000818360600151610e519190611bbc565b60a0840181815260c0850186815260008087526001600160a01b0389811682526004602081815260408085208b518154938d015174ffffffffffffffffffffffffffffffffffffffffff1990941690151574ffffffffffffffffffffffffffffffffffffffff0019161761010093909516929092029390931781559189015160018084019190915560608a0151600284015560808a015160038401819055955191830191909155925160059091015581549394509192909190610f15908490611e27565b925050819055508160026000828254610f2e9190611bbc565b9091555050606083015160038054600090610f4a908490611e27565b90915550506040517fa9059cbb0000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152602482018390527f000000000000000000000000f4d861575ecc9493420a3f5a14f85b13f0b50eb3169063a9059cbb90604401602060405180830381600087803b158015610fd257600080fd5b505af1158015610fe6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061100a9190611a98565b6110565760405162461bcd60e51b815260206004820152601c60248201527f5374616b696e673a205472616e7366657220686173206661696c6564000000006044820152606401610598565b604080516001600160a01b0387168152602081018690529081018290527f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc69060600160405180910390a15050505050565b6001600160a01b038082166000908152600460208181526040808420815160e081018352815460ff811615801583526101009091049097169381019390935260018101549183019190915260028101546060830152600381015460808301529182015460a082015260059091015460c08201529091610c6e57611133816040015142836060015161150e565b915050610c74565b6001600160a01b0381166000908152600460205260408120600201541580159061117e57506001600160a01b038216600090815260046020526040902060050154155b156111a557506001600160a01b038116600090815260046020526040902060020154610c74565b506000610c74565b6000546001600160a01b031633146112075760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610598565b7f0000000000000000000000000000000000000000000000000000000060d3294842116112765760405162461bcd60e51b815260206004820152601d60248201527f5374616b696e673a207374616b696e67206e6f74206f766572207965740000006044820152606401610598565b7f000000000000000000000000f4d861575ecc9493420a3f5a14f85b13f0b50eb36001600160a01b031663a9059cbb6112b76000546001600160a01b031690565b6112bf610c79565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561131d57600080fd5b505af1158015611331573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113559190611a98565b50565b6000546001600160a01b031633146113b25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610598565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600068056bc75e2d63100000427f00000000000000000000000000000000000000000000000000000000609bca4881101561146157507f00000000000000000000000000000000000000000000000000000000609bca485b600061148e7f00000000000000000000000000000000000000000000000000000000609bca48838561150e565b9050600061149f6201518084611bbc565b905060006114ce7f00000000000000000000000000000000000000000000000000000000609bca48838761150e565b905060006114dc8483611e27565b90506000866114ed8361016d611dc9565b6114f8906064611dc9565b6115029190611c02565b97505050505050505090565b600080600061151d8686611791565b9150915060008061152e84846118c5565b91509150600061153e83836119c4565b90506000611550620f42406064611dc9565b8261157b7f00000000000000000000000000000000000000000000000000000000000000288b611dc9565b6115859190611dc9565b61158f9190611c02565b9a9950505050505050505050565b6002546003546040516370a0823160e01b815230600482015260009291906001600160a01b037f000000000000000000000000f4d861575ecc9493420a3f5a14f85b13f0b50eb316906370a082319060240160206040518083038186803b15801561160757600080fd5b505afa15801561161b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163f9190611ab8565b6116499190611e27565b610d2f9190611bbc565b6000546001600160a01b031633146116ad5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610598565b6001600160a01b0381166117295760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610598565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000807f00000000000000000000000000000000000000000000000000000000609bca48831115806117e357507f0000000000000000000000000000000000000000000000000000000060d329488410155b1561181257507f00000000000000000000000000000000000000000000000000000000609bca489050806118be565b60007f00000000000000000000000000000000000000000000000000000000609bca4885106118415784611863565b7f00000000000000000000000000000000000000000000000000000000609bca485b905060007f0000000000000000000000000000000000000000000000000000000060d32948851161189457846118b6565b7f0000000000000000000000000000000000000000000000000000000060d329485b919350909150505b9250929050565b600080806119137f00000000000000000000000000000000000000000000000000000000609bca487f0000000000000000000000000000000000000000000000000000000060d32948611e27565b90508061192a576000620f424092509250506118be565b600081620f424061195b7f00000000000000000000000000000000000000000000000000000000609bca4889611e27565b6119659190611dc9565b61196f9190611c02565b9050600082620f42406119a27f00000000000000000000000000000000000000000000000000000000609bca4889611e27565b6119ac9190611dc9565b6119b69190611c02565b919791965090945050505050565b6000806119d16000611a2d565b6119dd620f4240611a2d565b6119e79190611de8565b905060006119f485611a2d565b6119fd85611a2d565b611a079190611de8565b9050600082611a19620f424084611d46565b611a239190611bd4565b9695505050505050565b60008181611a3f620f42406003611d46565b6003611a4e620f424085611de8565b611a589190611d2a565b611a629190611bd4565b949350505050565b600060208284031215611a7b578081fd5b81356001600160a01b0381168114611a91578182fd5b9392505050565b600060208284031215611aa9578081fd5b81518015158114611a91578182fd5b600060208284031215611ac9578081fd5b5051919050565b600080600060408486031215611ae4578182fd5b83359250602084013567ffffffffffffffff80821115611b02578384fd5b818601915086601f830112611b15578384fd5b813581811115611b23578485fd5b876020828501011115611b34578485fd5b6020830194508093505050509250925092565b600080600060608486031215611b5b578283fd5b505081359360208301359350604090920135919050565b60006001600160a01b0380871683528086166020840152506060604083015282606083015282846080840137818301608090810191909152601f909201601f191601019392505050565b60008219821115611bcf57611bcf611e3e565b500190565b600082611be357611be3611e54565b600160ff1b821460001984141615611bfd57611bfd611e3e565b500590565b600082611c1157611c11611e54565b500490565b80825b6001808611611c285750611c53565b818704821115611c3a57611c3a611e3e565b80861615611c4757918102915b9490941c938002611c19565b94509492505050565b6000828015611c725760018114611c7c57611c85565b6001915050611a62565b82915050611a62565b5081611c9357506000611a62565b50600160008213808214611cac578015611cc357611cd5565b828604831115611cbe57611cbe611e3e565b611cd5565b828605831215611cd557611cd5611e3e565b5080831615611ce15750805b611cf2858460011c84850284611c16565b8087048211600083131615611d0957611d09611e3e565b8086058212600083121615611d2057611d20611e3e565b0295945050505050565b6000611a916001600160ff1b03600160ff1b60ff861685611c5c565b60006001600160ff1b0381841382841385830485118282161615611d6c57611d6c611e3e565b600160ff1b84871286820588128184161615611d8a57611d8a611e3e565b858712925087820587128484161615611da557611da5611e3e565b87850587128184161615611dbb57611dbb611e3e565b505050929093029392505050565b6000816000190483118215151615611de357611de3611e3e565b500290565b600080831283600160ff1b01831281151615611e0657611e06611e3e565b836001600160ff1b03018313811615611e2157611e21611e3e565b50500390565b600082821015611e3957611e39611e3e565b500390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fdfea2646970667358221220a608fe17ad014b675fd16d235d747ccdf1f96499344e0788469b5c8903cdb4bb64736f6c63430008030033

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

000000000000000000000000f4d861575ecc9493420a3f5a14f85b13f0b50eb30000000000000000000000001a5fa65e50d503a29ec57cd102f2e7970a6963bb000000000000000000000000a3015543ce7da7b9708076c1171e242c36452f1000000000000000000000000000000000000000000000000000000000609bca480000000000000000000000000000000000000000000000000000000060d329480000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000043c33c19375648000000000000000000000000000000000000000000000000000000000000000000028

-----Decoded View---------------
Arg [0] : _token (address): 0xF4d861575ecC9493420A3f5a14F85B13f0b50EB3
Arg [1] : _registry (address): 0x1A5FA65E50d503a29Ec57cD102f2e7970a6963BB
Arg [2] : _attester (address): 0xa3015543Ce7da7B9708076C1171E242C36452F10
Arg [3] : _startDate (uint256): 1620822600
Arg [4] : _endDate (uint256): 1624451400
Arg [5] : _minAmount (uint256): 1000000000000000000
Arg [6] : _maxAmount (uint256): 20000000000000000000000
Arg [7] : _cap (uint256): 40

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 000000000000000000000000f4d861575ecc9493420a3f5a14f85b13f0b50eb3
Arg [1] : 0000000000000000000000001a5fa65e50d503a29ec57cd102f2e7970a6963bb
Arg [2] : 000000000000000000000000a3015543ce7da7b9708076c1171e242c36452f10
Arg [3] : 00000000000000000000000000000000000000000000000000000000609bca48
Arg [4] : 0000000000000000000000000000000000000000000000000000000060d32948
Arg [5] : 0000000000000000000000000000000000000000000000000de0b6b3a7640000
Arg [6] : 00000000000000000000000000000000000000000000043c33c1937564800000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000028


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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