Add Liquidity
To make the deposit process safe and simple we have designed the Arrakis Public Vault Router. This contract is in charge of getting the right amounts and tokens to deposit. This is achieved by integrating with a swap aggregator and wrapping tokens when necessary. It also implements the Permit 2 standard for gassless approvals.
The following provides a step-by-step explanation of manually creating and sending an addLiquidity
transaction to deposit into an Arrakis Public Vault.
-
Identify the Meta Vault associated to the pair you want to participate in. See for example here for a full list of live Arrakis Public Vaults.
-
From now on, we use the Arrakis Public Router contract, defined here
ArrakisPublicVaultRouter.sol
-
Next step is to determine how many of each tokens you expect to need to join the Meta Vault.
- Use
getMintAmounts
to determine the extact amounts oftoken0
andtoken1
to deposit.
- Use
-
In order to set token transfer authorizations before depositing, there are two alternatives:
- Calling the standard ERC20
Approve
- Set up Permit2 data and signature
- Calling the standard ERC20
-
Now, in order to deposit into the pool there are multiple paths:
-
If you set up ERC20 approvals:
- Call
addLiquidity
to deposit both tokens to the vault. - If you have
ETH
and want to deposit into a pool withWETH
as one of its tokens, you can also callwrapAndAddLiquidity
. - If you want to synchronously perform a swap before adding liquidity you can call
swapAndAddLiquidity
orwrapAndSwapAndAddLiquidity
(if you want to use send nativeETH
instead ofWETH
for a swap-and-deposit interaction)
- Call
-
If you have set the correct Permit2 data and signature you should respectively call
addLiquidityPermit2
,wrapAndAddLiquidityPermit2
,swapAndAddLiquidityPermit2
orwrapAndSwapAndAddLiquidityPermit2
-
-
Once your deposit transaction goes through, you obtain ERC20 LP
shares
of the vault you are depositing to.