IArrakisPublicVaultRouter
Functions
pause
function used to pause the router.
only callable by owner
function pause() external;
unpause
function used to unpause the router.
only callable by owner
function unpause() external;
addLiquidity
addLiquidity adds liquidity to meta vault of interest (mints L tokens)
function addLiquidity(AddLiquidityData memory params_)
external
payable
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
swapAndAddLiquidity
swapAndAddLiquidity transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidity(SwapAndAddData memory params_)
external
payable
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
removeLiquidity
removeLiquidity removes liquidity from vault and burns LP tokens
function removeLiquidity(RemoveLiquidityData memory params_)
external
returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
params_ | RemoveLiquidityData | RemoveLiquidityData struct containing data for withdrawals |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | actual amount of token0 transferred to receiver for burning burnAmount |
amount1 | uint256 | actual amount of token1 transferred to receiver for burning burnAmount |
addLiquidityPermit2
addLiquidityPermit2 adds liquidity to public vault of interest (mints LP tokens)
function addLiquidityPermit2(AddLiquidityPermit2Data memory params_)
external
payable
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
swapAndAddLiquidityPermit2
swapAndAddLiquidityPermit2 transfer tokens to and calls RouterSwapExecutor
function swapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
removeLiquidityPermit2
removeLiquidityPermit2 removes liquidity from vault and burns LP tokens
function removeLiquidityPermit2(
RemoveLiquidityPermit2Data memory params_
) external returns (uint256 amount0, uint256 amount1);
Parameters
Name | Type | Description |
---|---|---|
params_ | RemoveLiquidityPermit2Data | RemoveLiquidityPermit2Data struct containing data for withdrawals |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | actual amount of token0 transferred to receiver for burning burnAmount |
amount1 | uint256 | actual amount of token1 transferred to receiver for burning burnAmount |
wrapAndAddLiquidity
wrapAndAddLiquidity wrap eth and adds liquidity to meta vault of interest (mints L tokens)
function wrapAndAddLiquidity(AddLiquidityData memory params_)
external
payable
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityData | AddLiquidityData struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
wrapAndSwapAndAddLiquidity
wrapAndSwapAndAddLiquidity wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidity(SwapAndAddData memory params_)
external
payable
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddData | SwapAndAddData struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
wrapAndAddLiquidityPermit2
wrapAndAddLiquidityPermit2 wrap eth and adds liquidity to public vault of interest (mints LP tokens)
function wrapAndAddLiquidityPermit2(
AddLiquidityPermit2Data memory params_
)
external
payable
returns (uint256 amount0, uint256 amount1, uint256 sharesReceived);
Parameters
Name | Type | Description |
---|---|---|
params_ | AddLiquidityPermit2Data | AddLiquidityPermit2Data struct containing data for adding liquidity |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
wrapAndSwapAndAddLiquidityPermit2
wrapAndSwapAndAddLiquidityPermit2 wrap eth and transfer tokens to and calls RouterSwapExecutor
function wrapAndSwapAndAddLiquidityPermit2(
SwapAndAddPermit2Data memory params_
)
external
payable
returns (
uint256 amount0,
uint256 amount1,
uint256 sharesReceived,
uint256 amount0Diff,
uint256 amount1Diff
);
Parameters
Name | Type | Description |
---|---|---|
params_ | SwapAndAddPermit2Data | SwapAndAddPermit2Data struct containing data for swap |
Returns
Name | Type | Description |
---|---|---|
amount0 | uint256 | amount of token0 transferred from msg.sender to mint mintAmount |
amount1 | uint256 | amount of token1 transferred from msg.sender to mint mintAmount |
sharesReceived | uint256 | amount of public vault tokens transferred to receiver |
amount0Diff | uint256 | token0 balance difference post swap |
amount1Diff | uint256 | token1 balance difference post swap |
getMintAmounts
getMintAmounts used to get the shares we can mint from some max amounts.
function getMintAmounts(
address vault_,
uint256 maxAmount0_,
uint256 maxAmount1_
)
external
view
returns (
uint256 shareToMint,
uint256 amount0ToDeposit,
uint256 amount1ToDeposit
);
Parameters
Name | Type | Description |
---|---|---|
vault_ | address | meta vault address. |
maxAmount0_ | uint256 | maximum amount of token0 user want to contribute. |
maxAmount1_ | uint256 | maximum amount of token1 user want to contribute. |
Returns
Name | Type | Description |
---|---|---|
shareToMint | uint256 | maximum amount of share user can get for 'maxAmount0*' and 'maxAmount1*'. |
amount0ToDeposit | uint256 | amount of token0 user should deposit into the vault for minting 'shareToMint'. |
amount1ToDeposit | uint256 | amount of token1 user should deposit into the vault for minting 'shareToMint'. |
Events
Swapped
event emitted when a swap happen before depositing.
event Swapped(
bool zeroForOne,
uint256 amount0Diff,
uint256 amount1Diff,
uint256 amountOutSwap
);
Parameters
Name | Type | Description |
---|---|---|
zeroForOne | bool | boolean indicating if we are swap token0 to token1 or the inverse. |
amount0Diff | uint256 | amount of token0 get or consumed by the swap. |
amount1Diff | uint256 | amount of token1 get or consumed by the swap. |
amountOutSwap | uint256 | minimum amount of tokens out wanted after swap. |
Errors
AddressZero
error AddressZero();
NotEnoughNativeTokenSent
error NotEnoughNativeTokenSent();
NoNativeTokenAndValueNotZero
error NoNativeTokenAndValueNotZero();
OnlyPublicVault
error OnlyPublicVault();
EmptyMaxAmounts
error EmptyMaxAmounts();
NothingToMint
error NothingToMint();
NothingToBurn
error NothingToBurn();
BelowMinAmounts
error BelowMinAmounts();
SwapCallFailed
error SwapCallFailed();
ReceivedBelowMinimum
error ReceivedBelowMinimum();
LengthMismatch
error LengthMismatch();
NoNativeToken
error NoNativeToken();
MsgValueZero
error MsgValueZero();
NativeTokenNotSupported
error NativeTokenNotSupported();
MsgValueDTMaxAmount
error MsgValueDTMaxAmount();
NoWethToken
error NoWethToken();
Permit2WethNotAuthorized
error Permit2WethNotAuthorized();