ETH Price: $2,738.90 (+5.90%)

Contract

0x6A1aa5ac35f38Bdb25BBD976E8eca942b23260b2
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Stake218218062025-02-11 7:31:3543 hrs ago1739259095IN
0x6A1aa5ac...2b23260b2
0 ETH0.00041193.48691898
Stake217753542025-02-04 19:54:238 days ago1738698863IN
0x6A1aa5ac...2b23260b2
0 ETH0.000684196.3043553
Stake217602702025-02-02 17:19:2310 days ago1738516763IN
0x6A1aa5ac...2b23260b2
0 ETH0.0014141812.4787234
Stake217449882025-01-31 14:04:4712 days ago1738332287IN
0x6A1aa5ac...2b23260b2
0 ETH0.000866598.577768
Stake217295312025-01-29 10:16:4714 days ago1738145807IN
0x6A1aa5ac...2b23260b2
0 ETH0.000512444.52178289
Stake217237502025-01-28 14:54:4715 days ago1738076087IN
0x6A1aa5ac...2b23260b2
0 ETH0.001078069.12627516
Stake217237162025-01-28 14:47:5915 days ago1738075679IN
0x6A1aa5ac...2b23260b2
0 ETH0.000841157.12072954
Stake217237032025-01-28 14:45:2315 days ago1738075523IN
0x6A1aa5ac...2b23260b2
0 ETH0.001081029.15131865
Stake217236762025-01-28 14:39:4715 days ago1738075187IN
0x6A1aa5ac...2b23260b2
0 ETH0.001025178.67853414
Stake217228072025-01-28 11:44:4715 days ago1738064687IN
0x6A1aa5ac...2b23260b2
0 ETH0.000696965.90004369
Stake217226162025-01-28 11:06:2315 days ago1738062383IN
0x6A1aa5ac...2b23260b2
0 ETH0.000714496.04850853
Stake217221802025-01-28 9:38:4715 days ago1738057127IN
0x6A1aa5ac...2b23260b2
0 ETH0.000647245.71122931
Stake217220762025-01-28 9:17:5915 days ago1738055879IN
0x6A1aa5ac...2b23260b2
0 ETH0.000632945.3581221
Stake217203962025-01-28 3:39:4715 days ago1738035587IN
0x6A1aa5ac...2b23260b2
0 ETH0.000689045.83302442
Stake217191552025-01-27 23:30:2316 days ago1738020623IN
0x6A1aa5ac...2b23260b2
0 ETH0.000844997.15320372
Stake217189512025-01-27 22:49:1116 days ago1738018151IN
0x6A1aa5ac...2b23260b2
0 ETH0.000839117.40433255
Stake217188402025-01-27 22:26:5916 days ago1738016819IN
0x6A1aa5ac...2b23260b2
0 ETH0.001059918.97262713
Stake217183142025-01-27 20:41:3516 days ago1738010495IN
0x6A1aa5ac...2b23260b2
0 ETH0.001168769.89408393
Stake217179112025-01-27 19:20:4716 days ago1738005647IN
0x6A1aa5ac...2b23260b2
0 ETH0.001400611.8566674
Stake217167982025-01-27 15:36:5916 days ago1737992219IN
0x6A1aa5ac...2b23260b2
0 ETH0.0026738422.63518811
Stake217167742025-01-27 15:32:1116 days ago1737991931IN
0x6A1aa5ac...2b23260b2
0 ETH0.0027745923.48807269
Stake217166762025-01-27 15:12:1116 days ago1737990731IN
0x6A1aa5ac...2b23260b2
0 ETH0.0031231226.43846008
Stake217166442025-01-27 15:05:4716 days ago1737990347IN
0x6A1aa5ac...2b23260b2
0 ETH0.0029314725.86715351
Stake214226262024-12-17 13:42:3557 days ago1734442955IN
0x6A1aa5ac...2b23260b2
0 ETH0.0024416420.66947683
Stake212151632024-11-18 14:20:3586 days ago1731939635IN
0x6A1aa5ac...2b23260b2
0 ETH0.0021955718.58639005
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 0x200c78f5...8a01f86C6
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
GemStaking

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
paris EvmVersion
File 1 of 9 : GemStaking.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import { Ownable, Ownable2Step } from "@openzeppelin/contracts/access/Ownable2Step.sol";

/// @title Staking contract
/// @notice The staking contract allows you to stake the token for one year,
/// and there will be no rewards or interest, withdraw will only be after the year of the staking date is completed.

contract GemStaking is Ownable2Step, ReentrancyGuard {
    using SafeERC20 for IERC20;

    /// @member The stake amount of staker
    /// @member The stake end time
    struct Stake {
        uint256 amount;
        uint256 endTime;
    }

    /// @notice The ERC20 token
    IERC20 public token;

    /// @notice Lockup period in seconds only
    uint256 public immutable LOCKUP_PERIOD;

    /// @notice Minimum amount a staker can stake
    uint256 public minStakeAmount;

    /// @notice Number of time a staker has staked
    mapping(address => mapping(uint256 => Stake)) public stakes;

    /// @notice Index for tracking latest staker stakes
    mapping(address => uint256) public stakeIndex;

    /// @dev Emitted when a staker stakes tokens
    event Staked(address indexed staker, uint256 amount, uint256 indexed stakerStakeIndex, uint256 stakeEndTime);

    /// @dev Emitted when a staker unstakes tokens
    event Unstaked(address indexed staker, uint256 amount, uint256 indexed stakerUnstakeIndex);

    /// @dev Emitted when the owner updates the minimum stake amount
    event MinimumAmountChanged(uint256 previousMinStakeAmount, uint256 newMinStakeAmount);

    /// @notice Thrown when the amount is less than minimum stake amount
    error InvalidAmount();

    /// @notice Thrown when the amount is equal to 0
    error ZeroAmount();

    /// @notice Thrown when the address is equal to 0
    error ZeroAddress();

    /// @notice Thrown when the minimum amount being set is same as current
    error SameMinValue();

    /// @notice Thrown when the lockedup period is not completed
    error LockupPeriodNotOver();

    /// @dev Constructor
    /// @param tokenAddress The address of the ERC20 token to stake
    /// @param minStakeValue The minimum stake amount
    /// @param lockupDuration The lockup time
    /// @param owner The address of owner wallet
    constructor(IERC20 tokenAddress, uint256 minStakeValue, uint256 lockupDuration, address owner) Ownable(owner) {
        if (address(tokenAddress) == address(0)) {
            revert ZeroAddress();
        }

        if (minStakeValue == 0 || lockupDuration == 0) {
            revert ZeroAmount();
        }

        token = tokenAddress;
        minStakeAmount = minStakeValue;
        LOCKUP_PERIOD = lockupDuration;
    }

    /// @notice Stakes staker tokens
    /// @param amount The amount to stake
    function stake(uint256 amount) external nonReentrant {
        if (amount < minStakeAmount) {
            revert InvalidAmount();
        }

        token.safeTransferFrom(msg.sender, address(this), amount);
        uint256 stakeEndTime = block.timestamp + LOCKUP_PERIOD;
        uint256 stakerStakeIndex = stakeIndex[msg.sender]++;
        stakes[msg.sender][stakerStakeIndex] = Stake({ amount: amount, endTime: stakeEndTime });
        emit Staked({
            staker: msg.sender,
            amount: amount,
            stakerStakeIndex: stakerStakeIndex,
            stakeEndTime: stakeEndTime
        });
    }

    /// @notice Unstakes tokens in a batch
    /// @param indexes The array of indexes at which the amount lies to unstake
    function unstake(uint256[] calldata indexes) external nonReentrant {
        uint256 indexesLength = indexes.length;
        for (uint256 i; i < indexesLength; ++i) {
            _unstake(indexes[i]);
        }
    }

    /// @notice Changes the minimum stake amount
    /// @param newMinAmount The minimum amount to stake
    function changeMinStakeAmount(uint256 newMinAmount) external onlyOwner {
        if (newMinAmount == 0) {
            revert ZeroAmount();
        }

        uint256 previoustMinAmount = minStakeAmount;
        _checkForIdenticalValue(newMinAmount, previoustMinAmount);
        emit MinimumAmountChanged({ previousMinStakeAmount: previoustMinAmount, newMinStakeAmount: newMinAmount });
        minStakeAmount = newMinAmount;
    }

    /// @dev Checks and reverts if updating the previous value with the same value
    function _checkForIdenticalValue(uint256 previousValue, uint256 newValue) private pure {
        if (previousValue == newValue) {
            revert SameMinValue();
        }
    }

    /// @dev Unstakes tokens after a year
    /// @param index The index at which the amount lies to unstake
    function _unstake(uint256 index) private {
        Stake memory stakerStake = stakes[msg.sender][index];
        if (stakerStake.amount == 0) {
            revert ZeroAmount();
        }

        if (block.timestamp < stakerStake.endTime) {
            revert LockupPeriodNotOver();
        }

        delete stakes[msg.sender][index];
        token.safeTransfer(msg.sender, stakerStake.amount);
        emit Unstaked({ staker: msg.sender, amount: stakerStake.amount, stakerUnstakeIndex: index });
    }
}

File 2 of 9 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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 {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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 9 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {Ownable} from "./Ownable.sol";

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

File 4 of 9 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @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.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
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].
     *
     * CAUTION: See Security Considerations above.
     */
    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 5 of 9 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

File 6 of 9 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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 An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @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.encodeCall(token.approve, (spender, value));

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

    /**
     * @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);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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(token).code.length > 0;
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) 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 FailedInnerCall();
        }
    }
}

File 8 of 9 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 9 of 9 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

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

    uint256 private _status;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"minStakeValue","type":"uint256"},{"internalType":"uint256","name":"lockupDuration","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"LockupPeriodNotOver","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SameMinValue","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"previousMinStakeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMinStakeAmount","type":"uint256"}],"name":"MinimumAmountChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"stakerStakeIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakeEndTime","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"stakerUnstakeIndex","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[],"name":"LOCKUP_PERIOD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMinAmount","type":"uint256"}],"name":"changeMinStakeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minStakeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakeIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakes","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"indexes","type":"uint256[]"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060408181526004918236101561001657600080fd5b600092833560e01c9182632a7ccb7914610a0a57508163584b62a114610994578163715018a6146108ef57816379ba50971461080e5781638da5cb5b146107bd578163a694fc3a14610584578163dd924acd146104b9578163e30c397814610466578163e449f34114610252578163ec16d076146101f9578163f1887684146101b957508063f2fde38b146101095763fc0c546a146100b457600080fd5b3461010557817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101055760209073ffffffffffffffffffffffffffffffffffffffff600354169051908152f35b5080fd5b82346101b65760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b657610141610a69565b610149610adc565b73ffffffffffffffffffffffffffffffffffffffff80911690817fffffffffffffffffffffffff000000000000000000000000000000000000000060015416176001558254167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227008380a380f35b80fd5b9050346101f557827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f55760209250549051908152f35b8280fd5b50503461010557817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010557602090517f0000000000000000000000000000000000000000000000000000000001e133808152f35b9050346101f557602091827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104625767ffffffffffffffff90823582811161045e573660238201121561045e57808401359383851161045a576024936005923660248860051b83010111610456576102cc610b2d565b885b8781106102de5789600160025580f35b8681861b83010135338b52858a52868b20818c528a52868b2087519061030382610a91565b8054808352600180920154908d84019182521561042e57514210610406578c90338252888d528982208483528d5289822082815501558a73ffffffffffffffffffffffffffffffffffffffff6003541682517fa9059cbb000000000000000000000000000000000000000000000000000000008b5193840152338c84015260449081840152825260808201828110888211176103db578a526001949392916103aa91610b66565b5188519081527f7fc4727e062e336010f2c282598ef5f14facb3de68cf8195c2f23e1454b2b74e8c3392a3016102ce565b8b8f60418b7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8689517f9e2470e9000000000000000000000000000000000000000000000000000000008152fd5b878a517f1f2a2005000000000000000000000000000000000000000000000000000000008152fd5b8880fd5b8680fd5b8580fd5b8380fd5b50503461010557817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101055760209073ffffffffffffffffffffffffffffffffffffffff600154169051908152f35b9050346101f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f5578035916104f5610adc565b821561055e57815480841461053757907f64c7ab733067301a7955b68805043628d2a52867fe9b42dcbe3a5d90aeba8be7918151908152846020820152a15580f35b50517f3dbac396000000000000000000000000000000000000000000000000000000008152fd5b517f1f2a2005000000000000000000000000000000000000000000000000000000008152fd5b83833461010557602090817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f5578335906105c2610b2d565b845482106107955773ffffffffffffffffffffffffffffffffffffffff600354168151907f23b872dd00000000000000000000000000000000000000000000000000000000858301523360248301523060448301528360648301526064825260a0820182811067ffffffffffffffff8211176107695783526106449190610b66565b7f0000000000000000000000000000000000000000000000000000000001e13380420180421161073d5733855260068452818520938454947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff861461071157907fb4caaf29adda3eefee3ad552a8e85058589bf834c7466cae4ee58787f70589ed93929160018701905582516106d981610a91565b8581526001828201848152338a5260058452858a20898b528452858a20925183555191015582519485528401523392a3600160025580f35b60248760118a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b6024856011887f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b60248760418a7f4e487b7100000000000000000000000000000000000000000000000000000000835252fd5b8490517f2c5211c6000000000000000000000000000000000000000000000000000000008152fd5b50503461010557817ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101055773ffffffffffffffffffffffffffffffffffffffff60209254169051908152f35b919050346101f557827ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f5576001549173ffffffffffffffffffffffffffffffffffffffff9133838516036108bf5750507fffffffffffffffffffffffff0000000000000000000000000000000000000000809216600155825491339083161783553391167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b6024925051907f118cdaa70000000000000000000000000000000000000000000000000000000082523390820152fd5b83346101b657807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101b657610926610adc565b8073ffffffffffffffffffffffffffffffffffffffff7fffffffffffffffffffffffff0000000000000000000000000000000000000000806001541660015582549081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461010557807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010557809173ffffffffffffffffffffffffffffffffffffffff6109e3610a69565b16815260056020528181206024358252602052206001815491015482519182526020820152f35b849084346101f55760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101f55760209273ffffffffffffffffffffffffffffffffffffffff610a5c610a69565b1681526006845220548152f35b6004359073ffffffffffffffffffffffffffffffffffffffff82168203610a8c57565b600080fd5b6040810190811067ffffffffffffffff821117610aad57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff600054163303610afd57565b60246040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152fd5b6002805414610b3c5760028055565b60046040517f3ee5aeb5000000000000000000000000000000000000000000000000000000008152fd5b73ffffffffffffffffffffffffffffffffffffffff1690600080826020829451910182865af13d15610cc45767ffffffffffffffff903d828111610c975760405192601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116840190811184821017610c6a576040528252610bf991903d84602084013e5b84610cd0565b908151918215159283610c42575b505050610c115750565b602490604051907f5274afe70000000000000000000000000000000000000000000000000000000082526004820152fd5b8192935090602091810103126101055760200151908115918215036101b65750388080610c07565b6024857f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b6024847f4e487b710000000000000000000000000000000000000000000000000000000081526041600452fd5b610bf990606090610bf3565b90610d0f5750805115610ce557805190602001fd5b60046040517f1425ea42000000000000000000000000000000000000000000000000000000008152fd5b81511580610d67575b610d20575090565b60249073ffffffffffffffffffffffffffffffffffffffff604051917f9996b315000000000000000000000000000000000000000000000000000000008352166004820152fd5b50803b15610d1856fea2646970667358221220f8f1a13003cd9d4d47e5cfa6ac8c473707d7d211f190e7b2908d931b186e076a64736f6c63430008190033

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.