CurveCryptoViews
Methods
get_dx_ex_fees
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
cryptoSwap
contract ICryptoSwap
Curve Cryptoswap contract
i
uint256
Index of the coin to sell
j
uint256
Index of the coin to buy
dy
uint256
Amount to tokens to receive
Returns
_0
uint256
Amount of tokens to sell
get_dy
Get the amount of coin j one would receive for swapping dx of coin i
solidity wrapper around CryptoSwap's get_dy
Parameters
cryptoSwap
contract ICryptoSwap
Curve Cryptoswap contract
i
uint256
Index of the coin to sell
j
uint256
Index of the coin to buy
dx
uint256
Amount to sell
Returns
_0
uint256
Amount of tokens to received (in j)
get_dy_fees
Get the amount of coin j one would have to pay as trading fees for swapping dx of coin i
Parameters
cryptoSwap
contract ICryptoSwap
Curve Cryptoswap contract
i
uint256
Index of the coin to sell
j
uint256
Index of the coin to buy
dx
uint256
Amount to sell
Returns
_0
uint256
Amount of token j paid as trading fees. 18 decimals
get_dy_fees_perc
Get the share of coin j one would have to pay as trading fees for swapping dx of coin i
Parameters
cryptoSwap
contract ICryptoSwap
Curve Cryptoswap contract
i
uint256
Index of the coin to sell
j
uint256
Index of the coin to buy
dx
uint256
Amount to sell
Returns
_0
uint256
Share of token j paid as trading fees. 18 decimals
get_dy_no_fee_deduct
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
cryptoSwap
contract ICryptoSwap
Curve Cryptoswap contract
i
uint256
Index of the coin to sell
j
uint256
Index of the coin to buy
dx
uint256
Amount to sell
Returns
_0
uint256
Amount of tokens to received + Any trading fees paid (in j)
math
Curve Math Contract
Returns
_0
contract IMath
undefined
Errors
PRBMath__MulDivOverflow
Emitted when the result overflows uint256.
Parameters
prod1
uint256
undefined
denominator
uint256
undefined
Last updated