feat: Update uniswap v3 package to use big endian encoding (#199)

* feat: update uniswap v3 package to big endian encoding

* chore: update use of format macro to make clippy happy
This commit is contained in:
Louise Poole
2025-05-05 15:54:11 +02:00
committed by GitHub
parent 01d97193b2
commit ee41e63775
6 changed files with 38 additions and 35 deletions

View File

@@ -40,17 +40,17 @@ fn get_new_pools(
attributes: vec![
Attribute {
name: "liquidity".to_string(),
value: BigInt::from(0).to_signed_bytes_le(),
value: BigInt::from(0).to_signed_bytes_be(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "tick".to_string(),
value: BigInt::from(0).to_signed_bytes_le(),
value: BigInt::from(0).to_signed_bytes_be(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "sqrt_price_x96".to_string(),
value: BigInt::from(0).to_signed_bytes_le(),
value: BigInt::from(0).to_signed_bytes_be(),
change: ChangeType::Creation.into(),
},
],
@@ -62,12 +62,12 @@ fn get_new_pools(
static_att: vec![
Attribute {
name: "fee".to_string(),
value: event.fee.to_signed_bytes_le(),
value: event.fee.to_signed_bytes_be(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "tick_spacing".to_string(),
value: event.tick_spacing.to_signed_bytes_le(),
value: event.tick_spacing.to_signed_bytes_be(),
change: ChangeType::Creation.into(),
},
Attribute {

View File

@@ -77,7 +77,7 @@ impl<'a> UniswapPoolStorage<'a> {
};
attributes.push(Attribute {
name: storage_location.name.to_string(),
value: value.to_signed_bytes_le(),
value: value.to_signed_bytes_be(),
change: ChangeType::Update.into(),
});
}
@@ -108,7 +108,7 @@ impl<'a> UniswapPoolStorage<'a> {
// We need this to keep the references to the names alive until we call
// `get_changed_attributes()`
for tick_idx in ticks_idx.iter() {
tick_names.push(format!("ticks/{}/net-liquidity", tick_idx));
tick_names.push(format!("ticks/{tick_idx}/net-liquidity"));
}
// Then, iterate over ticks_idx and tick_names simultaneously