IVaultV2
The main interface for Morpho Vault V2, extending the ERC4626 tokenized vault standard and ERC2612 permit functionality.
interface IVaultV2 is IERC4626, IERC2612
Structs
Caps
Defines allocation and cap constraints for adapters.
struct Caps {
uint256 allocation;
uint128 absoluteCap;
uint128 relativeCap;
}
State variables
virtualShares
function virtualShares() external view returns (uint256);
Returns the number of virtual shares used for exchange rate calculations.
The virtual shares amount
owner
function owner() external view returns (address);
Returns the vault owner address.
curator
function curator() external view returns (address);
Returns the curator address who manages vault parameters.
receiveSharesGate
function receiveSharesGate() external view returns (address);
Returns the gate contract for receiving shares.
The receive shares gate address
sendSharesGate
function sendSharesGate() external view returns (address);
Returns the gate contract for sending shares.
The send shares gate address
receiveAssetsGate
function receiveAssetsGate() external view returns (address);
Returns the gate contract for receiving assets.
The receive assets gate address
sendAssetsGate
function sendAssetsGate() external view returns (address);
Returns the gate contract for sending assets.
The send assets gate address
adapterRegistry
function adapterRegistry() external view returns (address);
Returns the adapter registry contract address.
The adapter registry address
isSentinel
function isSentinel(address account) external view returns (bool);
Checks if an account has sentinel privileges.
True if the account is a sentinel
isAllocator
function isAllocator(address account) external view returns (bool);
Checks if an account has allocator privileges.
True if the account is an allocator
firstTotalAssets
function firstTotalAssets() external view returns (uint256);
Returns the total assets at the first interest accrual.
The first total assets amount
_totalAssets
function _totalAssets() external view returns (uint128);
Returns the internal total assets tracker.
The internal total assets amount
lastUpdate
function lastUpdate() external view returns (uint64);
Returns the timestamp of the last interest accrual.
The last update timestamp
maxRate
function maxRate() external view returns (uint64);
Returns the maximum allowed interest rate.
adapters
function adapters(uint256 index) external view returns (address);
Returns the adapter at the given index.
The adapter address at the index
adaptersLength
function adaptersLength() external view returns (uint256);
Returns the total number of adapters.
isAdapter
function isAdapter(address account) external view returns (bool);
Checks if an address is a registered adapter.
True if the address is an adapter
allocation
function allocation(bytes32 id) external view returns (uint256);
Returns the current allocation for a market ID.
The current allocation amount
absoluteCap
function absoluteCap(bytes32 id) external view returns (uint256);
Returns the absolute cap for a market ID.
relativeCap
function relativeCap(bytes32 id) external view returns (uint256);
Returns the relative cap for a market ID.
The relative cap percentage
forceDeallocatePenalty
function forceDeallocatePenalty(address adapter) external view returns (uint256);
Returns the penalty for force deallocating from an adapter.
liquidityAdapter
function liquidityAdapter() external view returns (address);
Returns the current liquidity adapter address.
The liquidity adapter address
liquidityData
function liquidityData() external view returns (bytes memory);
Returns the liquidity adapter configuration data.
timelock
function timelock(bytes4 selector) external view returns (uint256);
Returns the timelock duration for a function selector.
The timelock duration in seconds
abdicated
function abdicated(bytes4 selector) external view returns (bool);
Checks if the curator has abdicated control of a function.
executableAt
function executableAt(bytes memory data) external view returns (uint256);
Returns the timestamp when a timelocked call becomes executable.
function performanceFee() external view returns (uint96);
Returns the performance fee percentage.
function performanceFeeRecipient() external view returns (address);
Returns the performance fee recipient address.
The performance fee recipient
managementFee
function managementFee() external view returns (uint96);
Returns the management fee percentage.
managementFeeRecipient
function managementFeeRecipient() external view returns (address);
Returns the management fee recipient address.
The management fee recipient
Gating
canSendShares
function canSendShares(address account) external view returns (bool);
Checks if an account can send shares.
True if the account can send shares
canReceiveShares
function canReceiveShares(address account) external view returns (bool);
Checks if an account can receive shares.
True if the account can receive shares
canSendAssets
function canSendAssets(address account) external view returns (bool);
Checks if an account can send assets.
True if the account can send assets
canReceiveAssets
function canReceiveAssets(address account) external view returns (bool);
Checks if an account can receive assets.
True if the account can receive assets
Multicall
multicall
function multicall(bytes[] memory data) external;
Executes multiple function calls in a single transaction.
Owner functions
setOwner
function setOwner(address newOwner) external;
Sets a new vault owner.
setCurator
function setCurator(address newCurator) external;
Sets a new curator.
setIsSentinel
function setIsSentinel(address account, bool isSentinel) external;
Grants or revokes sentinel privileges.
setName
function setName(string memory newName) external;
Sets a new vault name.
setSymbol
function setSymbol(string memory newSymbol) external;
Sets a new vault symbol.
Timelocks for curator functions
submit
function submit(bytes memory data) external;
Submits a timelocked function call.
revoke
function revoke(bytes memory data) external;
Revokes a pending timelocked function call.
Curator functions
setIsAllocator
function setIsAllocator(address account, bool newIsAllocator) external;
Grants or revokes allocator privileges.
setReceiveSharesGate
function setReceiveSharesGate(address newReceiveSharesGate) external;
Sets the receive shares gate contract.
setSendSharesGate
function setSendSharesGate(address newSendSharesGate) external;
Sets the send shares gate contract.
setReceiveAssetsGate
function setReceiveAssetsGate(address newReceiveAssetsGate) external;
Sets the receive assets gate contract.
setSendAssetsGate
function setSendAssetsGate(address newSendAssetsGate) external;
Sets the send assets gate contract.
setAdapterRegistry
function setAdapterRegistry(address newAdapterRegistry) external;
Sets the adapter registry contract.
addAdapter
function addAdapter(address account) external;
Adds a new adapter to the vault.
removeAdapter
function removeAdapter(address account) external;
Removes an adapter from the vault.
increaseTimelock
function increaseTimelock(bytes4 selector, uint256 newDuration) external;
Increases the timelock duration for a function.
decreaseTimelock
function decreaseTimelock(bytes4 selector, uint256 newDuration) external;
Decreases the timelock duration for a function.
abdicate
function abdicate(bytes4 selector) external;
Abdicates curator control of a function.
function setPerformanceFee(uint256 newPerformanceFee) external;
Sets the performance fee percentage.
setManagementFee
function setManagementFee(uint256 newManagementFee) external;
Sets the management fee percentage.
function setPerformanceFeeRecipient(address newPerformanceFeeRecipient) external;
Sets the performance fee recipient.
setManagementFeeRecipient
function setManagementFeeRecipient(address newManagementFeeRecipient) external;
Sets the management fee recipient.
increaseAbsoluteCap
function increaseAbsoluteCap(bytes memory idData, uint256 newAbsoluteCap) external;
Increases the absolute cap for a market.
decreaseAbsoluteCap
function decreaseAbsoluteCap(bytes memory idData, uint256 newAbsoluteCap) external;
Decreases the absolute cap for a market.
increaseRelativeCap
function increaseRelativeCap(bytes memory idData, uint256 newRelativeCap) external;
Increases the relative cap for a market.
decreaseRelativeCap
function decreaseRelativeCap(bytes memory idData, uint256 newRelativeCap) external;
Decreases the relative cap for a market.
setMaxRate
function setMaxRate(uint256 newMaxRate) external;
Sets the maximum allowed interest rate.
setForceDeallocatePenalty
function setForceDeallocatePenalty(address adapter, uint256 newForceDeallocatePenalty) external;
Sets the penalty for force deallocating from an adapter.
Allocator functions
allocate
function allocate(address adapter, bytes memory data, uint256 assets) external;
Allocates assets to an adapter.
deallocate
function deallocate(address adapter, bytes memory data, uint256 assets) external;
Deallocates assets from an adapter.
setLiquidityAdapterAndData
function setLiquidityAdapterAndData(address newLiquidityAdapter, bytes memory newLiquidityData) external;
Sets the liquidity adapter and its configuration data.
Exchange rate
accrueInterest
function accrueInterest() external;
Accrues interest and updates the vault’s exchange rate.
accrueInterestView
function accrueInterestView()
external
view
returns (uint256 newTotalAssets, uint256 performanceFeeShares, uint256 managementFeeShares);
Simulates interest accrual without state changes.
The projected total assets after accrual
The performance fee shares to be minted
The management fee shares to be minted
Force deallocate
forceDeallocate
function forceDeallocate(address adapter, bytes memory data, uint256 assets, address onBehalf)
external
returns (uint256 penaltyShares);
Force deallocates assets from an adapter with a penalty.
The number of penalty shares minted to the caller