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

function periodConfigurationAtTimestamp(uint48 timestamp) public view returns (struct PeriodConfiguration)

Returns the period configuration corresponding to a given timestamp.

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

function periodConfigurationAtNumber(uint256 periodNumber) external view returns (struct PeriodConfiguration)

Returns the period configuration corresponding to a given period number.

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

function periodAtTimestamp(uint48 timestamp) public view returns (uint256)

Returns the period number for the timestamp given.

Return Values

Name
Type
Description

[0]

uint256

The period number corresponding to the given timestamp.

currentPeriodConfiguration

function currentPeriodConfiguration() public view returns (struct PeriodConfiguration)

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

function currentPeriod() public view returns (uint256)

Returns the current active period.

Return Values

Name
Type
Description

[0]

uint256

The current period number since contract deployment.

currentPeriodStart

function currentPeriodStart() external view returns (uint48)

Returns the start timestamp of the current period.

Return Values

Name
Type
Description

[0]

uint48

Timestamp of the start of the current period.

currentPeriodEnd

function currentPeriodEnd() public view returns (uint48)

Returns the end timestamp of the current period.

Return Values

Name
Type
Description

[0]

uint48

Timestamp of the end of the current period.

nextPeriodEnd

function nextPeriodEnd() public view returns (uint48)

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

Return Values

[0]

uint48

Timestamp of the next period end.

maxDeposit

function maxDeposit(address receiver) public view returns (uint256 amount)

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

function maxMint(address receiver) public view returns (uint256 amount)

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

function maxWithdraw(address owner) public view returns (uint256 amount)

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

function maxRedeem(address owner) public view returns (uint256 amount)

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

function totalAssets() public view returns (uint256)

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

function balanceOfAt(address account, uint48 timestamp) external view returns (uint256)

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

function totalSupplyAt(uint48 timestamp) external view returns (uint256)

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

function totalAssetsAt(uint48 timestamp) external view returns (uint256)

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

function withdrawalsOf(uint256 period, address account) external view returns (uint256)

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

function periodConfigurationsLength() public view returns (uint256)

Returns the length of the periodConfigurations array.

Return Values

Name
Type
Description

[0]

uint256

Length of the periodConfigurations array.

pause

function pause() external

Pauses the contract. Requires PAUSE_ROLE.

unpause

function unpause() external

Unpauses the contract. Requires PAUSE_ROLE.

updateDepositLimit

function updateDepositLimit(uint256 newLimit) external

Updates the maximum deposit limit for the vault.

Requires DEPOSIT_LIMIT_UPDATE_ROLE.

Parameters

Name

Type

Description

newLimit

uint256

The new deposit limit.

addPeriodConfiguration

function addPeriodConfiguration(uint48 epoch, uint48 duration) external

Adds a period configuration.

Requires PERIOD_CONFIGURATION_UPDATE_ROLE.

Parameters

Name
Type
Description

epoch

uint48

The epoch timestamp.

duration

uint48

The period duration.

addToBlocklist

function addToBlocklist(address account) external

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

function removeFromBlocklist(address account) external

Removes an address from the blocklist.

Requires BLOCKLIST_ROLE.

Parameters

Name
Type
Description

account

address

Address to remove from blocklist. Must be blocklisted.

transfer

function transfer(address to, uint256 shares) public returns (bool)

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

function transferFrom(address from, address to, uint256 shares) public returns (bool)

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

function deposit(uint256 assets, address receiver) public returns (uint256)

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

function mint(uint256 shares, address receiver) public returns (uint256)

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

function redeem(uint256 shares, address receiver, address owner) public returns (uint256)

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

function withdraw(uint256 assets, address receiver, address owner) public returns (uint256)

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

function claimWithdraw(uint256 period) external returns (uint256 assets)

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

function rescueSharesFromBlocklisted(address from, address to) external

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

function rescueWithdrawFromBlocklisted(address from, address to, uint256[] periods) external

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