Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ICurvePool

Git Source

Title: ICurvePool

Interface for Curve StableSwap pools.

Used for USDC/plDXY-BEAR swaps. Indices: USDC=0, plDXY-BEAR=1.

Functions

get_dy

Calculates expected output for a swap.

function get_dy(
    uint256 i,
    uint256 j,
    uint256 dx
) external view returns (uint256);

Parameters

NameTypeDescription
iuint256Input token index.
juint256Output token index.
dxuint256Input amount.

Returns

NameTypeDescription
<none>uint256Expected output amount.

exchange

Executes a token swap.

function exchange(
    uint256 i,
    uint256 j,
    uint256 dx,
    uint256 min_dy
) external payable returns (uint256);

Parameters

NameTypeDescription
iuint256Input token index.
juint256Output token index.
dxuint256Input amount.
min_dyuint256Minimum output (slippage protection).

Returns

NameTypeDescription
<none>uint256Actual output amount.

price_oracle

Returns EMA oracle price (18 decimals).

function price_oracle() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256Price of token1 in terms of token0.