ETH Price: $3,480.41 (+2.12%)
Gas: 6 Gwei

Contract

0x24Ca300577b16096824680A10672e9fDaD734D47
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Claim202111252024-07-01 10:39:117 hrs ago1719830351IN
0x24Ca3005...DaD734D47
0 ETH0.000284152.70377816
Claim202044762024-06-30 12:23:1129 hrs ago1719750191IN
0x24Ca3005...DaD734D47
0 ETH0.000451563.69541508
Claim202000022024-06-29 21:23:3544 hrs ago1719696215IN
0x24Ca3005...DaD734D47
0 ETH0.000189041.79880302
Claim201973332024-06-29 12:26:232 days ago1719663983IN
0x24Ca3005...DaD734D47
0 ETH0.000307852.51936199
Claim201966532024-06-29 10:09:352 days ago1719655775IN
0x24Ca3005...DaD734D47
0 ETH0.000219232.08603078
Claim201964832024-06-29 9:35:232 days ago1719653723IN
0x24Ca3005...DaD734D47
0 ETH0.000214392.04001208
Claim201950122024-06-29 4:39:232 days ago1719635963IN
0x24Ca3005...DaD734D47
0 ETH0.000172451.64090665
Claim201933312024-06-28 23:00:472 days ago1719615647IN
0x24Ca3005...DaD734D47
0 ETH0.000220652.09954807
Claim201923162024-06-28 19:36:352 days ago1719603395IN
0x24Ca3005...DaD734D47
0 ETH0.00037753.59196282
Claim201890472024-06-28 8:39:593 days ago1719563999IN
0x24Ca3005...DaD734D47
0 ETH0.000361553.44026327
Claim201879452024-06-28 4:58:113 days ago1719550691IN
0x24Ca3005...DaD734D47
0 ETH0.000220022.50040712
Claim201848932024-06-27 18:43:593 days ago1719513839IN
0x24Ca3005...DaD734D47
0 ETH0.000677.61407984
Claim201821262024-06-27 9:27:354 days ago1719480455IN
0x24Ca3005...DaD734D47
0 ETH0.000580485.5233537
Claim201785882024-06-26 21:37:114 days ago1719437831IN
0x24Ca3005...DaD734D47
0 ETH0.000648936.17471487
Claim201780692024-06-26 19:52:354 days ago1719431555IN
0x24Ca3005...DaD734D47
0 ETH0.000870689.89461471
Claim201775222024-06-26 18:02:114 days ago1719424931IN
0x24Ca3005...DaD734D47
0 ETH0.001008069.59180294
Claim201751292024-06-26 10:00:595 days ago1719396059IN
0x24Ca3005...DaD734D47
0 ETH0.000388743.18131495
Claim201608712024-06-24 10:13:237 days ago1719224003IN
0x24Ca3005...DaD734D47
0 ETH0.000776348.82250933
Claim201605382024-06-24 9:06:117 days ago1719219971IN
0x24Ca3005...DaD734D47
0 ETH0.000517494.92400654
Claim201586832024-06-24 2:52:237 days ago1719197543IN
0x24Ca3005...DaD734D47
0 ETH0.00024122.74112919
Claim201528612024-06-23 7:18:478 days ago1719127127IN
0x24Ca3005...DaD734D47
0 ETH0.000354522.90124483
Claim201515652024-06-23 2:58:118 days ago1719111491IN
0x24Ca3005...DaD734D47
0 ETH0.000243192.31399083
Claim201496232024-06-22 20:27:358 days ago1719088055IN
0x24Ca3005...DaD734D47
0 ETH0.000240732.29065941
Claim201483182024-06-22 16:04:599 days ago1719072299IN
0x24Ca3005...DaD734D47
0 ETH0.000458163.74938717
Claim201477272024-06-22 14:05:239 days ago1719065123IN
0x24Ca3005...DaD734D47
0 ETH0.000445444.23841545
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xe420f94a...f5bc9364f
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Vesting

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 8 : Vesting.sol
// Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity 0.8.15;

import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '../interfaces/ISQToken.sol';

contract Vesting is Ownable {
    using SafeERC20 for IERC20;

    /// @notice Vesting plan
    struct VestingPlan {
        uint256 lockPeriod;
        uint256 vestingPeriod;
        uint256 initialUnlockPercent;
    }

    /// @notice token for vesting
    address public token;
    /// @notice the minted token for vesting with 1:1 ratio
    address public vtToken;
    /// @notice start date for this vesting contract
    uint256 public vestingStartDate;
    /// @notice total allocation amount for all users and plans
    uint256 public totalAllocation;
    /// @notice total claimed amount for all users and plans
    uint256 public totalClaimed;
    /// @notice vesting plans
    VestingPlan[] public plans;

    /// @notice allovation ammout for user by planId: planId => user => amount
    mapping(uint256 => mapping(address => uint256)) public allocations;
    /// @notice claimed amount for user by planId: planId => user => amount
    mapping(uint256 => mapping(address => uint256)) public claimed;

    /**
     * @dev Emitted when a new vesting plan is added
     */
    event VestingPlanAdded(
        uint256 planId,
        uint256 lockPeriod,
        uint256 vestingPeriod,
        uint256 initialUnlockPercent
    );
    /**
     * @dev Emitted when a new vesting allocation is added to a user by planId
     */
    event VestingAllocated(address indexed user, uint256 planId, uint256 allocation);
    /**
     * @dev Emitted when a user claims vested tokens
     */
    event VestingClaimed(address indexed user, uint256 planId, uint256 amount);

    constructor(address _token, address _vtToken) Ownable() {
        require(_token != address(0x0), 'G009');
        require(_vtToken != address(0x0), 'G009');
        vtToken = _vtToken;
        token = _token;
    }

    function addVestingPlan(
        uint256 _lockPeriod,
        uint256 _vestingPeriod,
        uint256 _initialUnlockPercent
    ) public onlyOwner {
        require(_initialUnlockPercent <= 100, 'V001');
        plans.push(VestingPlan(_lockPeriod, _vestingPeriod, _initialUnlockPercent));

        // emit event for vesting plan addition
        emit VestingPlanAdded(plans.length - 1, _lockPeriod, _vestingPeriod, _initialUnlockPercent);
    }

    function _allocateVesting(address addr, uint256 planId, uint256 allocation) internal {
        require(addr != address(0x0), 'V002');
        require(allocations[planId][addr] == 0, 'V003');
        require(allocation > 0, 'V004');
        require(planId < plans.length, 'V013');

        //        userPlanId[addr] = planId;
        allocations[planId][addr] = allocation;

        ISQToken(vtToken).mint(addr, allocation);

        emit VestingAllocated(addr, planId, allocation);
    }

    function batchAllocateVesting(
        uint256[] calldata _planIds,
        address[] calldata _addrs,
        uint256[] calldata _allocations
    ) external onlyOwner {
        require(_addrs.length > 0, 'V005');
        require(_addrs.length == _allocations.length, 'V006');
        require(_addrs.length == _planIds.length, 'V006');

        uint256 _total;
        for (uint256 i = 0; i < _addrs.length; i++) {
            _allocateVesting(_addrs[i], _planIds[i], _allocations[i]);

            unchecked {
                _total += _allocations[i];
            }
        }

        unchecked {
            totalAllocation += _total;
        }
    }

    function withdrawAllByAdmin() external onlyOwner {
        uint256 amount = IERC20(token).balanceOf(address(this));
        require(IERC20(token).transfer(msg.sender, amount), 'V008');
    }

    function startVesting(uint256 _vestingStartDate) external onlyOwner {
        require(block.timestamp < _vestingStartDate, 'V009');

        vestingStartDate = _vestingStartDate;

        uint256 amount = IERC20(token).balanceOf(address(this));
        require(amount == totalAllocation, 'V010');

        transferOwnership(address(this));
    }

    function claim(uint256 planId) external {
        _claim(planId, msg.sender);
    }

    function claimFor(uint256 planId, address account) external {
        _claim(planId, account);
    }

    function _claim(uint256 planId, address account) internal {
        require(planId < plans.length, 'V013');
        require(allocations[planId][account] != 0, 'V011');

        uint256 amount = claimableAmount(planId, account);
        require(amount > 0, 'V012');

        ISQToken(vtToken).burnFrom(account, amount);
        claimed[planId][account] += amount;
        totalClaimed += amount;

        require(claimed[planId][account] <= allocations[planId][account], 'V012');

        require(IERC20(token).transfer(account, amount), 'V008');
        emit VestingClaimed(account, planId, amount);
    }

    function claimableAmount(uint256 planId, address user) public view returns (uint256) {
        uint256 amount = unlockedAmount(planId, user);
        uint256 vtSQTAmount = IERC20(vtToken).balanceOf(user);
        return vtSQTAmount >= amount ? amount : vtSQTAmount;
    }

    function unlockedAmount(uint256 planId, address user) public view returns (uint256) {
        // vesting start date is not set or allocation is empty
        if (vestingStartDate == 0 || allocations[planId][user] == 0) {
            return 0;
        }

        VestingPlan memory plan = plans[planId];
        uint256 planStartDate = vestingStartDate + plan.lockPeriod;

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

        // no versting period or vesting period passed
        uint256 planCompleteDate = planStartDate + plan.vestingPeriod;
        if (plan.vestingPeriod == 0 || block.timestamp > planCompleteDate) {
            return allocations[planId][user] - claimed[planId][user];
        }

        // druring plan period
        uint256 vestedPeriod = block.timestamp - planStartDate;
        uint256 initialAmount = (allocations[planId][user] * plan.initialUnlockPercent) / 100;
        uint256 vestingTokens = allocations[planId][user] - initialAmount;
        return
            initialAmount +
            (vestingTokens * vestedPeriod) /
            plan.vestingPeriod -
            claimed[planId][user];
    }

    function plansLength() external view returns (uint256) {
        return plans.length;
    }
}

File 2 of 8 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

File 3 of 8 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 4 of 8 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 5 of 8 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

File 6 of 8 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

File 8 of 8 : ISQToken.sol
// Copyright (C) 2020-2024 SubQuery Pte Ltd authors & contributors
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity 0.8.15;

interface ISQToken {
    function mint(address destination, uint256 amount) external;

    function burn(uint256 amount) external;

    function burnFrom(address account, uint256 amount) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_vtToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"planId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"allocation","type":"uint256"}],"name":"VestingAllocated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"planId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"VestingClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"planId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lockPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"vestingPeriod","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"initialUnlockPercent","type":"uint256"}],"name":"VestingPlanAdded","type":"event"},{"inputs":[{"internalType":"uint256","name":"_lockPeriod","type":"uint256"},{"internalType":"uint256","name":"_vestingPeriod","type":"uint256"},{"internalType":"uint256","name":"_initialUnlockPercent","type":"uint256"}],"name":"addVestingPlan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"allocations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_planIds","type":"uint256[]"},{"internalType":"address[]","name":"_addrs","type":"address[]"},{"internalType":"uint256[]","name":"_allocations","type":"uint256[]"}],"name":"batchAllocateVesting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"planId","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"planId","type":"uint256"},{"internalType":"address","name":"account","type":"address"}],"name":"claimFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"planId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"claimableAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"claimed","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":"plans","outputs":[{"internalType":"uint256","name":"lockPeriod","type":"uint256"},{"internalType":"uint256","name":"vestingPeriod","type":"uint256"},{"internalType":"uint256","name":"initialUnlockPercent","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"plansLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_vestingStartDate","type":"uint256"}],"name":"startVesting","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalClaimed","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":"uint256","name":"planId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"unlockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestingStartDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vtToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawAllByAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806379203dc4116100ad578063d54ad2a111610071578063d54ad2a11461028f578063f2ab3a5a14610298578063f2fde38b146102ab578063f311df8e146102be578063fc0c546a146102d157600080fd5b806379203dc41461022c5780638da5cb5b1461023557806394a368d214610246578063b16206161461024e578063c0b793e71461027c57600080fd5b80632e4313c4116100f45780632e4313c4146101e2578063379607f5146101f55780633a4dc2fb14610208578063579acacc1461021b578063715018a61461022457600080fd5b806310ee3f0014610131578063120aa877146101465780631c3a964f1461018457806326837aa8146101af57806327c0cdab146101b7575b600080fd5b61014461013f3660046110a8565b6102e4565b005b6101716101543660046110a8565b600860209081526000928352604080842090915290825290205481565b6040519081526020015b60405180910390f35b6101716101923660046110a8565b600760209081526000928352604080842090915290825290205481565b600654610171565b6002546101ca906001600160a01b031681565b6040516001600160a01b03909116815260200161017b565b6101446101f0366004611120565b6102f2565b6101446102033660046111ba565b610458565b6101446102163660046111ba565b610465565b61017160035481565b61014461055c565b61017160045481565b6000546001600160a01b03166101ca565b610144610570565b61026161025c3660046111ba565b610690565b6040805193845260208401929092529082015260600161017b565b61014461028a3660046111d3565b6106c3565b61017160055481565b6101716102a63660046110a8565b610802565b6101446102b93660046111ff565b610a07565b6101716102cc3660046110a8565b610a7d565b6001546101ca906001600160a01b031681565b6102ee8282610b19565b5050565b6102fa610e11565b826103395760405162461bcd60e51b8152600401610330906020808252600490820152635630303560e01b604082015260600190565b60405180910390fd5b8281146103715760405162461bcd60e51b8152600401610330906020808252600490820152632b18181b60e11b604082015260600190565b8285146103a95760405162461bcd60e51b8152600401610330906020808252600490820152632b18181b60e11b604082015260600190565b6000805b84811015610446576104168686838181106103ca576103ca611221565b90506020020160208101906103df91906111ff565b8989848181106103f1576103f1611221565b9050602002013586868581811061040a5761040a611221565b90506020020135610e6b565b83838281811061042857610428611221565b9050602002013582019150808061043e9061124d565b9150506103ad565b50600480549091019055505050505050565b6104628133610b19565b50565b61046d610e11565b8042106104a55760405162461bcd60e51b8152600401610330906020808252600490820152635630303960e01b604082015260600190565b60038190556001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156104f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105179190611266565b905060045481146105535760405162461bcd60e51b8152600401610330906020808252600490820152630563031360e41b604082015260600190565b6102ee30610a07565b610564610e11565b61056e600061103c565b565b610578610e11565b6001546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa1580156105c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e59190611266565b60015460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015610637573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065b919061127f565b6104625760405162461bcd60e51b8152600401610330906020808252600490820152630ac6060760e31b604082015260600190565b600681815481106106a057600080fd5b600091825260209091206003909102018054600182015460029092015490925083565b6106cb610e11565b60648111156107055760405162461bcd60e51b8152600401610330906020808252600490820152635630303160e01b604082015260600190565b60408051606081018252848152602081018481529181018381526006805460018082018355600083905293517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f60039092029182015593517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d4085015590517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d419093019290925590547fca5df404991e1c363c1fc3388c80b7ef8238e1c7ce3100ccf9e311af8f5e38a8916107d8916112a1565b604080519182526020820186905281018490526060810183905260800160405180910390a1505050565b600060035460001480610835575060008381526007602090815260408083206001600160a01b0386168452909152902054155b1561084257506000610a01565b60006006848154811061085757610857611221565b6000918252602080832060408051606081018252600394850290920180548084526001820154948401949094526002015490820152915491935061089a916112b8565b90508042116108ae57600092505050610a01565b60008260200151826108c091906112b8565b90508260200151600014806108d457508042115b156109255760008681526008602090815260408083206001600160a01b038916808552908352818420548a85526007845282852091855292529091205461091b91906112a1565b9350505050610a01565b600061093183426112a1565b60408086015160008a8152600760209081528382206001600160a01b038c1683529052918220549293509091606491610969916112d0565b61097391906112ef565b60008981526007602090815260408083206001600160a01b038c168452909152812054919250906109a59083906112a1565b60008a81526008602090815260408083206001600160a01b038d16845282529091205490880151919250906109da85846112d0565b6109e491906112ef565b6109ee90846112b8565b6109f891906112a1565b96505050505050505b92915050565b610a0f610e11565b6001600160a01b038116610a745760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610330565b6104628161103c565b600080610a8a8484610802565b6002546040516370a0823160e01b81526001600160a01b038681166004830152929350600092909116906370a0823190602401602060405180830381865afa158015610ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610afe9190611266565b905081811015610b0e5780610b10565b815b95945050505050565b6006548210610b535760405162461bcd60e51b8152600401610330906020808252600490820152635630313360e01b604082015260600190565b60008281526007602090815260408083206001600160a01b03851684529091528120549003610bad5760405162461bcd60e51b8152600401610330906020808252600490820152635630313160e01b604082015260600190565b6000610bb98383610a7d565b905060008111610bf45760405162461bcd60e51b8152600401610330906020808252600490820152632b18189960e11b604082015260600190565b60025460405163079cc67960e41b81526001600160a01b03848116600483015260248201849052909116906379cc679090604401600060405180830381600087803b158015610c4257600080fd5b505af1158015610c56573d6000803e3d6000fd5b50505060008481526008602090815260408083206001600160a01b038716845290915281208054849350909190610c8e9084906112b8565b925050819055508060056000828254610ca791906112b8565b909155505060008381526007602090815260408083206001600160a01b03861680855290835281842054878552600884528285209185529252909120541115610d1b5760405162461bcd60e51b8152600401610330906020808252600490820152632b18189960e11b604082015260600190565b60015460405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490529091169063a9059cbb906044016020604051808303816000875af1158015610d6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d92919061127f565b610dc75760405162461bcd60e51b8152600401610330906020808252600490820152630ac6060760e31b604082015260600190565b60408051848152602081018390526001600160a01b038416917f4a94c2c356e29a6583071e731bdacf2ca56565ba5efebcff6936eb7923b5172191015b60405180910390a2505050565b6000546001600160a01b0316331461056e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610330565b6001600160a01b038316610eaa5760405162461bcd60e51b8152600401610330906020808252600490820152632b18181960e11b604082015260600190565b60008281526007602090815260408083206001600160a01b038716845290915290205415610f035760405162461bcd60e51b8152600401610330906020808252600490820152635630303360e01b604082015260600190565b60008111610f3c5760405162461bcd60e51b815260040161033090602080825260049082015263158c0c0d60e21b604082015260600190565b6006548210610f765760405162461bcd60e51b8152600401610330906020808252600490820152635630313360e01b604082015260600190565b60008281526007602090815260408083206001600160a01b03878116808652919093529281902084905560025490516340c10f1960e01b815260048101939093526024830184905216906340c10f1990604401600060405180830381600087803b158015610fe357600080fd5b505af1158015610ff7573d6000803e3d6000fd5b505060408051858152602081018590526001600160a01b03871693507f6b467f0a76daac5283d2251b6e7660fed01ea99dbd70aa7092f3318731690c9d925001610e04565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b03811681146110a357600080fd5b919050565b600080604083850312156110bb57600080fd5b823591506110cb6020840161108c565b90509250929050565b60008083601f8401126110e657600080fd5b50813567ffffffffffffffff8111156110fe57600080fd5b6020830191508360208260051b850101111561111957600080fd5b9250929050565b6000806000806000806060878903121561113957600080fd5b863567ffffffffffffffff8082111561115157600080fd5b61115d8a838b016110d4565b9098509650602089013591508082111561117657600080fd5b6111828a838b016110d4565b9096509450604089013591508082111561119b57600080fd5b506111a889828a016110d4565b979a9699509497509295939492505050565b6000602082840312156111cc57600080fd5b5035919050565b6000806000606084860312156111e857600080fd5b505081359360208301359350604090920135919050565b60006020828403121561121157600080fd5b61121a8261108c565b9392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161125f5761125f611237565b5060010190565b60006020828403121561127857600080fd5b5051919050565b60006020828403121561129157600080fd5b8151801515811461121a57600080fd5b6000828210156112b3576112b3611237565b500390565b600082198211156112cb576112cb611237565b500190565b60008160001904831182151516156112ea576112ea611237565b500290565b60008261130c57634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122038b5bebc96e122e51001d2771133a3c68d8a4a0fb39f748b7fa9ccdfb508b33d64736f6c634300080f0033

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.