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 SPA tokens
function zapIn(
address spa,
address wspa,
address receiver,
uint256 minMintAmount,
uint256[] calldata amounts
)
external
returns (uint256 wspaAmount);
Parameters
Name | Type | Description |
---|---|---|
spa | address | Address of the SPA contract |
wspa | address | Address of the wrapped SPA token contract |
receiver | address | Address to receive the wrapped SPA tokens |
minMintAmount | uint256 | Minimum amount of SPA tokens to receive |
amounts | uint256[] | Array of token amounts to add |
Returns
Name | Type | Description |
---|---|---|
wspaAmount | uint256 | Amount of wrapped SPA tokens minted |
zapOut
Remove liquidity from SPA by unwrapping SPA tokens first
function zapOut(
address spa,
address wspa,
address receiver,
uint256 wspaAmount,
uint256[] calldata minAmountsOut,
bool proportional
)
external
returns (uint256[] memory amounts);
Parameters
Name | Type | Description |
---|---|---|
spa | address | Address of the SPA contract |
wspa | address | Address of the wrapped SPA token contract |
receiver | address | Address to receive the tokens |
wspaAmount | uint256 | Amount of wrapped SPA 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 wSPA tokens and redeem a single asset
function zapOutSingle(
address spa,
address wspa,
address receiver,
uint256 wspaAmount,
uint256 tokenIndex,
uint256 minAmountOut
)
external
returns (uint256 amount);
Parameters
Name | Type | Description |
---|---|---|
spa | address | Address of the SPA contract |
wspa | address | Address of the wrapped SPA token contract |
receiver | address | Address to receive the tokens |
wspaAmount | uint256 | Amount of wrapped SPA 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 |
Events
ZapIn
event ZapIn(
address indexed spa, address indexed user, address indexed receiver, uint256 wspaAmount, uint256[] inputAmounts
);
ZapOut
event ZapOut(
address indexed spa,
address indexed user,
address indexed receiver,
uint256 wspaAmount,
uint256[] outputAmounts,
bool proportional
);