CurveCryptoViews

Methods

get_dx_ex_fees

function get_dx_ex_fees(contract ICryptoSwap cryptoSwap, uint256 i, uint256 j, uint256 dy) external view returns (uint256)

Get the amount of coin i one would have to pay for receiving dy of coin j (before any trading fees are charged)

Does not get the identical estimate (i.e. get_dy(get_dx(100))) ~= 100) Question: Why is that the case? Answer: Newton_y stops when the converge limit is reached: https://github.com/curvefi/curve-crypto-contract/blob/d7d04cd9ae038970e40be850df99de8c1ff7241b/contracts/two/CurveCryptoSwap2.vy#L355Should be used for external contracts to get a fairly precise "estimate" of the amount of tokens one has to pay to receive dy tokenssimplified version where we use that PRECISIONS = [1, 1]

Parameters

Returns

get_dy

function get_dy(contract ICryptoSwap cryptoSwap, uint256 i, uint256 j, uint256 dx) external view returns (uint256)

Get the amount of coin j one would receive for swapping dx of coin i

solidity wrapper around CryptoSwap's get_dy

Parameters

Returns

get_dy_fees

function get_dy_fees(contract ICryptoSwap cryptoSwap, uint256 i, uint256 j, uint256 dx) external view returns (uint256)

Get the amount of coin j one would have to pay as trading fees for swapping dx of coin i

Parameters

Returns

get_dy_fees_perc

function get_dy_fees_perc(contract ICryptoSwap cryptoSwap, uint256 i, uint256 j, uint256 dx) external view returns (uint256)

Get the share of coin j one would have to pay as trading fees for swapping dx of coin i

Parameters

Returns

get_dy_no_fee_deduct

function get_dy_no_fee_deduct(contract ICryptoSwap cryptoSwap, uint256 i, uint256 j, uint256 dx) external view returns (uint256)

Get the amount of coin j one would receive for swapping dx of coin i (excl. fees)

solidity implementation of the get_dy excluding the last last line where fees are deductedsimplified version where we use that PRECISIONS = [1, 1] https://github.com/curvefi/curve-crypto-contract/blob/d7d04cd9ae038970e40be850df99de8c1ff7241b/contracts/tricrypto/CurveCryptoViews3.vy#L40-L78

Parameters

Returns

math

function math() external view returns (contract IMath)

Curve Math Contract

Returns

Errors

PRBMath__MulDivOverflow

error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator)

Emitted when the result overflows uint256.

Parameters

Last updated