IZap
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
Name | Type | Description |
---|---|---|
spa | address | Address of the SPA contract |
wlp | address | Address of the wrapped LP token contract |
receiver | address | Address to receive the wrapped LP tokens |
minMintAmount | uint256 | Minimum amount of LP tokens to receive |
amounts | uint256[] | Array of token amounts to add |
Returns
Name | Type | Description |
---|---|---|
wlpAmount | uint256 | Amount 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
Name | Type | Description |
---|---|---|
spa | address | Address of the SPA contract |
wlp | address | Address of the wrapped LP token contract |
receiver | address | Address to receive the tokens |
wlpAmount | uint256 | Amount of wrapped LP tokens to redeem |
minAmountsOut | uint256[] | Minimum amounts of tokens to receive |
proportional | bool | If true, withdraws proportionally; if false, uses minAmountsOut |
Returns
Name | Type | Description |
---|---|---|
amounts | uint256[] | 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
Name | Type | Description |
---|---|---|
spa | address | Address of the SPA contract |
wlp | address | Address of the wrapped LP token contract |
receiver | address | Address to receive the tokens |
wlpAmount | uint256 | Amount of wrapped LP tokens to redeem |
tokenIndex | uint256 | Index of the token to receive |
minAmountOut | uint256 | Minimum amount of token to receive |
Returns
Name | Type | Description |
---|---|---|
amount | uint256 | Amount of token received |
recoverERC20
Recover tokens accidentally sent to this contract
function recoverERC20(address token, uint256 amount, address to) external;
Parameters
Name | Type | Description |
---|---|---|
token | address | Address of the token to recover |
amount | uint256 | Amount to recover |
to | address | Address 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
);