feat(uniswap_v2): encode attribute values with big endian encoding

This commit is contained in:
Louise Poole
2024-10-17 15:58:26 +02:00
parent 78f6cb277a
commit 3639d8d747
5 changed files with 7 additions and 7 deletions

2
substreams/Cargo.lock generated
View File

@@ -1041,7 +1041,7 @@ dependencies = [
[[package]]
name = "substreams-ethereum-uniswap-v2"
version = "0.2.1"
version = "0.3.0"
dependencies = [
"anyhow",
"ethabi 18.0.0",

View File

@@ -1,6 +1,6 @@
[package]
name = "substreams-ethereum-uniswap-v2"
version = "0.2.1"
version = "0.3.0"
edition = "2021"
[lib]

View File

@@ -1,7 +1,7 @@
specVersion: v0.1.0
package:
name: "ethereum_uniswap_v2"
version: v0.2.1
version: v0.3.0
protobuf:
files:

View File

@@ -46,12 +46,12 @@ fn get_pools(block: &eth::Block, new_pools: &mut Vec<TransactionChanges>, params
attributes: vec![
Attribute {
name: "reserve0".to_string(),
value: BigInt::from(0).to_signed_bytes_le(),
value: BigInt::from(0).to_signed_bytes_be(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "reserve1".to_string(),
value: BigInt::from(0).to_signed_bytes_le(),
value: BigInt::from(0).to_signed_bytes_be(),
change: ChangeType::Creation.into(),
},
],
@@ -64,7 +64,7 @@ fn get_pools(block: &eth::Block, new_pools: &mut Vec<TransactionChanges>, params
// Trading Fee is hardcoded to 0.3%, saved as int in bps (basis points)
Attribute {
name: "fee".to_string(),
value: BigInt::from(30).to_signed_bytes_le(),
value: BigInt::from(30).to_signed_bytes_be(),
change: ChangeType::Creation.into(),
},
Attribute {

View File

@@ -104,7 +104,7 @@ fn handle_sync(
name: attribute_name,
value: reserve_bytes
.clone()
.to_signed_bytes_le(), //TODO: Unify bytes encoding (either be or le)
.to_signed_bytes_be(),
change: ChangeType::Update.into(),
},
);