Address io187lwsgrmuy5r99rs63rdz4atl5yrdk9gm9wv0j

Contract Overview

Balance:
0 IOTX

IOTX Value:
$ 0

Token:
Txn Hash
Block
From
To
Value [Txn Fee]
b672e4911500c557813a3760a311b5714766641e29201f77e553f1e816dad688 13341441 2022-03-15 10:13:10 +0000 UTC 2 years ago io1re79z5myg6w8ay8rmhhecs0dkjwrmuv408kz08  IN    Contract: LaunchpadIotexpad 0 IOTX 0.091535
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LaunchpadIotexpad

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license

Contract Source Code (Solidity)

// File @openzeppelin/contracts/token/ERC20/[email protected]

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @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 @openzeppelin/contracts/utils/[email protected]

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}


// File @openzeppelin/contracts/access/[email protected]

// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}


// File @openzeppelin/contracts/utils/[email protected]

// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

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

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

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

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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


// File @openzeppelin/contracts/token/ERC20/utils/[email protected]

// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;


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

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

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

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

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

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

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

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


// File @openzeppelin/contracts/utils/math/[email protected]

// OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)

pragma solidity ^0.8.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.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a / b + (a % b == 0 ? 0 : 1);
    }
}


// File contracts/Staking.sol

pragma solidity 0.8.10;




/**
 *  @dev Structs to store user staking data.
 */
struct Deposit {
    uint256 depositAmount;
    uint256 depositTime;
    uint256 endTime;
    uint32 rate;
    bool paid;
}

/**
 *  @dev Structs to store staking contract basic information
 */
struct StakingContractInfo {
    string name;
    address addr;
    uint32 lockDuration; // in hours
    uint32 rate;
    uint8 withdrawFeePercent;
}

contract Staking is Ownable {
    using SafeERC20 for IERC20;

    error AllowanceTooLow(uint256 current, uint256 required);
    error InsufficientRewardsPleaseAddRewardsOrUseEmergencyExit(
        uint256 available,
        uint256 required
    );
    error MustNotBeZero(string param);
    error NoStakeFoundForUser(address user);
    error NoZeroAddress(string param);
    error MaturityDateExpiredPleaseWithdraw();
    error StakingIsPaused();
    error MustBeLessOrEqual100();

    mapping(address => Deposit) private deposits;
    mapping(address => bool) private hasStaked;

    StakingContractInfo internal contractInfo;
    IERC20 public tokenAddress;
    address public treasury;
    uint256 public stakedBalance;
    uint256 public rewardBalance;
    uint256 public totalParticipants;
    bool public isStopped;
    uint256 public constant INTEREST_RATE_CONVERTER = 100;
    uint256 public constant YEAR_IN_SECONDS = 31536000;

    /**
     *  @notice Emitted when user stakes new value of tokens
     */
    event Staked(
        address indexed token,
        address indexed staker,
        uint256 stakedAmount
    );

    /**
     *  @notice Emitted when user withdraws his deposit
     */
    event PaidOut(
        address indexed token,
        address indexed staker,
        uint256 amount,
        uint256 reward
    );

    /**
     *  @notice Emitted when user withdraws his deposit
     */
    event RateAndLockdurationChanged(
        uint32 newRate,
        uint32 lockDuration,
        uint256 time
    );

    /**
     *  @notice Emitted when new amount of rewards is added to contract
     */
    event RewardsAdded(uint256 amount, uint256 time);

    /**
     *  @notice Emitted when contract is paused/unpaused
     */
    event StakingStatusChanged(bool status, uint256 time);

    /**
     *  @notice Emitted when owner changes withdraw fee
     */
    event WithdrawFeeChanged(uint8 newFee, uint256 time);

    modifier withdrawCheck(address from) {
        if (!hasStaked[from]) revert NoStakeFoundForUser(from);
        _;
    }

    modifier hasAllowance(address allower, uint256 amount) {
        // Make sure the allower has provided the right allowance.
        uint256 ourAllowance = tokenAddress.allowance(allower, address(this));

        if (amount > ourAllowance) revert AllowanceTooLow(ourAllowance, amount);
        _;
    }

    /**
     *   @param name name of the contract
     *   @param tokenAddress_ contract address of the token
     *   @param rate percentage
     *   @param lockDuration duration in hours
     */
    constructor(
        string memory name,
        IERC20 tokenAddress_,
        uint32 rate,
        uint32 lockDuration,
        uint8 withdrawFeePercent,
        address treasury_
    ) {
        if (withdrawFeePercent > 100) revert MustBeLessOrEqual100();
        if (address(tokenAddress_) == address(0)) {
            revert NoZeroAddress("tokenAddress_");
        }
        if (address(treasury_) == address(0)) {
            revert NoZeroAddress("treasury_");
        }

        contractInfo = StakingContractInfo(
            name,
            address(this),
            lockDuration,
            rate,
            withdrawFeePercent
        );

        tokenAddress = tokenAddress_;
        treasury = treasury_;
    }

    /**
     *  @notice owner can change current withdraw fee for stakers
     *  @param percent withdraw fee percentage
     */
    function setWithdrawFee(uint8 percent) external onlyOwner {
        if (percent > 100) revert MustBeLessOrEqual100();

        contractInfo.withdrawFeePercent = percent;

        emit WithdrawFeeChanged(percent, block.timestamp);
    }

    /**
     *  @notice to set new interest rates and lock duration
     *  @param rate New effective interest rate
     *  @param lockDuration Duration of lock for new deposits in hours
     *  @dev lockduration is in hours
     */
    function setRateAndLockduration(uint32 rate, uint32 lockDuration)
        external
        onlyOwner
    {
        contractInfo.rate = rate;
        contractInfo.lockDuration = lockDuration;

        emit RateAndLockdurationChanged(rate, lockDuration, block.timestamp);
    }

    /**
     *  @dev if _status is false contract will be "stopped" and
     *  no new deposits will be allowed
     */
    function changeStakingStatus(bool _status) external onlyOwner {
        isStopped = _status;

        emit StakingStatusChanged(_status, block.timestamp);
    }

    /**
     *  @param amount Amount to be staked
     *  @dev to stake 'amount' value of tokens
     *  once the user has given allowance to the staking contract
     */
    function stake(uint256 amount) external hasAllowance(msg.sender, amount) {
        if (amount == 0) revert MustNotBeZero("amount");
        if (isStopped) revert StakingIsPaused();

        address from = msg.sender;
        if (hasStaked[from] && (block.timestamp >= deposits[from].endTime)) {
            revert MaturityDateExpiredPleaseWithdraw();
        }

        uint256 newAmount;
        if (hasStaked[from]) {
            newAmount =
                amount +
                deposits[from].depositAmount +
                _calculate(from, block.timestamp);
        } else {
            hasStaked[from] = true;

            newAmount = amount;
            totalParticipants += 1;
        }

        deposits[from] = Deposit({
            depositAmount: newAmount,
            depositTime: block.timestamp,
            endTime: block.timestamp +
                uint256(contractInfo.lockDuration) *
                3600,
            rate: contractInfo.rate,
            paid: false
        });

        stakedBalance = stakedBalance + amount;
        tokenAddress.safeTransferFrom(from, address(this), amount);

        emit Staked(address(tokenAddress), from, amount);
    }

    function getUserDeposit(address _userAddress)
        external
        view
        returns (Deposit memory)
    {
        return deposits[_userAddress];
    }

    function getContractInfo()
        public
        view
        returns (StakingContractInfo memory)
    {
        return contractInfo;
    }

    /**
     * @notice Calcule withdraw penalty for user if deposit is withdrawn now
     *
     */
    function calculateWithdrawFee(address user) public view returns (uint256) {
        Deposit storage userDeposit = deposits[user];

        if (block.timestamp > userDeposit.endTime) {
            return 0;
        }

        return
            (userDeposit.depositAmount * contractInfo.withdrawFeePercent) / 100;
    }

    /**
     *  @param rewardAmount rewards to be added to the staking contract
     *  @dev to add rewards to the staking contract
     *  once the allowance is given to this contract for 'rewardAmount' by the user
     */
    function addReward(uint256 rewardAmount)
        external
        hasAllowance(msg.sender, rewardAmount)
    {
        if (rewardAmount == 0) revert MustNotBeZero("rewardAmount");

        rewardBalance = rewardBalance + rewardAmount;

        tokenAddress.safeTransferFrom(msg.sender, address(this), rewardAmount);

        emit RewardsAdded(rewardAmount, block.timestamp);
    }

    function withdraw() external withdrawCheck(msg.sender) {
        address from = msg.sender;
        uint256 endTime = Math.min(block.timestamp, deposits[from].endTime);
        uint256 reward = _calculate(from, endTime);

        if (rewardBalance < reward) {
            revert InsufficientRewardsPleaseAddRewardsOrUseEmergencyExit(
                rewardBalance,
                reward
            );
        }

        _withdraw(from, reward);
    }

    function _withdraw(address from, uint256 reward) private {
        uint256 penalty = calculateWithdrawFee(from);
        uint256 amount = deposits[from].depositAmount;
        uint256 amountAfterPenalty = amount - penalty;

        stakedBalance = stakedBalance - amount;
        rewardBalance = rewardBalance - reward;

        deposits[from].paid = true;
        hasStaked[from] = false;
        totalParticipants -= 1;

        // send user his deposit
        tokenAddress.safeTransfer(from, amountAfterPenalty + reward);
        if (penalty > 0) {
            // send any penalty to treasury wallet
            tokenAddress.safeTransfer(treasury, penalty);
        }

        emit PaidOut(address(tokenAddress), from, amountAfterPenalty, reward);
    }

    /**
     * @notice in case contract runs out of rewards and user is impatient
     */
    function emergencyWithdraw() external withdrawCheck(msg.sender) {
        _withdraw(msg.sender, 0);
    }

    /**
     * @param user User wallet address
     * @return totalRewards Rewards from staking if user waits for maturity/end date
     * @return currentRewards Rewards from staking if user decide to withdraw right now
     */
    function calculateRewards(address user)
        external
        view
        returns (uint256 totalRewards, uint256 currentRewards)
    {
        totalRewards = _calculate(user, deposits[user].endTime);
        currentRewards = _calculate(
            user,
            Math.min(block.timestamp, deposits[user].endTime)
        );
    }

    function _calculate(address from, uint256 endTime)
        private
        view
        returns (uint256 interest)
    {
        if (!hasStaked[from]) return 0;

        Deposit memory deposit = deposits[from];

        uint256 time = endTime - deposit.depositTime;

        interest =
            (deposit.depositAmount * deposit.rate * time) /
            (YEAR_IN_SECONDS * INTEREST_RATE_CONVERTER);

        return interest;
    }
}


// File contracts/Helper.sol

pragma solidity 0.8.10;



struct Tier {
    string name;
    uint256 amountNeeded;
    uint16 weight;
}

contract Helper is Ownable {
    using SafeERC20 for IERC20;
    error TiersShouldBeOrderByAmountNeeded();

    Staking[] public stakingContracts;
    Tier[] public tiers;
    mapping(string => Tier) public tiersMap;

    /**
     * @dev Tiers should be ordered asc by amountNeeded
     * @param _stakingContracts Array of all of staking contracts deployed
     * @param _tiers Array of all staking tiers
     */
    constructor(Staking[] memory _stakingContracts, Tier[] memory _tiers) {
        for (uint8 i = 0; i < _stakingContracts.length; i++) {
            stakingContracts.push(_stakingContracts[i]);
        }

        Tier memory noneTier = Tier("NONE", 0, 0);
        tiers.push(noneTier);
        tiersMap["NONE"] = noneTier;

        Tier memory prevTier = tiers[0];
        for (uint256 i = 0; i < _tiers.length; i++) {
            if (prevTier.amountNeeded >= _tiers[i].amountNeeded) {
                revert TiersShouldBeOrderByAmountNeeded();
            }
            tiers.push(_tiers[i]);
            tiersMap[_tiers[i].name] = _tiers[i];

            prevTier = _tiers[i];
        }
    }

    /**
     * @notice Returns array of all possible tiers including "NONE"
     */
    function getTiersData() external view returns (Tier[] memory) {
        return tiers;
    }

    /**
     * @notice Aggregates data from all staking contracts to determine user tier
     * @param user  Address of the staker
     */
    function getUserStakingData(address user)
        public
        view
        returns (
            string memory tierName,
            uint256 totalAmount,
            Deposit[] memory userDeposits
        )
    {
        userDeposits = new Deposit[](stakingContracts.length);

        for (uint256 i = 0; i < stakingContracts.length; i++) {
            userDeposits[i] = stakingContracts[i].getUserDeposit(user);

            if (
                !userDeposits[i].paid &&
                // wait for at least one block before validating user deposit
                block.timestamp > userDeposits[i].depositTime
            ) {
                totalAmount += userDeposits[i].depositAmount;
            }
        }

        for (uint256 j = tiers.length - 1; j >= 0; j--) {
            if (totalAmount >= tiers[j].amountNeeded) {
                tierName = tiers[j].name;
                break;
            }
        }

        return (tierName, totalAmount, userDeposits);
    }

    /**
     * @notice Aggregates contract info from all staking contracts to make things easier on FE
     */
    function getStakingContractsInfo()
        external
        view
        returns (StakingContractInfo[] memory stakingContractsInfo)
    {
        stakingContractsInfo = new StakingContractInfo[](
            stakingContracts.length
        );

        for (uint256 i = 0; i < stakingContracts.length; i++) {
            stakingContractsInfo[i] = stakingContracts[i].getContractInfo();
        }

        return stakingContractsInfo;
    }

    // @notice rescue any token accidentally sent to this contract
    function emergencyWithdrawToken(IERC20 token) external onlyOwner {
        token.safeTransfer(msg.sender, token.balanceOf(address(this)));
    }

    // @dev used for snapshot before IDO
    function getAllocationPerUser(
        address[] calldata users,
        uint256 totalAllocation
    )
        external
        view
        returns (uint256[] memory allocations, uint256 blockNumber)
    {
        allocations = new uint256[](users.length);
        uint16[] memory userWeights = new uint16[](users.length);
        uint256 totalWeight;

        for (uint256 i = 0; i < users.length; i++) {
            (string memory tier, , ) = getUserStakingData(users[i]);
            userWeights[i] = tiersMap[tier].weight;
            totalWeight += userWeights[i];
        }

        for (uint256 i = 0; i < users.length; i++) {
            allocations[i] = (userWeights[i] * totalAllocation) / totalWeight;
        }

        return (allocations, block.number);
    }
}


// File contracts/LaunchpadIotexpad.sol

pragma solidity 0.8.10;


/**
 * @title Launchpad
 * @dev 4 rounds : 0 = not open, 1 = guaranty round, 2 = fcfs, 3 = sale finished
 */
contract LaunchpadIotexpad is Ownable {
    using SafeERC20 for IERC20;

    error FunctionInvalidAtThisRound(uint8 currentRound, uint8 requiredRound);
    error UsersAndAllocationsArrayNeedToBeSameLength();
    error NotWhitelistedOrAlreadyFullyParticipated();
    error CannotMatchTiersToAllowances();
    error AmountTooHigh();
    error SaleDateCannotBeInThePast();
    error SaleAlreadyEnded();
    error SaleHasNotEnded();
    error SoldOut();
    error MustNotBeZero(string param);

    uint256 public constant ROUND1_ALLOCATION = 200e6;
    uint256 public constant ROUND2_ALLOCATION = 500e6;

    uint256 public saleStartDate;
    uint256 public immutable tokenTarget;
    uint256 public immutable stableTarget;
    uint256 public immutable multiplier; // ratio between tokenTarget and stableTarget * 100
    uint256 public immutable round1Duration = 2 hours;
    bool public endUnlocked;
    uint256 public totalOwed;
    uint256 public stableRaised;

    IERC20 public immutable stablecoin;

    mapping(address => bool) public whitelist;
    mapping(address => bool) public hasParticipated;
    mapping(address => uint256) public contributedRound1;
    mapping(address => uint256) public contributedRound2;
    address[] public participants;

    event SaleWillStart(uint256 startTimestamp);
    event SaleEnded(uint256 endTimestamp);
    event PoolProgress(uint256 stableRaised, uint256 stableTarget);

    modifier atRound(uint8 requiredRound) {
        uint8 currentRound = roundNumber();
        if (currentRound != requiredRound) {
            revert FunctionInvalidAtThisRound(currentRound, requiredRound);
        }
        _;
    }

    constructor(
        uint256 _tokenTarget,
        uint256 _stableTarget,
        uint256 _saleStartDate,
        IERC20 _stableCoinAddress
    ) {
        if (_stableTarget == 0) revert MustNotBeZero("_stableTarget");
        if (_tokenTarget == 0) revert MustNotBeZero("_tokenTarget");

        tokenTarget = _tokenTarget;
        stableTarget = _stableTarget;
        saleStartDate = _saleStartDate;
        multiplier = (tokenTarget * 100) / stableTarget;
        stablecoin = _stableCoinAddress;
    }

    function setSaleStartDate(uint256 _saleStartDate)
        external
        onlyOwner
        atRound(0)
    {
        if (block.timestamp - 60 > _saleStartDate) {
            revert SaleDateCannotBeInThePast();
        }

        saleStartDate = _saleStartDate;

        emit SaleWillStart(block.timestamp);
    }

    function finishSale() external onlyOwner {
        if (endUnlocked) revert SaleAlreadyEnded();

        endUnlocked = true;
        emit SaleEnded(block.timestamp);
    }

    // whitelisting
    function addWhitelistedAddress(address user) external onlyOwner {
        _addWhitelistedAddress(user);
    }

    function addMultipleWhitelistedAddresses(address[] calldata users)
        external
        onlyOwner
    {
        for (uint256 i = 0; i < users.length; i++) {
            _addWhitelistedAddress(users[i]);
        }
    }

    function _addWhitelistedAddress(address user) private {
        whitelist[user] = true;
    }

    function removeWhitelistedAddress(address user) external onlyOwner {
        whitelist[user] = false;
    }

    function withdrawStable() external onlyOwner {
        if (!endUnlocked) revert SaleHasNotEnded();

        stablecoin.safeTransfer(
            msg.sender,
            stablecoin.balanceOf(address(this))
        );
    }

    function getUserContribution(address user)
        external
        view
        returns (uint256 contributedStable, uint256 tokensToReceive)
    {
        contributedStable = contributedRound1[user] + contributedRound2[user];
        tokensToReceive = (contributedStable * multiplier) / 100;
    }

    // @notice rescue any token accidentally sent to this contract
    function emergencyWithdrawToken(IERC20 token)
        external
        onlyOwner
        atRound(3)
    {
        token.safeTransfer(msg.sender, token.balanceOf(address(this)));
    }

    function buyRound1(uint256 stableAmount) external atRound(1) {
        uint256 allowance = round1Allowance(msg.sender);

        _checkAllowance(allowance, stableAmount);

        _registerParticipation(msg.sender);

        contributedRound1[msg.sender] += stableAmount;

        _buy(stableAmount);
    }

    function buyRound2(uint256 stableAmount) external atRound(2) {
        uint256 allowance = round2Allowance(msg.sender);

        _checkAllowance(allowance, stableAmount);

        _registerParticipation(msg.sender);

        contributedRound2[msg.sender] += stableAmount;

        _buy(stableAmount);
    }

    function _checkAllowance(uint256 allowance, uint256 amount) private pure {
        if (allowance == 0) revert NotWhitelistedOrAlreadyFullyParticipated();

        if (amount > allowance) revert AmountTooHigh();
    }

    function _registerParticipation(address user) private {
        if (!hasParticipated[user]) {
            hasParticipated[user] = true;
            participants.push(user);
        }
    }

    function _buy(uint256 stableAmount) private {
        stablecoin.safeTransferFrom(msg.sender, address(this), stableAmount);

        uint256 tokenAmount = (stableAmount * multiplier) / 100;

        totalOwed += tokenAmount;
        if (totalOwed > tokenTarget) {
            revert SoldOut();
        }

        stableRaised += stableAmount;

        if (stableRaised > stableTarget) {
            revert SoldOut();
        }

        emit PoolProgress(stableRaised, stableTarget);

        if (stableRaised == stableTarget) {
            endUnlocked = true;
            emit SaleEnded(block.timestamp);
        }
    }

    function roundNumber() public view returns (uint8 _roundNumber) {
        if (endUnlocked) return 3;

        if (block.timestamp < saleStartDate || saleStartDate == 0) {
            return 0;
        }

        if (
            block.timestamp >= saleStartDate &&
            block.timestamp < saleStartDate + round1Duration
        ) {
            return 1;
        }

        if (block.timestamp >= (saleStartDate + round1Duration)) {
            return 2;
        }
    }

    function getNumberOfParticipants() public view returns (uint256) {
        return participants.length;
    }

    function isWhitelisted(address user) public view returns (bool) {
        return whitelist[user];
    }

    function round1Allowance(address user) public view returns (uint256) {
        if (!whitelist[user]) return 0;

        return ROUND1_ALLOCATION - contributedRound1[user];
    }

    function round2Allowance(address user) public view returns (uint256) {
        return ROUND2_ALLOCATION - contributedRound2[user];
    }
}

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_tokenTarget","type":"uint256"},{"internalType":"uint256","name":"_stableTarget","type":"uint256"},{"internalType":"uint256","name":"_saleStartDate","type":"uint256"},{"internalType":"contract IERC20","name":"_stableCoinAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AmountTooHigh","type":"error"},{"inputs":[],"name":"CannotMatchTiersToAllowances","type":"error"},{"inputs":[{"internalType":"uint8","name":"currentRound","type":"uint8"},{"internalType":"uint8","name":"requiredRound","type":"uint8"}],"name":"FunctionInvalidAtThisRound","type":"error"},{"inputs":[{"internalType":"string","name":"param","type":"string"}],"name":"MustNotBeZero","type":"error"},{"inputs":[],"name":"NotWhitelistedOrAlreadyFullyParticipated","type":"error"},{"inputs":[],"name":"SaleAlreadyEnded","type":"error"},{"inputs":[],"name":"SaleDateCannotBeInThePast","type":"error"},{"inputs":[],"name":"SaleHasNotEnded","type":"error"},{"inputs":[],"name":"SoldOut","type":"error"},{"inputs":[],"name":"UsersAndAllocationsArrayNeedToBeSameLength","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"stableRaised","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stableTarget","type":"uint256"}],"name":"PoolProgress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"name":"SaleEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"startTimestamp","type":"uint256"}],"name":"SaleWillStart","type":"event"},{"inputs":[],"name":"ROUND1_ALLOCATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROUND2_ALLOCATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"users","type":"address[]"}],"name":"addMultipleWhitelistedAddresses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"addWhitelistedAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"stableAmount","type":"uint256"}],"name":"buyRound1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"stableAmount","type":"uint256"}],"name":"buyRound2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"contributedRound1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"contributedRound2","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"emergencyWithdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endUnlocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finishSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getNumberOfParticipants","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserContribution","outputs":[{"internalType":"uint256","name":"contributedStable","type":"uint256"},{"internalType":"uint256","name":"tokensToReceive","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"hasParticipated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"multiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"participants","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"removeWhitelistedAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"round1Allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"round1Duration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"round2Allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roundNumber","outputs":[{"internalType":"uint8","name":"_roundNumber","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"saleStartDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_saleStartDate","type":"uint256"}],"name":"setSaleStartDate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stableRaised","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stableTarget","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stablecoin","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenTarget","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalOwed","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":"whitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawStable","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Contract Creation Code

608060405234801561001057600080fd5b50600436106102065760003560e01c80638da5cb5b1161011a578063c80c28a2116100ad578063e7fa9f7d1161007c578063e7fa9f7d146104e0578063e9cbd822146104e9578063f1f6bf0f14610510578063f2fde38b14610523578063f8757ba31461053657600080fd5b8063c80c28a214610485578063ca54fbe81461048d578063cd344b33146104ad578063d20ce48b146104c057600080fd5b8063b479c521116100e9578063b479c52114610427578063b4fb3ee31461042f578063bb8b2b4714610452578063be751d3a1461047a57600080fd5b80638da5cb5b146103c45780638f86f5ea146103d55780639b19251a146103dd578063abfea13d1461040057600080fd5b80634e2786fb1161019d578063758a490f1161016c578063758a490f14610363578063782e1e6c146103765780637ff081a21461039d578063803dd109146103b05780638973123c146103bb57600080fd5b80634e2786fb1461031b578063524c9aa414610335578063530cd5ab14610348578063715018a61461035b57600080fd5b806329975b43116101d957806329975b431461028a57806335c1d3491461029d5780633af32abf146102c85780633ba94b7a146102f457600080fd5b80631af032031461020b5780631b3ed722146102205780631d8e59d91461025a5780631dfd8baf14610277575b600080fd5b61021e610219366004611384565b61053f565b005b6102477f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b6002546102679060ff1681565b6040519015158152602001610251565b610247610285366004611384565b610637565b61021e610298366004611384565b610664565b6102b06102ab3660046113a1565b61069a565b6040516001600160a01b039091168152602001610251565b6102676102d6366004611384565b6001600160a01b031660009081526005602052604090205460ff1690565b6102477f000000000000000000000000000000000000000000000000000000000000000081565b6103236106c4565b60405160ff9091168152602001610251565b61021e6103433660046113ba565b610779565b61021e610356366004611384565b6107ef565b61021e61083a565b61021e6103713660046113a1565b610870565b6102477f000000000000000000000000000000000000000000000000000000000000000081565b61021e6103ab3660046113a1565b610905565b610247631dcd650081565b61024760015481565b6000546001600160a01b03166102b0565b61021e6109d7565b6102676103eb366004611384565b60056020526000908152604090205460ff1681565b6102477f000000000000000000000000000000000000000000000000000000000000000081565b61021e610a6e565b61026761043d366004611384565b60066020526000908152604090205460ff1681565b610465610460366004611384565b610b7a565b60408051928352602083019190915201610251565b610247630bebc20081565b600954610247565b61024761049b366004611384565b60076020526000908152604090205481565b61021e6104bb3660046113a1565b610be8565b6102476104ce366004611384565b60086020526000908152604090205481565b61024760035481565b6102b07f000000000000000000000000000000000000000000000000000000000000000081565b61024761051e366004611384565b610c68565b61021e610531366004611384565b610cb7565b61024760045481565b6000546001600160a01b031633146105725760405162461bcd60e51b81526004016105699061142f565b60405180910390fd5b6003600061057e6106c4565b90508160ff168160ff16146105b357604051631856783960e11b815260ff808316600483015283166024820152604401610569565b6040516370a0823160e01b81523060048201526106329033906001600160a01b038616906370a0823190602401602060405180830381865afa1580156105fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106219190611464565b6001600160a01b0386169190610d4f565b505050565b6001600160a01b03811660009081526008602052604081205461065e90631dcd6500611493565b92915050565b6000546001600160a01b0316331461068e5760405162461bcd60e51b81526004016105699061142f565b61069781610db2565b50565b600981815481106106aa57600080fd5b6000918252602090912001546001600160a01b0316905081565b60025460009060ff16156106d85750600390565b6001544210806106e85750600154155b156106f35750600090565b600154421015801561073157507f000000000000000000000000000000000000000000000000000000000000000060015461072e91906114aa565b42105b1561073c5750600190565b7f000000000000000000000000000000000000000000000000000000000000000060015461076a91906114aa565b42106107765750600290565b90565b6000546001600160a01b031633146107a35760405162461bcd60e51b81526004016105699061142f565b60005b81811015610632576107dd8383838181106107c3576107c36114c2565b90506020020160208101906107d89190611384565b610db2565b806107e7816114d8565b9150506107a6565b6000546001600160a01b031633146108195760405162461bcd60e51b81526004016105699061142f565b6001600160a01b03166000908152600560205260409020805460ff19169055565b6000546001600160a01b031633146108645760405162461bcd60e51b81526004016105699061142f565b61086e6000610dd6565b565b6002600061087c6106c4565b90508160ff168160ff16146108b157604051631856783960e11b815260ff808316600483015283166024820152604401610569565b60006108bc33610637565b90506108c88185610e26565b6108d133610e69565b33600090815260086020526040812080548692906108f09084906114aa565b909155506108ff905084610eef565b50505050565b6000546001600160a01b0316331461092f5760405162461bcd60e51b81526004016105699061142f565b60008061093a6106c4565b90508160ff168160ff161461096f57604051631856783960e11b815260ff808316600483015283166024820152604401610569565b8261097b603c42611493565b111561099a57604051631ddc645760e21b815260040160405180910390fd5b60018390556040514281527fbd497855048a1edceda7bc0b52200b6b4fd5025fc634396bbc7ce4491408414e9060200160405180910390a1505050565b6000546001600160a01b03163314610a015760405162461bcd60e51b81526004016105699061142f565b60025460ff1615610a2557604051637ce54feb60e11b815260040160405180910390fd5b6002805460ff191660011790556040517f94bb74a9473ae4063ec1e73dc3e35fd4b5abe9cc1e43ad0db84e5358559ccd5a90610a649042815260200190565b60405180910390a1565b6000546001600160a01b03163314610a985760405162461bcd60e51b81526004016105699061142f565b60025460ff16610abb576040516313365f7760e01b815260040160405180910390fd5b6040516370a0823160e01b815230600482015261086e9033906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015610b25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b499190611464565b6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169190610d4f565b6001600160a01b03811660009081526008602090815260408083205460079092528220548291610ba9916114aa565b91506064610bd77f0000000000000000000000000000000000000000000000000000000000000000846114f3565b610be19190611512565b9050915091565b60016000610bf46106c4565b90508160ff168160ff1614610c2957604051631856783960e11b815260ff808316600483015283166024820152604401610569565b6000610c3433610c68565b9050610c408185610e26565b610c4933610e69565b33600090815260076020526040812080548692906108f09084906114aa565b6001600160a01b03811660009081526005602052604081205460ff16610c9057506000919050565b6001600160a01b03821660009081526007602052604090205461065e90630bebc200611493565b6000546001600160a01b03163314610ce15760405162461bcd60e51b81526004016105699061142f565b6001600160a01b038116610d465760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610569565b61069781610dd6565b6040516001600160a01b03831660248201526044810182905261063290849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526110e2565b6001600160a01b03166000908152600560205260409020805460ff19166001179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b81610e4457604051637c2b677560e11b815260040160405180910390fd5b81811115610e655760405163fd7850ad60e01b815260040160405180910390fd5b5050565b6001600160a01b03811660009081526006602052604090205460ff16610697576001600160a01b03166000818152600660205260408120805460ff191660019081179091556009805491820181559091527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0180546001600160a01b0319169091179055565b610f246001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163330846111b4565b60006064610f527f0000000000000000000000000000000000000000000000000000000000000000846114f3565b610f5c9190611512565b90508060036000828254610f7091906114aa565b90915550506003547f00000000000000000000000000000000000000000000000000000000000000001015610fb8576040516352df9fe560e01b815260040160405180910390fd5b8160046000828254610fca91906114aa565b90915550506004547f00000000000000000000000000000000000000000000000000000000000000001015611012576040516352df9fe560e01b815260040160405180910390fd5b600454604080519182527f000000000000000000000000000000000000000000000000000000000000000060208301527f357502b34fc8f232b9a7e025b581e7e28e54f4277ecf4171ae7e4ac193ea25a7910160405180910390a17f00000000000000000000000000000000000000000000000000000000000000006004541415610e65576002805460ff191660011790556040517f94bb74a9473ae4063ec1e73dc3e35fd4b5abe9cc1e43ad0db84e5358559ccd5a906110d69042815260200190565b60405180910390a15050565b6000611137826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111ec9092919063ffffffff16565b80519091501561063257808060200190518101906111559190611534565b6106325760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610569565b6040516001600160a01b03808516602483015283166044820152606481018290526108ff9085906323b872dd60e01b90608401610d7b565b60606111fb8484600085611205565b90505b9392505050565b6060824710156112665760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610569565b6001600160a01b0385163b6112bd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610569565b600080866001600160a01b031685876040516112d99190611582565b60006040518083038185875af1925050503d8060008114611316576040519150601f19603f3d011682016040523d82523d6000602084013e61131b565b606091505b509150915061132b828286611336565b979650505050505050565b606083156113455750816111fe565b8251156113555782518084602001fd5b8160405162461bcd60e51b8152600401610569919061159e565b6001600160a01b038116811461069757600080fd5b60006020828403121561139657600080fd5b81356111fe8161136f565b6000602082840312156113b357600080fd5b5035919050565b600080602083850312156113cd57600080fd5b823567ffffffffffffffff808211156113e557600080fd5b818501915085601f8301126113f957600080fd5b81358181111561140857600080fd5b8660208260051b850101111561141d57600080fd5b60209290920196919550909350505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561147657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000828210156114a5576114a561147d565b500390565b600082198211156114bd576114bd61147d565b500190565b634e487b7160e01b600052603260045260246000fd5b60006000198214156114ec576114ec61147d565b5060010190565b600081600019048311821515161561150d5761150d61147d565b500290565b60008261152f57634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561154657600080fd5b815180151581146111fe57600080fd5b60005b83811015611571578181015183820152602001611559565b838111156108ff5750506000910152565b60008251611594818460208701611556565b9190910192915050565b60208152600082518060208401526115bd816040850160208701611556565b601f01601f1916919091016040019291505056fea2646970667358221220f514d5febf248e280e7b155be62a9b97db2562c9e986fbcfac614165e605355564736f6c634300080a0033

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