ETH Price: $2,731.49 (-8.61%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Unstake243434162026-01-29 22:11:473 hrs ago1769724707IN
0x08071901...e3087d101
0 ETH0.000213342.08261602
Unstake243434132026-01-29 22:11:113 hrs ago1769724671IN
0x08071901...e3087d101
0 ETH0.000248442.07839105
Unstake243432202026-01-29 21:32:114 hrs ago1769722331IN
0x08071901...e3087d101
0 ETH0.000229392.10356927
Unstake243430162026-01-29 20:50:595 hrs ago1769719859IN
0x08071901...e3087d101
0 ETH0.000213512.10233821
Unstake243429912026-01-29 20:45:595 hrs ago1769719559IN
0x08071901...e3087d101
0 ETH0.000215232.11933048
Unstake243429872026-01-29 20:45:115 hrs ago1769719511IN
0x08071901...e3087d101
0 ETH0.000214492.11203002
Unstake243429832026-01-29 20:44:235 hrs ago1769719463IN
0x08071901...e3087d101
0 ETH0.000308012.1165586
Unstake243427312026-01-29 19:53:595 hrs ago1769716439IN
0x08071901...e3087d101
0 ETH0.00002140.17905287
Unstake243417722026-01-29 16:41:359 hrs ago1769704895IN
0x08071901...e3087d101
0 ETH0.000294841.7690404
Stake243353772026-01-28 19:16:5930 hrs ago1769627819IN
0x08071901...e3087d101
0 ETH0.000024940.13305345
Stake243353572026-01-28 19:12:5930 hrs ago1769627579IN
0x08071901...e3087d101
0 ETH0.00002350.12300811
Stake243318882026-01-28 7:36:2342 hrs ago1769585783IN
0x08071901...e3087d101
0 ETH0.000403642.04638544
Unstake243303942026-01-28 2:36:4747 hrs ago1769567807IN
0x08071901...e3087d101
0 ETH0.000205652.04263949
Unstake243303912026-01-28 2:36:1147 hrs ago1769567771IN
0x08071901...e3087d101
0 ETH0.000259552.04182621
Unstake243303682026-01-28 2:31:3547 hrs ago1769567495IN
0x08071901...e3087d101
0 ETH0.000185492.04343323
Unstake243303642026-01-28 2:30:4747 hrs ago1769567447IN
0x08071901...e3087d101
0 ETH0.000205182.04389243
Unstake243303612026-01-28 2:30:1147 hrs ago1769567411IN
0x08071901...e3087d101
0 ETH0.000204982.04194017
Unstake243303552026-01-28 2:28:5947 hrs ago1769567339IN
0x08071901...e3087d101
0 ETH0.000335272.04196786
Stake243289692026-01-27 21:51:112 days ago1769550671IN
0x08071901...e3087d101
0 ETH0.000416722.11581653
Stake243287972026-01-27 21:16:232 days ago1769548583IN
0x08071901...e3087d101
0 ETH0.000408892.130008
Unstake243286642026-01-27 20:49:352 days ago1769546975IN
0x08071901...e3087d101
0 ETH0.000213362.10691611
Unstake243286582026-01-27 20:48:232 days ago1769546903IN
0x08071901...e3087d101
0 ETH0.000304362.10186614
Stake243280902026-01-27 18:53:472 days ago1769540027IN
0x08071901...e3087d101
0 ETH0.000444112.11733689
Stake243204282026-01-26 17:14:473 days ago1769447687IN
0x08071901...e3087d101
0 ETH0.000032490.17204441
Unstake243160352026-01-26 2:32:353 days ago1769394755IN
0x08071901...e3087d101
0 ETH0.000014110.11631206
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
StakingVault

Compiler Version
v0.8.30+commit.73712a01

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.30;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "./interfaces/staking/IStakingStorage.sol";
import "./interfaces/staking/StakingErrors.sol";
import "./lib/Flags.sol";
import "./StakingFlags.sol";
import "./StakingFlags.sol";

uint16 constant EMPTY_FLAGS = 0;

contract StakingVault is
    ReentrancyGuard,
    AccessControl,
    Pausable,
    StakingErrors
{
    using SafeERC20 for IERC20;
    using Flags for uint16;

    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");
    bytes32 public constant CLAIM_CONTRACT_ROLE =
        keccak256("CLAIM_CONTRACT_ROLE");
    bytes32 public constant MULTISIG_ROLE = keccak256("MULTISIG_ROLE");

    // Immutable references
    IStakingStorage public immutable stakingStorage;
    IERC20 public immutable token;

    // Events
    event Staked(
        address indexed staker,
        bytes32 stakeId,
        uint128 amount,
        uint16 indexed stakeDay,
        uint16 indexed daysLock,
        uint16 flags
    );

    event Unstaked(
        address indexed staker,
        bytes32 indexed stakeId,
        uint16 indexed unstakeDay,
        uint128 amount
    );

    event EmergencyRecover(address token, address to, uint256 amount);

    constructor(
        IERC20 _token,
        address _storage,
        address _multisig,
        address _manager
    ) {
        _grantRole(DEFAULT_ADMIN_ROLE, _multisig);
        _grantRole(MANAGER_ROLE, _manager);
        _grantRole(MULTISIG_ROLE, _multisig);

        token = _token;
        stakingStorage = IStakingStorage(_storage);
    }

    // ═══════════════════════════════════════════════════════════════════
    //                        CORE STAKING FUNCTIONS
    // ═══════════════════════════════════════════════════════════════════

    /**
     * @notice Stake tokens with timelock
     * @param amount Amount to stake
     * @param daysLock Timelock period in days
     * @return stakeId Unique identifier for the stake
     */
    function stake(
        uint128 amount,
        uint16 daysLock
    ) external whenNotPaused nonReentrant returns (bytes32 stakeId) {
        require(amount > 0, InvalidAmount());

        address staker = msg.sender;

        // Transfer tokens
        token.safeTransferFrom(staker, address(this), amount);

        // Create stake in storage and get the generated ID
        stakeId = stakingStorage.createStake(
            staker,
            amount,
            daysLock,
            EMPTY_FLAGS
        );

        emit Staked(
            staker,
            stakeId,
            amount,
            _getCurrentDay(),
            daysLock,
            EMPTY_FLAGS
        );
    }

    /**
     * @notice Unstake matured tokens
     * @param stakeId ID of the stake to unstake
     */
    function unstake(bytes32 stakeId) public whenNotPaused nonReentrant {
        address caller = msg.sender;

        // Get stake from storage
        IStakingStorage.Stake memory _stake = stakingStorage.getStake(stakeId);

        // Validate stake
        require(_stake.amount > 0, StakeNotFound(stakeId));
        require(_stake.unstakeDay == 0, StakeAlreadyUnstaked(stakeId));

        // Check maturity
        uint16 currentDay = _getCurrentDay();
        uint16 matureDay = _stake.stakeDay + _stake.daysLock;
        require(
            currentDay >= matureDay,
            StakeNotMatured(stakeId, currentDay, matureDay)
        );

        // Remove stake from storage
        stakingStorage.removeStake(caller, stakeId);

        // Transfer tokens back
        token.safeTransfer(caller, _stake.amount);

        emit Unstaked(caller, stakeId, currentDay, _stake.amount);
    }

    /**
     * @notice Unstake multiple matured tokens in a single transaction.
     * @param stakeIds An array of stake IDs to unstake.
     */
    function batchUnstake(bytes32[] calldata stakeIds) external {
        for (uint256 i = 0; i < stakeIds.length; i++) {
            unstake(stakeIds[i]);
        }
    }

    /**
     * @notice Stake tokens from claim contract
     * @dev This function is used to stake tokens from the claim contract
     * @dev Tokens are already transferred from the claim contract to the staking vault
     * @param staker Address of the staker
     * @param amount Amount to stake
     * @param daysLock Timelock period in days
     * @return stakeId Unique identifier for the stake
     */
    function stakeFromClaim(
        address staker,
        uint128 amount,
        uint16 daysLock
    )
        external
        whenNotPaused
        onlyRole(CLAIM_CONTRACT_ROLE)
        returns (bytes32 stakeId)
    {
        require(amount > 0, InvalidAmount());

        uint16 flags = Flags.set(EMPTY_FLAGS, StakingFlags.IS_FROM_CLAIM_BIT);

        // Create stake in storage and get the generated ID
        stakeId = stakingStorage.createStake(staker, amount, daysLock, flags);

        emit Staked(staker, stakeId, amount, _getCurrentDay(), daysLock, flags);
    }

    // ═══════════════════════════════════════════════════════════════════
    //                        ADMIN FUNCTIONS
    // ═══════════════════════════════════════════════════════════════════

    /**
     * @notice Pause the contract
     */
    function pause() external onlyRole(MANAGER_ROLE) {
        _pause();
    }

    /**
     * @notice Unpause the contract
     */
    function unpause() external onlyRole(MANAGER_ROLE) {
        _unpause();
    }

    /**
     * @notice Emergency token recovery
     * @param token_ Token to recover
     * @param amount Amount to recover
     */
    function emergencyRecover(
        IERC20 token_,
        uint256 amount
    ) external onlyRole(MULTISIG_ROLE) {
        token_.safeTransfer(msg.sender, amount);
        emit EmergencyRecover(address(token_), msg.sender, amount);
    }

    // ═══════════════════════════════════════════════════════════════════
    //                        INTERNAL FUNCTIONS
    // ═══════════════════════════════════════════════════════════════════

    function _getCurrentDay() internal view returns (uint16) {
        return uint16(block.timestamp / 1 days);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.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 EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * 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;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` from `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 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 Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            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 silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.30;

/**
 * @title IStakingStorage Interface
 * @notice Unified interface for consolidated staking storage
 */
interface IStakingStorage {
    enum Sign {
        POSITIVE,
        NEGATIVE
    }
    struct Stake {
        uint128 amount;
        uint16 stakeDay;
        uint16 unstakeDay;
        uint16 daysLock;
        uint16 flags; // 2 bytes - pack multiple booleans
    }

    struct StakerInfo {
        uint128 totalStaked;
        uint128 totalRewarded;
        uint128 totalClaimed;
        uint16 stakesCounter;
        uint16 activeStakesNumber;
        uint16 lastCheckpointDay;
    }

    struct DailySnapshot {
        uint128 totalStakedAmount;
        uint16 totalStakesCount;
    }

    // Events
    event Staked(
        address indexed staker,
        bytes32 indexed stakeId,
        uint128 amount,
        uint16 indexed stakeDay,
        uint16 daysLock,
        uint16 flags
    );

    event Unstaked(
        address indexed staker,
        bytes32 indexed stakeId,
        uint16 indexed unstakeDay,
        uint128 amount
    );

    event CheckpointCreated(
        address indexed staker,
        uint16 indexed day,
        uint128 balance,
        uint16 stakesCount
    );

    // Stake Management
    function createStake(
        address staker,
        uint128 amount,
        uint16 daysLock,
        uint16 flags
    ) external returns (bytes32 stakeId);

    function removeStake(address staker, bytes32 stakeId) external;

    function getStake(bytes32 stakeId) external view returns (Stake memory);

    function isActiveStake(bytes32 stakeId) external view returns (bool);

    // Staker Management
    function getStakerInfo(
        address staker
    ) external view returns (StakerInfo memory);

    function getStakerBalance(address staker) external view returns (uint128);

    function getStakerBalanceAt(
        address staker,
        uint16 targetDay
    ) external view returns (uint128);

    function batchGetStakerBalances(
        address[] calldata stakers,
        uint16 targetDay
    ) external view returns (uint128[] memory);

    // Global Statistics
    function getDailySnapshot(
        uint16 day
    ) external view returns (DailySnapshot memory);

    function getCurrentTotalStaked() external view returns (uint128);

    // Pagination
    function getStakersPaginated(
        uint256 offset,
        uint256 limit
    ) external view returns (address[] memory);

    function getTotalStakersCount() external view returns (uint256);

    function getStakerStakeIds(
        address staker
    ) external view returns (bytes32[] memory);
}

File 8 of 17 : StakingErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;

/**
 * @title StakingErrors
 * @notice Comprehensive standardized error definitions for the staking system
 */
interface StakingErrors {
    // ============================================================================
    // Stake Validation Errors
    // ============================================================================
    error InvalidAmount();
    error StakeNotFound(bytes32 stakeId);
    error StakeAlreadyExists(bytes32 stakeId);
    error StakeAlreadyUnstaked(bytes32 stakeId);
    error StakeNotMatured(bytes32 stakeId, uint16 currentDay, uint16 matureDay);

    // ============================================================================
    // Ownership and Access Errors
    // ============================================================================
    error NotStakeOwner(address caller, address owner);
    error StakerNotFound(address staker);
    error UnauthorizedCaller(address caller, bytes32 requiredRole);
    error ControllerAlreadySet();

    // ============================================================================
    // Token and Recovery Errors
    // ============================================================================
    error CannotRecoverStakingToken();
    error InsufficientTokenBalance(uint256 requested, uint256 available);
    error TokenTransferFailed(address token, address to, uint256 amount);

    // ============================================================================
    // Data Access and Pagination Errors
    // ============================================================================
    error OutOfBounds(uint256 total, uint256 offset);
    error InvalidPaginationParameters(uint256 offset, uint256 limit);
    error LimitTooLarge(uint256 limit, uint256 maximum);

    // ============================================================================
    // Time and Lock Period Errors
    // ============================================================================
    error InvalidLockPeriod(uint16 daysLock, uint16 minimum, uint16 maximum);
    error InvalidDay(uint16 day);
    error TimeLockNotExpired(
        bytes32 stakeId,
        uint16 currentDay,
        uint16 unlockDay
    );

    // ============================================================================
    // State Management Errors
    // ============================================================================
    error ContractPaused();
    error ContractNotPaused();
    error InvalidContractState(string expectedState, string currentState);

    // ============================================================================
    // Checkpoint and Historical Data Errors
    // ============================================================================
    error CheckpointNotFound(address staker, uint16 day);
    error InvalidCheckpointDay(uint16 day, uint16 currentDay);
    error CheckpointArrayCorrupted(address staker);

    // ============================================================================
    // Stake Creation and Management Errors
    // ============================================================================
    error StakeCreationFailed(address staker, uint128 amount, uint16 daysLock);
    error StakeRemovalFailed(address staker, bytes32 stakeId);
    error InvalidStakeParameters(uint128 amount, uint16 daysLock);

    // ============================================================================
    // Address Validation Errors
    // ============================================================================
    error ZeroAddress();
    error InvalidStakerAddress(address staker);
    error InvalidContractAddress(address contractAddr);

    // ============================================================================
    // Arithmetic and Calculation Errors
    // ============================================================================
    error ArithmeticOverflow(uint256 value);
    error ArithmeticUnderflow(uint256 value);
    error DivisionByZero();
    error InvalidCalculationResult(uint256 result);

    // ============================================================================
    // Flag System Errors
    // ============================================================================
    error InvalidFlags(uint16 flags);
    error UnsupportedFlagOperation(uint16 flags, string operation);

    // ============================================================================
    // Batch Operation Errors
    // ============================================================================
    error BatchSizeExceeded(uint256 batchSize, uint256 maximum);
    error BatchOperationFailed(uint256 successCount, uint256 totalCount);
    error EmptyBatchOperation();
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;

/**
 * @title Flags
 * @notice A generic library for handling bitwise flag operations on a uint16.
 */
library Flags {
    /**
     * @notice Sets a specific bit in the flags.
     * @param flags The current flags value.
     * @param bit The bit position to set.
     * @return The updated flags value.
     */
    function set(uint16 flags, uint8 bit) internal pure returns (uint16) {
        return flags | uint16(1 << bit);
    }

    /**
     * @notice Unsets a specific bit in the flags.
     * @param flags The current flags value.
     * @param bit The bit position to unset.
     * @return The updated flags value.
     */
    function unset(uint16 flags, uint8 bit) internal pure returns (uint16) {
        return flags & ~uint16(1 << bit);
    }

    /**
     * @notice Checks if a specific bit is set in the flags.
     * @param flags The current flags value.
     * @param bit The bit position to check.
     * @return True if the bit is set, false otherwise.
     */
    function isSet(uint16 flags, uint8 bit) internal pure returns (bool) {
        return (flags & (1 << bit)) != 0;
    }
}

File 10 of 17 : StakingFlags.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.30;

/**
 * @title StakingFlags
 * @notice A central place for staking-specific flag definitions.
 */
library StakingFlags {
    uint8 public constant IS_FROM_CLAIM_BIT = 0;
    // Future flags can be added here, e.g.:
    // uint8 public constant IS_DELEGATED_BIT = 1;
    // uint8 public constant IS_LOCKED_BIT = 2;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC-165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted to signal this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 16 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

File 17 of 17 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

Settings
{
  "remappings": [
    "@openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "console/=lib/forge-std/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"address","name":"_storage","type":"address"},{"internalType":"address","name":"_multisig","type":"address"},{"internalType":"address","name":"_manager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"ArithmeticOverflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"ArithmeticUnderflow","type":"error"},{"inputs":[{"internalType":"uint256","name":"successCount","type":"uint256"},{"internalType":"uint256","name":"totalCount","type":"uint256"}],"name":"BatchOperationFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"batchSize","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"BatchSizeExceeded","type":"error"},{"inputs":[],"name":"CannotRecoverStakingToken","type":"error"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"CheckpointArrayCorrupted","type":"error"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint16","name":"day","type":"uint16"}],"name":"CheckpointNotFound","type":"error"},{"inputs":[],"name":"ContractNotPaused","type":"error"},{"inputs":[],"name":"ContractPaused","type":"error"},{"inputs":[],"name":"ControllerAlreadySet","type":"error"},{"inputs":[],"name":"DivisionByZero","type":"error"},{"inputs":[],"name":"EmptyBatchOperation","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"uint256","name":"requested","type":"uint256"},{"internalType":"uint256","name":"available","type":"uint256"}],"name":"InsufficientTokenBalance","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"name":"InvalidCalculationResult","type":"error"},{"inputs":[{"internalType":"uint16","name":"day","type":"uint16"},{"internalType":"uint16","name":"currentDay","type":"uint16"}],"name":"InvalidCheckpointDay","type":"error"},{"inputs":[{"internalType":"address","name":"contractAddr","type":"address"}],"name":"InvalidContractAddress","type":"error"},{"inputs":[{"internalType":"string","name":"expectedState","type":"string"},{"internalType":"string","name":"currentState","type":"string"}],"name":"InvalidContractState","type":"error"},{"inputs":[{"internalType":"uint16","name":"day","type":"uint16"}],"name":"InvalidDay","type":"error"},{"inputs":[{"internalType":"uint16","name":"flags","type":"uint16"}],"name":"InvalidFlags","type":"error"},{"inputs":[{"internalType":"uint16","name":"daysLock","type":"uint16"},{"internalType":"uint16","name":"minimum","type":"uint16"},{"internalType":"uint16","name":"maximum","type":"uint16"}],"name":"InvalidLockPeriod","type":"error"},{"inputs":[{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"InvalidPaginationParameters","type":"error"},{"inputs":[{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint16","name":"daysLock","type":"uint16"}],"name":"InvalidStakeParameters","type":"error"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"InvalidStakerAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"limit","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"LimitTooLarge","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"NotStakeOwner","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"offset","type":"uint256"}],"name":"OutOfBounds","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"bytes32","name":"stakeId","type":"bytes32"}],"name":"StakeAlreadyExists","type":"error"},{"inputs":[{"internalType":"bytes32","name":"stakeId","type":"bytes32"}],"name":"StakeAlreadyUnstaked","type":"error"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint16","name":"daysLock","type":"uint16"}],"name":"StakeCreationFailed","type":"error"},{"inputs":[{"internalType":"bytes32","name":"stakeId","type":"bytes32"}],"name":"StakeNotFound","type":"error"},{"inputs":[{"internalType":"bytes32","name":"stakeId","type":"bytes32"},{"internalType":"uint16","name":"currentDay","type":"uint16"},{"internalType":"uint16","name":"matureDay","type":"uint16"}],"name":"StakeNotMatured","type":"error"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"bytes32","name":"stakeId","type":"bytes32"}],"name":"StakeRemovalFailed","type":"error"},{"inputs":[{"internalType":"address","name":"staker","type":"address"}],"name":"StakerNotFound","type":"error"},{"inputs":[{"internalType":"bytes32","name":"stakeId","type":"bytes32"},{"internalType":"uint16","name":"currentDay","type":"uint16"},{"internalType":"uint16","name":"unlockDay","type":"uint16"}],"name":"TimeLockNotExpired","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenTransferFailed","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes32","name":"requiredRole","type":"bytes32"}],"name":"UnauthorizedCaller","type":"error"},{"inputs":[{"internalType":"uint16","name":"flags","type":"uint16"},{"internalType":"string","name":"operation","type":"string"}],"name":"UnsupportedFlagOperation","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyRecover","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":false,"internalType":"bytes32","name":"stakeId","type":"bytes32"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"},{"indexed":true,"internalType":"uint16","name":"stakeDay","type":"uint16"},{"indexed":true,"internalType":"uint16","name":"daysLock","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"flags","type":"uint16"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"bytes32","name":"stakeId","type":"bytes32"},{"indexed":true,"internalType":"uint16","name":"unstakeDay","type":"uint16"},{"indexed":false,"internalType":"uint128","name":"amount","type":"uint128"}],"name":"Unstaked","type":"event"},{"inputs":[],"name":"CLAIM_CONTRACT_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MULTISIG_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"stakeIds","type":"bytes32[]"}],"name":"batchUnstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token_","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyRecover","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint16","name":"daysLock","type":"uint16"}],"name":"stake","outputs":[{"internalType":"bytes32","name":"stakeId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint16","name":"daysLock","type":"uint16"}],"name":"stakeFromClaim","outputs":[{"internalType":"bytes32","name":"stakeId","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingStorage","outputs":[{"internalType":"contract IStakingStorage","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"stakeId","type":"bytes32"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c060405234801561000f575f5ffd5b5060405161132d38038061132d83398101604081905261002e91610157565b60015f90815561003e90836100ae565b506100697f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08826100ae565b506100947fa5a0b70b385ff7611cd3840916bd08b10829e5bf9e6637cf79dd9a427fc0e2ab836100ae565b5050506001600160a01b0391821660a052166080526101b3565b5f8281526001602090815260408083206001600160a01b038516845290915281205460ff16610137575f8381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a450600161013a565b505f5b92915050565b6001600160a01b0381168114610154575f5ffd5b50565b5f5f5f5f6080858703121561016a575f5ffd5b845161017581610140565b602086015190945061018681610140565b604086015190935061019781610140565b60608601519092506101a881610140565b939692955090935050565b60805160a05161112f6101fe5f395f818161030c015281816105ef01526107e301525f818161021f01528181610426015281816105880152818161082b01526109ad015261112f5ff3fe608060405234801561000f575f5ffd5b5060043610610127575f3560e01c8063a217fddf116100a9578063dbe46e671161006e578063dbe46e671461027f578063e328400c146102a6578063ec87621c146102cd578063fb1643d7146102f4578063fc0c546a14610307575f5ffd5b8063a217fddf14610200578063a5a1126614610207578063b518a00e1461021a578063b55fb44c14610259578063d547741f1461026c575f5ffd5b80635c975abb116100ef5780635c975abb146101b457806371ed5d1a146101bf5780638456cb59146101d257806391d14854146101da5780639639011e146101ed575f5ffd5b806301ffc9a71461012b578063248a9ca3146101535780632f2ff15d1461018457806336568abe146101995780633f4ba83a146101ac575b5f5ffd5b61013e610139366004610de5565b61032e565b60405190151581526020015b60405180910390f35b610176610161366004610e13565b5f908152600160208190526040909120015490565b60405190815260200161014a565b610197610192366004610e3e565b610364565b005b6101976101a7366004610e3e565b61038f565b6101976103c7565b60025460ff1661013e565b6101976101cd366004610e13565b6103fc565b610197610680565b61013e6101e8366004610e3e565b6106b2565b6101976101fb366004610e6c565b6106dc565b6101765f81565b610197610215366004610e96565b610768565b6102417f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161014a565b610176610267366004610f2a565b61079b565b61019761027a366004610e3e565b61091a565b6101767f7b86e74b5b2cbeb359a5556f7b8aa26ec9fb74773c1c7b2dc16e82d368c7062781565b6101767fa5a0b70b385ff7611cd3840916bd08b10829e5bf9e6637cf79dd9a427fc0e2ab81565b6101767f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b610176610302366004610f56565b61093f565b6102417f000000000000000000000000000000000000000000000000000000000000000081565b5f6001600160e01b03198216637965db0b60e01b148061035e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f828152600160208190526040909120015461037f81610aa6565b6103898383610ab0565b50505050565b6001600160a01b03811633146103b85760405163334bd91960e11b815260040160405180910390fd5b6103c28282610b26565b505050565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b086103f181610aa6565b6103f9610b91565b50565b610404610be3565b61040c610c09565b6040516373b2e09160e11b81526004810182905233905f907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e765c1229060240160a060405180830381865afa158015610473573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104979190610fb9565b805190915083906001600160801b03166104d05760405163fbea34c360e01b81526004016104c791815260200190565b60405180910390fd5b506040810151839061ffff16156104fd57604051634fae759560e11b81526004016104c791815260200190565b505f610507610c31565b90505f8260600151836020015161051e9190611053565b905084828261ffff80821690831610156105605760405163a171a31b60e01b8152600481019390935261ffff91821660248401521660448201526064016104c7565b505060405163377f548960e01b81526001600160a01b038681166004830152602482018890527f000000000000000000000000000000000000000000000000000000000000000016915063377f5489906044015f604051808303815f87803b1580156105ca575f5ffd5b505af11580156105dc573d5f5f3e3d5ffd5b5050845161062192506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016915086906001600160801b0316610c44565b82516040516001600160801b03909116815261ffff83169086906001600160a01b038716907f954d6c098e53b2493dff95f8d8fe70acebd03cf52c3f36942c5a440864852ddf9060200160405180910390a4505050506103f960015f55565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b086106aa81610aa6565b6103f9610ca3565b5f9182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7fa5a0b70b385ff7611cd3840916bd08b10829e5bf9e6637cf79dd9a427fc0e2ab61070681610aa6565b61071a6001600160a01b0384163384610c44565b604080516001600160a01b03851681523360208201529081018390527f1fb552e352146cbf91ab18bef411c89c83078d9c853e55bef197d0b6731285009060600160405180910390a1505050565b5f5b818110156103c25761079383838381811061078757610787611079565b905060200201356103fc565b60010161076a565b5f6107a4610be3565b6107ac610c09565b5f836001600160801b0316116107d55760405163162908e360e11b815260040160405180910390fd5b336108146001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001682306001600160801b038816610ce0565b6040516307c1dc3760e51b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f83b86e090610866908490889088905f9060040161108d565b6020604051808303815f875af1158015610882573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a691906110c3565b91508261ffff166108b5610c31565b604080518581526001600160801b03881660208201525f81830152905161ffff92909216916001600160a01b038516917fd792eeed90f5fb1d601b0bcdff559e8ba255d831f87c329460206cdbc34e2cde919081900360600190a45061035e60015f55565b5f828152600160208190526040909120015461093581610aa6565b6103898383610b26565b5f610948610be3565b7f7b86e74b5b2cbeb359a5556f7b8aa26ec9fb74773c1c7b2dc16e82d368c7062761097281610aa6565b5f846001600160801b03161161099b5760405163162908e360e11b815260040160405180910390fd5b6040516307c1dc3760e51b81526001907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f83b86e0906109f090899089908990879060040161108d565b6020604051808303815f875af1158015610a0c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a3091906110c3565b92508361ffff16610a3f610c31565b604080518681526001600160801b038916602082015261ffff858116928201929092529116906001600160a01b038916907fd792eeed90f5fb1d601b0bcdff559e8ba255d831f87c329460206cdbc34e2cde9060600160405180910390a450509392505050565b6103f98133610d19565b5f610abb83836106b2565b610b1f575f8381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a450600161035e565b505f61035e565b5f610b3183836106b2565b15610b1f575f8381526001602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161035e565b610b99610d56565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff1615610c075760405163d93c066560e01b815260040160405180910390fd5b565b60025f5403610c2b57604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b5f610c3f62015180426110da565b905090565b6040516001600160a01b038381166024830152604482018390526103c291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610d79565b610cab610be3565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610bc63390565b6040516001600160a01b0384811660248301528381166044830152606482018390526103899186918216906323b872dd90608401610c71565b610d2382826106b2565b610d525760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016104c7565b5050565b60025460ff16610c0757604051638dfc202b60e01b815260040160405180910390fd5b5f5f60205f8451602086015f885af180610d98576040513d5f823e3d81fd5b50505f513d91508115610daf578060011415610dbc565b6001600160a01b0384163b155b1561038957604051635274afe760e01b81526001600160a01b03851660048201526024016104c7565b5f60208284031215610df5575f5ffd5b81356001600160e01b031981168114610e0c575f5ffd5b9392505050565b5f60208284031215610e23575f5ffd5b5035919050565b6001600160a01b03811681146103f9575f5ffd5b5f5f60408385031215610e4f575f5ffd5b823591506020830135610e6181610e2a565b809150509250929050565b5f5f60408385031215610e7d575f5ffd5b8235610e8881610e2a565b946020939093013593505050565b5f5f60208385031215610ea7575f5ffd5b823567ffffffffffffffff811115610ebd575f5ffd5b8301601f81018513610ecd575f5ffd5b803567ffffffffffffffff811115610ee3575f5ffd5b8560208260051b8401011115610ef7575f5ffd5b6020919091019590945092505050565b6001600160801b03811681146103f9575f5ffd5b61ffff811681146103f9575f5ffd5b5f5f60408385031215610f3b575f5ffd5b8235610f4681610f07565b91506020830135610e6181610f1b565b5f5f5f60608486031215610f68575f5ffd5b8335610f7381610e2a565b92506020840135610f8381610f07565b91506040840135610f9381610f1b565b809150509250925092565b8051610fa981610f07565b919050565b8051610fa981610f1b565b5f60a0828403128015610fca575f5ffd5b5060405160a0810167ffffffffffffffff81118282101715610ffa57634e487b7160e01b5f52604160045260245ffd5b60405261100683610f9e565b815261101460208401610fae565b602082015261102560408401610fae565b604082015261103660608401610fae565b606082015261104760808401610fae565b60808201529392505050565b61ffff818116838216019081111561035e57634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b6001600160a01b039490941684526001600160801b0392909216602084015261ffff908116604084015216606082015260800190565b5f602082840312156110d3575f5ffd5b5051919050565b5f826110f457634e487b7160e01b5f52601260045260245ffd5b50049056fea26469706673582212207a860c9ba8144122e6596b60d8977758f67686e694067ab298a15e0e3b9a9e0664736f6c634300081e0033000000000000000000000000f9ff95468cb9a0cd57b8542bbc4c148e290ff465000000000000000000000000faa8a501cf7ffd8080b0864f2c959e8cbcf8303000000000000000000000000007338f0d76f9d74c42c360ff7f852fce1c5369830000000000000000000000006972480b73fd3a5278c039cf072b499c4ca22e33

Deployed Bytecode

0x608060405234801561000f575f5ffd5b5060043610610127575f3560e01c8063a217fddf116100a9578063dbe46e671161006e578063dbe46e671461027f578063e328400c146102a6578063ec87621c146102cd578063fb1643d7146102f4578063fc0c546a14610307575f5ffd5b8063a217fddf14610200578063a5a1126614610207578063b518a00e1461021a578063b55fb44c14610259578063d547741f1461026c575f5ffd5b80635c975abb116100ef5780635c975abb146101b457806371ed5d1a146101bf5780638456cb59146101d257806391d14854146101da5780639639011e146101ed575f5ffd5b806301ffc9a71461012b578063248a9ca3146101535780632f2ff15d1461018457806336568abe146101995780633f4ba83a146101ac575b5f5ffd5b61013e610139366004610de5565b61032e565b60405190151581526020015b60405180910390f35b610176610161366004610e13565b5f908152600160208190526040909120015490565b60405190815260200161014a565b610197610192366004610e3e565b610364565b005b6101976101a7366004610e3e565b61038f565b6101976103c7565b60025460ff1661013e565b6101976101cd366004610e13565b6103fc565b610197610680565b61013e6101e8366004610e3e565b6106b2565b6101976101fb366004610e6c565b6106dc565b6101765f81565b610197610215366004610e96565b610768565b6102417f000000000000000000000000faa8a501cf7ffd8080b0864f2c959e8cbcf8303081565b6040516001600160a01b03909116815260200161014a565b610176610267366004610f2a565b61079b565b61019761027a366004610e3e565b61091a565b6101767f7b86e74b5b2cbeb359a5556f7b8aa26ec9fb74773c1c7b2dc16e82d368c7062781565b6101767fa5a0b70b385ff7611cd3840916bd08b10829e5bf9e6637cf79dd9a427fc0e2ab81565b6101767f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b610176610302366004610f56565b61093f565b6102417f000000000000000000000000f9ff95468cb9a0cd57b8542bbc4c148e290ff46581565b5f6001600160e01b03198216637965db0b60e01b148061035e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b5f828152600160208190526040909120015461037f81610aa6565b6103898383610ab0565b50505050565b6001600160a01b03811633146103b85760405163334bd91960e11b815260040160405180910390fd5b6103c28282610b26565b505050565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b086103f181610aa6565b6103f9610b91565b50565b610404610be3565b61040c610c09565b6040516373b2e09160e11b81526004810182905233905f907f000000000000000000000000faa8a501cf7ffd8080b0864f2c959e8cbcf830306001600160a01b03169063e765c1229060240160a060405180830381865afa158015610473573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104979190610fb9565b805190915083906001600160801b03166104d05760405163fbea34c360e01b81526004016104c791815260200190565b60405180910390fd5b506040810151839061ffff16156104fd57604051634fae759560e11b81526004016104c791815260200190565b505f610507610c31565b90505f8260600151836020015161051e9190611053565b905084828261ffff80821690831610156105605760405163a171a31b60e01b8152600481019390935261ffff91821660248401521660448201526064016104c7565b505060405163377f548960e01b81526001600160a01b038681166004830152602482018890527f000000000000000000000000faa8a501cf7ffd8080b0864f2c959e8cbcf8303016915063377f5489906044015f604051808303815f87803b1580156105ca575f5ffd5b505af11580156105dc573d5f5f3e3d5ffd5b5050845161062192506001600160a01b037f000000000000000000000000f9ff95468cb9a0cd57b8542bbc4c148e290ff46516915086906001600160801b0316610c44565b82516040516001600160801b03909116815261ffff83169086906001600160a01b038716907f954d6c098e53b2493dff95f8d8fe70acebd03cf52c3f36942c5a440864852ddf9060200160405180910390a4505050506103f960015f55565b7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b086106aa81610aa6565b6103f9610ca3565b5f9182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b7fa5a0b70b385ff7611cd3840916bd08b10829e5bf9e6637cf79dd9a427fc0e2ab61070681610aa6565b61071a6001600160a01b0384163384610c44565b604080516001600160a01b03851681523360208201529081018390527f1fb552e352146cbf91ab18bef411c89c83078d9c853e55bef197d0b6731285009060600160405180910390a1505050565b5f5b818110156103c25761079383838381811061078757610787611079565b905060200201356103fc565b60010161076a565b5f6107a4610be3565b6107ac610c09565b5f836001600160801b0316116107d55760405163162908e360e11b815260040160405180910390fd5b336108146001600160a01b037f000000000000000000000000f9ff95468cb9a0cd57b8542bbc4c148e290ff4651682306001600160801b038816610ce0565b6040516307c1dc3760e51b81526001600160a01b037f000000000000000000000000faa8a501cf7ffd8080b0864f2c959e8cbcf83030169063f83b86e090610866908490889088905f9060040161108d565b6020604051808303815f875af1158015610882573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108a691906110c3565b91508261ffff166108b5610c31565b604080518581526001600160801b03881660208201525f81830152905161ffff92909216916001600160a01b038516917fd792eeed90f5fb1d601b0bcdff559e8ba255d831f87c329460206cdbc34e2cde919081900360600190a45061035e60015f55565b5f828152600160208190526040909120015461093581610aa6565b6103898383610b26565b5f610948610be3565b7f7b86e74b5b2cbeb359a5556f7b8aa26ec9fb74773c1c7b2dc16e82d368c7062761097281610aa6565b5f846001600160801b03161161099b5760405163162908e360e11b815260040160405180910390fd5b6040516307c1dc3760e51b81526001907f000000000000000000000000faa8a501cf7ffd8080b0864f2c959e8cbcf830306001600160a01b03169063f83b86e0906109f090899089908990879060040161108d565b6020604051808303815f875af1158015610a0c573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a3091906110c3565b92508361ffff16610a3f610c31565b604080518681526001600160801b038916602082015261ffff858116928201929092529116906001600160a01b038916907fd792eeed90f5fb1d601b0bcdff559e8ba255d831f87c329460206cdbc34e2cde9060600160405180910390a450509392505050565b6103f98133610d19565b5f610abb83836106b2565b610b1f575f8381526001602081815260408084206001600160a01b0387168086529252808420805460ff19169093179092559051339286917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a450600161035e565b505f61035e565b5f610b3183836106b2565b15610b1f575f8381526001602090815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161035e565b610b99610d56565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff1615610c075760405163d93c066560e01b815260040160405180910390fd5b565b60025f5403610c2b57604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b5f610c3f62015180426110da565b905090565b6040516001600160a01b038381166024830152604482018390526103c291859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050610d79565b610cab610be3565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610bc63390565b6040516001600160a01b0384811660248301528381166044830152606482018390526103899186918216906323b872dd90608401610c71565b610d2382826106b2565b610d525760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016104c7565b5050565b60025460ff16610c0757604051638dfc202b60e01b815260040160405180910390fd5b5f5f60205f8451602086015f885af180610d98576040513d5f823e3d81fd5b50505f513d91508115610daf578060011415610dbc565b6001600160a01b0384163b155b1561038957604051635274afe760e01b81526001600160a01b03851660048201526024016104c7565b5f60208284031215610df5575f5ffd5b81356001600160e01b031981168114610e0c575f5ffd5b9392505050565b5f60208284031215610e23575f5ffd5b5035919050565b6001600160a01b03811681146103f9575f5ffd5b5f5f60408385031215610e4f575f5ffd5b823591506020830135610e6181610e2a565b809150509250929050565b5f5f60408385031215610e7d575f5ffd5b8235610e8881610e2a565b946020939093013593505050565b5f5f60208385031215610ea7575f5ffd5b823567ffffffffffffffff811115610ebd575f5ffd5b8301601f81018513610ecd575f5ffd5b803567ffffffffffffffff811115610ee3575f5ffd5b8560208260051b8401011115610ef7575f5ffd5b6020919091019590945092505050565b6001600160801b03811681146103f9575f5ffd5b61ffff811681146103f9575f5ffd5b5f5f60408385031215610f3b575f5ffd5b8235610f4681610f07565b91506020830135610e6181610f1b565b5f5f5f60608486031215610f68575f5ffd5b8335610f7381610e2a565b92506020840135610f8381610f07565b91506040840135610f9381610f1b565b809150509250925092565b8051610fa981610f07565b919050565b8051610fa981610f1b565b5f60a0828403128015610fca575f5ffd5b5060405160a0810167ffffffffffffffff81118282101715610ffa57634e487b7160e01b5f52604160045260245ffd5b60405261100683610f9e565b815261101460208401610fae565b602082015261102560408401610fae565b604082015261103660608401610fae565b606082015261104760808401610fae565b60808201529392505050565b61ffff818116838216019081111561035e57634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b6001600160a01b039490941684526001600160801b0392909216602084015261ffff908116604084015216606082015260800190565b5f602082840312156110d3575f5ffd5b5051919050565b5f826110f457634e487b7160e01b5f52601260045260245ffd5b50049056fea26469706673582212207a860c9ba8144122e6596b60d8977758f67686e694067ab298a15e0e3b9a9e0664736f6c634300081e0033

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

000000000000000000000000f9ff95468cb9a0cd57b8542bbc4c148e290ff465000000000000000000000000faa8a501cf7ffd8080b0864f2c959e8cbcf8303000000000000000000000000007338f0d76f9d74c42c360ff7f852fce1c5369830000000000000000000000006972480b73fd3a5278c039cf072b499c4ca22e33

-----Decoded View---------------
Arg [0] : _token (address): 0xF9ff95468cb9A0cD57b8542bbc4c148e290Ff465
Arg [1] : _storage (address): 0xFaa8A501cf7Ffd8080B0864F2C959E8cbcf83030
Arg [2] : _multisig (address): 0x07338f0D76F9d74C42c360fF7f852FCe1c536983
Arg [3] : _manager (address): 0x6972480B73fd3A5278C039cF072B499C4cA22E33

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000f9ff95468cb9a0cd57b8542bbc4c148e290ff465
Arg [1] : 000000000000000000000000faa8a501cf7ffd8080b0864f2c959e8cbcf83030
Arg [2] : 00000000000000000000000007338f0d76f9d74c42c360ff7f852fce1c536983
Arg [3] : 0000000000000000000000006972480b73fd3a5278c039cf072b499c4ca22e33


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
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.