Price
Responsible for denominating the relative price between two tokens. Denominator and numerator must be unadjusted for decimals. Derived from Fraction entity.
Example
This example shows the CELO/USD price, where CELO is the base token, and cUSD is the quote token. The price is constructed from an amount of CELO (the numerator) / an amount of cUSD (the denominator).
Properties
baseCurrency (Token type): Numerator
quoteCurrency (Token type): Denominator
scalar (Fraction type): Used to adjust the raw fraction based on the decimals of the tokens
Methods
raw
Returns the raw price, unadjusted for decimals.
adjusted
Returns the price, adjusted for decimals.
invert
quote
Given an asset amount, returns an equivalent value of the other asset, according to the current price.
multiply
toSignificant
toFixed
Last updated