ITREASURY
Interface for the Treasury contract with linear vesting, timelock upgrades and multisig support
Defines all external functions and events for the Treasury contract
Notes:
security-contact: security@nebula-labs.xyz
copyright: Copyright (c) 2025 Nebula Holding Inc. All rights reserved.
Functions
pause
Pauses all token transfers and releases
Can only be called by accounts with the PAUSER_ROLE
function pause() external;
unpause
Unpauses token transfers and releases
Can only be called by accounts with the PAUSER_ROLE
function unpause() external;
releasable
Returns the amount of ETH that can be released now
function releasable() external view returns (uint256);
Returns
<none>
uint256
Amount of releasable ETH
releasable
Returns the amount of a specific token that can be released now
function releasable(address token) external view returns (uint256);
Parameters
token
address
The ERC20 token to check
Returns
<none>
uint256
Amount of releasable tokens
release
Releases a specific amount of vested ETH
Can only be called by accounts with the MANAGER_ROLE
function release(address to, uint256 amount) external;
Parameters
to
address
The address that will receive the ETH
amount
uint256
The amount of ETH to release
release
Releases a specific amount of vested tokens
Can only be called by accounts with the MANAGER_ROLE
function release(address token, address to, uint256 amount) external;
Parameters
token
address
The ERC20 token to release
to
address
The address that will receive the tokens
amount
uint256
The amount of tokens to release
updateVestingSchedule
Updates the vesting schedule parameters
Can only be called by accounts with the DEFAULT_ADMIN_ROLE
function updateVestingSchedule(uint256 newStart, uint256 newDuration) external;
Parameters
newStart
uint256
The new start timestamp
newDuration
uint256
The new duration in seconds
emergencyWithdrawToken
Withdraws funds in case of emergency
Can only be called by accounts with the MANAGER_ROLE
Always sends funds to the timelock controller
function emergencyWithdrawToken(address token) external;
Parameters
token
address
Address of the token to withdraw
emergencyWithdrawEther
Withdraws funds in case of emergency
Can only be called by accounts with the MANAGER_ROLE
Always sends funds to the timelock controller
function emergencyWithdrawEther() external;
scheduleUpgrade
Schedules an upgrade to a new implementation
Can only be called by accounts with the UPGRADER_ROLE
function scheduleUpgrade(address newImplementation) external;
Parameters
newImplementation
address
Address of the new implementation
upgradeTimelockRemaining
Returns the remaining time before a scheduled upgrade can be executed
function upgradeTimelockRemaining() external view returns (uint256);
Returns
<none>
uint256
The time remaining in seconds, or 0 if no upgrade is scheduled or timelock has passed
timelockAddress
Get the timelock controller address
function timelockAddress() external view returns (address);
Returns
<none>
address
The timelock controller address
vestedAmount
Returns the pending upgrade information
Calculates the amount of ETH vested at a specific timestamp
function vestedAmount(uint256 timestamp) external view returns (uint256);
Parameters
timestamp
uint256
The timestamp to check
Returns
<none>
uint256
Information about the pending upgrade
vestedAmount
Calculates the amount of tokens vested at a specific timestamp
function vestedAmount(address token, uint256 timestamp) external view returns (uint256);
Parameters
token
address
The ERC20 token to check
timestamp
uint256
The timestamp to check
Returns
<none>
uint256
The vested amount of tokens
version
Returns the current contract version
function version() external view returns (uint32);
Returns
<none>
uint32
Current version number
start
Returns the start timestamp of the vesting period
function start() external view returns (uint256);
Returns
<none>
uint256
Start timestamp
duration
Returns the duration of the vesting period
function duration() external view returns (uint256);
Returns
<none>
uint256
Duration in seconds
end
Returns the end timestamp of the vesting period
function end() external view returns (uint256);
Returns
<none>
uint256
End timestamp (start + duration)
released
Returns the amount of ETH already released
function released() external view returns (uint256);
Returns
<none>
uint256
Amount of ETH released so far
released
Returns the amount of a specific token already released
function released(address token) external view returns (uint256);
Parameters
token
address
The ERC20 token to check
Returns
<none>
uint256
Amount of tokens released so far
MANAGER_ROLE
Returns the MANAGER_ROLE identifier used for access control
function MANAGER_ROLE() external view returns (bytes32);
Returns
<none>
bytes32
The keccak256 hash of "MANAGER_ROLE"
PAUSER_ROLE
Returns the PAUSER_ROLE identifier used for access control
function PAUSER_ROLE() external view returns (bytes32);
Returns
<none>
bytes32
The keccak256 hash of "PAUSER_ROLE"
UPGRADER_ROLE
Returns the UPGRADER_ROLE identifier used for access control
function UPGRADER_ROLE() external view returns (bytes32);
Returns
<none>
bytes32
The keccak256 hash of "UPGRADER_ROLE"
Events
Initialized
Emitted when the contract is initialized
event Initialized(address indexed initializer, uint256 startTime, uint256 duration);
Parameters
initializer
address
Address that called the initialize function
startTime
uint256
Start timestamp of the vesting schedule
duration
uint256
Duration of the vesting period in seconds
EthReleased
Emitted when ETH is released from the treasury
event EthReleased(address indexed to, uint256 amount, uint256 remainingReleasable);
Parameters
to
address
Address receiving the ETH
amount
uint256
Amount of ETH released
remainingReleasable
uint256
Amount of ETH still available for release
TokenReleased
Emitted when ERC20 tokens are released from the treasury
event TokenReleased(address indexed token, address indexed to, uint256 amount);
Parameters
token
address
Address of the ERC20 token being released
to
address
Address receiving the tokens
amount
uint256
Amount of tokens released
VestingScheduleUpdated
Emitted when the vesting schedule parameters are updated
event VestingScheduleUpdated(address indexed updater, uint256 newStart, uint256 newDuration);
Parameters
updater
address
Address that updated the vesting schedule
newStart
uint256
New start timestamp of the vesting schedule
newDuration
uint256
New duration of the vesting period in seconds
EmergencyWithdrawal
Emitted when funds are withdrawn via the emergency withdrawal function
event EmergencyWithdrawal(address indexed token, address indexed to, uint256 amount);
Parameters
token
address
Address of the token withdrawn (address(0) for ETH)
to
address
Address receiving the funds
amount
uint256
Amount withdrawn
Upgraded
Emitted when the contract implementation is upgraded
event Upgraded(address indexed upgrader, address indexed implementation, uint32 version);
Parameters
upgrader
address
Address that performed the upgrade
implementation
address
Address of the new implementation
version
uint32
New version number after the upgrade
Received
Emitted when ETH is received by the contract
event Received(address indexed src, uint256 amount);
Parameters
src
address
Address that sent ETH to the contract
amount
uint256
Amount of ETH received
UpgradeScheduled
Emitted when an upgrade is scheduled
event UpgradeScheduled(
address indexed sender, address indexed implementation, uint64 scheduledTime, uint64 effectiveTime
);
Parameters
sender
address
The address that scheduled the upgrade
implementation
address
The new implementation address
scheduledTime
uint64
The time when the upgrade was scheduled
effectiveTime
uint64
The time when the upgrade can be executed
UpgradeCancelled
Emitted when a scheduled upgrade is cancelled
event UpgradeCancelled(address indexed canceller, address indexed implementation);
Parameters
canceller
address
The address that cancelled the upgrade
implementation
address
The implementation address that was cancelled
Errors
ZeroAddress
Thrown when an operation receives the zero address where a non-zero address is required
error ZeroAddress();
ZeroAmount
Thrown when an operation receives a zero amount where a non-zero amount is required
error ZeroAmount();
InsufficientVestedAmount
Thrown when trying to release more funds than what's currently vested
error InsufficientVestedAmount(uint256 requested, uint256 available);
Parameters
requested
uint256
The amount requested for release
available
uint256
The actual amount available for release
InvalidDuration
Thrown when attempting to set an invalid vesting duration
error InvalidDuration(uint256 minimum);
Parameters
minimum
uint256
The minimum allowed duration
UpgradeTimelockActive
Error thrown when trying to execute an upgrade too soon
error UpgradeTimelockActive(uint256 remainingTime);
Parameters
remainingTime
uint256
The time remaining until upgrade can be executed
UpgradeNotScheduled
Error thrown when trying to execute an upgrade that wasn't scheduled
error UpgradeNotScheduled();
ImplementationMismatch
Error thrown when trying to execute an upgrade with wrong implementation
error ImplementationMismatch(address expected, address provided);
Parameters
expected
address
The expected implementation address
provided
address
The provided implementation address
ZeroBalance
Error thrown when attempting operations with zero balance
error ZeroBalance();
Structs
UpgradeRequest
Upgrade request details
Tracks pending contract upgrades with timelock
struct UpgradeRequest {
address implementation;
uint64 scheduledTime;
bool exists;
}
Properties
implementation
address
New implementation contract address
scheduledTime
uint64
When the upgrade was requested
exists
bool
Whether this upgrade request is active
Last updated