Skip to content

Commit

Permalink
Fix GRT/USD conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed May 19, 2022
1 parent 2d9bcb4 commit ab8ee01
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/agent_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,22 +437,22 @@ fn parse_api_keys(
)]
struct ConversionRates;

fn parse_conversion_rates(data: conversion_rates::ResponseData) -> Option<USD> {
fn parse_conversion_rates(data: conversion_rates::ResponseData) -> Option<GRT> {
use conversion_rates::{ConversionRatesData, ConversionRatesDataValue};
match data {
conversion_rates::ResponseData {
data:
Some(ConversionRatesData {
value:
ConversionRatesDataValue {
grt_to_dai: Some(usd_per_grt),
dai_to_grt: Some(grt_per_usd),
..
},
..
}),
} => {
tracing::debug!(?usd_per_grt);
usd_per_grt.parse::<USD>().ok()
tracing::debug!(?grt_per_usd);
grt_per_usd.parse::<GRT>().ok()
}
_ => None,
}
Expand Down
2 changes: 1 addition & 1 deletion src/indexer_selection/economic_security.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct EconomicSecurity {

pub struct NetworkParameters {
pub slashing_percentage: Eventual<PPM>,
pub usd_to_grt_conversion: Eventual<USD>,
pub usd_to_grt_conversion: Eventual<GRT>,
}

impl NetworkParameters {
Expand Down
4 changes: 2 additions & 2 deletions src/indexer_selection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,15 @@ pub struct UtilityScores {

pub struct Inputs {
pub slashing_percentage: Eventual<PPM>,
pub usd_to_grt_conversion: Eventual<USD>,
pub usd_to_grt_conversion: Eventual<GRT>,
pub indexers: SharedLookup<Address, IndexerDataReader>,
pub indexings: SharedLookup<Indexing, SelectionFactors>,
pub special_indexers: Eventual<HashMap<Address, NotNan<f64>>>,
}

pub struct InputWriters {
pub slashing_percentage: EventualWriter<PPM>,
pub usd_to_grt_conversion: EventualWriter<USD>,
pub usd_to_grt_conversion: EventualWriter<GRT>,
pub indexers: SharedLookupWriter<Address, IndexerDataReader, IndexerDataWriter>,
pub indexings: SharedLookupWriter<Indexing, SelectionFactors, IndexingData>,
pub special_indexers: EventualWriter<HashMap<Address, NotNan<f64>>>,
Expand Down

0 comments on commit ab8ee01

Please sign in to comment.