Skip to content

Commit 1940422

Browse files
authored
Merge pull request #10 from Graph-BuildersDAO/fix_store
Switched store values from rawPrice to price
2 parents c753a0a + 08d5f24 commit 1940422

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

chainlink-prices/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use substreams::errors::Error;
88
use substreams::scalar::{BigDecimal, BigInt};
99
use substreams::store::StoreNew;
1010
use substreams::store::{StoreGet, StoreGetProto, StoreSetIfNotExistsProto};
11-
use substreams::store::{StoreSet, StoreSetBigInt, StoreSetIfNotExists};
11+
use substreams::store::{StoreSet, StoreSetBigDecimal, StoreSetIfNotExists};
1212
use substreams::Hex;
1313
use substreams_entity_change::pb::entity::EntityChanges;
1414
use substreams_entity_change::tables::Tables;
@@ -123,7 +123,7 @@ fn get_chainlink_answers(
123123
}
124124

125125
#[substreams::handlers::store]
126-
fn chainlink_price_store(events: Prices, output: StoreSetBigInt) {
126+
fn chainlink_price_store(events: Prices, output: StoreSetBigDecimal) {
127127
for price in events.items {
128128
let asset_description = price.clone().asset_pair.unwrap();
129129

@@ -156,7 +156,7 @@ fn chainlink_price_store(events: Prices, output: StoreSetBigInt) {
156156
.unwrap()
157157
.address
158158
),
159-
&BigInt::from_str(&price.raw_price).unwrap(),
159+
&BigDecimal::from_str(&price.price).unwrap(),
160160
);
161161
}
162162
}
@@ -167,13 +167,13 @@ fn chainlink_price_store(events: Prices, output: StoreSetBigInt) {
167167
"price_by_aggregator:{}",
168168
price.clone().asset_pair.unwrap().aggregator_address
169169
),
170-
&BigInt::from_str(&price.raw_price).unwrap(),
170+
&BigDecimal::from_str(&price.price).unwrap(),
171171
);
172172

173173
output.set(
174174
0,
175175
format!("price_by_symbol:{}", split_description.join(":")),
176-
&BigInt::from_str(&price.raw_price).unwrap(),
176+
&BigDecimal::from_str(&price.price).unwrap(),
177177
);
178178
}
179179
}

chainlink-prices/substreams.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ modules:
3838
kind: store
3939
initialBlock: 10607721
4040
updatePolicy: set
41-
valueType: bigint
41+
valueType: bigdecimal
4242
inputs:
4343
- map: get_chainlink_answers
4444
- name: graph_out

0 commit comments

Comments
 (0)