Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

IVesting

Git Source

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

NameTypeDescription
<none>IERC20Address of the asset token

vestingPeriod

Returns the current vesting period in seconds

function vestingPeriod() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Vesting period in seconds

vestingPeriodStart

Returns the start of the current vesting period

function vestingPeriodStart() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Start of the current vesting period

vestingPeriodRemaining

Returns the remaining time in the current vesting period

function vestingPeriodRemaining() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Remaining time in the current vesting period

vestingPeriodEnd

Returns the end of the current vesting period

function vestingPeriodEnd() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256End 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

NameTypeDescription
<none>uint256Amount 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

NameTypeDescription
<none>uint256Amount of newly vested yield

unvestedAmount

Returns the amount of yield that is still vesting

function unvestedAmount() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Amount 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

NameTypeDescription
newBeneficiaryaddressNew beneficiary contract address

setVestingPeriod

Sets the vesting period

Only callable through AccessManager with ADMIN_ROLE

function setVestingPeriod(uint256 newPeriod) external;

Parameters

NameTypeDescription
newPerioduint256New 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

NameTypeDescription
amountuint256Amount 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

NameTypeDescription
depositoraddressAddress that deposited the yield
amountuint256Amount of yield deposited

VestedYieldTransferred

Emitted when vested yield is transferred out

event VestedYieldTransferred(address indexed beneficiary, uint256 amount);

Parameters

NameTypeDescription
beneficiaryaddressAddress receiving the vested yield (beneficiary)
amountuint256Amount of vested yield transferred

VestingPeriodUpdated

Emitted when the vesting period is updated

event VestingPeriodUpdated(uint256 oldPeriod, uint256 newPeriod);

Parameters

NameTypeDescription
oldPerioduint256Previous vesting period in seconds
newPerioduint256New vesting period in seconds

BeneficiaryUpdated

Emitted when the vault contract address is updated

event BeneficiaryUpdated(address oldBeneficiary, address newBeneficiary);

Parameters

NameTypeDescription
oldBeneficiaryaddressPrevious beneficiary contract address
newBeneficiaryaddressNew beneficiary contract address

Errors

UnauthorizedTransfer

Error thrown when an unauthorized address attempts to transfer vested yield

error UnauthorizedTransfer();