Morpho Vaults V2
Code
v2.0 repositoryIntroduction to principles
Caps structure
struct Caps {
uint256 allocation;
uint128 absoluteCap;
uint128 relativeCap;
}| Name | Type | Description |
|---|---|---|
allocation | uint256 | The current amount of assets allocated to this id. |
absoluteCap | uint128 | The maximum amount of assets that can be allocated to this id. |
relativeCap | uint128 | The maximum percentage of total assets that can be allocated to this id, scaled by 1e18. |
id, idData, and data
Allocation targets are identified by id = keccak256(abi.encode(marketId)). When allocating or setting caps, you pass the raw data (e.g., abi.encode(marketId)). When querying allocations or caps, you must compute and pass the id hash. The vault does not provide a helper function to compute id - you must calculate it off-chain or in your contract.
Throughout the vault contract, you'll encounter three related concepts for identifying allocation targets:
data / idData
- Raw bytes: Protocol-specific data that identifies where funds are allocated
- For Morpho adapters: This is typically the
bytes32market ID encoded as bytes - Example:
abi.encode(marketId)wheremarketIdis the Morpho market identifier
id
- Computed hash:
id = keccak256(idData) - Purpose: Used as the unique key in the vault's storage mappings to track allocations and caps
- Type:
bytes32
Function usage patterns
- Setting caps: Functions like
increaseAbsoluteCaptakeidData(raw bytes) as input - Allocating: Functions like
allocatetakedata(raw bytes) as input - Querying: Functions like
allocation,absoluteCap,relativeCaptakeid(keccak256 hash) as input
This design allows the vault to work with any adapter and allocation target, as long as they can be identified by bytes-encoded data.
Function Selectors
A function selector is a bytes4 value that uniquely identifies a function in a smart contract. It's the first 4 bytes of the keccak256 hash of the function's signature.
What are they used for in the vault? Selectors are used for timelock management. The curator can configure different timelock durations for different functions, or permanently abdicate the ability to call specific functions. Functions like timelock(bytes4 selector), abdicated(bytes4 selector), increaseTimelock(bytes4 selector, ...), and decreaseTimelock(bytes4 selector, ...) use selectors to identify which function's settings to modify.
- The function signature must include parameter types but not parameter names or return types
- Example:
"setPerformanceFee(uint256)"not"setPerformanceFee(uint256 newFee)" - Selectors are always exactly 4 bytes (shown as 10 characters in hex:
0x+ 8 hex digits)
External Functions
deposit
function deposit(uint256 assets, address onBehalf) external returns (uint256)Deposits assets of the underlying token to mint vault shares for onBehalf.
Parameters:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of the underlying asset to deposit. |
onBehalf | address | The recipient of the minted vault shares. |
Return Values:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The amount of vault shares minted. |
mint
function mint(uint256 shares, address onBehalf) external returns (uint256)Mints exactly shares vault shares for onBehalf by depositing the required amount of the underlying token.
Parameters:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The exact amount of shares to mint. |
onBehalf | address | The recipient of the minted vault shares. |
Return Values:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of the underlying asset deposited. |
withdraw
function withdraw(uint256 assets, address receiver, address onBehalf) public returns (uint256)Withdraws assets of the underlying token by burning shares from onBehalf and sends them to receiver.
Parameters:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of the underlying asset to withdraw. |
receiver | address | The recipient of the withdrawn assets. |
onBehalf | address | The owner of the shares to be burned. msg.sender must be approved. |
Return Values:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The amount of vault shares burned. |
redeem
function redeem(uint256 shares, address receiver, address onBehalf) external returns (uint256)Burns exactly shares vault shares from onBehalf and sends the corresponding amount of underlying assets to receiver.
Parameters:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The exact amount of shares to burn. |
receiver | address | The recipient of the withdrawn assets. |
onBehalf | address | The owner of the shares to be burned. msg.sender must be approved. |
Return Values:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of the underlying asset withdrawn. |
forceDeallocate
function forceDeallocate(address adapter, bytes memory data, uint256 assets, address onBehalf) external returns (uint256)Forcibly deallocates assets from a specific adapter to the vault's idle pool. A penalty can be set and taken from onBehalf's shares to disincentivize misuse (see setForceDeallocatePenalty). This function is permissionless and serves as an in-kind redemption mechanism.
Parameters:
| Name | Type | Description |
|---|---|---|
adapter | address | The adapter to deallocate from. |
data | bytes | The protocol-specific data for the deallocation. |
assets | uint256 | The amount of assets to deallocate. |
onBehalf | address | The account from which the penalty shares will be burned. |
Return Values:
| Name | Type | Description |
|---|---|---|
withdrawnShares | uint256 | The amount of shares burned from onBehalf as a penalty. |
accrueInterest
function accrueInterest() publicAccrues interest for the vault by querying adapters for their current assets and updating totalAssets. This function is called by most state-changing functions.
accrueInterestView
function accrueInterestView() public view returns (uint256, uint256, uint256)Returns the view version of interest accrual without updating state.
Return Values:
| Name | Type | Description |
|---|---|---|
newTotalAssets | uint256 | The updated total assets after interest accrual. |
performanceFeeShares | uint256 | The amount of shares minted as performance fee. |
managementFeeShares | uint256 | The amount of shares minted as management fee. |
previewDeposit
function previewDeposit(uint256 assets) public view returns (uint256)Returns previewed minted shares for a given asset amount.
Parameters:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of assets to preview deposit for. |
Return Values:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The amount of shares that would be minted. |
previewMint
function previewMint(uint256 shares) public view returns (uint256)Returns previewed deposited assets for a given share amount.
Parameters:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The amount of shares to preview mint for. |
Return Values:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of assets that would be deposited. |
previewWithdraw
function previewWithdraw(uint256 assets) public view returns (uint256)Returns previewed redeemed shares for a given asset amount.
Parameters:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of assets to preview withdrawal for. |
Return Values:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The amount of shares that would be burned. |
previewRedeem
function previewRedeem(uint256 shares) public view returns (uint256)Returns previewed withdrawn assets for a given share amount.
Parameters:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The amount of shares to preview redemption for. |
Return Values:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of assets that would be withdrawn. |
convertToShares
function convertToShares(uint256 assets) external view returns (uint256)Returns corresponding shares (rounded down) for a given asset amount. Takes into account performance and management fees.
Parameters:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The amount of assets to convert. |
Return Values:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The corresponding amount of shares. |
convertToAssets
function convertToAssets(uint256 shares) external view returns (uint256)Returns corresponding assets (rounded down) for a given share amount. Takes into account performance and management fees.
Parameters:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The amount of shares to convert. |
Return Values:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The corresponding amount of assets. |
maxDeposit
function maxDeposit(address) external pure returns (uint256)Returns the maximum amount of assets that can be deposited. Always returns 0 due to gate complexity.
maxMint
function maxMint(address) external pure returns (uint256)Returns the maximum amount of shares that can be minted. Always returns 0 due to gate complexity.
maxWithdraw
function maxWithdraw(address) external pure returns (uint256)Returns the maximum amount of assets that can be withdrawn. Always returns 0 due to gate complexity.
maxRedeem
function maxRedeem(address) external pure returns (uint256)Returns the maximum amount of shares that can be redeemed. Always returns 0 due to gate complexity.
multicall
function multicall(bytes[] calldata data) externalUseful for EOAs to batch admin calls. Does not return anything, because accounts who would use the return data would be contracts, which can do the multicall themselves.
Parameters:
| Name | Type | Description |
|---|---|---|
data | bytes[] | Array of encoded function calls to execute. |
Owner Functions
setOwner
function setOwner(address newOwner) externalTransfers ownership of the vault to newOwner. Only callable by the current owner.
setCurator
function setCurator(address newCurator) externalSets the vault's Curator. Only callable by the owner.
setIsSentinel
function setIsSentinel(address account, bool newIsSentinel) externalGrants or revokes the Sentinel role for an account. Only callable by the owner.
setName
function setName(string memory newName) externalSets the vault's name. Only callable by the owner.
setSymbol
function setSymbol(string memory newSymbol) externalSets the vault's symbol. Only callable by the owner.
Curator Functions
The following functions are only callable by the Curator. Some are subject to a timelock while others are instant. The timelock process is:
Curatorcallssubmit(bytes calldata data)with the ABI-encoded function call.- After the timelock expires, anyone can execute the function directly.
abdicate
function abdicate(bytes4 selector) externalIrreversibly disables the ability to submit a specific type of action.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
selector | bytes4 | The function selector to abdicate. |
addAdapter
function addAdapter(address account) externalAdds a new adapter to the vault.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
account | address | The adapter address to add. |
decreaseAbsoluteCap
function decreaseAbsoluteCap(bytes memory idData, uint256 newAbsoluteCap) externalDecreases the absolute cap for an allocation target. The id is computed as keccak256(idData) where idData is the market-specific data identifying the allocation target.
Instant Action (also callable by a Sentinel)
Parameters:
| Name | Type | Description |
|---|---|---|
idData | bytes | Market-specific data identifying the allocation target (e.g., market ID for Morpho markets). The hash of this data (keccak256(idData)) is used as the unique identifier. |
newAbsoluteCap | uint256 | The new absolute cap value. |
decreaseRelativeCap
function decreaseRelativeCap(bytes memory idData, uint256 newRelativeCap) externalDecreases the relative cap for an allocation target. The id is computed as keccak256(idData) where idData is the market-specific data identifying the allocation target.
Instant Action (also callable by a Sentinel)
Parameters:
| Name | Type | Description |
|---|---|---|
idData | bytes | Market-specific data identifying the allocation target (e.g., market ID for Morpho markets). The hash of this data (keccak256(idData)) is used as the unique identifier. |
newRelativeCap | uint256 | The new relative cap value (scaled by 1e18). |
decreaseTimelock
function decreaseTimelock(bytes4 selector, uint256 newDuration) externalDecreases a function's timelock duration. This action's timelock equals the current timelock of the function being decreased.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
selector | bytes4 | The function selector. |
newDuration | uint256 | The new timelock duration. |
increaseAbsoluteCap
function increaseAbsoluteCap(bytes memory idData, uint256 newAbsoluteCap) externalIncreases the absolute cap for an allocation target. The id is computed as keccak256(idData) where idData is the market-specific data identifying the allocation target.
Parameters:
| Name | Type | Description |
|---|---|---|
idData | bytes | Market-specific data identifying the allocation target (e.g., market ID for Morpho markets). The hash of this data (keccak256(idData)) is used as the unique identifier. |
newAbsoluteCap | uint256 | The new absolute cap value. |
increaseRelativeCap
function increaseRelativeCap(bytes memory idData, uint256 newRelativeCap) externalIncreases the relative cap for an allocation target. The id is computed as keccak256(idData) where idData is the market-specific data identifying the allocation target.
Parameters:
| Name | Type | Description |
|---|---|---|
idData | bytes | Market-specific data identifying the allocation target (e.g., market ID for Morpho markets). The hash of this data (keccak256(idData)) is used as the unique identifier. |
newRelativeCap | uint256 | The new relative cap value (scaled by 1e18). |
increaseTimelock
function increaseTimelock(bytes4 selector, uint256 newDuration) externalIncreases a function's timelock duration.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
selector | bytes4 | The function selector. |
newDuration | uint256 | The new timelock duration. |
removeAdapter
function removeAdapter(address account) externalRemoves an adapter from the vault.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
account | address | The adapter address to remove. |
revoke
function revoke(bytes calldata data) externalRevokes a pending timelocked action.
Instant Action (also callable by a Sentinel)
Parameters:
| Name | Type | Description |
|---|---|---|
data | bytes | The ABI-encoded function call data to revoke. |
setAdapterRegistry
function setAdapterRegistry(address newAdapterRegistry) externalSets the adapter registry contract. The function validates that the new registry approves all currently added adapters. If the new registry returns false for any existing adapter, the transaction will revert. This ensures that changing the registry doesn't invalidate adapters that are already in use. Timelocked Action
Parameters:
| Name | Type | Description |
|---|---|---|
newAdapterRegistry | address | The new adapter registry contract. |
setForceDeallocatePenalty
function setForceDeallocatePenalty(address adapter, uint256 newForceDeallocatePenalty) externalSets the penalty for using forceDeallocate on a specific adapter.
Parameters:
| Name | Type | Description |
|---|---|---|
adapter | address | The adapter to set penalty for. |
newForceDeallocatePenalty | uint256 | The new penalty value (scaled by 1e18). |
setIsAllocator
function setIsAllocator(address account, bool newIsAllocator) externalGrants or revokes the Allocator role for an account.
Parameters:
| Name | Type | Description |
|---|---|---|
account | address | The account to modify. |
newIsAllocator | bool | Whether the account should be an allocator. |
setManagementFee
function setManagementFee(uint256 newManagementFee) externalSets the vault's management fee.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
newManagementFee | uint256 | The new management fee (scaled by 1e18). |
setManagementFeeRecipient
function setManagementFeeRecipient(address newManagementFeeRecipient) externalSets the management fee recipient.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
newManagementFeeRecipient | address | The new management fee recipient. |
setPerformanceFee
function setPerformanceFee(uint256 newPerformanceFee) externalSets the vault's performance fee.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
newPerformanceFee | uint256 | The new performance fee (scaled by 1e18). |
setPerformanceFeeRecipient
function setPerformanceFeeRecipient(address newPerformanceFeeRecipient) externalSets the performance fee recipient.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
newPerformanceFeeRecipient | address | The new performance fee recipient. |
setReceiveAssetsGate
function setReceiveAssetsGate(address newReceiveAssetsGate) externalSets the contract for gating asset receipts.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
newReceiveAssetsGate | address | The new receive assets gate contract. |
setReceiveSharesGate
function setReceiveSharesGate(address newReceiveSharesGate) externalSets the contract for gating share receipts.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
newReceiveSharesGate | address | The new receive shares gate contract. |
setSendAssetsGate
function setSendAssetsGate(address newSendAssetsGate) externalSets the contract for gating asset sends.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
newSendAssetsGate | address | The new send assets gate contract. |
setSendSharesGate
function setSendSharesGate(address newSendSharesGate) externalSets the contract for gating share sends.
Timelocked ActionParameters:
| Name | Type | Description |
|---|---|---|
newSendSharesGate | address | The new send shares gate contract. |
submit
function submit(bytes calldata data) externalSubmits a timelocked action for execution after the timelock period expires.
Timelock Management FunctionParameters:
| Name | Type | Description |
|---|---|---|
data | bytes | The ABI-encoded function call data. |
Allocator Functions
allocate
function allocate(address adapter, bytes memory data, uint256 assets) externalAllocates assets from the vault's idle pool to a specific adapter. The allocation is subject to the caps configured for the target market. Only callable by an Allocator.
Parameters:
| Name | Type | Description |
|---|---|---|
adapter | address | The adapter to allocate assets to. |
data | bytes | Market-specific data encoding passed to the adapter (e.g., market ID for Morpho markets). The hash of this data (keccak256(data)) identifies the allocation target for cap enforcement. |
assets | uint256 | The amount of assets to allocate. |
deallocate
function deallocate(address adapter, bytes memory data, uint256 assets) externalDeallocates assets from an adapter back to the vault's idle pool. Also callable by a Sentinel.
Parameters:
| Name | Type | Description |
|---|---|---|
adapter | address | The adapter to deallocate assets from. |
data | bytes | Market-specific data encoding passed to the adapter (e.g., market ID for Morpho markets). Must match the data used when allocating. |
assets | uint256 | The amount of assets to deallocate. |
setLiquidityAdapterAndData
function setLiquidityAdapterAndData(address newLiquidityAdapter, bytes memory newLiquidityData) externalSets the default adapter for handling user deposits and withdrawals.
Parameters:
| Name | Type | Description |
|---|---|---|
newLiquidityAdapter | address | The new liquidity adapter address. |
newLiquidityData | bytes | The new liquidity data for the adapter. |
setMaxRate
function setMaxRate(uint256 newMaxRate) externalSets the maximum rate at which totalAssets can grow. A curator-controlled parameter that caps how quickly totalAssets can grow, useful for implementing fixed-rate distributions or preventing unrealistic yield spikes.
Parameters:
| Name | Type | Description |
|---|---|---|
newMaxRate | uint256 | The new maximum rate per second (scaled by 1e18). |
Gating Functions
Gates are optional external smart contracts that implement access control for the vault.
The vault supports four independent gates: receiveSharesGate, sendSharesGate, receiveAssetsGate, and sendAssetsGate.
Gates are separate smart contracts that you (or the curator) must deploy independently.
They are not part of the vault contract itself. The curator configures them using functions like setReceiveSharesGate, setSendSharesGate, etc.
Each gate contract must implement a function that returns bool to indicate whether an account is allowed to perform the action.
The vault calls these gates during transfers and deposits/withdrawals to enforce access control.
canReceiveShares
function canReceiveShares(address account) public view returns (bool)Checks if an account can receive shares based on the receive shares gate.
Parameters:
| Name | Type | Description |
|---|---|---|
account | address | The account to check. |
Return Values:
| Name | Type | Description |
|---|---|---|
allowed | bool | Whether the account can receive shares. |
canSendShares
function canSendShares(address account) public view returns (bool)Checks if an account can send shares based on the send shares gate.
Parameters:
| Name | Type | Description |
|---|---|---|
account | address | The account to check. |
Return Values:
| Name | Type | Description |
|---|---|---|
allowed | bool | Whether the account can send shares. |
canReceiveAssets
function canReceiveAssets(address account) public view returns (bool)Checks if an account can receive assets based on the receive assets gate. The vault itself is always allowed.
Parameters:
| Name | Type | Description |
|---|---|---|
account | address | The account to check. |
Return Values:
| Name | Type | Description |
|---|---|---|
allowed | bool | Whether the account can receive assets. |
canSendAssets
function canSendAssets(address account) public view returns (bool)Checks if an account can send assets based on the send assets gate.
Parameters
| Name | Type | Description |
|---|---|---|
account | address | The account to check. |
Return Values:
| Name | Type | Description |
|---|---|---|
allowed | bool | Whether the account can send assets. |
View Functions
totalAssets
function totalAssets() external view returns (uint256)Returns the total amount of underlying assets held by the vault, including both idle assets and assets allocated to adapters.
Return Values:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The total assets in the vault. |
adaptersLength
function adaptersLength() external view returns (uint256)Returns the number of adapters currently added to the vault.
Return Values:
| Name | Type | Description |
|---|---|---|
length | uint256 | The number of adapters. |
absoluteCap
function absoluteCap(bytes32 id) external view returns (uint256)Returns the absolute cap for a given allocation id. The id is computed as keccak256(idData) where idData is the market-specific data identifying the allocation target.
Parameters:
| Name | Type | Description |
|---|---|---|
id | bytes32 | The allocation identifier (keccak256 hash of idData). |
Return Values:
| Name | Type | Description |
|---|---|---|
cap | uint256 | The absolute cap value. |
relativeCap
function relativeCap(bytes32 id) external view returns (uint256)Returns the relative cap for a given allocation id. The id is computed as keccak256(idData) where idData is the market-specific data identifying the allocation target.
Parameters:
| Name | Type | Description |
|---|---|---|
id | bytes32 | The allocation identifier (keccak256 hash of idData). |
Return Values:
| Name | Type | Description |
|---|---|---|
cap | uint256 | The relative cap value (scaled by 1e18). |
allocation
function allocation(bytes32 id) external view returns (uint256)Returns the current allocation amount for a given id. The id is computed as keccak256(idData) where idData is the market-specific data identifying the allocation target.
Parameters:
| Name | Type | Description |
|---|---|---|
id | bytes32 | The allocation identifier (keccak256 hash of idData). |
Return Values:
| Name | Type | Description |
|---|---|---|
amount | uint256 | The current allocation amount. |
owner
function owner() external view returns (address)Returns the current owner address of the vault.
Return Values:
| Name | Type | Description |
|---|---|---|
owner | address | The owner address. |
curator
function curator() external view returns (address)Returns the current curator address of the vault.
Return Values:
| Name | Type | Description |
|---|---|---|
curator | address | The curator address. |
isSentinel
function isSentinel(address account) external view returns (bool)Checks if an account has the Sentinel role.
Parameters:
| Name | Type | Description |
|---|---|---|
account | address | The account to check. |
Return Values:
| Name | Type | Description |
|---|---|---|
isSentinel | bool | Whether the account is a sentinel. |
isAllocator
function isAllocator(address account) external view returns (bool)Checks if an account has the Allocator role.
Parameters:
| Name | Type | Description |
|---|---|---|
account | address | The account to check. |
Return Values:
| Name | Type | Description |
|---|---|---|
isAllocator | bool | Whether the account is an allocator. |
receiveSharesGate
function receiveSharesGate() external view returns (address)Returns the address of the receive shares gate contract.
Return Values:
| Name | Type | Description |
|---|---|---|
gate | address | The receive shares gate address. |
sendSharesGate
function sendSharesGate() external view returns (address)Returns the address of the send shares gate contract.
Return Values:
| Name | Type | Description |
|---|---|---|
gate | address | The send shares gate address. |
receiveAssetsGate
function receiveAssetsGate() external view returns (address)Returns the address of the receive assets gate contract.
Return Values:
| Name | Type | Description |
|---|---|---|
gate | address | The receive assets gate address. |
sendAssetsGate
function sendAssetsGate() external view returns (address)Returns the address of the send assets gate contract.
Return Values:
| Name | Type | Description |
|---|---|---|
gate | address | The send assets gate address. |
adapterRegistry
function adapterRegistry() external view returns (address)Returns the address of the adapter registry contract.
Return Values:
| Name | Type | Description |
|---|---|---|
registry | address | The adapter registry address. |
adapters
function adapters(uint256 index) external view returns (address)Returns the adapter address at a specific index (index list retrievable via the adaptersLength function).
Parameters:
| Name | Type | Description |
|---|---|---|
index | uint256 | The index in the adapters array. |
Return Values:
| Name | Type | Description |
|---|---|---|
adapter | address | The adapter address at the given index. |
isAdapter
function isAdapter(address account) external view returns (bool)Checks if an account is a registered adapter.
Parameters:
| Name | Type | Description |
|---|---|---|
account | address | The account to check. |
Return Values:
| Name | Type | Description |
|---|---|---|
isAdapter | bool | Whether the account is an adapter. |
liquidityAdapter
function liquidityAdapter() external view returns (address)Returns the default adapter used for handling user deposits and withdrawals.
Return Values:
| Name | Type | Description |
|---|---|---|
adapter | address | The liquidity adapter address. |
liquidityData
function liquidityData() external view returns (bytes memory)Returns the data associated with the liquidity adapter.
Return Values:
| Name | Type | Description |
|---|---|---|
data | bytes | The liquidity adapter data. |
forceDeallocatePenalty
function forceDeallocatePenalty(address adapter) external view returns (uint256)Returns the penalty for using forceDeallocate on a specific adapter.
Parameters:
| Name | Type | Description |
|---|---|---|
adapter | address | The adapter to check. |
Return Values:
| Name | Type | Description |
|---|---|---|
penalty | uint256 | The force deallocate penalty (scaled by 1e18). |
virtualShares
function virtualShares() external view returns (uint256)Returns the virtual shares used for avoiding initial share inflation attacks.
Return Values:
| Name | Type | Description |
|---|---|---|
shares | uint256 | The virtual shares amount. |
firstTotalAssets
function firstTotalAssets() external view returns (uint256)Returns the total assets after the first interest accrual of the current transaction. Used to prevent bypassing relative caps with flashloans.
Return Values:
| Name | Type | Description |
|---|---|---|
assets | uint256 | The total assets after the first interest accrual of the transaction. |
_totalAssets
function _totalAssets() external view returns (uint128)Returns the internal cached total assets value.
Return Values:
| Name | Type | Description |
|---|---|---|
assets | uint128 | The cached total assets. |
lastUpdate
function lastUpdate() external view returns (uint64)Returns the timestamp of the last interest accrual.
Return Values:
| Name | Type | Description |
|---|---|---|
timestamp | uint64 | The last update timestamp. |
maxRate
function maxRate() external view returns (uint64)Returns the maximum rate at which totalAssets can grow.
Return Values:
| Name | Type | Description |
|---|---|---|
rate | uint64 | The maximum rate per second (scaled by 1e18). |
performanceFee
function performanceFee() external view returns (uint96)Returns the current performance fee.
Return Values:
| Name | Type | Description |
|---|---|---|
fee | uint96 | The performance fee (scaled by 1e18). |
performanceFeeRecipient
function performanceFeeRecipient() external view returns (address)Returns the recipient address of performance fees.
Return Values:
| Name | Type | Description |
|---|---|---|
recipient | address | The performance fee recipient address. |
managementFee
function managementFee() external view returns (uint96)Returns the current management fee.
Return Values:
| Name | Type | Description |
|---|---|---|
fee | uint96 | The management fee (scaled by 1e18). |
managementFeeRecipient
function managementFeeRecipient() external view returns (address)Returns the recipient address of management fees.
Return Values:
| Name | Type | Description |
|---|---|---|
recipient | address | The management fee recipient address. |
timelock
function timelock(bytes4 selector) external view returns (uint256)Returns the timelock duration for a specific function selector.
Parameters:
| Name | Type | Description |
|---|---|---|
selector | bytes4 | The function selector. |
Return Values:
| Name | Type | Description |
|---|---|---|
duration | uint256 | The timelock duration in seconds. |
abdicated
function abdicated(bytes4 selector) external view returns (bool)Checks if the curator has abdicated the ability to submit a specific action.
Parameters:
| Name | Type | Description |
|---|---|---|
selector | bytes4 | The function selector. |
Return Values:
| Name | Type | Description |
|---|---|---|
abdicated | bool | Whether the action has been abdicated. |
executableAt
function executableAt(bytes memory data) external view returns (uint256)Returns the timestamp when a submitted timelocked action becomes executable.
Parameters:
| Name | Type | Description |
|---|---|---|
data | bytes | The ABI-encoded function call data. |
Return Values:
| Name | Type | Description |
|---|---|---|
timestamp | uint256 | The timestamp when the action becomes executable. |
DOMAIN_SEPARATOR
function DOMAIN_SEPARATOR() external view returns (bytes32)Returns the EIP-712 domain separator used for permit signatures.
Return Values:
| Name | Type | Description |
|---|---|---|
separator | bytes32 | The domain separator. |
