false
true
0

Contract Address Details

0x234C847E16253779c3ca04A5bDA4D6baaDc354AE

Contract Name
TreasuryV2
Creator
0x697275–1ed143 at 0xc768ff–0b6369
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
2 Transactions
Transfers
88 Transfers
Gas Used
100,702
Last Balance Update
26175637
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
TreasuryV2




Optimization enabled
true
Compiler version
v0.8.20+commit.a1b79de6




Optimization runs
200
EVM Version
paris




Verified at
2025-09-02T16:56:28.867020Z

Constructor Arguments

0x0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb39

Arg [0] (address) : 0x2b591e99afe9f32eaa6214f7b7629768c40eeb39

              

contracts/Treasury.sol

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

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

/**
 * TreasuryV2
 * - Holds HEX
 * - Owner can approve StakingCycle to pull HEX (keeps StakingCycle unchanged)
 * - Optional cycleManager + payout for future-proofing
 */
contract TreasuryV2 is Ownable {
    address public immutable HEX_TOKEN;
    address public cycleManager;

    event CycleManagerUpdated(address indexed manager);
    event Approved(address indexed spender, uint256 amount);
    event Payout(address indexed to, uint256 amount);
    event Swept(address indexed token, address indexed to, uint256 amount);

    modifier onlyCycleManager() {
        require(msg.sender == cycleManager, "not manager");
        _;
    }

    constructor(address _hex) Ownable(msg.sender) {
        require(_hex != address(0), "hex=0");
        HEX_TOKEN = _hex;
    }

    // Required for current StakingCycle pull model
    function approveHEX(address spender, uint256 amount) external onlyOwner {
        require(spender != address(0), "spender=0");
        IERC20(HEX_TOKEN).approve(spender, amount);
        emit Approved(spender, amount);
    }

    // Optional
    function setCycleManager(address m) external onlyOwner {
        cycleManager = m;
        emit CycleManagerUpdated(m);
    }

    function payout(address to, uint256 amount) external onlyCycleManager {
        require(to != address(0), "to=0");
        IERC20(HEX_TOKEN).transfer(to, amount);
        emit Payout(to, amount);
    }

    // Safety
    function sweep(address token, address to, uint256 amount) external onlyOwner {
        require(to != address(0), "to=0");
        IERC20(token).transfer(to, amount);
        emit Swept(token, to, amount);
    }
}
        

@openzeppelin/contracts/access/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);
    }
}
          

@openzeppelin/contracts/token/ERC20/IERC20.sol

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

pragma solidity >=0.4.16;

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

@openzeppelin/contracts/utils/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;
    }
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{},"evmVersion":"paris"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_hex","internalType":"address"}]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"event","name":"Approved","inputs":[{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CycleManagerUpdated","inputs":[{"type":"address","name":"manager","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Payout","inputs":[{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Swept","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"HEX_TOKEN","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approveHEX","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"cycleManager","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"payout","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setCycleManager","inputs":[{"type":"address","name":"m","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"sweep","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
              

Contract Creation Code

0x60a060405234801561001057600080fd5b5060405161086938038061086983398101604081905261002f916100ff565b338061005657604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61005f816100af565b506001600160a01b03811661009e5760405162461bcd60e51b815260206004820152600560248201526406865783d360dc1b604482015260640161004d565b6001600160a01b031660805261012f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561011157600080fd5b81516001600160a01b038116811461012857600080fd5b9392505050565b6080516107126101576000396000818160c50152818161021a015261033f01526107126000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063715018a611610066578063715018a61461011657806373b50a8d1461011e5780638da5cb5b1461013157806392b50d6914610142578063f2fde38b1461015557600080fd5b8063117de2fd1461009857806333f2b73b146100ad5780635b314ce5146100c057806362c0676714610103575b600080fd5b6100ab6100a6366004610632565b610168565b005b6100ab6100bb366004610632565b6102cf565b6100e77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b6100ab61011136600461065c565b6103e8565b6100ab6104f5565b6100ab61012c366004610698565b610509565b6000546001600160a01b03166100e7565b6001546100e7906001600160a01b031681565b6100ab610163366004610698565b61055b565b6001546001600160a01b031633146101b55760405162461bcd60e51b815260206004820152600b60248201526a3737ba1036b0b730b3b2b960a91b60448201526064015b60405180910390fd5b6001600160a01b0382166101f45760405162461bcd60e51b81526004016101ac906020808252600490820152630746f3d360e41b604082015260600190565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af1158015610263573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028791906106ba565b50816001600160a01b03167f5afeca38b2064c23a692c4cf353015d80ab3ecc417b4f893f372690c11fbd9a6826040516102c391815260200190565b60405180910390a25050565b6102d7610599565b6001600160a01b0382166103195760405162461bcd60e51b815260206004820152600960248201526807370656e6465723d360bc1b60448201526064016101ac565b60405163095ea7b360e01b81526001600160a01b038381166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303816000875af1158015610388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ac91906106ba565b50816001600160a01b03167ff13bfe0b6ec5df39265dccb0a01a09aa4162489c7a083dc6670bde0255d02ca7826040516102c391815260200190565b6103f0610599565b6001600160a01b03821661042f5760405162461bcd60e51b81526004016101ac906020808252600490820152630746f3d360e41b604082015260600190565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561047e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a291906106ba565b50816001600160a01b0316836001600160a01b03167f7b09c29f9106defeccc9ac3b823f3aad0b470d120e5df7aed033b5c43a4bf718836040516104e891815260200190565b60405180910390a3505050565b6104fd610599565b61050760006105c6565b565b610511610599565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f83f965e35b65c2397fe8d86da35d30d5ce28abff0537ff53496969479a557eb790600090a250565b610563610599565b6001600160a01b03811661058d57604051631e4fbdf760e01b8152600060048201526024016101ac565b610596816105c6565b50565b6000546001600160a01b031633146105075760405163118cdaa760e01b81523360048201526024016101ac565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461062d57600080fd5b919050565b6000806040838503121561064557600080fd5b61064e83610616565b946020939093013593505050565b60008060006060848603121561067157600080fd5b61067a84610616565b925061068860208501610616565b9150604084013590509250925092565b6000602082840312156106aa57600080fd5b6106b382610616565b9392505050565b6000602082840312156106cc57600080fd5b815180151581146106b357600080fdfea26469706673582212200e1312c30e670cf67a77ca18090e7fabd88a418730594d8500c868781e3ec6d964736f6c634300081400330000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb39

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063715018a611610066578063715018a61461011657806373b50a8d1461011e5780638da5cb5b1461013157806392b50d6914610142578063f2fde38b1461015557600080fd5b8063117de2fd1461009857806333f2b73b146100ad5780635b314ce5146100c057806362c0676714610103575b600080fd5b6100ab6100a6366004610632565b610168565b005b6100ab6100bb366004610632565b6102cf565b6100e77f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb3981565b6040516001600160a01b03909116815260200160405180910390f35b6100ab61011136600461065c565b6103e8565b6100ab6104f5565b6100ab61012c366004610698565b610509565b6000546001600160a01b03166100e7565b6001546100e7906001600160a01b031681565b6100ab610163366004610698565b61055b565b6001546001600160a01b031633146101b55760405162461bcd60e51b815260206004820152600b60248201526a3737ba1036b0b730b3b2b960a91b60448201526064015b60405180910390fd5b6001600160a01b0382166101f45760405162461bcd60e51b81526004016101ac906020808252600490820152630746f3d360e41b604082015260600190565b60405163a9059cbb60e01b81526001600160a01b038381166004830152602482018390527f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb39169063a9059cbb906044016020604051808303816000875af1158015610263573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028791906106ba565b50816001600160a01b03167f5afeca38b2064c23a692c4cf353015d80ab3ecc417b4f893f372690c11fbd9a6826040516102c391815260200190565b60405180910390a25050565b6102d7610599565b6001600160a01b0382166103195760405162461bcd60e51b815260206004820152600960248201526807370656e6465723d360bc1b60448201526064016101ac565b60405163095ea7b360e01b81526001600160a01b038381166004830152602482018390527f0000000000000000000000002b591e99afe9f32eaa6214f7b7629768c40eeb39169063095ea7b3906044016020604051808303816000875af1158015610388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ac91906106ba565b50816001600160a01b03167ff13bfe0b6ec5df39265dccb0a01a09aa4162489c7a083dc6670bde0255d02ca7826040516102c391815260200190565b6103f0610599565b6001600160a01b03821661042f5760405162461bcd60e51b81526004016101ac906020808252600490820152630746f3d360e41b604082015260600190565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb906044016020604051808303816000875af115801561047e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a291906106ba565b50816001600160a01b0316836001600160a01b03167f7b09c29f9106defeccc9ac3b823f3aad0b470d120e5df7aed033b5c43a4bf718836040516104e891815260200190565b60405180910390a3505050565b6104fd610599565b61050760006105c6565b565b610511610599565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f83f965e35b65c2397fe8d86da35d30d5ce28abff0537ff53496969479a557eb790600090a250565b610563610599565b6001600160a01b03811661058d57604051631e4fbdf760e01b8152600060048201526024016101ac565b610596816105c6565b50565b6000546001600160a01b031633146105075760405163118cdaa760e01b81523360048201526024016101ac565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461062d57600080fd5b919050565b6000806040838503121561064557600080fd5b61064e83610616565b946020939093013593505050565b60008060006060848603121561067157600080fd5b61067a84610616565b925061068860208501610616565b9150604084013590509250925092565b6000602082840312156106aa57600080fd5b6106b382610616565b9392505050565b6000602082840312156106cc57600080fd5b815180151581146106b357600080fdfea26469706673582212200e1312c30e670cf67a77ca18090e7fabd88a418730594d8500c868781e3ec6d964736f6c63430008140033