Skip to content

Commit

Permalink
docs: better explanation of ratio value
Browse files Browse the repository at this point in the history
  • Loading branch information
cytadela8 committed Sep 27, 2024
1 parent c6ddc1a commit e005f6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/lib/external_price_api/src/coingecko_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl CoinGeckoPriceAPIClient {
}
}

/// returns ETH/BaseToken price of a token by address
/// returns token price in ETH by token address. Returned value is X such that 1 TOKEN = X ETH.
async fn get_token_price_by_address(&self, address: Address) -> anyhow::Result<f64> {
let address_str = address_to_string(&address);
let price_url = self
Expand Down
3 changes: 2 additions & 1 deletion core/lib/external_price_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ use zksync_types::{base_token_ratio::BaseTokenAPIRatio, Address};
#[async_trait]
pub trait PriceAPIClient: Sync + Send + fmt::Debug + 'static {
/// Returns the BaseToken<->ETH ratio for the input token address.
/// The returned unit is BaseToken/ETH. Example if 1 BaseToken = 0.002 ETH, then ratio is 500/1
/// The returned value is rational number X such that X BaseToken = 1 ETH.
/// Example if 1 BaseToken = 0.002 ETH, then ratio is 500/1 (500 BaseToken = 1ETH)
async fn fetch_ratio(&self, token_address: Address) -> anyhow::Result<BaseTokenAPIRatio>;
}

Expand Down

0 comments on commit e005f6c

Please sign in to comment.