fix(balancer): Change pool_id encoding to utf-8.

Since it is used to replace component_id, it should be a string as well.
This commit is contained in:
kayibal
2024-08-07 13:30:44 +02:00
committed by tvinagre
parent 5238141771
commit 9df366b29d
2 changed files with 29 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ This is planned to be resolved with the dynamic contract indexing module.
|--------------------|-------|---------------------------------------------------------------------------------------------------------| |--------------------|-------|---------------------------------------------------------------------------------------------------------|
| pool_type | str | A unique identifier per pool type. Set depending on the factory | | pool_type | str | A unique identifier per pool type. Set depending on the factory |
| normalized weights | json | The normalised weights of a weighted pool. | | normalized weights | json | The normalised weights of a weighted pool. |
| pool_id | bytes | The balancer pool id. | | pool_id | str | A hex encoded balancer pool id. |
| rate_providers | json | A list of rate provider addresses. | | rate_providers | json | A list of rate provider addresses. |
| bpt | bytes | The balancer lp token, set if the pool support entering and exiting lp postions via the swap interface. | | bpt | bytes | The balancer lp token, set if the pool support entering and exiting lp postions via the swap interface. |
| main_token | bytes | The main token address for a linear pool | | main_token | bytes | The main token address for a linear pool |

View File

@@ -70,7 +70,10 @@ pub fn address_map(
"normalized_weights", "normalized_weights",
&json_serialize_bigint_list(&create_call.normalized_weights), &json_serialize_bigint_list(&create_call.normalized_weights),
), ),
("pool_id", &pool_registered.pool_id), (
"pool_id",
format!("0x{}", hex::encode(pool_registered.pool_id)).as_bytes(),
),
( (
"rate_providers", "rate_providers",
&json_serialize_address_list(&create_call.rate_providers), &json_serialize_address_list(&create_call.rate_providers),
@@ -100,7 +103,10 @@ pub fn address_map(
.with_tokens(&tokens_registered.tokens) .with_tokens(&tokens_registered.tokens)
.with_attributes(&[ .with_attributes(&[
("pool_type", "ComposableStablePoolFactory".as_bytes()), ("pool_type", "ComposableStablePoolFactory".as_bytes()),
("pool_id", &pool_registered.pool_id), (
"pool_id",
format!("0x{}", hex::encode(pool_registered.pool_id)).as_bytes(),
),
("bpt", &pool_created.pool), ("bpt", &pool_created.pool),
( (
"fee", "fee",
@@ -137,7 +143,10 @@ pub fn address_map(
.upper_target .upper_target
.to_signed_bytes_be(), .to_signed_bytes_be(),
), ),
("pool_id", &pool_registered.pool_id), (
"pool_id",
format!("0x{}", hex::encode(pool_registered.pool_id)).as_bytes(),
),
("manual_updates", &[1u8]), ("manual_updates", &[1u8]),
("bpt", &pool_created.pool), ("bpt", &pool_created.pool),
("main_token", &create_call.main_token), ("main_token", &create_call.main_token),
@@ -172,7 +181,10 @@ pub fn address_map(
.upper_target .upper_target
.to_signed_bytes_be(), .to_signed_bytes_be(),
), ),
("pool_id", &pool_registered.pool_id), (
"pool_id",
format!("0x{}", hex::encode(pool_registered.pool_id)).as_bytes(),
),
("manual_updates", &[1u8]), ("manual_updates", &[1u8]),
("bpt", &pool_created.pool), ("bpt", &pool_created.pool),
("main_token", &create_call.main_token), ("main_token", &create_call.main_token),
@@ -255,7 +267,10 @@ pub fn address_map(
.upper_target .upper_target
.to_signed_bytes_be(), .to_signed_bytes_be(),
), ),
("pool_id", &pool_registered.pool_id), (
"pool_id",
format!("0x{}", hex::encode(pool_registered.pool_id)).as_bytes(),
),
("manual_updates", &[1u8]), ("manual_updates", &[1u8]),
("bpt", &pool_created.pool), ("bpt", &pool_created.pool),
("main_token", &create_call.main_token), ("main_token", &create_call.main_token),
@@ -290,7 +305,10 @@ pub fn address_map(
.upper_target .upper_target
.to_signed_bytes_be(), .to_signed_bytes_be(),
), ),
("pool_id", &pool_registered.pool_id), (
"pool_id",
format!("0x{}", hex::encode(pool_registered.pool_id)).as_bytes(),
),
("manual_updates", &[1u8]), ("manual_updates", &[1u8]),
("bpt", &pool_created.pool), ("bpt", &pool_created.pool),
("main_token", &create_call.main_token), ("main_token", &create_call.main_token),
@@ -321,7 +339,10 @@ pub fn address_map(
.with_attributes(&[ .with_attributes(&[
("pool_type", "WeightedPool2TokensFactory".as_bytes()), ("pool_type", "WeightedPool2TokensFactory".as_bytes()),
("weights", &json_serialize_bigint_list(&create_call.weights)), ("weights", &json_serialize_bigint_list(&create_call.weights)),
("pool_id", &pool_registered.pool_id), (
"pool_id",
format!("0x{}", hex::encode(pool_registered.pool_id)).as_bytes(),
),
( (
"fee", "fee",
&create_call &create_call