fix(usv2): correctly encode the component_id in balances

This commit is contained in:
Louise Poole
2024-10-25 15:32:26 +02:00
parent 430375f035
commit ef985f5ff4

View File

@@ -4,7 +4,6 @@ use ethabi::ethereum_types::Address;
use serde::Deserialize; use serde::Deserialize;
use substreams::prelude::BigInt; use substreams::prelude::BigInt;
use substreams_ethereum::pb::eth::v2::{self as eth}; use substreams_ethereum::pb::eth::v2::{self as eth};
use substreams_helper::{event_handler::EventHandler, hex::Hexable}; use substreams_helper::{event_handler::EventHandler, hex::Hexable};
use crate::abi::factory::events::PairCreated; use crate::abi::factory::events::PairCreated;
@@ -86,12 +85,12 @@ fn get_pools(block: &eth::Block, new_pools: &mut Vec<TransactionChanges>, params
BalanceChange { BalanceChange {
token: event.token0, token: event.token0,
balance: BigInt::from(0).to_signed_bytes_be(), balance: BigInt::from(0).to_signed_bytes_be(),
component_id: event.pair.clone(), component_id: event.pair.to_hex().as_bytes().to_vec(),
}, },
BalanceChange { BalanceChange {
token: event.token1, token: event.token1,
balance: BigInt::from(0).to_signed_bytes_be(), balance: BigInt::from(0).to_signed_bytes_be(),
component_id: event.pair, component_id: event.pair.to_hex().as_bytes().to_vec(),
}, },
], ],
}) })