Example: How to Use Lorenzo OTF Vaults
To deposit/withdraw assets to/from Lorenzo OTF vaults, please follow the following steps:
Deposit
Approve your underlying asset to the vault contract for the desired amount. The deposit amount must be greater than the
minDepositAmountvalue set in the vault.Compose a transaction to call the
depoist(uint256)method on the vault and submit the transaction.On receiving the transaction:
The vault first transfers the underlying asset in by calling
transferFrom().The vault then dispatches the underlying assets to its portfolios' wallet addresses.
The vault finally mints LP tokens to the depositor. For calculation details, please refer to the previous section.
Request Withdrawal
First, determine the amount of LP token shares to withdraw and invoke the
requestWithdraw(uint256)method on the vault contract. The amount of shares must be greater than theminWithdrawAmountvalue set in the vault. If the amount of shares is less thanminWithdrawAmount, all of the balance must be withdrawn at once.After the transaction is submitted successfully, a
requestIdis returned for later completing the final withdrawal. If the user submits multiple withdrawal requests within the same settlement period, the amount of requested LP tokens is accumulated and associated to only onerequestId.The requested amount of LP tokens are locked instead of being immediately burnt until the final withdrawal settlement.
Wait 5~8 days until the is finalized for the current settlement period.
Withdraw
After the is finalized, the final withdrawal settlement can proceed.
Invoke the
withdraw(unint256 reqeustId)method on the vault with the prefiously receivedrequestId.After the transaction is submitted, the corresponding amount of underlying assets is returned. The received amount , and of LP tokens are burnt.
Last updated