Curve
Swap
- Label: Swap_Curve
- Description: Swap a token to get another in exchange in Curve.
- Actions in execution process:
- Swap SELL_TOKENto getBUY_TOKENin exchange.
 
- Swap 
SELL_TOKEN · approve
Approve TargetPool  to spend SELL_TOKEN tokens on behalf of the avatar.
- 
Contract: SELL_TOKEN
- 
Function: approve(address,uint256)Parameter Constraint spenderTargetPoolamountequal to the SELL_TOKENamount to swap
Note: If ETH is SELL_TOKEN, the approve function is skipped.
TargetPool · exchange
Swap dx amount of SELL_TOKEN tokens for as much as possible of BUY_TOKEN tokens.
- Contract: TargetPool
- Function: exchange(int128,int128,uint256,uint256)
| Parameter | Constraint | 
|---|---|
| i | equal to SELL_TOKENindex | 
| j | equal to BUY_TOKENindex | 
| dx | equal to SELL_TOKENamount | 
| min_dy | equal to minimum amount of BUY_TOKENto receive |