feat: move initial lp fee to static attributes (#161)

This initial lp fee value is used for generating the PoolKey. It is static and should be part of the ProtocolComponent static attributes.
This commit is contained in:
Louise Poole
2025-02-18 15:01:38 +02:00
committed by GitHub
parent b1e7ba9e2f
commit 20165c271e
5 changed files with 16 additions and 15 deletions

2
substreams/Cargo.lock generated
View File

@@ -404,7 +404,7 @@ dependencies = [
[[package]]
name = "ethereum-uniswap-v4"
version = "0.1.1"
version = "0.2.0"
dependencies = [
"anyhow",
"ethabi 18.0.0",

View File

@@ -1,6 +1,6 @@
[package]
name = "ethereum-uniswap-v4"
version = "0.1.1"
version = "0.2.0"
edition = "2021"
[lib]

View File

@@ -1,7 +1,7 @@
specVersion: v0.1.0
package:
name: "base_uniswap_v4"
version: v0.1.1
version: v0.2.0
protobuf:
files:

View File

@@ -1,7 +1,7 @@
specVersion: v0.1.0
package:
name: "ethereum_uniswap_v4"
version: v0.1.1
version: v0.2.0
protobuf:
files:

View File

@@ -37,22 +37,11 @@ fn get_new_pools(
entity_changes: vec![EntityChanges {
component_id: event.id.to_vec().to_hex(),
attributes: vec![
// Represents the pool's LP Fee. The fee is either static or dynamic.
// Static fees are represented in hundredths of a bip, and can be set to a
// value between 0 and 1000000 (100%) and are immutable. If
// the value is set to 0x800000 (1 in the most significant bit of uint24) then
// the pool has a dynamic fee. This pool is initialized
// with 0 fee which can be changed later via hooks (dynamic fee).
Attribute {
name: "balance_owner".to_string(),
value: hex::decode(pool_manager_address).unwrap(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "fee".to_string(),
value: event.fee.to_signed_bytes_be(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "liquidity".to_string(),
value: BigInt::from(0).to_signed_bytes_be(),
@@ -102,6 +91,18 @@ fn get_new_pools(
value: event.hooks.to_vec(),
change: ChangeType::Creation.into(),
},
// Represents the pool's LP Fee. The fee is either static or dynamic. Static
// fees are represented in hundredths of a bip, can be set to a value between 0
// and 1000000 (100%) and are immutable. If the value is set to 0x800000 then
// the pool is flagged as using dynamic fees. The dynamic fees changes should
// be tracked in state attributes and the flag value set
// here should remain untouched (it is needed for
// generating the PoolKey for contract interactions).
Attribute {
name: "key_lp_fee".to_string(),
value: event.fee.to_signed_bytes_be(),
change: ChangeType::Creation.into(),
},
],
change: i32::from(ChangeType::Creation),
protocol_type: Some(ProtocolType {