IVesting
Inherits: EInvalidAddress, EInvalidAmount
Title: IVesting
Interface for the Vesting contract that handles yield distribution. Different implementations may have different vesting periods and yield distribution mechanisms.
Defines functions, events, and errors for yield vesting functionality
Functions
asset
Returns the asset token address
function asset() external view returns (IERC20);
Returns
| Name | Type | Description |
|---|---|---|
<none> | IERC20 | Address of the asset token |
vestingPeriod
Returns the current vesting period in seconds
function vestingPeriod() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Vesting period in seconds |
vestingPeriodStart
Returns the start of the current vesting period
function vestingPeriodStart() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Start of the current vesting period |
vestingPeriodRemaining
Returns the remaining time in the current vesting period
function vestingPeriodRemaining() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Remaining time in the current vesting period |
vestingPeriodEnd
Returns the end of the current vesting period
function vestingPeriodEnd() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | End of the current vesting period |
vestedAmount
Returns the amount of yield that has vested and is available, including fully vested and newly vested yield.
function vestedAmount() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Amount of vested yield including fully vested and newly vested yield |
newlyVestedAmount
Returns the amount of yield that has been newly vested since the last transfer
function newlyVestedAmount() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Amount of newly vested yield |
unvestedAmount
Returns the amount of yield that is still vesting
function unvestedAmount() external view returns (uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | Amount of unvested yield |
setBeneficiary
Sets the beneficiary address. This is used when initializing the vesting contract, to set the beneficiary address and when migrating to a new vesting contract.
Only callable through AccessManager with ADMIN_ROLE
function setBeneficiary(address newBeneficiary) external;
Parameters
| Name | Type | Description |
|---|---|---|
newBeneficiary | address | New beneficiary contract address |
setVestingPeriod
Sets the vesting period
Only callable through AccessManager with ADMIN_ROLE
function setVestingPeriod(uint256 newPeriod) external;
Parameters
| Name | Type | Description |
|---|---|---|
newPeriod | uint256 | New vesting period in seconds |
depositYield
Deposits yield into the vesting contract
Resets the vesting period, adding vested yield to the fullyVestedAmount and the new deposit amount to the vestingAmount.
function depositYield(uint256 amount) external;
Parameters
| Name | Type | Description |
|---|---|---|
amount | uint256 | Amount of yield to deposit |
pullVestedYield
Transfers all vested yield to the vault
Only callable by vault contract. No-op if no vested yield available.
function pullVestedYield() external;
Events
YieldDeposited
Emitted when yield is deposited into the vesting contract
event YieldDeposited(address indexed depositor, uint256 amount);
Parameters
| Name | Type | Description |
|---|---|---|
depositor | address | Address that deposited the yield |
amount | uint256 | Amount of yield deposited |
VestedYieldTransferred
Emitted when vested yield is transferred out
event VestedYieldTransferred(address indexed beneficiary, uint256 amount);
Parameters
| Name | Type | Description |
|---|---|---|
beneficiary | address | Address receiving the vested yield (beneficiary) |
amount | uint256 | Amount of vested yield transferred |
VestingPeriodUpdated
Emitted when the vesting period is updated
event VestingPeriodUpdated(uint256 oldPeriod, uint256 newPeriod);
Parameters
| Name | Type | Description |
|---|---|---|
oldPeriod | uint256 | Previous vesting period in seconds |
newPeriod | uint256 | New vesting period in seconds |
BeneficiaryUpdated
Emitted when the vault contract address is updated
event BeneficiaryUpdated(address oldBeneficiary, address newBeneficiary);
Parameters
| Name | Type | Description |
|---|---|---|
oldBeneficiary | address | Previous beneficiary contract address |
newBeneficiary | address | New beneficiary contract address |
Errors
UnauthorizedTransfer
Error thrown when an unauthorized address attempts to transfer vested yield
error UnauthorizedTransfer();