Functions

List of key functions.

Initialize

function initialize(contract IERC20 _asset, string _name, string _symbol, bytes _initParams) public

Initializes the Firelight Vault contract with given parameters.

Parameters

Name
Type
Description

_asset

contract IERC20

The underlying collateral ERC20 token.

_name

string

The name of the vault token.

_symbol

string

The symbol of the vault token.

_initParams

bytes InitParams

Initial parameters.

InitParams

Initial parameters needed for the vault's deployment.

struct InitParams {
address defaultAdmin;
address limitUpdater;
address blocklister;
address pauser;
address periodConfigurationUpdater;
uint256 depositLimit;
uint48 periodConfigurationDuration;
}

Parameters

Name
Type
Description

defaultAdmin

address

Vault's admin that grants and revokes roles.

limitUpdater

address

Address assigned the DEPOSIT_LIMIT_UPDATE_ROLE at initialization.

blocklister

address

Address assigned the PAUSE_ROLE at initialization.

pauser

address

Address assigned the PAUSE_ROLE at initialization.

paperiodConfigurationUpdateruser

address

Address assigned the PERIOD_CONFIGURATION_UPDATE_ROLE at initialization.

depositLimit

uint256

Initial total deposit limit.

depositLimit

uint48

Initial period duration of the vault.

periodConfigurationAtTimestamp

Returns the period configuration corresponding to a given timestamp.

circle-exclamation

Parameters

Name
Type
Description

timestamp

uint48

The timestamp to find the period configuration for.

Return Values

Name
Type
Description

[0]

struct PeriodConfiguration

The period configuration corresponding to the given timestamp.

periodConfigurationAtNumber

Returns the period configuration corresponding to a given period number.

circle-exclamation

Parameters

Name
Type
Description

periodNumber

uint256

The period number to find the period configuration for.

Return Values

Name
Type
Description

[0]

struct PeriodConfiguration

The period configuration corresponding to the given period number.

periodAtTimestamp

Returns the period number for the timestamp given.

circle-exclamation

Return Values

Name
Type
Description

[0]

uint256

The period number corresponding to the given timestamp.

currentPeriodConfiguration

Returns the period configuration for the current period.

Return Values

Name
Type
Description

[0]

struct PeriodConfiguration

The period configuration corresponding to the current period.

currentPeriod

Returns the current active period.

Return Values

Name
Type
Description

[0]

uint256

The current period number since contract deployment.

currentPeriodStart

Returns the start timestamp of the current period.

Return Values

Name
Type
Description

[0]

uint48

Timestamp of the start of the current period.

currentPeriodEnd

Returns the end timestamp of the current period.

Return Values

Name
Type
Description

[0]

uint48

Timestamp of the end of the current period.

nextPeriodEnd

Returns the end timestamp of the period following the current period.

Return Values

[0]

uint48

Timestamp of the next period end.

maxDeposit

Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver, through a deposit call.

Parameters

Name
Type
Description

receiver

address

The address of the deposit receiver.

Return Values

Name
Type
Description

amount

uint256

Maximum amount of assets that can be deposited.

maxMint

Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.

Parameters

Name
Type
Description

receiver

address

The address of the mint receiver.

Return Values

amount

uint256

Maximum amount of shares that can be minted.

maxWithdraw

Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the Vault, through a withdraw call.

Parameters

Name
Type
Description

owner

address

The owner of the assets.

Return Values

Name
Type
Description

amount

uint256

Maximum amount of assets that can be withdrawn.

maxRedeem

Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault, through a redeem call.

Parameters

Name
Type
Description

owner

address

The owner of the shares.

totalAssets

Returns the total assets in the vault excluding those marked for withdrawal. Return Values

Name
Type
Description

[0]

uint256

The total assets held by the vault.

balanceOfAt

Returns the effective total shares for account at a specific timestamp.

Parameters

account

address

The address whose share balance is being queried.

timestamp

uint48

The point in time for which the balance is being checked.

Return Values

Name
Type
Description

[0]

uint256

The shares owned by account at the specified time.

totalSupplyAt

Returns the total supply of shares at a specific timestamp.

Parameters

Name
Type
Description

timestamp

uint48

The point in time for which the total supply is being checked.

Return Values

Name
Type
Description

[0]

uint256

The total shares in existence at the specified time.

totalAssetsAt

Returns the total underlying assets held by the vault at a specific timestamp, excluding any assets marked for withdrawal.

Parameters

Name
Type
Text

timestamp

uint48

The point in time for which the total assets are being checked.

Return Values

Name
Type
Description

[0]

uint256

The total underlying assets held by the vault at the specified time.

withdrawalsOf

Gets the amount an account can withdraw for a given period.

Parameters

Name
Type
Description

period

uint256

Period number to check.

account

address

Account address.

Return Values

Name
Type
Description

[0]

uint256

Amount of assets claimable for that period.

periodConfigurationsLength

Returns the length of the periodConfigurations array.

Return Values

Name
Type
Description

[0]

uint256

Length of the periodConfigurations array.

pause

Pauses the contract. Requires PAUSE_ROLE.

unpause

Unpauses the contract. Requires PAUSE_ROLE.

updateDepositLimit

Updates the maximum deposit limit for the vault.

Requires DEPOSIT_LIMIT_UPDATE_ROLE.

Parameters

Name

Type

Description

newLimit

uint256

The new deposit limit.

addPeriodConfiguration

Adds a period configuration.

Requires PERIOD_CONFIGURATION_UPDATE_ROLE.

Parameters

Name
Type
Description

epoch

uint48

The epoch timestamp.

duration

uint48

The period duration.

addToBlocklist

Adds an address to the blocklist.

Requires BLOCKLIST_ROLE.

Parameters

Name
Type
Description

account

address

Address to blocklist. Cannot be zero address nor blocklisted.

removeFromBlocklist

Removes an address from the blocklist.

Requires BLOCKLIST_ROLE.

Parameters

Name
Type
Description

account

address

Address to remove from blocklist. Must be blocklisted.

transfer

Transfers shares to an address, with blocklist and pause checks.

Parameters

Name
Type
Description

to

address

Recipient address.

shares

uint256

Number of shares to transfer.

Return Values

Name
Type
Description

[0]

bool

Boolean indicating transfer success.

transferFrom

Transfers shares from one account to another using allowance, with blocklist and pause checks.

Parameters

from

address

Address sending the shares.

to

address

Address receiving the shares.

shares

uint256

Number of shares to transfer.

Return Values

Name
Type
Description

[0]

bool

Boolean indicating transfer success.

deposit

Deposits assets into the vault and receive shares, with blocklist and pause checks.

Parameters

Name
Type
Description

assets

uint256

Amount of assets to deposit.

receiver

address

Address receiving the shares.

Return Values

Name
Type
Description

[0]

uint256

Amount of shares received.

mint

Mints shares by depositing the required amount of assets into the vault, with blocklist and pause checks.

Parameters

Name
Type
Description

shares

uint256

Amount of shares to mint.

receiver

address

Address receiving the shares.

Return Values

[0]

uint256

Amount of assets deposited.

redeem

Redeems shares from the vault and receives underlying assets, with blocklist and pause checks. Creates a withdrawal request, which will be available in the next period. Shares are burned.

Parameters

Name
Type
Description

shares

uint256

Amount of shares to redeem.

receiver

address

Address to receive the assets in the next period.

owner

address

Address whose shares are being redeemed.

Return Values

Name
Type
Description

[0]

uint256

Amount of assets that will be received in the next period.

withdraw

Initiates a withdrawal request from the vault, with blocklist and pause checks. The request becomes claimable starting from the period after the next full period. The calculated shares are burned.

Parameters

Name
Type
Description

assets

uint256

The amount of assets to withdraw.

receiver

address

The address to receive the assets in the next period.

owner

address

The address whose shares are being withdrawn.

Return Values

Name
Type
Description

[0]

uint256

The amount of shares that were burned.

claimWithdraw

Claims a pending withdrawal for a given period. Transfers the corresponding assets to the caller if not already claimed. Can only be called after the specified period has ended. Reverts if the withdrawal has already been claimed or if no withdrawal amount is available for the period.

Parameters

Name
Type
Description

period

uint256

The period number for which to claim the withdrawal.

Return Values

Name
Type
Description

assets

uint256

The amount of assets transferred to the caller.

rescueSharesFromBlocklisted

Rescues shares from a blocklisted address. Requires RESCUER_ROLE.

Parameters

Name
Type
Text

from

address

The blocklisted address.

to

address

The address to transfer the shares. Must not be blocklisted.

rescueWithdrawFromBlocklisted

Rescues pending withdrawals from a blocklisted address. Requires RESCUER_ROLE.

Parameters

from

address

The blocklisted address.

to

address

The address to transfer the shares to. Must not be blocklisted.

periods

uint256[]

An array of periods to rescue.

Last updated