Configuring a Vault

Adding or Removing Facets

The Vault Owner can decide which protocol and strategy facets to activate by calling diamondCut() and specifying facetAddress and FacetCutAction.

function diamondCut(FacetCut[] calldata _diamondCut) external;

with array of struct FacetCut[],

struct FacetCut {
        address facetAddress;
        FacetCutAction action;
        bytes4[] functionSelectors;
        bytes initData;
}

enum FacetCutAction {
        Add,
        Replace,
        Remove
    }

// Add=0, Replace=1, Remove=2

If you want to add or replace a facet, the available facets will depend on whether your vault was created using the permissioned or permissionless factory. When adding facets to a vault created with the permissioned factory, you must verify that the facet exists in the permissioned vault registry. When adding facets to a vault created with the permissionless factory, any facet can be added.

Available Assets

Available assets are the assets that can be managed by the Curator. Available assets can be added only if an Oracle Registry contains an oracle for the specified asset. Either the Vault Owner or Curator can add available assets.

function addAvailableAsset(address asset)

Once an available asset is added, it cannot be removed.

Available assets are subject to gas limit overflow checks to ensure that operations do not exceed max block limits or bounds set by the Vault Owner. Gas limit checks are described further in Risk Management.

Depositable Assets

Depositable assets include any asset that can be accepted by the vault from depositors. It must first be enabled as an available asset before it can be enabled as a depositable asset. Vault Owners and Curators can add or remove a depositable asset.

These assets are not subjected to gas limits like available assets.

Add a depositable asset

function enableAssetToDeposit(address asset) external

Remove a depositable asset

function disableAssetToDeposit(address asset) external

Risk Management

Max Slippage Percent

The max slippage percentage defines the bounds for the maximum acceptable loss upon executeActions(), when a portfolio allocation or rebalance is executed. If this bound is exceeded, the transaction will revert. Only Vault Owner can modify this parameter.

function setMaxSlippagePercent(uint256 _newPercent) external

Gas Limit for Accounting

The gas limit parameter ensures that vault operations remain under an acceptable threshold. By default, the gas limit is set to the block gas limit, 30,000,000 on most chains. Either the Vault Owner or Curator can set this parameter.

The gas limit is set for each available asset, _availableTokenAccountingGas, each held token, _heldTokenAccountingGas (e.g. LP tokens, ATokens, CTokens, debt tokens, etc.) and each facet, _facetAccountingGas. _newLimit specifies the total gas limit for total accounting.

function setGasLimitForAccounting(
   uint48 _availableTokenAccountingGas,
   uint48 _heldTokenAccountingGas,
   uint48 _facetAccountingGas,
   uint48 _newLimit
) external

Deposit Capacity

Vault Owners or Curators can set a global supply cap for the vault. This can support scaling new strategies or when coupled with a whitelist create competitive dynamics for liquidity provisions.

The deposit capacity sets a maximum allowance for total deposits across all depositors, specified in terms of the UNDERLYING_ASSET.

function setDepositCapacity(uint256 capacity) external

Depositor whitelists are not directly related to the global deposit capacity. Deposit capacity will apply regardless of per user deposit capacities specified in whitelists.

Depositor Whitelists

Both Vault Owners and Curators can enable or disable whitelists. Users can only deposit if their address is included on the whitelist. Each user can have a specific deposit capacity.

To enable the whitelist

function enableDepositWhitelist() external

To disable the whitelist

function disableDepositWhitelist() external

To updae the whitelist

function setDepositWhitelist(
    address[] calldata depositors,
    uint256[] calldata underlyingAssetCaps
) external

Timelocks

Global Timelock

Only the Vault Owner can set or update the global timelock. This parameter configures the the timelock between submitActions() and executeActions(). These functions are described in Allocate & Rebalance.

Specify the global timelock in seconds

function setTimeLockPeriod(uint256 period) external

Withdrawal Timelock

For asynchronous withdrawals, the withdrawal timelock sets the minimum duration that should elapse between requestRedeem() and redeem() or requestWithdraw() and withdraw(). The withdrawal timelock can be set by the Vault Owner or Curator, and is itself subject to the global timelock.

Specify the withdrawal timelock in seconds

function setWithdrawalTimelock(uint64 _duration) external

Fees

Currently, only performance fees can be collected in a vault. Performance fees accrue on generated profit and are realized when a user redeems or withdraws. No fees are taken on negative profit.

Set the performance fee

function setFee(uint96 _fee) external

Set the fee recipient

function setFeeRecipient(address recipient) external

While the protocol does not currently take fees, in the future, the DAO can vote to activate the fee switch. When the fee switch is activated, a portion of vault fees accrue to the protocol treasury.

Transfer Roles

Any of the vault roles can be transferred. Only the Vault Owner may execute these actions. A Vault Owner may want to bring on a new strategist or recruit a new Guardian. The Vault Owner may also want to transfer the ownership of the vault to an acquiring party. In any of these cases, updates are subject to the global timelock, giving LPs an opportunity to exit if they disagree with the decision.

Transfer Owner

Ownsership transfer occurs in 2 steps. The current Vault Owner must initiate the transfer and the new Vault Owner must accept it. Ownership remains with the current Vault Owner until the transfer is accepted.

Initiate ownership transfer

function transferOwnership(address _newOwner)

Accept ownership transfer

function acceptOwnership() external

Transfer Curator

A Vault Owner may replace a Curator.

function transferCuratorship(address _newCurator) external

Transfer Guardian

A Vault Owner may replace a Guardian.

function transferGuardian(address _newGuardian) external

Last updated