Configuring a Vault
Vault configuration can be set when deploying a vault. It can also be updated once the vault is deployed. To update the vault, you must get the selector and encode it with parameters provided to submitActions(). Global timelocks are applied to several configuration updates. The guardian can veto any upgrade during the timelock period.
diamondCut
Owner
transferCuratorship
Owner
transferGuardian
Owner
transferOwnership
Owner
disableDepositWhitelist
Owner
enableAssetToDeposit
Owner
setGasLimitForAccounting
Owner
setMaxSlippagePercent
Owner
setTimeLockPeriod
Owner
setFee
Owner
setWithdrawalTimelock
Owner
setWithdrawalFee
Owner
updateWithdrawalQueueStatus
Owner
setCrossChainAccountingManager
Owner
setOraclesCrossChainAccounting
Owner
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=2When adding facets, you must verify that the facet exists in the Vault Registry.
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)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.
Add a depositable asset
function enableAssetToDeposit(address asset) externalRemove a depositable asset
function disableAssetToDeposit(address asset) externalRisk 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) externalGas 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
) externalDeposit 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) externalDepositor 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() externalTo disable the whitelist
function disableDepositWhitelist() externalTo updae the whitelist
function setDepositWhitelist(
address[] calldata depositors,
uint256[] calldata underlyingAssetCaps
) externalTimelocks
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) externalWithdrawal 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) externalFees
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) externalSet the fee recipient
function setFeeRecipient(address recipient) externalTransfer 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() externalTransfer Curator
A Vault Owner may replace a Curator.
function transferCuratorship(address _newCurator) externalTransfer Guardian
A Vault Owner may replace a Guardian.
function transferGuardian(address _newGuardian) externalLast updated