Migrate an existing vault into a new Lagoon vault ?
Last updated
Last updated
This tutorial will explain how to migrate an existing vault or fund into a Lagoon vault without needing an action from your shareholders.
Migrating a vault is a dangerous procedure please procede if you know what you are doing.
Prerequisites:
having the capacity to approve and deposit the assets of the deprecated vault into the future Lagoon vault.
having all assets funds in underlying. Eg: in a USDC vault you should only have USDC.
the vault shares should not be used in DeFi.
This tutorial assumes that you have a clear understanding of how To showcase the migration process, we will use a USDC vault as an example.
We advice to pause the vault or at least freeze movement of shares to avoid loss of funds from your users.
In our case, here is the result of our snapshot:
0x123
4
40%
0x456
6
60%
TOTAL
10
100%
Concretly, the address 0x123 owns 4 shares out of the 10 total shares, which is equivalent to 40%.
In our case, after claim we received exactly 100 shares.
The address of the token you want to distribute is the address of shares which is the address of the vault. In our case, 0xabc.
We will now distribute 40 shares to the address 0x123 and 60 shares to the address 0x456. In disperse.app frontend it will be something like this:
the Lagoon Vault performance metrics will start from 0, meaning that you will have to reconcile the deprecated vault and the vault historics to have the full picture of your performance.
the deprecated vault shares will be worth 0, meaning that you can't do a migration on a vault that is used in DeFi.
. In our case, it will be a USDC vault and its address is 0xabc.
This is a tricky part of the procedure. When you will to accept your own deposit, you must input 0 as the valuation. If you input any other number, your vault shares accounting system will be broken and you will have to start again.
In our case, the total value of the first vault was 100 USDC, so we will do a requestDeposit of 100 USDC and . Then, we claim our shares by calling the deposit function. Go over if you need to know more about the deposit flow.
You can distribute the shares using dedicated tool. Be careful, frontend could be compromised, review the transactions carefully. We are going to use the but If you are more confortable using blockchain explorer you can enter disperse.app
in etherscan to find directly the smart contract to interact with.