Create a workspace and make clippy happy.
This commit is contained in:
@@ -63,6 +63,8 @@ pub fn store_balance_changes(deltas: BlockBalanceDeltas, store: impl StoreAdd<Bi
|
||||
});
|
||||
}
|
||||
|
||||
type TxAggregatedBalances = HashMap<Vec<u8>, (Transaction, HashMap<Vec<u8>, BalanceChange>)>;
|
||||
|
||||
/// Aggregates absolute balances per transaction and token.
|
||||
///
|
||||
/// ## Arguments
|
||||
@@ -82,7 +84,7 @@ pub fn store_balance_changes(deltas: BlockBalanceDeltas, store: impl StoreAdd<Bi
|
||||
pub fn aggregate_balances_changes(
|
||||
balance_store: StoreDeltas,
|
||||
deltas: BlockBalanceDeltas,
|
||||
) -> HashMap<Vec<u8>, (Transaction, HashMap<Vec<u8>, BalanceChange>)> {
|
||||
) -> TxAggregatedBalances {
|
||||
balance_store
|
||||
.deltas
|
||||
.into_iter()
|
||||
@@ -207,9 +209,9 @@ mod tests {
|
||||
let token_1 = hex::decode("babe00").unwrap();
|
||||
|
||||
let t0_key =
|
||||
format!("{}:{}", String::from_utf8(comp_id.clone()).unwrap(), hex::encode(&token_0));
|
||||
format!("{}:{}", String::from_utf8(comp_id.clone()).unwrap(), hex::encode(token_0));
|
||||
let t1_key =
|
||||
format!("{}:{}", String::from_utf8(comp_id.clone()).unwrap(), hex::encode(&token_1));
|
||||
format!("{}:{}", String::from_utf8(comp_id.clone()).unwrap(), hex::encode(token_1));
|
||||
StoreDeltas {
|
||||
deltas: vec![
|
||||
StoreDelta {
|
||||
@@ -283,12 +285,12 @@ mod tests {
|
||||
let res_0 = store.get_last(format!(
|
||||
"{}:{}",
|
||||
String::from_utf8(comp_id.clone()).unwrap(),
|
||||
hex::encode(&token_0)
|
||||
hex::encode(token_0)
|
||||
));
|
||||
let res_1 = store.get_last(format!(
|
||||
"{}:{}",
|
||||
String::from_utf8(comp_id.clone()).unwrap(),
|
||||
hex::encode(&token_1)
|
||||
hex::encode(token_1)
|
||||
));
|
||||
|
||||
assert_eq!(res_0, Some(BigInt::from_str("+999").unwrap()));
|
||||
|
||||
@@ -49,11 +49,7 @@ impl InterimContractChange {
|
||||
balance: vec![],
|
||||
code: vec![],
|
||||
slots: Default::default(),
|
||||
change: if creation {
|
||||
tycho::ChangeType::Creation.into()
|
||||
} else {
|
||||
tycho::ChangeType::Update.into()
|
||||
},
|
||||
change: if creation { tycho::ChangeType::Creation } else { tycho::ChangeType::Update },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,11 @@ use std::rc::Rc;
|
||||
use substreams::prelude::{BigInt, StoreDelete, StoreGet, StoreNew};
|
||||
use substreams::store::StoreAdd;
|
||||
|
||||
type BigIntStore = HashMap<String, Vec<(u64, BigInt)>>;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct MockStore {
|
||||
data: Rc<RefCell<HashMap<String, Vec<(u64, BigInt)>>>>,
|
||||
data: Rc<RefCell<BigIntStore>>,
|
||||
}
|
||||
|
||||
impl StoreDelete for MockStore {
|
||||
|
||||
Reference in New Issue
Block a user