IZap

Git Source

Interface for Zap contract

Defines functions to add and remove liquidity with wrapping/unwrapping in one transaction

Functions

zapIn

Add liquidity to SPA and automatically wrap LP tokens

function zapIn(
    address spa,
    address wlp,
    address receiver,
    uint256 minMintAmount,
    uint256[] calldata amounts
)
    external
    returns (uint256 wlpAmount);

Parameters

NameTypeDescription
spaaddressAddress of the SPA contract
wlpaddressAddress of the wrapped LP token contract
receiveraddressAddress to receive the wrapped LP tokens
minMintAmountuint256Minimum amount of LP tokens to receive
amountsuint256[]Array of token amounts to add

Returns

NameTypeDescription
wlpAmountuint256Amount of wrapped LP tokens minted

zapOut

Remove liquidity from SPA by unwrapping LP tokens first

function zapOut(
    address spa,
    address wlp,
    address receiver,
    uint256 wlpAmount,
    uint256[] calldata minAmountsOut,
    bool proportional
)
    external
    returns (uint256[] memory amounts);

Parameters

NameTypeDescription
spaaddressAddress of the SPA contract
wlpaddressAddress of the wrapped LP token contract
receiveraddressAddress to receive the tokens
wlpAmountuint256Amount of wrapped LP tokens to redeem
minAmountsOutuint256[]Minimum amounts of tokens to receive
proportionalboolIf true, withdraws proportionally; if false, uses minAmountsOut

Returns

NameTypeDescription
amountsuint256[]Array of token amounts received

zapOutSingle

Unwrap wLP tokens and redeem a single asset

function zapOutSingle(
    address spa,
    address wlp,
    address receiver,
    uint256 wlpAmount,
    uint256 tokenIndex,
    uint256 minAmountOut
)
    external
    returns (uint256 amount);

Parameters

NameTypeDescription
spaaddressAddress of the SPA contract
wlpaddressAddress of the wrapped LP token contract
receiveraddressAddress to receive the tokens
wlpAmountuint256Amount of wrapped LP tokens to redeem
tokenIndexuint256Index of the token to receive
minAmountOutuint256Minimum amount of token to receive

Returns

NameTypeDescription
amountuint256Amount of token received

recoverERC20

Recover tokens accidentally sent to this contract

function recoverERC20(address token, uint256 amount, address to) external;

Parameters

NameTypeDescription
tokenaddressAddress of the token to recover
amountuint256Amount to recover
toaddressAddress to send the tokens to

Events

ZapIn

event ZapIn(
    address indexed spa, address indexed user, address indexed receiver, uint256 wlpAmount, uint256[] inputAmounts
);

ZapOut

event ZapOut(
    address indexed spa,
    address indexed user,
    address indexed receiver,
    uint256 wlpAmount,
    uint256[] outputAmounts,
    bool proportional
);