ETH Price: $2,914.48 (-10.07%)
Gas: 22 Gwei

Contract

0xb55Dcc69d909103b4De773412A22AB8B86e8c602
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

1 address found via
Transaction Hash
Method
Block
From
To
Value
Get Yield202369622024-07-05 1:16:232 hrs ago1720142183IN
0xb55Dcc69...B86e8c602
0 ETH0.001193487.35953027
Get Yield202355072024-07-04 20:23:237 hrs ago1720124603IN
0xb55Dcc69...B86e8c602
0 ETH0.001236757.62636091
Get Yield202342242024-07-04 16:04:4711 hrs ago1720109087IN
0xb55Dcc69...B86e8c602
0 ETH0.0022184213.67973659
Get Yield202322692024-07-04 9:31:1118 hrs ago1720085471IN
0xb55Dcc69...B86e8c602
0 ETH0.0017286610.65964711
Get Yield202316562024-07-04 7:27:5920 hrs ago1720078079IN
0xb55Dcc69...B86e8c602
0 ETH0.000795564.90575315
Get Yield202315822024-07-04 7:13:1120 hrs ago1720077191IN
0xb55Dcc69...B86e8c602
0 ETH0.000665124.10145231
Get Yield202311562024-07-04 5:47:3522 hrs ago1720072055IN
0xb55Dcc69...B86e8c602
0 ETH0.000319152.2
Get Yield202297822024-07-04 1:11:2326 hrs ago1720055483IN
0xb55Dcc69...B86e8c602
0 ETH0.000601923.75807076
Get Yield202297752024-07-04 1:09:5926 hrs ago1720055399IN
0xb55Dcc69...B86e8c602
0 ETH0.000552433.40655943
Checkpoint202295592024-07-04 0:26:4727 hrs ago1720052807IN
0xb55Dcc69...B86e8c602
0 ETH0.000485413.29676647
Checkpoint202295492024-07-04 0:24:4727 hrs ago1720052687IN
0xb55Dcc69...B86e8c602
0 ETH0.000367343.55131454
Get Yield202295402024-07-04 0:22:5927 hrs ago1720052579IN
0xb55Dcc69...B86e8c602
0 ETH0.000649933.95236074
Get Yield202289922024-07-03 22:32:5929 hrs ago1720045979IN
0xb55Dcc69...B86e8c602
0 ETH0.001434448.84538217
Checkpoint202279132024-07-03 18:56:1132 hrs ago1720032971IN
0xb55Dcc69...B86e8c602
0 ETH0.001094888.13497853
Get Yield202276932024-07-03 18:12:1133 hrs ago1720030331IN
0xb55Dcc69...B86e8c602
0 ETH0.001304128.04173588
Get Yield202267972024-07-03 15:12:2336 hrs ago1720019543IN
0xb55Dcc69...B86e8c602
0 ETH0.0027787717.13503817
Get Yield202239352024-07-03 5:36:3546 hrs ago1719984995IN
0xb55Dcc69...B86e8c602
0 ETH0.000372272.29558333
Get Yield202228302024-07-03 1:53:472 days ago1719971627IN
0xb55Dcc69...B86e8c602
0 ETH0.000542073.34268433
Get Yield202205472024-07-02 18:13:592 days ago1719944039IN
0xb55Dcc69...B86e8c602
0 ETH0.000934695.76368457
Get Yield202197422024-07-02 15:31:472 days ago1719934307IN
0xb55Dcc69...B86e8c602
0 ETH0.001461969.01506661
Get Yield202178452024-07-02 9:09:592 days ago1719911399IN
0xb55Dcc69...B86e8c602
0 ETH0.000660694.07408657
Get Yield202154112024-07-02 1:00:113 days ago1719882011IN
0xb55Dcc69...B86e8c602
0 ETH0.000372732.29842493
Get Yield202153442024-07-02 0:46:473 days ago1719881207IN
0xb55Dcc69...B86e8c602
0 ETH0.000396242.40636335
Get Yield202107252024-07-01 9:18:353 days ago1719825515IN
0xb55Dcc69...B86e8c602
0 ETH0.000813695.60903729
Get Yield202102092024-07-01 7:34:473 days ago1719819287IN
0xb55Dcc69...B86e8c602
0 ETH0.000863865.32693372
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:
HiIQRewards

Compiler Version
v0.7.1+commit.f4a555be

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 12 : HiIQRewards.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;

// ====================================================================
// |     ______                   _______                             |
// |    / _____________ __  __   / ____(_____  ____ _____  ________   |
// |   / /_  / ___/ __ `| |/_/  / /_  / / __ \/ __ `/ __ \/ ___/ _ \  |
// |  / __/ / /  / /_/ _>  <   / __/ / / / / / /_/ / / / / /__/  __/  |
// | /_/   /_/   \__,_/_/|_|  /_/   /_/_/ /_/\__,_/_/ /_/\___/\___/   |
// |                                                                  |
// ====================================================================
// ======================veFXSYieldDistributorV4=======================
// ====================================================================
// Distributes IQ protocol yield based on the claimer's hiIQ balance
// V3: Yield will now not accrue for unlocked hiIQ

// Frax Finance: https://github.com/FraxFinance

// Primary Author(s)
// Travis Moore: https://github.com/FortisFortuna

// Reviewer(s) / Contributor(s)
// Jason Huan: https://github.com/jasonhuan
// Sam Kazemian: https://github.com/samkazemian

// Originally inspired by Synthetix.io, but heavily modified by the Frax team (hiIQ portion)
// https://raw.githubusercontent.com/Synthetixio/synthetix/develop/contracts/StakingYield.sol

import "./TransferHelper.sol";
import "../Lock/IhiIQ.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract HiIQRewards is Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for ERC20;

    /* ========== STATE VARIABLES ========== */

    // Instances
    IhiIQ private hiIQ;
    ERC20 public emittedToken;

    // Addresses
    address public emitted_token_address;

    // Constant for price precision
    uint256 private constant PRICE_PRECISION = 1e6;

    // Yield and period related
    uint256 public periodFinish;
    uint256 public lastUpdateTime;
    uint256 public yieldRate;
    uint256 public yieldDuration = 604800; // 7 * 86400  (7 days)

    // Yield tracking
    uint256 public yieldPerHiIQStored = 0;
    mapping(address => uint256) public userYieldPerTokenPaid;
    mapping(address => uint256) public yields;

    // hiIQ tracking
    uint256 public totalHiIQSupplyStored = 0;
    mapping(address => bool) public userIsInitialized;
    mapping(address => uint256) public userHiIQCheckpointed;
    mapping(address => uint256) public userHiIQEndpointCheckpointed;
    mapping(address => uint256) private userHiIQLastCheckpointed;
    mapping(address => uint256) private lastRewardClaimTime; // staker addr -> timestamp

    // Greylists
    mapping(address => bool) public greylist;

    // Admin booleans for emergencies
    bool public yieldCollectionPaused = false; // For emergencies

    struct LockedBalance {
        int128 amount;
        uint256 end;
    }

    /* ========== MODIFIERS ========== */

    modifier notYieldCollectionPaused() {
        require(yieldCollectionPaused == false, "Yield collection is paused");
        _;
    }

    modifier checkpointUser(address account) {
        _checkpointUser(account);
        _;
    }

    /* ========== CONSTRUCTOR ========== */

    constructor(address _emittedToken, address _hiIQ_address) {
        emitted_token_address = _emittedToken;
        emittedToken = ERC20(_emittedToken);

        hiIQ = IhiIQ(_hiIQ_address);
        lastUpdateTime = block.timestamp;

        // 1 IQ a day at initialization
        yieldRate = (uint256(365e18)).div(365 * 86400);
    }

    /* ========== VIEWS ========== */

    function lastTimeYieldApplicable() public view returns (uint256) {
        uint256 currentPeriod = periodFinish;
        // this is the retroCatchUp calculation. applying it here in case earned is called and many periods have passed without checkpoint
        if (block.timestamp > periodFinish) {
            uint256 num_periods_elapsed = uint256(block.timestamp.sub(periodFinish)) / yieldDuration;
            currentPeriod = periodFinish.add((num_periods_elapsed.add(1)).mul(yieldDuration));
        }

        return Math.min(block.timestamp, currentPeriod);
    }

    function yieldPerHiIQ() public view returns (uint256) {
        if (totalHiIQSupplyStored == 0) {
            return yieldPerHiIQStored;
        } else {
            return (
                yieldPerHiIQStored.add(
                    lastTimeYieldApplicable().sub(lastUpdateTime).mul(yieldRate).mul(1e18).div(totalHiIQSupplyStored)
                )
            );
        }
    }

    function earned(address account) public view returns (uint256) {
        // Uninitialized users should not earn anything yet
        if (!userIsInitialized[account]) return 0;

        uint256 yieldPerHiIQToUse = yieldPerHiIQ().sub(userYieldPerTokenPaid[account]);

        uint256 user_locking_ending_time = userHiIQEndpointCheckpointed[account];

        // Get eligible hiIQ balances
        uint256 eligible_current_hiiq;
        if (block.timestamp >= user_locking_ending_time) {
            eligible_current_hiiq = 0;
        } else {
            eligible_current_hiiq = hiIQ.balanceOf(account);
        }


        // If your hiIQ is unlocked
        uint256 eligible_time_fraction = PRICE_PRECISION;
        if (eligible_current_hiiq == 0) {
            // And you already claimed after expiration
            if (lastRewardClaimTime[account] >= user_locking_ending_time) {
                // You get NOTHING. You LOSE. Good DAY ser!
                return 0;
            } else if (userHiIQLastCheckpointed[account] > user_locking_ending_time) {
                eligible_time_fraction = 0;
            } else {
                // You haven't claimed yet
                // user can checkpoint multiple times and it shouldnt affect this
                uint256 eligible_time = user_locking_ending_time.sub(lastRewardClaimTime[account]);
                uint256 total_time = block.timestamp.sub(lastRewardClaimTime[account]);
                eligible_time_fraction = Math.min(PRICE_PRECISION, PRICE_PRECISION.mul(eligible_time).div(total_time));
            }
        }
        yieldPerHiIQToUse = yieldPerHiIQToUse.mul(eligible_time_fraction);

        // If the amount of hiIQ increased, only pay off based on the old balance
        // Otherwise, take the midpoint
        uint256 hiiq_balance_to_use;
        {
            uint256 old_hiiq_balance = userHiIQCheckpointed[account];
            if (eligible_current_hiiq > old_hiiq_balance) {
                hiiq_balance_to_use = old_hiiq_balance;
            } else if (user_locking_ending_time < block.timestamp) {
                // it should not go to zero, use ending point hiIQ and prev checkpoint amount
                uint256 balanceOf = 0;
                try hiIQ.balanceOf(account, user_locking_ending_time) returns (uint256 balance) {
                   balanceOf = balance;
                } catch(bytes memory _err) {
                }
                hiiq_balance_to_use = ((balanceOf).add(old_hiiq_balance)).div(2);
            } else {
                hiiq_balance_to_use = ((eligible_current_hiiq).add(old_hiiq_balance)).div(2);
            }
        }

        return calculateEarn(account, hiiq_balance_to_use, yieldPerHiIQToUse);
    }

    function calculateEarn(address account, uint256 hiiq_balance_to_use, uint256 yieldPerHiIQToUse) internal view returns (uint256) {
        return hiiq_balance_to_use
        .mul(yieldPerHiIQToUse)
        .div(1e18 * PRICE_PRECISION)
        .add(yields[account]);
    }

    function getYieldForDuration() external view returns (uint256) {
        return (yieldRate.mul(yieldDuration));
    }

    /* ========== MUTATIVE FUNCTIONS ========== */

    function _checkpointUser(address account) internal {
        // Need to retro-adjust some things if the period hasn't been renewed, then start a new one
        sync();

        // Calculate the earnings first
        _syncEarned(account);

        IhiIQ.LockedBalance memory curr_locked_bal_pack = hiIQ.locked(account);
        // Update the user's stored hiIQ balance
        userHiIQCheckpointed[account] = hiIQ.balanceOf(account);

        // Update the user's stored ending timestamp
        userHiIQEndpointCheckpointed[account] = curr_locked_bal_pack.end;

        // Update the user's stored checkpoint timestamp
        userHiIQLastCheckpointed[account] = block.timestamp;

        // Mark the user as initialized
        if (!userIsInitialized[account]) {
            userIsInitialized[account] = true;
            lastRewardClaimTime[account] = block.timestamp;
        }
    }

    function _syncEarned(address account) internal {
        if (account != address(0)) {
            uint256 earned0 = earned(account);
            yields[account] = earned0;
            userYieldPerTokenPaid[account] = yieldPerHiIQStored;
        }
    }

    // Anyone can checkpoint another user
    function checkpointOtherUser(address user_addr) external {
        _checkpointUser(user_addr);
    }

    // Checkpoints the user
    function checkpoint() external {
        _checkpointUser(msg.sender);
    }

    function getYield()
        external
        nonReentrant
        notYieldCollectionPaused
        checkpointUser(msg.sender)
        returns (uint256 yield0)
    {
        require(greylist[msg.sender] == false, "Address has been greylisted");

        yield0 = yields[msg.sender];
        if (yield0 > 0) {
            yields[msg.sender] = 0;
            TransferHelper.safeTransfer(emitted_token_address, msg.sender, yield0);
            emit YieldCollected(msg.sender, yield0, emitted_token_address);
        }

        lastRewardClaimTime[msg.sender] = block.timestamp;
    }

    // If the period expired, renew it
    function retroCatchUp() internal {
        // Failsafe check
        require(block.timestamp > periodFinish, "Period has not expired yet!");

        // Ensure the provided yield amount is not more than the balance in the contract.
        // This keeps the yield rate in the right range, preventing overflows due to
        // very high values of yieldRate in the earned and yieldPerToken functions;
        // Yield + leftover must be less than 2^256 / 10^18 to avoid overflow.
        uint256 num_periods_elapsed = uint256(block.timestamp.sub(periodFinish)) / yieldDuration;
        // Floor division to the nearest period
        uint256 balance0 = emittedToken.balanceOf(address(this));
        require(
            yieldRate.mul(yieldDuration).mul(num_periods_elapsed + 1) <= balance0,
            "Not enough emittedToken available for yield distribution!"
        );

        periodFinish = periodFinish.add((num_periods_elapsed.add(1)).mul(yieldDuration));

        uint256 yield0 = yieldPerHiIQ();
        yieldPerHiIQStored = yield0;
        lastUpdateTime = lastTimeYieldApplicable();

        emit YieldPeriodRenewed(emitted_token_address, yieldRate);
    }

    function sync() public {
        // Update the total hiIQ supply
        totalHiIQSupplyStored = hiIQ.totalSupply();

        if (block.timestamp > periodFinish) {
            retroCatchUp();
        } else {
            uint256 yield0 = yieldPerHiIQ();
            yieldPerHiIQStored = yield0;
            lastUpdateTime = lastTimeYieldApplicable();
        }
    }

    /* ========== RESTRICTED FUNCTIONS ========== */

    // Added to support recovering LP Yield and other mistaken tokens from other systems to be distributed to holders
    function recoverERC20(address tokenAddress, uint256 tokenAmount) external onlyOwner {
        // Only the owner address can ever receive the recovery withdrawal
        TransferHelper.safeTransfer(tokenAddress, owner(), tokenAmount);
        emit RecoveredERC20(tokenAddress, tokenAmount);
    }

    function setYieldDuration(uint256 _yieldDuration) external onlyOwner {
        require(
            periodFinish == 0 || block.timestamp > periodFinish,
            "Previous yield period must be complete before changing the duration for the new period"
        );
        yieldDuration = _yieldDuration;
        emit YieldDurationUpdated(yieldDuration);
    }

    function initializeDefault() external onlyOwner {
        lastUpdateTime = block.timestamp;
        periodFinish = block.timestamp.add(yieldDuration);
        totalHiIQSupplyStored = hiIQ.totalSupply();
        emit DefaultInitialization();
    }

    function greylistAddress(address _address) external onlyOwner {
        greylist[_address] = !(greylist[_address]);
    }

    function setPauses(bool _yieldCollectionPaused) external onlyOwner {
        yieldCollectionPaused = _yieldCollectionPaused;
    }

    function setYieldRate(uint256 _new_rate0, bool sync_too) external onlyOwner {
        yieldRate = _new_rate0;

        if (sync_too) {
            sync();
        }
    }

    /* ========== EVENTS ========== */

    event YieldCollected(address indexed user, uint256 yield, address token_address);
    event YieldDurationUpdated(uint256 newDuration);
    event RecoveredERC20(address token, uint256 amount);
    event YieldPeriodRenewed(address token, uint256 yieldRate);
    event DefaultInitialization();
}

File 2 of 12 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

pragma solidity ^0.7.0;

import "../GSN/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.
 */
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 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 12 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow, so we distribute
        return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
    }
}

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

pragma solidity ^0.7.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

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

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

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

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

        return c;
    }

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

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

File 6 of 12 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.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 {
    using SafeMath for uint256;
    using Address for address;

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * 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;
        _decimals = 18;
    }

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

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view 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 {_setupDecimals} is
     * called.
     *
     * 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 returns (uint8) {
        return _decimals;
    }

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

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view 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);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        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].add(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) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        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);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(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 = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(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);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(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 Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal {
        _decimals = decimals_;
    }

    /**
     * @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 7 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.7.0;

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

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

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

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

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

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

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

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

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

File 9 of 12 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

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

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

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

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

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

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

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 10 of 12 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

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

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

    uint256 private _status;

    constructor () {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 11 of 12 : IhiIQ.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;

interface IhiIQ {
    struct LockedBalance {
        int128 amount;
        uint256 end;
    }

    /* ========== VIEWS ========== */
    function balanceOf(address addr) external view returns (uint256);

    function balanceOf(address addr, uint256 _t) external view returns (uint256);

    function balanceOfAt(address addr, uint256 _block) external returns (uint256);

    function totalSupply() external view returns (uint256);

    function totalSupply(uint256 t) external view returns (uint256);

    function totalSupplyAt(uint256 _block) external returns (uint256);

    function totalIQSupply() external view returns (uint256);

    function totalIQSupplyAt(uint256 _block) external view returns (uint256);

    function locked(address addr) external view returns (LockedBalance memory);

    /* ========== PUBLIC FUNCTIONS ========== */
    function checkpoint() external;
}

File 12 of 12 : TransferHelper.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.1;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: APPROVE_FAILED");
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transfer(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: TRANSFER_FAILED");
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "TransferHelper: TRANSFER_FROM_FAILED");
    }

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, "TransferHelper: ETH_TRANSFER_FAILED");
    }
}

Settings
{
  "evmVersion": "istanbul",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_emittedToken","type":"address"},{"internalType":"address","name":"_hiIQ_address","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[],"name":"DefaultInitialization","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":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RecoveredERC20","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"yield","type":"uint256"},{"indexed":false,"internalType":"address","name":"token_address","type":"address"}],"name":"YieldCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newDuration","type":"uint256"}],"name":"YieldDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"yieldRate","type":"uint256"}],"name":"YieldPeriodRenewed","type":"event"},{"inputs":[],"name":"checkpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user_addr","type":"address"}],"name":"checkpointOtherUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emittedToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emitted_token_address","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getYield","outputs":[{"internalType":"uint256","name":"yield0","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getYieldForDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"greylist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"greylistAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializeDefault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lastTimeYieldApplicable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","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":"periodFinish","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_yieldCollectionPaused","type":"bool"}],"name":"setPauses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_yieldDuration","type":"uint256"}],"name":"setYieldDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_new_rate0","type":"uint256"},{"internalType":"bool","name":"sync_too","type":"bool"}],"name":"setYieldRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sync","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalHiIQSupplyStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userHiIQCheckpointed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userHiIQEndpointCheckpointed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userIsInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userYieldPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yieldCollectionPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yieldDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yieldPerHiIQ","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yieldPerHiIQStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yieldRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"yields","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405262093a8060085560006009819055600c556013805460ff191690553480156200002c57600080fd5b5060405162001d3c38038062001d3c8339810160408190526200004f91620001cd565b60006200005b6200011a565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060018055600480546001600160a01b03199081166001600160a01b03858116918217909355600380548316909117905560028054909116918316919091179055426006556200010e6813c9647e25a99400006301e133806200011e602090811b62000f0d17901c565b600755506200025c9050565b3390565b60006200016883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506200017160201b60201c565b90505b92915050565b600081836200019e5760405162461bcd60e51b815260040162000195919062000206565b60405180910390fd5b506000838581620001ab57fe5b0495945050505050565b80516001600160a01b03811681146200016b57600080fd5b60008060408385031215620001e0578182fd5b620001ec8484620001b5565b9150620001fd8460208501620001b5565b90509250929050565b6000602080835283518082850152825b81811015620002345785810183015185820160400152820162000216565b81811115620002465783604083870101525b50601f01601f1916929092016040019392505050565b611ad0806200026c6000396000f3fe608060405234801561001057600080fd5b50600436106101ef5760003560e01c80638980f11f1161010f578063c2c4c5c1116100a2578063ebe2b12b11610071578063ebe2b12b1461038a578063f2fde38b14610392578063f40c1ca7146103a5578063fff6cae9146103b8576101ef565b8063c2c4c5c11461036a578063c8f33c9114610372578063e172cf211461037a578063e9218ff614610382576101ef565b8063948e25a2116100de578063948e25a2146103295780639f8a835a1461033c578063a875f4721461034f578063ad1148cb14610362576101ef565b80638980f11f146102e85780638da5cb5b146102fb57806391519bda14610303578063941d9f6514610316576101ef565b806350fe98ac116101875780636999ac93116101565780636999ac93146102bd578063715018a6146102c557806374ea0b98146102cd5780637c262871146102e0576101ef565b806350fe98ac146102925780635169a7a1146102a5578063561fd712146102ad57806356d9fff3146102b5576101ef565b806319aec6d2116101c357806319aec6d21461025a578063224156601461026257806331ca208c1461026a57806338359fc21461027d576101ef565b80628cc262146101f457806302be7f8e1461021d57806314b3053714610230578063169d27ef14610250575b600080fd5b610207610202366004611567565b6103c0565b6040516102149190611a3c565b60405180910390f35b61020761022b366004611567565b6106e1565b61024361023e366004611567565b6106f3565b60405161021491906116e5565b610258610708565b005b610207610820565b61020761083f565b610243610278366004611567565b610845565b61028561085a565b60405161021491906116b8565b6102076102a0366004611567565b610869565b61020761087b565b6102076108d0565b6102076108d6565b610207610942565b610258610948565b6102586102db36600461163d565b6109d4565b610207610a75565b6102586102f6366004611582565b610ba1565b610285610c25565b61025861031136600461166d565b610c34565b610258610324366004611567565b610c80565b6102586103373660046115ac565b610cde565b61025861034a366004611567565b610d26565b61020761035d366004611567565b610d32565b610243610d44565b610258610d4d565b610207610d58565b610207610d5e565b610285610d64565b610207610d73565b6102586103a0366004611567565b610d79565b6102076103b3366004611567565b610e3c565b610258610e4e565b6001600160a01b0381166000908152600d602052604081205460ff166103e8575060006106dc565b6001600160a01b0382166000908152600a60205260408120546104139061040d61087b565b90610f58565b6001600160a01b0384166000908152600f602052604081205491925042821161043e575060006104c1565b6002546040516370a0823160e01b81526001600160a01b03909116906370a082319061046e9088906004016116b8565b60206040518083038186803b15801561048657600080fd5b505afa15801561049a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104be9190611655565b90505b620f424081610591576001600160a01b03861660009081526011602052604090205483116104f65760009450505050506106dc565b6001600160a01b03861660009081526010602052604090205483101561051e57506000610591565b6001600160a01b038616600090815260116020526040812054610542908590610f58565b6001600160a01b0388166000908152601160205260408120549192509061056a904290610f58565b905061058c620f4240610587836105818387610f9a565b90610f0d565b610fd4565b925050505b61059b8482610f9a565b6001600160a01b0387166000908152600e602052604081205491955090808411156105c8578091506106c8565b428510156106b6576002546040517efdd58e0000000000000000000000000000000000000000000000000000000081526000916001600160a01b03169062fdd58e9061061a908c908a906004016116cc565b60206040518083038186803b15801561063257600080fd5b505afa925050508015610662575060408051601f3d908101601f1916820190925261065f91810190611655565b60015b61069c573d808015610690576040519150601f19603f3d011682016040523d82523d6000602084013e610695565b606091505b505061069f565b90505b6106ae60026105818385610fea565b9250506106c8565b6106c560026105818684610fea565b91505b506106d487828761100f565b955050505050505b919050565b600f6020526000908152604090205481565b600d6020526000908152604090205460ff1681565b610710611052565b6000546001600160a01b039081169116146107465760405162461bcd60e51b815260040161073d9061194d565b60405180910390fd5b4260068190556008546107599190610fea565b600555600254604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916318160ddd91600480820192602092909190829003018186803b1580156107ba57600080fd5b505afa1580156107ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f29190611655565b600c556040517fb5cfe3ccd03847076864f081609024cbc2eb98c38da4d8b2cebe9479a9a1ef3790600090a1565b6000610839600854600754610f9a90919063ffffffff16565b90505b90565b600c5481565b60126020526000908152604090205460ff1681565b6004546001600160a01b031681565b600b6020526000908152604090205481565b6000600c5460001415610891575060095461083c565b6108c96108c0600c54610581670de0b6b3a76400006108ba6007546108ba60065461040d6108d6565b90610f9a565b60095490610fea565b905061083c565b60095481565b600554600090428110156109325760006008546108fe60055442610f5890919063ffffffff16565b8161090557fe5b04905061092e6109256008546108ba600185610fea90919063ffffffff16565b60055490610fea565b9150505b61093c4282610fd4565b91505090565b60075481565b610950611052565b6000546001600160a01b0390811691161461097d5760405162461bcd60e51b815260040161073d9061194d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6109dc611052565b6000546001600160a01b03908116911614610a095760405162461bcd60e51b815260040161073d9061194d565b6005541580610a19575060055442115b610a355760405162461bcd60e51b815260040161073d90611982565b60088190556040517fce653f06b9044b00e7d9d01b9b4228e84812092cb6a38371889bef19370d21f790610a6a908390611a3c565b60405180910390a150565b600060026001541415610a9a5760405162461bcd60e51b815260040161073d90611a05565b600260015560135460ff1615610ac25760405162461bcd60e51b815260040161073d90611825565b33610acc81611056565b3360009081526012602052604090205460ff1615610afc5760405162461bcd60e51b815260040161073d906118b9565b336000908152600b602052604090205491508115610b8757336000818152600b6020526040812055600454610b3d916001600160a01b0390911690846111fe565b60045460405133917f3998039806f6db7e5d83a5371638cc47dd2e9ae500d5d561d95ec6381f53e3cd91610b7e9186916001600160a01b0390911690611a45565b60405180910390a25b503360009081526011602052604090204290556001805590565b610ba9611052565b6000546001600160a01b03908116911614610bd65760405162461bcd60e51b815260040161073d9061194d565b610be882610be2610c25565b836111fe565b7f55350610fe57096d8c0ffa30beede987326bccfcb0b4415804164d0dd50ce8b18282604051610c199291906116cc565b60405180910390a15050565b6000546001600160a01b031690565b610c3c611052565b6000546001600160a01b03908116911614610c695760405162461bcd60e51b815260040161073d9061194d565b60078290558015610c7c57610c7c610e4e565b5050565b610c88611052565b6000546001600160a01b03908116911614610cb55760405162461bcd60e51b815260040161073d9061194d565b6001600160a01b03166000908152601260205260409020805460ff19811660ff90911615179055565b610ce6611052565b6000546001600160a01b03908116911614610d135760405162461bcd60e51b815260040161073d9061194d565b6013805460ff1916911515919091179055565b610d2f81611056565b50565b600a6020526000908152604090205481565b60135460ff1681565b610d5633611056565b565b60065481565b60085481565b6003546001600160a01b031681565b60055481565b610d81611052565b6000546001600160a01b03908116911614610dae5760405162461bcd60e51b815260040161073d9061194d565b6001600160a01b038116610dd45760405162461bcd60e51b815260040161073d9061175a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600e6020526000908152604090205481565b600260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9c57600080fd5b505afa158015610eb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed49190611655565b600c55600554421115610eee57610ee9611301565b610d56565b6000610ef861087b565b60098190559050610f076108d6565b60065550565b6000610f4f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061148d565b90505b92915050565b6000610f4f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506114c4565b600082610fa957506000610f52565b82820282848281610fb657fe5b0414610f4f5760405162461bcd60e51b815260040161073d906118f0565b6000818310610fe35781610f4f565b5090919050565b600082820183811015610f4f5760405162461bcd60e51b815260040161073d906117b7565b6001600160a01b0383166000908152600b602052604081205461104a9061104469d3c21bcecceda10000006105818787610f9a565b90610fea565b949350505050565b3390565b61105e610e4e565b611067816114f0565b61106f611539565b6002546040517fcbf9fe5f0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063cbf9fe5f906110b89085906004016116b8565b604080518083038186803b1580156110cf57600080fd5b505afa1580156110e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110791906115e4565b6002546040516370a0823160e01b81529192506001600160a01b0316906370a08231906111389085906004016116b8565b60206040518083038186803b15801561115057600080fd5b505afa158015611164573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111889190611655565b6001600160a01b0383166000908152600e602090815260408083209390935583810151600f82528383205560108152828220429055600d9052205460ff16610c7c576001600160a01b0382166000908152600d60209081526040808320805460ff19166001179055601190915290204290555050565b60006060846001600160a01b031663a9059cbb85856040516024016112249291906116cc565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611272919061169c565b6000604051808303816000865af19150503d80600081146112af576040519150601f19603f3d011682016040523d82523d6000602084013e6112b4565b606091505b50915091508180156112de5750805115806112de5750808060200190518101906112de91906115c8565b6112fa5760405162461bcd60e51b815260040161073d90611723565b5050505050565b60055442116113225760405162461bcd60e51b815260040161073d906117ee565b600060085461133c60055442610f5890919063ffffffff16565b8161134357fe5b6003546040516370a0823160e01b81529290910492506000916001600160a01b03909116906370a082319061137c9030906004016116b8565b60206040518083038186803b15801561139457600080fd5b505afa1580156113a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cc9190611655565b9050806113ed836001016108ba600854600754610f9a90919063ffffffff16565b111561140b5760405162461bcd60e51b815260040161073d9061185c565b60085461142190610925906108ba856001610fea565b600555600061142e61087b565b6009819055905061143d6108d6565b6006556004546007546040517fb304aeb00c30205e714696b5e1e78d04e16b0ad608da8c3c700796c1ddea636792611480926001600160a01b03909116916116cc565b60405180910390a1505050565b600081836114ae5760405162461bcd60e51b815260040161073d91906116f0565b5060008385816114ba57fe5b0495945050505050565b600081848411156114e85760405162461bcd60e51b815260040161073d91906116f0565b505050900390565b6001600160a01b03811615610d2f57600061150a826103c0565b6001600160a01b0383166000908152600b6020908152604080832093909355600954600a909152919020555050565b604080518082019091526000808252602082015290565b80356001600160a01b0381168114610f5257600080fd5b600060208284031215611578578081fd5b610f4f8383611550565b60008060408385031215611594578081fd5b61159e8484611550565b946020939093013593505050565b6000602082840312156115bd578081fd5b8135610f4f81611a8c565b6000602082840312156115d9578081fd5b8151610f4f81611a8c565b6000604082840312156115f5578081fd5b6040516040810181811067ffffffffffffffff82111715611614578283fd5b6040528251600f81900b8114611628578283fd5b81526020928301519281019290925250919050565b60006020828403121561164e578081fd5b5035919050565b600060208284031215611666578081fd5b5051919050565b6000806040838503121561167f578182fd5b82359150602083013561169181611a8c565b809150509250929050565b600082516116ae818460208701611a5c565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b600060208252825180602084015261170f816040850160208701611a5c565b601f01601f19169190910160400192915050565b6020808252601f908201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601b908201527f506572696f6420686173206e6f74206578706972656420796574210000000000604082015260600190565b6020808252601a908201527f5969656c6420636f6c6c656374696f6e20697320706175736564000000000000604082015260600190565b60208082526039908201527f4e6f7420656e6f75676820656d6974746564546f6b656e20617661696c61626c60408201527f6520666f72207969656c6420646973747269627574696f6e2100000000000000606082015260800190565b6020808252601b908201527f4164647265737320686173206265656e20677265796c69737465640000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526056908201527f50726576696f7573207969656c6420706572696f64206d75737420626520636f60408201527f6d706c657465206265666f7265206368616e67696e672074686520647572617460608201527f696f6e20666f7220746865206e657720706572696f6400000000000000000000608082015260a00190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b90815260200190565b9182526001600160a01b0316602082015260400190565b60005b83811015611a77578181015183820152602001611a5f565b83811115611a86576000848401525b50505050565b8015158114610d2f57600080fdfea2646970667358221220064ac031e8ab6576c1db3b89cc2b0b472237abe20d791b9d25f7198cc114e5ac64736f6c63430007010033000000000000000000000000579cea1889991f68acc35ff5c3dd0621ff29b0c90000000000000000000000001bf5457ecaa14ff63cc89efd560e251e814e16ba

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101ef5760003560e01c80638980f11f1161010f578063c2c4c5c1116100a2578063ebe2b12b11610071578063ebe2b12b1461038a578063f2fde38b14610392578063f40c1ca7146103a5578063fff6cae9146103b8576101ef565b8063c2c4c5c11461036a578063c8f33c9114610372578063e172cf211461037a578063e9218ff614610382576101ef565b8063948e25a2116100de578063948e25a2146103295780639f8a835a1461033c578063a875f4721461034f578063ad1148cb14610362576101ef565b80638980f11f146102e85780638da5cb5b146102fb57806391519bda14610303578063941d9f6514610316576101ef565b806350fe98ac116101875780636999ac93116101565780636999ac93146102bd578063715018a6146102c557806374ea0b98146102cd5780637c262871146102e0576101ef565b806350fe98ac146102925780635169a7a1146102a5578063561fd712146102ad57806356d9fff3146102b5576101ef565b806319aec6d2116101c357806319aec6d21461025a578063224156601461026257806331ca208c1461026a57806338359fc21461027d576101ef565b80628cc262146101f457806302be7f8e1461021d57806314b3053714610230578063169d27ef14610250575b600080fd5b610207610202366004611567565b6103c0565b6040516102149190611a3c565b60405180910390f35b61020761022b366004611567565b6106e1565b61024361023e366004611567565b6106f3565b60405161021491906116e5565b610258610708565b005b610207610820565b61020761083f565b610243610278366004611567565b610845565b61028561085a565b60405161021491906116b8565b6102076102a0366004611567565b610869565b61020761087b565b6102076108d0565b6102076108d6565b610207610942565b610258610948565b6102586102db36600461163d565b6109d4565b610207610a75565b6102586102f6366004611582565b610ba1565b610285610c25565b61025861031136600461166d565b610c34565b610258610324366004611567565b610c80565b6102586103373660046115ac565b610cde565b61025861034a366004611567565b610d26565b61020761035d366004611567565b610d32565b610243610d44565b610258610d4d565b610207610d58565b610207610d5e565b610285610d64565b610207610d73565b6102586103a0366004611567565b610d79565b6102076103b3366004611567565b610e3c565b610258610e4e565b6001600160a01b0381166000908152600d602052604081205460ff166103e8575060006106dc565b6001600160a01b0382166000908152600a60205260408120546104139061040d61087b565b90610f58565b6001600160a01b0384166000908152600f602052604081205491925042821161043e575060006104c1565b6002546040516370a0823160e01b81526001600160a01b03909116906370a082319061046e9088906004016116b8565b60206040518083038186803b15801561048657600080fd5b505afa15801561049a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104be9190611655565b90505b620f424081610591576001600160a01b03861660009081526011602052604090205483116104f65760009450505050506106dc565b6001600160a01b03861660009081526010602052604090205483101561051e57506000610591565b6001600160a01b038616600090815260116020526040812054610542908590610f58565b6001600160a01b0388166000908152601160205260408120549192509061056a904290610f58565b905061058c620f4240610587836105818387610f9a565b90610f0d565b610fd4565b925050505b61059b8482610f9a565b6001600160a01b0387166000908152600e602052604081205491955090808411156105c8578091506106c8565b428510156106b6576002546040517efdd58e0000000000000000000000000000000000000000000000000000000081526000916001600160a01b03169062fdd58e9061061a908c908a906004016116cc565b60206040518083038186803b15801561063257600080fd5b505afa925050508015610662575060408051601f3d908101601f1916820190925261065f91810190611655565b60015b61069c573d808015610690576040519150601f19603f3d011682016040523d82523d6000602084013e610695565b606091505b505061069f565b90505b6106ae60026105818385610fea565b9250506106c8565b6106c560026105818684610fea565b91505b506106d487828761100f565b955050505050505b919050565b600f6020526000908152604090205481565b600d6020526000908152604090205460ff1681565b610710611052565b6000546001600160a01b039081169116146107465760405162461bcd60e51b815260040161073d9061194d565b60405180910390fd5b4260068190556008546107599190610fea565b600555600254604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916318160ddd91600480820192602092909190829003018186803b1580156107ba57600080fd5b505afa1580156107ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f29190611655565b600c556040517fb5cfe3ccd03847076864f081609024cbc2eb98c38da4d8b2cebe9479a9a1ef3790600090a1565b6000610839600854600754610f9a90919063ffffffff16565b90505b90565b600c5481565b60126020526000908152604090205460ff1681565b6004546001600160a01b031681565b600b6020526000908152604090205481565b6000600c5460001415610891575060095461083c565b6108c96108c0600c54610581670de0b6b3a76400006108ba6007546108ba60065461040d6108d6565b90610f9a565b60095490610fea565b905061083c565b60095481565b600554600090428110156109325760006008546108fe60055442610f5890919063ffffffff16565b8161090557fe5b04905061092e6109256008546108ba600185610fea90919063ffffffff16565b60055490610fea565b9150505b61093c4282610fd4565b91505090565b60075481565b610950611052565b6000546001600160a01b0390811691161461097d5760405162461bcd60e51b815260040161073d9061194d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6109dc611052565b6000546001600160a01b03908116911614610a095760405162461bcd60e51b815260040161073d9061194d565b6005541580610a19575060055442115b610a355760405162461bcd60e51b815260040161073d90611982565b60088190556040517fce653f06b9044b00e7d9d01b9b4228e84812092cb6a38371889bef19370d21f790610a6a908390611a3c565b60405180910390a150565b600060026001541415610a9a5760405162461bcd60e51b815260040161073d90611a05565b600260015560135460ff1615610ac25760405162461bcd60e51b815260040161073d90611825565b33610acc81611056565b3360009081526012602052604090205460ff1615610afc5760405162461bcd60e51b815260040161073d906118b9565b336000908152600b602052604090205491508115610b8757336000818152600b6020526040812055600454610b3d916001600160a01b0390911690846111fe565b60045460405133917f3998039806f6db7e5d83a5371638cc47dd2e9ae500d5d561d95ec6381f53e3cd91610b7e9186916001600160a01b0390911690611a45565b60405180910390a25b503360009081526011602052604090204290556001805590565b610ba9611052565b6000546001600160a01b03908116911614610bd65760405162461bcd60e51b815260040161073d9061194d565b610be882610be2610c25565b836111fe565b7f55350610fe57096d8c0ffa30beede987326bccfcb0b4415804164d0dd50ce8b18282604051610c199291906116cc565b60405180910390a15050565b6000546001600160a01b031690565b610c3c611052565b6000546001600160a01b03908116911614610c695760405162461bcd60e51b815260040161073d9061194d565b60078290558015610c7c57610c7c610e4e565b5050565b610c88611052565b6000546001600160a01b03908116911614610cb55760405162461bcd60e51b815260040161073d9061194d565b6001600160a01b03166000908152601260205260409020805460ff19811660ff90911615179055565b610ce6611052565b6000546001600160a01b03908116911614610d135760405162461bcd60e51b815260040161073d9061194d565b6013805460ff1916911515919091179055565b610d2f81611056565b50565b600a6020526000908152604090205481565b60135460ff1681565b610d5633611056565b565b60065481565b60085481565b6003546001600160a01b031681565b60055481565b610d81611052565b6000546001600160a01b03908116911614610dae5760405162461bcd60e51b815260040161073d9061194d565b6001600160a01b038116610dd45760405162461bcd60e51b815260040161073d9061175a565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b600e6020526000908152604090205481565b600260009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9c57600080fd5b505afa158015610eb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ed49190611655565b600c55600554421115610eee57610ee9611301565b610d56565b6000610ef861087b565b60098190559050610f076108d6565b60065550565b6000610f4f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061148d565b90505b92915050565b6000610f4f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506114c4565b600082610fa957506000610f52565b82820282848281610fb657fe5b0414610f4f5760405162461bcd60e51b815260040161073d906118f0565b6000818310610fe35781610f4f565b5090919050565b600082820183811015610f4f5760405162461bcd60e51b815260040161073d906117b7565b6001600160a01b0383166000908152600b602052604081205461104a9061104469d3c21bcecceda10000006105818787610f9a565b90610fea565b949350505050565b3390565b61105e610e4e565b611067816114f0565b61106f611539565b6002546040517fcbf9fe5f0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063cbf9fe5f906110b89085906004016116b8565b604080518083038186803b1580156110cf57600080fd5b505afa1580156110e3573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110791906115e4565b6002546040516370a0823160e01b81529192506001600160a01b0316906370a08231906111389085906004016116b8565b60206040518083038186803b15801561115057600080fd5b505afa158015611164573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111889190611655565b6001600160a01b0383166000908152600e602090815260408083209390935583810151600f82528383205560108152828220429055600d9052205460ff16610c7c576001600160a01b0382166000908152600d60209081526040808320805460ff19166001179055601190915290204290555050565b60006060846001600160a01b031663a9059cbb85856040516024016112249291906116cc565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051611272919061169c565b6000604051808303816000865af19150503d80600081146112af576040519150601f19603f3d011682016040523d82523d6000602084013e6112b4565b606091505b50915091508180156112de5750805115806112de5750808060200190518101906112de91906115c8565b6112fa5760405162461bcd60e51b815260040161073d90611723565b5050505050565b60055442116113225760405162461bcd60e51b815260040161073d906117ee565b600060085461133c60055442610f5890919063ffffffff16565b8161134357fe5b6003546040516370a0823160e01b81529290910492506000916001600160a01b03909116906370a082319061137c9030906004016116b8565b60206040518083038186803b15801561139457600080fd5b505afa1580156113a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cc9190611655565b9050806113ed836001016108ba600854600754610f9a90919063ffffffff16565b111561140b5760405162461bcd60e51b815260040161073d9061185c565b60085461142190610925906108ba856001610fea565b600555600061142e61087b565b6009819055905061143d6108d6565b6006556004546007546040517fb304aeb00c30205e714696b5e1e78d04e16b0ad608da8c3c700796c1ddea636792611480926001600160a01b03909116916116cc565b60405180910390a1505050565b600081836114ae5760405162461bcd60e51b815260040161073d91906116f0565b5060008385816114ba57fe5b0495945050505050565b600081848411156114e85760405162461bcd60e51b815260040161073d91906116f0565b505050900390565b6001600160a01b03811615610d2f57600061150a826103c0565b6001600160a01b0383166000908152600b6020908152604080832093909355600954600a909152919020555050565b604080518082019091526000808252602082015290565b80356001600160a01b0381168114610f5257600080fd5b600060208284031215611578578081fd5b610f4f8383611550565b60008060408385031215611594578081fd5b61159e8484611550565b946020939093013593505050565b6000602082840312156115bd578081fd5b8135610f4f81611a8c565b6000602082840312156115d9578081fd5b8151610f4f81611a8c565b6000604082840312156115f5578081fd5b6040516040810181811067ffffffffffffffff82111715611614578283fd5b6040528251600f81900b8114611628578283fd5b81526020928301519281019290925250919050565b60006020828403121561164e578081fd5b5035919050565b600060208284031215611666578081fd5b5051919050565b6000806040838503121561167f578182fd5b82359150602083013561169181611a8c565b809150509250929050565b600082516116ae818460208701611a5c565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b600060208252825180602084015261170f816040850160208701611a5c565b601f01601f19169190910160400192915050565b6020808252601f908201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252601b908201527f506572696f6420686173206e6f74206578706972656420796574210000000000604082015260600190565b6020808252601a908201527f5969656c6420636f6c6c656374696f6e20697320706175736564000000000000604082015260600190565b60208082526039908201527f4e6f7420656e6f75676820656d6974746564546f6b656e20617661696c61626c60408201527f6520666f72207969656c6420646973747269627574696f6e2100000000000000606082015260800190565b6020808252601b908201527f4164647265737320686173206265656e20677265796c69737465640000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526056908201527f50726576696f7573207969656c6420706572696f64206d75737420626520636f60408201527f6d706c657465206265666f7265206368616e67696e672074686520647572617460608201527f696f6e20666f7220746865206e657720706572696f6400000000000000000000608082015260a00190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b90815260200190565b9182526001600160a01b0316602082015260400190565b60005b83811015611a77578181015183820152602001611a5f565b83811115611a86576000848401525b50505050565b8015158114610d2f57600080fdfea2646970667358221220064ac031e8ab6576c1db3b89cc2b0b472237abe20d791b9d25f7198cc114e5ac64736f6c63430007010033

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

000000000000000000000000579cea1889991f68acc35ff5c3dd0621ff29b0c90000000000000000000000001bf5457ecaa14ff63cc89efd560e251e814e16ba

-----Decoded View---------------
Arg [0] : _emittedToken (address): 0x579CEa1889991f68aCc35Ff5c3dd0621fF29b0C9
Arg [1] : _hiIQ_address (address): 0x1bF5457eCAa14Ff63CC89EFd560E251e814E16Ba

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000579cea1889991f68acc35ff5c3dd0621ff29b0c9
Arg [1] : 0000000000000000000000001bf5457ecaa14ff63cc89efd560e251e814e16ba


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.