LogarithmVault
Inherits: Initializable, PausableUpgradeable, ManagedVault
Author: Logarithm Labs
The Logarithm Vault supplies depositor funds to a single connected strategy, with depositors receiving shares proportional to their contributions and paying entry fees to cover the strategy’s execution costs. Vault tokens are yield-bearing and can be redeemed at any time, enabling depositors to withdraw their initial investment plus any generated yield, while incurring exit fees to cover strategy-related costs. When idle assets are available in the vault, redemptions may proceed synchronously; otherwise, they occur asynchronously as funds are withdrawn from the strategy, involving interactions with asynchronous protocols like GMX and cross-chain systems such as HyperLiquid.
The withdrawable assets and redeemable shares are determined by the maxRequestWithdraw
and maxRequestRedeem
functions and are executed via requestWithdraw
and requestRedeem
. These functions return a unique withdrawal key that can be used to check the status and claimability of the withdraw request. Standard ERC4626-compliant functions — maxWithdraw
, maxRedeem
, withdraw
, and redeem
— remain available but operate exclusively with idle assets within the vault. LogarithmVault is an ERC4626-compliant, upgradeable vault with asynchronous redemption functionality, deployed through a beacon proxy pattern.
State Variables
LogarithmVaultStorageLocation
Functions
_getLogarithmVaultStorage
onlySecurityManager
Reverts if the caller is not a security manager.
initialize
_setEntryCost
_setExitCost
_setPriorityProvider
setSecurityManager
Configures the security manager.
Parameters
account
address
The address of new security manager. A zero address means disabling security manager functions.
setStrategy
Configures the strategy. Note:
Approve new strategy to manage asset of this vault infinitely.
If there is an old strategy, revoke its asset approval after stopping the strategy.
setEntryCost
Configures new entry cost setting.
setExitCost
Configures new exit cost setting.
setPriorityProvider
Configures new priority provider.
shutdown
Shutdown vault, where all deposit/mint are disabled while withdraw/redeem are still available.
pause
Pauses Vault temporarily so that deposit and withdraw functions are disabled. This function is callable only by the security manager and is used if some unexpected behaviors from external protocols are spotted by the security manager.
Parameters
stopStrategy
bool
True means stopping strategy, otherwise pausing strategy.
unpause
Unpauses Vault while unpausing the connected strategy. This function is callable only by the security manager.
maxRequestWithdraw
Returns the maximum amount of the underlying asset that can be requested to withdraw from the owner balance in the Vault, through a requestWithdraw call.
maxRequestRedeem
Returns the maximum amount of Vault shares that can be requested to redeem from the owner balance in the Vault, through a requestRedeem call.
requestWithdraw
Requests to withdraw assets and returns a unique withdraw key if the requested asset amount is bigger than the idle assets. If idle assets are available in the Vault, they are withdrawn synchronously within the requestWithdraw
call, while any shortfall amount remains pending for execution by the system.
Burns shares from owner and sends exactly assets of underlying tokens to receiver if the idle assets is enough. If the idle assets is not enough, creates a withdraw request with the shortfall assets while sending the idle assets to receiver.
Returns
<none>
bytes32
The withdraw key that is used in the claim function.
requestRedeem
Requests to redeem shares and returns a unique withdraw key if the derived asset amount is bigger than the idle assets. If idle assets are available in the Vault, they are withdrawn synchronously within the requestWithdraw
call, while any shortfall amount remains pending for execution by the system.
Burns exactly shares from owner and sends assets of underlying tokens to receiver if the idle assets is enough, If the idle assets is not enough, creates a withdraw request with the shortfall assets while sending the idle assets to receiver.
Returns
<none>
bytes32
The withdraw key that is used in the claim function.
_requestWithdraw
requestWithdraw/requestRedeem common workflow.
processPendingWithdrawRequests
Processes pending withdraw requests with idle assets.
This is a decentralized function that can be called by anyone.
Returns
<none>
uint256
The assets used to process pending withdraw requests.
claim
Claims a withdraw request if it is executed.
Parameters
withdrawRequestKey
bytes32
The withdraw key that was returned by requestWithdraw/requestRedeem.
isClaimable
Tells if the withdraw request is claimable or not.
Parameters
withdrawRequestKey
bytes32
The withdraw key that was returned by requestWithdraw/requestRedeem.
isPrioritized
Tells if the owner is prioritized to withdraw.
idleAssets
The underlying asset amount in this vault that is free to withdraw or utilize.
totalPendingWithdraw
The underlying asset amount requested to withdraw, that is not executed yet.
getWithdrawKey
Derives a unique withdraw key based on the user’s address and his/her nonce.
totalAssets
See {IERC4626-totalAssets}.
previewDeposit
See {IERC4626-previewDeposit}.
previewMint
See {IERC4626-previewMint}.
previewWithdraw
See {IERC4626-previewWithdraw}.
previewRedeem
See {IERC4626-previewRedeem}.
maxDeposit
See {IERC4626-maxDeposit}.
maxMint
See {IERC4626-maxMint}.
maxWithdraw
This is limited by the idle assets.
maxRedeem
This is limited by the idle assets.
_deposit
If there are pending withdraw requests, the deposited assets is used to process them. And disables harvesting of the performance fee as a core logarithm vault doesn’t have the functionality.
_withdraw
Disables harvesting of the performance fee as a core logarithm vault doesn’t have the functionality.
_calcProcessedAssets
Calculates the processed withdrawal assets.
Parameters
_idleAssets
uint256
The idle assets available for processing withdraw requests.
_processedWithdrawAssets
uint256
The value of processedWithdrawAssets storage variable.
_accRequestedWithdrawAssets
uint256
The value of accRequestedWithdrawAssets storage variable.
Returns
remainingAssets
uint256
The remaining asset amount after processing
processedAssets
uint256
The processed asset amount
_isWithdrawRequestExecuted
Executable state of withdraw request
Parameters
isPrioritizedAccount
bool
Tells if account is prioritized for withdrawal
accRequestedWithdrawAssetsOfRequest
uint256
The accRequestedWithdrawAssets storage value of withdraw request
Returns
isExecuted
bool
Tells whether a request is executed or not
isLast
bool
Tells whether a request is last or not
_useNonce
Uses nonce of the specified user and increase it
_costOnRaw
Calculates the cost that should be added to an amount assets
that does not include cost. Used in IERC4626-mint and {IERC4626-withdraw} operations.
_costOnTotal
Calculates the cost part of an amount assets
that already includes cost. Used in IERC4626-deposit and {IERC4626-redeem} operations.
strategy
The address of strategy that uses the underlying asset of this vault.
priorityProvider
The priority provider address which provides the prioritized accounts. For example, the addresses of logarithm meta vaults are prioritized to withdraw. Prioritizing of withdraw means that their withdraw requests are processed before the other normal withdraw requests.
entryCost
The entry cost percent that is charged when depositing.
Denominated in 18 decimals.
exitCost
The exit cost percent that is charged when withdrawing.
Denominated in 18 decimals.
assetsToClaim
The underlying asset amount that is in Vault and reserved to claim for the executed withdraw requests.
accRequestedWithdrawAssets
The accumulated underlying asset amount requested to withdraw by the normal users.
processedWithdrawAssets
The accumulated underlying asset amount processed for the normal withdraw requests.
prioritizedAccRequestedWithdrawAssets
The accumulated underlying asset amount requested to withdraw by the prioritized users.
prioritizedProcessedWithdrawAssets
The accumulated underlying asset amount processed for the prioritized withdraw requests.
withdrawRequests
Returns the state of a withdraw request for the withdrawKey.
nonces
Returns a nonce of a user that are reserved to generate the next withdraw key.
securityManager
The address of security manager who is responsible for pausing/unpausing vault.
isShutdown
When this vault is shutdown, only withdrawals are available. It can’t be reverted.
Events
WithdrawRequested
Emitted when a new withdraw/redeem request is created.
Parameters
caller
address
The address of withdraw requestor.
receiver
address
The address who receives the withdraw assets.
owner
address
The address of owner who was requested to withdraw.
withdrawKey
bytes32
The bytes32 value that identifies the withdraw request.
assets
uint256
The asset amount that is requested to withdraw.
shares
uint256
The share amount that is burnt.
Claimed
Emitted when a withdraw request gets claimed.
Parameters
claimer
address
The address who claimed the withdraw request.
withdrawKey
bytes32
The bytes32 withdraw key identifying a withdraw request.
assets
uint256
The asset amount that is claimed.
Shutdown
Emitted when this vault get shutdown.
Parameters
account
address
The address who shutdown this vault.
SecurityManagerUpdated
Emitted when a new security manager is set.
Parameters
account
address
The address who changed the security manager.
newManager
address
The address of new security manager.
StrategyUpdated
Emitted when a new strategy is set.
Parameters
account
address
The address who changed strategy to a new one.
newStrategy
address
The address of a new strategy.
EntryCostUpdated
Emitted when the entry cost configuration is changed.
Parameters
account
address
The address who changed the entry cost configuration.
newEntryCost
uint256
The value of the new entry cost configuration.
ExitCostUpdated
Emitted when the exit cost configuration is changed.
Parameters
account
address
The address who changed the exit cost configuration.
newExitCost
uint256
The value of the new exit cost configuration.
PriorityProviderUpdated
Emitted when the priority provider address is changed.
Parameters
account
address
The address who changed the priority provider.
newPriorityProvider
address
The address of new priority provider.
Structs
WithdrawRequest
A struct describing an user’s withdraw request.
LogarithmVaultStorage
Last updated