IArrakisPublicVaultRouter

Git Source

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

NameTypeDescription
params_AddLiquidityDataAddLiquidityData struct containing data for adding liquidity

Returns

NameTypeDescription
amount0uint256amount of token0 transferred from msg.sender to mint mintAmount
amount1uint256amount of token1 transferred from msg.sender to mint mintAmount
sharesReceiveduint256amount 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

NameTypeDescription
params_SwapAndAddDataSwapAndAddData struct containing data for swap

Returns

NameTypeDescription
amount0uint256amount of token0 transferred from msg.sender to mint mintAmount
amount1uint256amount of token1 transferred from msg.sender to mint mintAmount
sharesReceiveduint256amount of public vault tokens transferred to receiver
amount0Diffuint256token0 balance difference post swap
amount1Diffuint256token1 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

NameTypeDescription
params_RemoveLiquidityDataRemoveLiquidityData struct containing data for withdrawals

Returns

NameTypeDescription
amount0uint256actual amount of token0 transferred to receiver for burning burnAmount
amount1uint256actual 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

NameTypeDescription
params_AddLiquidityPermit2DataAddLiquidityPermit2Data struct containing data for adding liquidity

Returns

NameTypeDescription
amount0uint256amount of token0 transferred from msg.sender to mint mintAmount
amount1uint256amount of token1 transferred from msg.sender to mint mintAmount
sharesReceiveduint256amount 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

NameTypeDescription
params_SwapAndAddPermit2DataSwapAndAddPermit2Data struct containing data for swap

Returns

NameTypeDescription
amount0uint256amount of token0 transferred from msg.sender to mint mintAmount
amount1uint256amount of token1 transferred from msg.sender to mint mintAmount
sharesReceiveduint256amount of public vault tokens transferred to receiver
amount0Diffuint256token0 balance difference post swap
amount1Diffuint256token1 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

NameTypeDescription
params_RemoveLiquidityPermit2DataRemoveLiquidityPermit2Data struct containing data for withdrawals

Returns

NameTypeDescription
amount0uint256actual amount of token0 transferred to receiver for burning burnAmount
amount1uint256actual 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

NameTypeDescription
params_AddLiquidityDataAddLiquidityData struct containing data for adding liquidity

Returns

NameTypeDescription
amount0uint256amount of token0 transferred from msg.sender to mint mintAmount
amount1uint256amount of token1 transferred from msg.sender to mint mintAmount
sharesReceiveduint256amount 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

NameTypeDescription
params_SwapAndAddDataSwapAndAddData struct containing data for swap

Returns

NameTypeDescription
amount0uint256amount of token0 transferred from msg.sender to mint mintAmount
amount1uint256amount of token1 transferred from msg.sender to mint mintAmount
sharesReceiveduint256amount of public vault tokens transferred to receiver
amount0Diffuint256token0 balance difference post swap
amount1Diffuint256token1 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

NameTypeDescription
params_AddLiquidityPermit2DataAddLiquidityPermit2Data struct containing data for adding liquidity

Returns

NameTypeDescription
amount0uint256amount of token0 transferred from msg.sender to mint mintAmount
amount1uint256amount of token1 transferred from msg.sender to mint mintAmount
sharesReceiveduint256amount 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

NameTypeDescription
params_SwapAndAddPermit2DataSwapAndAddPermit2Data struct containing data for swap

Returns

NameTypeDescription
amount0uint256amount of token0 transferred from msg.sender to mint mintAmount
amount1uint256amount of token1 transferred from msg.sender to mint mintAmount
sharesReceiveduint256amount of public vault tokens transferred to receiver
amount0Diffuint256token0 balance difference post swap
amount1Diffuint256token1 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

NameTypeDescription
vault_addressmeta vault address.
maxAmount0_uint256maximum amount of token0 user want to contribute.
maxAmount1_uint256maximum amount of token1 user want to contribute.

Returns

NameTypeDescription
shareToMintuint256maximum amount of share user can get for 'maxAmount0*' and 'maxAmount1*'.
amount0ToDeposituint256amount of token0 user should deposit into the vault for minting 'shareToMint'.
amount1ToDeposituint256amount 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

NameTypeDescription
zeroForOneboolboolean indicating if we are swap token0 to token1 or the inverse.
amount0Diffuint256amount of token0 get or consumed by the swap.
amount1Diffuint256amount of token1 get or consumed by the swap.
amountOutSwapuint256minimum 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();