ETH Price: $4,042.75 (+4.72%)

Contract

0x5BB8F95DC4ADB5C8A3b089CfA60e30ba2E8b3327
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Transaction Hash
Method
Block
From
To
0x9aa90321248dc61726563aa5c72f15098bcd18f8a64e29bad2e56de6a2f7cfd0 Unstake And With...(pending)2024-12-01 2:03:275 days ago1733018607IN
0x5BB8F95D...a2E8b3327
0 ETH(Pending)(Pending)
Stake Tokens213462062024-12-06 21:40:591 hrs ago1733521259IN
0x5BB8F95D...a2E8b3327
0 ETH0.0021265122.42163444
Unstake And With...213457762024-12-06 20:14:232 hrs ago1733516063IN
0x5BB8F95D...a2E8b3327
0 ETH0.0028938328.10423781
Withdraw Tokens213449892024-12-06 17:36:355 hrs ago1733506595IN
0x5BB8F95D...a2E8b3327
0 ETH0.0021203128.4824483
Stake Tokens213449592024-12-06 17:30:355 hrs ago1733506235IN
0x5BB8F95D...a2E8b3327
0 ETH0.0029156930.72715357
Unstake And With...213445072024-12-06 15:59:476 hrs ago1733500787IN
0x5BB8F95D...a2E8b3327
0 ETH0.0039637538.49504916
Withdraw Tokens213441902024-12-06 14:56:117 hrs ago1733496971IN
0x5BB8F95D...a2E8b3327
0 ETH0.0022161529.76501171
Unstake And With...213439902024-12-06 14:15:598 hrs ago1733494559IN
0x5BB8F95D...a2E8b3327
0 ETH0.002167221.04986565
Unstake And With...213434012024-12-06 12:17:3510 hrs ago1733487455IN
0x5BB8F95D...a2E8b3327
0 ETH0.0014841914.41583824
Unstake And With...213432872024-12-06 11:54:4710 hrs ago1733486087IN
0x5BB8F95D...a2E8b3327
0 ETH0.0013903513.5028066
Unstake And With...213432832024-12-06 11:53:5910 hrs ago1733486039IN
0x5BB8F95D...a2E8b3327
0 ETH0.001404213.63574946
Stake Tokens213432572024-12-06 11:48:4710 hrs ago1733485727IN
0x5BB8F95D...a2E8b3327
0 ETH0.0017840814.67581845
Withdraw Tokens213430542024-12-06 11:07:4711 hrs ago1733483267IN
0x5BB8F95D...a2E8b3327
0 ETH0.0010759614.4534957
Withdraw Tokens213428562024-12-06 10:27:5912 hrs ago1733480879IN
0x5BB8F95D...a2E8b3327
0 ETH0.0011410815.32830885
Stake Tokens213427292024-12-06 10:02:3512 hrs ago1733479355IN
0x5BB8F95D...a2E8b3327
0 ETH0.0020833518.60699837
Stake Tokens213420812024-12-06 7:52:1114 hrs ago1733471531IN
0x5BB8F95D...a2E8b3327
0 ETH0.0012940713.64103068
Stake Tokens213420272024-12-06 7:41:2314 hrs ago1733470883IN
0x5BB8F95D...a2E8b3327
0 ETH0.0012399111.86636804
Withdraw Tokens213419892024-12-06 7:33:4715 hrs ago1733470427IN
0x5BB8F95D...a2E8b3327
0 ETH0.0007444412.97957035
Withdraw Tokens213419852024-12-06 7:32:5915 hrs ago1733470379IN
0x5BB8F95D...a2E8b3327
0 ETH0.0010197413.69833854
Unstake And With...213416812024-12-06 6:32:1116 hrs ago1733466731IN
0x5BB8F95D...a2E8b3327
0 ETH0.0013399614.7
Withdraw Tokens213415362024-12-06 6:02:5916 hrs ago1733464979IN
0x5BB8F95D...a2E8b3327
0 ETH0.0010771614.46968104
Stake Tokens213404562024-12-06 2:24:5920 hrs ago1733451899IN
0x5BB8F95D...a2E8b3327
0 ETH0.00178418.80318033
Unstake And With...213397052024-12-05 23:54:3522 hrs ago1733442875IN
0x5BB8F95D...a2E8b3327
0 ETH0.0017862117.34529746
Stake Tokens213389602024-12-05 21:24:1125 hrs ago1733433851IN
0x5BB8F95D...a2E8b3327
0 ETH0.0019596220.65677521
Withdraw Tokens213385392024-12-05 19:59:4726 hrs ago1733428787IN
0x5BB8F95D...a2E8b3327
0 ETH0.0016710329.14102996
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ZigStaking

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 1000 runs

Other Settings:
paris EvmVersion
File 1 of 8 : ZigStaking.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";

contract ZigStaking is Ownable2Step {
    using SafeERC20 for IERC20;

    /**
     * @dev Structure to store information about each stake.
     * @param amount The amount of tokens staked.
     * @param stakeStartDate The timestamp when the stake was created.
     * @param stakeEndDate The timestamp when the stake was ended (unstaked). A value of 0 indicates the stake is active.
     */
    struct StakeInfo {
        uint256 amount;
        uint64 stakeStartDate;
        StakeReleaseInfo[] releases;
    }

    struct StakeReleaseInfo {
        uint256 released;
        uint64 stakeEndDate;
        bool withdrawn;
    }

    /**
     * @dev The constant penalty period after unstaking, during which withdrawing tokens is restricted.
     */
    uint64 public immutable penaltyPeriod;

    /**
     * @dev The maximum penalty period after unstaking, during which withdrawing tokens is restricted.
     */
    uint64 public constant MAX_PENALTY_PERIOD = 90 days;

    /**
     * @dev The address of the ERC-20 token contract used for staking.
     * This address is immutable and set during contract deployment.
     */
    address immutable zigContract;

    /**
     * @dev Boolean flag to indicate whether staking has been released or is still locked.
     * If `true`, users can withdraw their staked tokens without penalty.
     */
    bool public isStakeReleased = false;

    /**
     * @dev Mapping to store an array of `StakeInfo` for each user address.
     * Each user's address maps to an array of stakes they have made.
     */
    mapping(address => StakeInfo[]) private stakes;

    event TokensStaked(
        address indexed _owner,
        uint256 _amount,
        uint64 _stakeDate
    );
    event TokensUnstaked(
        address indexed _owner,
        uint256 _amount,
        uint64 _endStakeDate
    );
    event TokensWithdrawn(
        address indexed _owner,
        uint256 _amount,
        uint64 _endStakeDate
    );
    event StakeStatusToogled(bool _stakeStatus);

    error NoTokens();
    error InsufficientStakedTokens();
    error UnstakedYet();
    error WithdrawnYet();
    error StakedYet();
    error InvalidStakeIndex();
    error InvalidReleaseIndex();
    error StakeIsReleased();
    error CantUnlockTokensYet();
    error NullAddress();
    error InvalidPenaltyPeriod();

    /**
     * @dev Constructor to initialize the contract with the ERC-20 token contract address.
     * @param _zigContract The address of the ERC-20 token contract used for staking.
     * @param _penaltyPeriod The seconds the user must wait when unstakes.
     */
    constructor(
        address _zigContract,
        uint64 _penaltyPeriod
    ) Ownable(msg.sender) {
        if (_zigContract == address(0)) revert NullAddress();
        if (_penaltyPeriod > MAX_PENALTY_PERIOD) revert InvalidPenaltyPeriod();

        zigContract = _zigContract;
        penaltyPeriod = _penaltyPeriod;
    }

    /**
     * @dev Function to stake a specified amount of ERC-20 tokens.
     * @param _amount The amount of tokens to stake.
     * @notice Tokens are transferred from the caller's address to the contract.
     * Emits a {TokensStaked} event.
     * Requirements:
     * - `isStakeReleased` must be false.
     * - `_amount` must be greater than 0.
     */
    function stakeTokens(uint256 _amount) external {
        if (isStakeReleased) revert StakeIsReleased();
        if (_amount == 0) revert NoTokens();

        StakeReleaseInfo[] memory releases;
        StakeInfo memory newStake = StakeInfo({
            amount: _amount,
            stakeStartDate: uint64(block.timestamp),
            releases: releases
        });
        stakes[msg.sender].push(newStake);

        IERC20(zigContract).safeTransferFrom(
            msg.sender,
            address(this),
            _amount
        );

        emit TokensStaked(msg.sender, _amount, uint64(block.timestamp));
    }

    /**
     * @dev Function to unstake and withdraw a specific staked amount based on its index.
     * @param _stakeIndex The index of the stake to unstake and withdraw.
     * @notice The function will unstake the tokens and will set the stakeEndDate to use
     * in the function withdrawTokens with the penalty period. Only ff the 'isStakeReleased' variable
     * is set to true, it will withdraw the tokens also, otherwise, the tokens will be withdrawn
     * with the withdrawn tokens function.
     * Emits a {TokensUnstaked} and potentially a {TokensWithdrawn} event.
     * Requirements:
     * - `_stakeIndex` must be within the caller's stakes array length.
     * - The stake must not have already been unstaked.
     * - `_amount` must be greater than 0.
     */
    function unstakeAndWithdrawTokens(
        uint256 _stakeIndex,
        uint256 _amount
    ) external {
        if (_stakeIndex >= stakes[msg.sender].length)
            revert InvalidStakeIndex();
        if (_amount == 0) revert NoTokens();
        StakeInfo storage stake = stakes[msg.sender][_stakeIndex];
        if (stake.amount - _calculateTotalReleased(stake) < _amount)
            revert InsufficientStakedTokens();

        StakeReleaseInfo memory newRelease = StakeReleaseInfo({
            released: _amount,
            stakeEndDate: uint64(block.timestamp),
            withdrawn: isStakeReleased
        });
        stake.releases.push(newRelease);

        if (isStakeReleased) {
            IERC20(zigContract).safeTransfer(msg.sender, _amount);

            emit TokensWithdrawn(msg.sender, _amount, uint64(block.timestamp));
        }

        emit TokensUnstaked(msg.sender, _amount, uint64(block.timestamp));
    }

    /**
     * @dev Function to withdraw tokens from an already unstaked position.
     * @param _stakeIndex The index of the unstaked tokens to withdraw.
     * @notice This function allows withdrawal after the penalty period or if staking is released.
     * Emits a {TokensWithdrawn} event.
     * Requirements:
     * - `_stakeIndex` must be within the caller's stakes array length.
     * - The tokens must be unstaked before withdrawal.
     * - Cannot withdraw during the penalty period unless staking is released.
     * - `_releaseIndex` every withdraw must have first an unstake register.
     */
    function withdrawTokens(
        uint256 _stakeIndex,
        uint256 _releaseIndex
    ) external {
        if (_stakeIndex >= stakes[msg.sender].length)
            revert InvalidStakeIndex();
        StakeInfo storage stake = stakes[msg.sender][_stakeIndex];
        if (_releaseIndex >= stake.releases.length)
            revert InvalidReleaseIndex();
        StakeReleaseInfo storage releaseInfo = stake.releases[_releaseIndex];
        if (releaseInfo.withdrawn == true) revert WithdrawnYet();
        if (
            !isStakeReleased &&
            (block.timestamp < releaseInfo.stakeEndDate + penaltyPeriod)
        ) revert CantUnlockTokensYet();

        releaseInfo.withdrawn = true;
        IERC20(zigContract).safeTransfer(msg.sender, releaseInfo.released);

        emit TokensWithdrawn(
            msg.sender,
            releaseInfo.released,
            uint64(block.timestamp)
        );
    }

    /**
     * @dev Function to toggle the staking status between released and locked.
     * @notice When staking is released, users can withdraw their staked tokens without penalty.
     * Emits a {StakeReleased} event if staking is released.
     * Requirements:
     * - The caller must be the owner of the contract.
     */
    function toggleStakeStatus() external onlyOwner {
        isStakeReleased = !isStakeReleased;

        emit StakeStatusToogled(isStakeReleased);
    }

    /**
     * @dev Function that calculates how many tokens a user can unstake
     * @param _stakeIndex must be within the caller's stakes array length.
     * @return A uint256 that is the amount of tokens that can be unstaked
     */
    function calculateTotalReleased(
        uint256 _stakeIndex
    ) external view returns (uint256) {
        StakeInfo memory stake = stakes[msg.sender][_stakeIndex];
        return _calculateTotalReleased(stake);
    }

    /**
     * @dev Function to retrieve the list of stakes for a specific user.
     * @param _user The address of the user whose stakes are to be retrieved.
     * @return An array of `StakeInfo` structs representing the user's stakes.
     */
    function getUserStakes(
        address _user
    ) external view returns (StakeInfo[] memory) {
        return stakes[_user];
    }

    /**
     * @dev Function to retrieve the total amount of tokens staked in the contract.
     * @return The total staked amount in the contract.
     */
    function getTotalStaked() external view returns (uint256) {
        return IERC20(zigContract).balanceOf(address(this));
    }

    function _calculateTotalReleased(
        StakeInfo memory stakeInfo
    ) internal pure returns (uint256) {
        uint256 totalReleased = 0;
        uint256 len = stakeInfo.releases.length;

        for (uint256 i = 0; i < len; ++i) {
            totalReleased += stakeInfo.releases[i].released;
        }

        return totalReleased;
    }
}

File 2 of 8 : 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 8 : 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 8 : 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 8 : 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 8 : 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 8 : 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 8 : 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;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000,
    "details": {
      "yulDetails": {
        "optimizerSteps": "u"
      }
    }
  },
  "viaIR": true,
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_zigContract","type":"address"},{"internalType":"uint64","name":"_penaltyPeriod","type":"uint64"}],"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":"CantUnlockTokensYet","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InsufficientStakedTokens","type":"error"},{"inputs":[],"name":"InvalidPenaltyPeriod","type":"error"},{"inputs":[],"name":"InvalidReleaseIndex","type":"error"},{"inputs":[],"name":"InvalidStakeIndex","type":"error"},{"inputs":[],"name":"NoTokens","type":"error"},{"inputs":[],"name":"NullAddress","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":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"StakeIsReleased","type":"error"},{"inputs":[],"name":"StakedYet","type":"error"},{"inputs":[],"name":"UnstakedYet","type":"error"},{"inputs":[],"name":"WithdrawnYet","type":"error"},{"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":false,"internalType":"bool","name":"_stakeStatus","type":"bool"}],"name":"StakeStatusToogled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_stakeDate","type":"uint64"}],"name":"TokensStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_endStakeDate","type":"uint64"}],"name":"TokensUnstaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_endStakeDate","type":"uint64"}],"name":"TokensWithdrawn","type":"event"},{"inputs":[],"name":"MAX_PENALTY_PERIOD","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeIndex","type":"uint256"}],"name":"calculateTotalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getUserStakes","outputs":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint64","name":"stakeStartDate","type":"uint64"},{"components":[{"internalType":"uint256","name":"released","type":"uint256"},{"internalType":"uint64","name":"stakeEndDate","type":"uint64"},{"internalType":"bool","name":"withdrawn","type":"bool"}],"internalType":"struct ZigStaking.StakeReleaseInfo[]","name":"releases","type":"tuple[]"}],"internalType":"struct ZigStaking.StakeInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isStakeReleased","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"penaltyPeriod","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"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":"stakeTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleStakeStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeIndex","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"unstakeAndWithdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_stakeIndex","type":"uint256"},{"internalType":"uint256","name":"_releaseIndex","type":"uint256"}],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c0604052346200005f576200001f6200001862000133565b90620001d3565b6040516118c4620003fe82396080518181816101c80152611205015260a0518181816105fe01528181610b3401528181610fc1015261115f01526118c490f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b90601f01601f191681019081106001600160401b038211176200009c57604052565b62000064565b90620000b9620000b160405190565b92836200007a565b565b6001600160a01b031690565b90565b6001600160a01b0381165b036200005f57565b90505190620000b982620000ca565b6001600160401b038116620000d5565b90505190620000b982620000ec565b91906040838203126200005f57620000c79060206200012b8286620000dd565b9401620000fc565b6200015662001cc2803803806200014a81620000a2565b9283398101906200010b565b9091565b9060ff60a01b9060a01b5b9181191691161790565b9062000182620000c76200018a92151590565b82546200015a565b9055565b620000bb620000c7620000c79290565b620000c7906200018e565b620001b9620000c7620000c79290565b6001600160401b031690565b620000c76276a700620001a9565b620001de3362000259565b620001ec600060016200016f565b620001fc620000bb60006200019e565b6001600160a01b0382161462000247576200021a620001b9620001c5565b6001600160401b03831611620002325760a052608052565b6040516233352960e11b8152600490fd5b0390fd5b60405163e99d5ac560e01b8152600490fd5b620000b99062000277565b6001600160a01b03909116815260200190565b6200028360006200019e565b6001600160a01b0381166001600160a01b03831614620002a95750620000b99062000341565b6200024390620002b860405190565b631e4fbdf760e01b81529182916004830162000264565b916001600160a01b0360089290920291821b911b62000165565b620000c790620000bb906001600160a01b031682565b620000c790620002e9565b620000c790620002ff565b91906200032a620000c76200018a936200030a565b908354620002cf565b620000b99160009162000315565b620000b990620003546000600162000333565b6200039d565b620000c790620000bb565b620000c790546200035a565b906001600160a01b039062000165565b9062000395620000c76200018a926200030a565b825462000371565b620003cb620003c4620003b1600062000365565b620003be84600062000381565b6200030a565b916200030a565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0620003f760405190565b600090a356fe6080604052600436101561001257600080fd5b60003560e01c80630917e7761461010257806332157455146100fd57806332279be4146100f8578063715018a6146100f35780637547c7a3146100ee57806379ba5097146100e9578063811fc153146100e4578063842e2981146100df5780638da5cb5b146100da578063a8e6577d146100d5578063ba7bd2aa146100d0578063c6aa57e3146100cb578063cc7c96ad146100c6578063e30c3978146100c15763f2fde38b036101125761053a565b61051f565b610507565b6104ec565b6104d3565b6104ba565b610470565b610430565b610289565b61024b565b610233565b6101ec565b6101b3565b61017d565b61011d565b600091031261011257565b600080fd5b9052565b565b346101125761012d366004610107565b6101486101386105f1565b6040519182918290815260200190565b0390f35b61015c6101596101599290565b90565b67ffffffffffffffff1690565b6101596276a70061014c565b610159610169565b346101125761018d366004610107565b610148610198610175565b6040519182918267ffffffffffffffff909116815260200190565b34610112576101c3366004610107565b6101487f0000000000000000000000000000000000000000000000000000000000000000610198565b34610112576101fc366004610107565b6102046106e9565b604051005b805b0361011257565b9050359061011b82610209565b906020828203126101125761015991610212565b346101125761020461024636600461021f565b610a9f565b346101125761025b366004610107565b610204610bfc565b610159916008021c5b60ff1690565b906101599154610263565b61015960146001610272565b3461011257610299366004610107565b6101486102a461027d565b60405191829182901515815260200190565b73ffffffffffffffffffffffffffffffffffffffff1690565b61020b816102b6565b9050359061011b826102cf565b9060208282031261011257610159916102d8565b0190565b9061031d61031661030c845190565b8084529260200190565b9260200190565b9060005b81811061032e5750505090565b90919261036d61036660019286518051825260208082015167ffffffffffffffff169083015260409081015115159082015260600190565b9460200190565b929101610321565b8051825261015991606081019160409060208181015167ffffffffffffffff169084015201519060408184039101526102fd565b9061015991610375565b906103c96103bf835190565b8083529160200190565b90816103db6020830284019460200190565b926000915b8383106103ef57505050505090565b9091929394602061041261040b838560019503875289516103a9565b9760200190565b93019301919392906103e0565b6020808252610159929101906103b3565b346101125761014861044b6104463660046102e5565b610e19565b6040519182918261041f565b610117906102b6565b60208101929161011b9190610457565b3461011257610480366004610107565b61014861048b610e48565b60405191829182610460565b9190604083820312610112576101599060206104b38286610212565b9401610212565b34610112576102046104cd366004610497565b90610eb6565b34610112576102046104e6366004610497565b906110c9565b346101125761014861013861050236600461021f565b61128c565b3461011257610517366004610107565b610204611341565b346101125761052f366004610107565b61014861048b611349565b346101125761020461054d3660046102e5565b6113e7565b6102b66101596101599273ffffffffffffffffffffffffffffffffffffffff1690565b61015990610552565b61015990610575565b634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff8211176105bf57604052565b610587565b9050519061011b82610209565b9060208282031261011257610159916105c4565b6040513d6000823e3d90fd5b61066d60206106276106227f000000000000000000000000000000000000000000000000000000000000000061057e565b61057e565b6106303061057e565b9061063a60405190565b938492839182917f70a0823100000000000000000000000000000000000000000000000000000000835260048301610460565b03915afa9081156106ac57600091610683575090565b610159915060203d6020116106a5575b61069d818361059d565b8101906105d1565b503d610693565b6105e5565b6106b96113f0565b61011b6106d7565b6102b66101596101599290565b610159906106c1565b61011b6106e460006106ce565b61145a565b61011b6106b1565b6101599060a01c61026c565b61015990546106f1565b6101596101596101599290565b9061011b61072160405190565b928361059d565b6101596060610714565b9061073c9061057e565b600052602052604060002090565b634e487b7160e01b600052603260045260246000fd5b80548210156107835761077a600391600052602060002090565b91020190600090565b61074a565b634e487b7160e01b600052600060045260246000fd5b5190565b90600019905b9181191691161790565b906107c26101596107c992610707565b82546107a2565b9055565b5167ffffffffffffffff1690565b9067ffffffffffffffff906107a8565b61015c6101596101599267ffffffffffffffff1690565b906108126101596107c9926107eb565b82546107db565b634e487b7160e01b600052601160045260246000fd5b8181029291811591840414171561084257565b610819565b61015990600261082f565b9160001960089290920291821b911b6107a8565b921b90565b919061087c6101596107c993610707565b908354610852565b61011b9160009161086b565b6000906001906108a08382610884565b0155565b906000036108b55761011b90610890565b610788565b8181106108c5575050565b806108d360006002936108a4565b016108ba565b9190918282106108e857505050565b61090c6109006108fa61011b95610847565b93610847565b91600052602060002090565b91820191016108ba565b906801000000000000000081116105bf578161093361011b935490565b908281556108d9565b51151590565b9068ff00000000000000009060401b6107a8565b151590565b9061096b6101596107c992610956565b8254610942565b906109b06040600161011b9461099361098d6000870161079e565b826107b2565b01926109aa6109a4602083016107cd565b85610802565b0161093c565b9061095b565b9061011b91610972565b6109df6109006109ce845190565b936109d98585610916565b60200190565b6000915b8383106109f05750505050565b6002602082610a08610a026001955190565b866109b6565b019201920191906109e3565b9061011b916109c0565b6002610a5b604061011b94610a3e610a386000830161079e565b866107b2565b610a56610a4d602083016107cd565b60018701610802565b015190565b9101610a14565b91906108b55761011b91610a1e565b90815491680100000000000000008310156105bf5782610a9991600161011b95018155610760565b90610a62565b610aa960016106fd565b610bd157610ab76000610707565b8114610ba2577f8b8eedb035537b2a16bfd327772278759fcf766e4fce44e964b16796da512e3d6060610b2b610aec4261014c565b91610b18610af8610728565b91610b01878452565b67ffffffffffffffff851660208401526040830152565b610b26610159336002610732565b610a71565b610b6983610b587f000000000000000000000000000000000000000000000000000000000000000061057e565b610b613061057e565b9033906114db565b610b723361057e565b92610b9d610b7f60405190565b9283928390815267ffffffffffffffff909116602082015260400190565b0390a2565b6040517fdf957883000000000000000000000000000000000000000000000000000000008152600490fd5b0390fd5b6040517f86445f9a000000000000000000000000000000000000000000000000000000008152600490fd5b33610c05611349565b610c17610c11836102b6565b916102b6565b03610c255761011b9061145a565b610bcd90610c3260405190565b9182917f118cdaa700000000000000000000000000000000000000000000000000000000835260048301610460565b67ffffffffffffffff81116105bf5760208091020190565b90610c8b610c8683610c61565b610714565b918252565b6101599081565b6101599054610c90565b6101599061015c565b6101599054610ca1565b6101599060401c61026c565b6101599054610cb4565b9061011b610d116001610cdb610728565b94610cec610ce882610c97565b8752565b610d0b610cfa838301610caa565b67ffffffffffffffff166020880152565b01610cc0565b15156040840152565b61015990610cca565b90610d2c825490565b610d3581610c79565b92610d496020850191600052602060002090565b6000915b838310610d5a5750505050565b60026020600192610d6a85610d1a565b815201920192019190610d4d565b9061011b610dab6002610d89610728565b94610d96610ce882610c97565b610da5610cfa60018301610caa565b01610d23565b6040840152565b61015990610d78565b90610dc4825490565b610dcd81610c79565b92610de16020850191600052602060002090565b6000915b838310610df25750505050565b60036020600192610e0285610db2565b815201920192019190610de5565b61015990610dbb565b610e3061015991610e28606090565b506002610732565b610e10565b610159906102b6565b6101599054610e35565b6101596000610e3e565b9190820391821161084257565b80548210156107835761077a600291600052602060002090565b91906108b55761011b91610972565b90815491680100000000000000008310156105bf5782610eb091600161011b95018155610e5f565b90610e79565b600290610ecd610159610ec93385610732565b5490565b81101561106657610ede6000610707565b8314610ba257610efa610efe91610ef53385610732565b610760565b5090565b90610f22610f0b83610c97565b610f1c610f1785610db2565b611552565b90610e52565b8390610f2d565b9190565b1061103b57610fa17f3b061160447fede5059a0f765150555bc1d94f758d7022585a89e3b7a9e57ab192610f9c610f634261014c565b93610f6e60016106fd565b926102f9610f7a610728565b94610f838a8752565b67ffffffffffffffff8816602087015215156040860152565b610e88565b610fab60016106fd565b610fb857610b723361057e565b610fec83610fe57f000000000000000000000000000000000000000000000000000000000000000061057e565b33906115c8565b610ff53361057e565b7fdaff949ee66f4de29b04430a6c3a6c3ec93f15a89da403ac554fa33613b0eafc61101f60405190565b85815267ffffffffffffffff84166020820152604090a2610b69565b6040517f0d9ec101000000000000000000000000000000000000000000000000000000008152600490fd5b6040517fcf468e43000000000000000000000000000000000000000000000000000000008152600490fd5b67ffffffffffffffff9081169116019067ffffffffffffffff821161084257565b6101596101596101599267ffffffffffffffff1690565b6002906110dc610159610ec93385610732565b81101561106657610efa6110f491610ef53385610732565b01611100610159825490565b8210156112615761111491610efa91610e5f565b61112060018201610cc0565b60019190151582146112365761113c611138836106fd565b1590565b806111f1575b6111c6576111558261119c93830161095b565b61119760006111837f000000000000000000000000000000000000000000000000000000000000000061057e565b92019161118f83610c97565b9033906115c8565b610c97565b7fdaff949ee66f4de29b04430a6c3a6c3ec93f15a89da403ac554fa33613b0eafc610b694261014c565b6040517f93622c73000000000000000000000000000000000000000000000000000000008152600490fd5b5061122f61122a611203848401610caa565b7f000000000000000000000000000000000000000000000000000000000000000090611091565b6110b2565b4210611142565b6040517ff8746d70000000000000000000000000000000000000000000000000000000008152600490fd5b6040517fbb9d765c000000000000000000000000000000000000000000000000000000008152600490fd5b610f176112aa6101599261129e600090565b50610ef5336002610732565b50610db2565b6112b86113f0565b61011b6112f7565b9074ff00000000000000000000000000000000000000009060a01b6107a8565b906112f06101596107c992610956565b82546112c0565b61130e61130761113860016106fd565b60016112e0565b7f0529c37531eba802cdc9f95a5975438e3d6a1fece492076b16fc72e8c4f4b3fa61133c6102a460016106fd565b0390a1565b61011b6112b0565b6101596001610e3e565b61011b9061135f6113f0565b611397565b9073ffffffffffffffffffffffffffffffffffffffff906107a8565b906113906101596107c99261057e565b8254611364565b6113a2816001611380565b6113b66113b0610622610e48565b9161057e565b907f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227006113e160405190565b600090a3565b61011b90611353565b6113f8610e48565b3390611406610c11836102b6565b03610c255750565b919060086107a891029161086673ffffffffffffffffffffffffffffffffffffffff841b90565b91906114466101596107c99361057e565b90835461140e565b61011b91600091611435565b61011b9061146a6000600161144e565b6115fc565b6114886114826101599263ffffffff1690565b60e01b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b6040906114d761011b94969593966114cd60608401986000850190610457565b6020830190610457565b0152565b906115209061151161011b956004956114f76323b872dd61146f565b9361150160405190565b97889560208701908152016114ad565b6020820181038252038361059d565b61166b565b60010190565b90611534825190565b811015610783576020809102010190565b9190820180921161084257565b600060406115606000610707565b920180515193835b855b8510156115a55761159d61159761156a926115918761158a8a895161152b565b510161079e565b90611545565b95611525565b949050611568565b945092505050565b91602061011b9294936114d760408201966000830190610457565b61152060049261151161011b956115e263a9059cbb61146f565b926115ec60405190565b96879460208601908152016115ad565b6116176113b061160c6000610e3e565b610622846000611380565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e06113e160405190565b80151561020b565b9050519061011b82611642565b90602082820312610112576101599161164a565b61167761167e9161057e565b91826116fe565b805161168d610f296000610707565b141590816116da575b5061169e5750565b610bcd906116ab60405190565b9182917f5274afe700000000000000000000000000000000000000000000000000000000835260048301610460565b6116f891508060206116ed611138935190565b818301019101611657565b38611696565b6101599161170c6000610707565b9161175b565b67ffffffffffffffff81116105bf57602090601f01601f19160190565b90610c8b610c8683611712565b3d156117565761174b3d61172f565b903d6000602084013e565b606090565b916117653061057e565b8181311061178f575060008281926020610159969551920190855af161178961173c565b916117cb565b610bcd9061179c60405190565b9182917fcd78605900000000000000000000000000000000000000000000000000000000835260048301610460565b906117d65750611846565b81516117e5610f296000610707565b1480611830575b6117f4575090565b610bcd9061180160405190565b9182917f9996b31500000000000000000000000000000000000000000000000000000000835260048301610460565b50803b611840610f296000610707565b146117ec565b8051611855610f296000610707565b111561186357805190602001fd5b6040517f1425ea42000000000000000000000000000000000000000000000000000000008152600490fdfea264697066735822122070041f7638b561962cd2087d9bfb752aa747e7eb8fb563dfbd81391555ddf6db64736f6c63430008180033000000000000000000000000b2617246d0c6c0087f18703d576831899ca94f010000000000000000000000000000000000000000000000000000000000127500

Deployed Bytecode

0x6080604052600436101561001257600080fd5b60003560e01c80630917e7761461010257806332157455146100fd57806332279be4146100f8578063715018a6146100f35780637547c7a3146100ee57806379ba5097146100e9578063811fc153146100e4578063842e2981146100df5780638da5cb5b146100da578063a8e6577d146100d5578063ba7bd2aa146100d0578063c6aa57e3146100cb578063cc7c96ad146100c6578063e30c3978146100c15763f2fde38b036101125761053a565b61051f565b610507565b6104ec565b6104d3565b6104ba565b610470565b610430565b610289565b61024b565b610233565b6101ec565b6101b3565b61017d565b61011d565b600091031261011257565b600080fd5b9052565b565b346101125761012d366004610107565b6101486101386105f1565b6040519182918290815260200190565b0390f35b61015c6101596101599290565b90565b67ffffffffffffffff1690565b6101596276a70061014c565b610159610169565b346101125761018d366004610107565b610148610198610175565b6040519182918267ffffffffffffffff909116815260200190565b34610112576101c3366004610107565b6101487f0000000000000000000000000000000000000000000000000000000000127500610198565b34610112576101fc366004610107565b6102046106e9565b604051005b805b0361011257565b9050359061011b82610209565b906020828203126101125761015991610212565b346101125761020461024636600461021f565b610a9f565b346101125761025b366004610107565b610204610bfc565b610159916008021c5b60ff1690565b906101599154610263565b61015960146001610272565b3461011257610299366004610107565b6101486102a461027d565b60405191829182901515815260200190565b73ffffffffffffffffffffffffffffffffffffffff1690565b61020b816102b6565b9050359061011b826102cf565b9060208282031261011257610159916102d8565b0190565b9061031d61031661030c845190565b8084529260200190565b9260200190565b9060005b81811061032e5750505090565b90919261036d61036660019286518051825260208082015167ffffffffffffffff169083015260409081015115159082015260600190565b9460200190565b929101610321565b8051825261015991606081019160409060208181015167ffffffffffffffff169084015201519060408184039101526102fd565b9061015991610375565b906103c96103bf835190565b8083529160200190565b90816103db6020830284019460200190565b926000915b8383106103ef57505050505090565b9091929394602061041261040b838560019503875289516103a9565b9760200190565b93019301919392906103e0565b6020808252610159929101906103b3565b346101125761014861044b6104463660046102e5565b610e19565b6040519182918261041f565b610117906102b6565b60208101929161011b9190610457565b3461011257610480366004610107565b61014861048b610e48565b60405191829182610460565b9190604083820312610112576101599060206104b38286610212565b9401610212565b34610112576102046104cd366004610497565b90610eb6565b34610112576102046104e6366004610497565b906110c9565b346101125761014861013861050236600461021f565b61128c565b3461011257610517366004610107565b610204611341565b346101125761052f366004610107565b61014861048b611349565b346101125761020461054d3660046102e5565b6113e7565b6102b66101596101599273ffffffffffffffffffffffffffffffffffffffff1690565b61015990610552565b61015990610575565b634e487b7160e01b600052604160045260246000fd5b90601f01601f1916810190811067ffffffffffffffff8211176105bf57604052565b610587565b9050519061011b82610209565b9060208282031261011257610159916105c4565b6040513d6000823e3d90fd5b61066d60206106276106227f000000000000000000000000b2617246d0c6c0087f18703d576831899ca94f0161057e565b61057e565b6106303061057e565b9061063a60405190565b938492839182917f70a0823100000000000000000000000000000000000000000000000000000000835260048301610460565b03915afa9081156106ac57600091610683575090565b610159915060203d6020116106a5575b61069d818361059d565b8101906105d1565b503d610693565b6105e5565b6106b96113f0565b61011b6106d7565b6102b66101596101599290565b610159906106c1565b61011b6106e460006106ce565b61145a565b61011b6106b1565b6101599060a01c61026c565b61015990546106f1565b6101596101596101599290565b9061011b61072160405190565b928361059d565b6101596060610714565b9061073c9061057e565b600052602052604060002090565b634e487b7160e01b600052603260045260246000fd5b80548210156107835761077a600391600052602060002090565b91020190600090565b61074a565b634e487b7160e01b600052600060045260246000fd5b5190565b90600019905b9181191691161790565b906107c26101596107c992610707565b82546107a2565b9055565b5167ffffffffffffffff1690565b9067ffffffffffffffff906107a8565b61015c6101596101599267ffffffffffffffff1690565b906108126101596107c9926107eb565b82546107db565b634e487b7160e01b600052601160045260246000fd5b8181029291811591840414171561084257565b610819565b61015990600261082f565b9160001960089290920291821b911b6107a8565b921b90565b919061087c6101596107c993610707565b908354610852565b61011b9160009161086b565b6000906001906108a08382610884565b0155565b906000036108b55761011b90610890565b610788565b8181106108c5575050565b806108d360006002936108a4565b016108ba565b9190918282106108e857505050565b61090c6109006108fa61011b95610847565b93610847565b91600052602060002090565b91820191016108ba565b906801000000000000000081116105bf578161093361011b935490565b908281556108d9565b51151590565b9068ff00000000000000009060401b6107a8565b151590565b9061096b6101596107c992610956565b8254610942565b906109b06040600161011b9461099361098d6000870161079e565b826107b2565b01926109aa6109a4602083016107cd565b85610802565b0161093c565b9061095b565b9061011b91610972565b6109df6109006109ce845190565b936109d98585610916565b60200190565b6000915b8383106109f05750505050565b6002602082610a08610a026001955190565b866109b6565b019201920191906109e3565b9061011b916109c0565b6002610a5b604061011b94610a3e610a386000830161079e565b866107b2565b610a56610a4d602083016107cd565b60018701610802565b015190565b9101610a14565b91906108b55761011b91610a1e565b90815491680100000000000000008310156105bf5782610a9991600161011b95018155610760565b90610a62565b610aa960016106fd565b610bd157610ab76000610707565b8114610ba2577f8b8eedb035537b2a16bfd327772278759fcf766e4fce44e964b16796da512e3d6060610b2b610aec4261014c565b91610b18610af8610728565b91610b01878452565b67ffffffffffffffff851660208401526040830152565b610b26610159336002610732565b610a71565b610b6983610b587f000000000000000000000000b2617246d0c6c0087f18703d576831899ca94f0161057e565b610b613061057e565b9033906114db565b610b723361057e565b92610b9d610b7f60405190565b9283928390815267ffffffffffffffff909116602082015260400190565b0390a2565b6040517fdf957883000000000000000000000000000000000000000000000000000000008152600490fd5b0390fd5b6040517f86445f9a000000000000000000000000000000000000000000000000000000008152600490fd5b33610c05611349565b610c17610c11836102b6565b916102b6565b03610c255761011b9061145a565b610bcd90610c3260405190565b9182917f118cdaa700000000000000000000000000000000000000000000000000000000835260048301610460565b67ffffffffffffffff81116105bf5760208091020190565b90610c8b610c8683610c61565b610714565b918252565b6101599081565b6101599054610c90565b6101599061015c565b6101599054610ca1565b6101599060401c61026c565b6101599054610cb4565b9061011b610d116001610cdb610728565b94610cec610ce882610c97565b8752565b610d0b610cfa838301610caa565b67ffffffffffffffff166020880152565b01610cc0565b15156040840152565b61015990610cca565b90610d2c825490565b610d3581610c79565b92610d496020850191600052602060002090565b6000915b838310610d5a5750505050565b60026020600192610d6a85610d1a565b815201920192019190610d4d565b9061011b610dab6002610d89610728565b94610d96610ce882610c97565b610da5610cfa60018301610caa565b01610d23565b6040840152565b61015990610d78565b90610dc4825490565b610dcd81610c79565b92610de16020850191600052602060002090565b6000915b838310610df25750505050565b60036020600192610e0285610db2565b815201920192019190610de5565b61015990610dbb565b610e3061015991610e28606090565b506002610732565b610e10565b610159906102b6565b6101599054610e35565b6101596000610e3e565b9190820391821161084257565b80548210156107835761077a600291600052602060002090565b91906108b55761011b91610972565b90815491680100000000000000008310156105bf5782610eb091600161011b95018155610e5f565b90610e79565b600290610ecd610159610ec93385610732565b5490565b81101561106657610ede6000610707565b8314610ba257610efa610efe91610ef53385610732565b610760565b5090565b90610f22610f0b83610c97565b610f1c610f1785610db2565b611552565b90610e52565b8390610f2d565b9190565b1061103b57610fa17f3b061160447fede5059a0f765150555bc1d94f758d7022585a89e3b7a9e57ab192610f9c610f634261014c565b93610f6e60016106fd565b926102f9610f7a610728565b94610f838a8752565b67ffffffffffffffff8816602087015215156040860152565b610e88565b610fab60016106fd565b610fb857610b723361057e565b610fec83610fe57f000000000000000000000000b2617246d0c6c0087f18703d576831899ca94f0161057e565b33906115c8565b610ff53361057e565b7fdaff949ee66f4de29b04430a6c3a6c3ec93f15a89da403ac554fa33613b0eafc61101f60405190565b85815267ffffffffffffffff84166020820152604090a2610b69565b6040517f0d9ec101000000000000000000000000000000000000000000000000000000008152600490fd5b6040517fcf468e43000000000000000000000000000000000000000000000000000000008152600490fd5b67ffffffffffffffff9081169116019067ffffffffffffffff821161084257565b6101596101596101599267ffffffffffffffff1690565b6002906110dc610159610ec93385610732565b81101561106657610efa6110f491610ef53385610732565b01611100610159825490565b8210156112615761111491610efa91610e5f565b61112060018201610cc0565b60019190151582146112365761113c611138836106fd565b1590565b806111f1575b6111c6576111558261119c93830161095b565b61119760006111837f000000000000000000000000b2617246d0c6c0087f18703d576831899ca94f0161057e565b92019161118f83610c97565b9033906115c8565b610c97565b7fdaff949ee66f4de29b04430a6c3a6c3ec93f15a89da403ac554fa33613b0eafc610b694261014c565b6040517f93622c73000000000000000000000000000000000000000000000000000000008152600490fd5b5061122f61122a611203848401610caa565b7f000000000000000000000000000000000000000000000000000000000012750090611091565b6110b2565b4210611142565b6040517ff8746d70000000000000000000000000000000000000000000000000000000008152600490fd5b6040517fbb9d765c000000000000000000000000000000000000000000000000000000008152600490fd5b610f176112aa6101599261129e600090565b50610ef5336002610732565b50610db2565b6112b86113f0565b61011b6112f7565b9074ff00000000000000000000000000000000000000009060a01b6107a8565b906112f06101596107c992610956565b82546112c0565b61130e61130761113860016106fd565b60016112e0565b7f0529c37531eba802cdc9f95a5975438e3d6a1fece492076b16fc72e8c4f4b3fa61133c6102a460016106fd565b0390a1565b61011b6112b0565b6101596001610e3e565b61011b9061135f6113f0565b611397565b9073ffffffffffffffffffffffffffffffffffffffff906107a8565b906113906101596107c99261057e565b8254611364565b6113a2816001611380565b6113b66113b0610622610e48565b9161057e565b907f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e227006113e160405190565b600090a3565b61011b90611353565b6113f8610e48565b3390611406610c11836102b6565b03610c255750565b919060086107a891029161086673ffffffffffffffffffffffffffffffffffffffff841b90565b91906114466101596107c99361057e565b90835461140e565b61011b91600091611435565b61011b9061146a6000600161144e565b6115fc565b6114886114826101599263ffffffff1690565b60e01b90565b7fffffffff000000000000000000000000000000000000000000000000000000001690565b6040906114d761011b94969593966114cd60608401986000850190610457565b6020830190610457565b0152565b906115209061151161011b956004956114f76323b872dd61146f565b9361150160405190565b97889560208701908152016114ad565b6020820181038252038361059d565b61166b565b60010190565b90611534825190565b811015610783576020809102010190565b9190820180921161084257565b600060406115606000610707565b920180515193835b855b8510156115a55761159d61159761156a926115918761158a8a895161152b565b510161079e565b90611545565b95611525565b949050611568565b945092505050565b91602061011b9294936114d760408201966000830190610457565b61152060049261151161011b956115e263a9059cbb61146f565b926115ec60405190565b96879460208601908152016115ad565b6116176113b061160c6000610e3e565b610622846000611380565b907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e06113e160405190565b80151561020b565b9050519061011b82611642565b90602082820312610112576101599161164a565b61167761167e9161057e565b91826116fe565b805161168d610f296000610707565b141590816116da575b5061169e5750565b610bcd906116ab60405190565b9182917f5274afe700000000000000000000000000000000000000000000000000000000835260048301610460565b6116f891508060206116ed611138935190565b818301019101611657565b38611696565b6101599161170c6000610707565b9161175b565b67ffffffffffffffff81116105bf57602090601f01601f19160190565b90610c8b610c8683611712565b3d156117565761174b3d61172f565b903d6000602084013e565b606090565b916117653061057e565b8181311061178f575060008281926020610159969551920190855af161178961173c565b916117cb565b610bcd9061179c60405190565b9182917fcd78605900000000000000000000000000000000000000000000000000000000835260048301610460565b906117d65750611846565b81516117e5610f296000610707565b1480611830575b6117f4575090565b610bcd9061180160405190565b9182917f9996b31500000000000000000000000000000000000000000000000000000000835260048301610460565b50803b611840610f296000610707565b146117ec565b8051611855610f296000610707565b111561186357805190602001fd5b6040517f1425ea42000000000000000000000000000000000000000000000000000000008152600490fdfea264697066735822122070041f7638b561962cd2087d9bfb752aa747e7eb8fb563dfbd81391555ddf6db64736f6c63430008180033

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

000000000000000000000000b2617246d0c6c0087f18703d576831899ca94f010000000000000000000000000000000000000000000000000000000000127500

-----Decoded View---------------
Arg [0] : _zigContract (address): 0xb2617246d0c6c0087f18703d576831899ca94f01
Arg [1] : _penaltyPeriod (uint64): 1209600

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000b2617246d0c6c0087f18703d576831899ca94f01
Arg [1] : 0000000000000000000000000000000000000000000000000000000000127500


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.