style(curve): Fix CI

This commit is contained in:
Florian Pellissier
2024-08-09 11:13:38 +02:00
parent bd59af67ed
commit 5c25d2fac0
3 changed files with 30 additions and 37 deletions

View File

@@ -13,9 +13,7 @@ use substreams::{
use substreams_ethereum::pb::eth; use substreams_ethereum::pb::eth;
use crate::{ use crate::{
consts::{ consts::{CONTRACTS_TO_INDEX, NEW_SUSD, OLD_SUSD},
CONTRACTS_TO_INDEX, NEW_SUSD, OLD_SUSD,
},
pool_changes::emit_eth_deltas, pool_changes::emit_eth_deltas,
pool_factories, pool_factories,
pools::emit_specific_pools, pools::emit_specific_pools,
@@ -149,12 +147,11 @@ pub fn map_relative_balances(
extract_balance_deltas_from_tx(tx, |token, transactor| { extract_balance_deltas_from_tx(tx, |token, transactor| {
let pool_key = format!("pool:{}", hex::encode(transactor)); let pool_key = format!("pool:{}", hex::encode(transactor));
if let Some(tokens) = tokens_store.get_last(pool_key) { if let Some(tokens) = tokens_store.get_last(pool_key) {
let token_id; let token_id = if token == OLD_SUSD {
if token == OLD_SUSD { hex::encode(NEW_SUSD)
token_id = hex::encode(NEW_SUSD);
} else { } else {
token_id = hex::encode(token); hex::encode(token)
} };
tokens.split(':').any(|t| t == token_id) tokens.split(':').any(|t| t == token_id)
} else { } else {
false false
@@ -294,7 +291,10 @@ pub fn map_protocol_changes(
non_component_accounts_store non_component_accounts_store
.get_last(hex::encode(addr)) .get_last(hex::encode(addr))
.is_some() || .is_some() ||
CONTRACTS_TO_INDEX.contains(addr.try_into().expect("address should be 20 bytes long")) CONTRACTS_TO_INDEX.contains(
addr.try_into()
.expect("address should be 20 bytes long"),
)
}, },
&mut transaction_changes, &mut transaction_changes,
); );

View File

@@ -115,12 +115,12 @@ pub fn address_map(
}, },
Attribute { Attribute {
name: "stateless_contract_addr_0".into(), name: "stateless_contract_addr_0".into(),
value: address_to_bytes_with_0x(&pool_implementation.try_into().unwrap()), value: address_to_bytes_with_0x(&pool_implementation),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
}, },
Attribute { Attribute {
name: "stateless_contract_addr_1".into(), name: "stateless_contract_addr_1".into(),
value: address_to_bytes_with_0x(&token_implementation.try_into().unwrap()), value: address_to_bytes_with_0x(&token_implementation),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
}, },
]; ];
@@ -236,9 +236,7 @@ pub fn address_map(
}, },
Attribute { Attribute {
name: "stateless_contract_addr_0".into(), name: "stateless_contract_addr_0".into(),
value: address_to_bytes_with_0x( value: address_to_bytes_with_0x(&pool_implementation),
&pool_implementation.try_into().unwrap(),
),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
}, },
], ],
@@ -321,9 +319,7 @@ pub fn address_map(
}, },
Attribute { Attribute {
name: "stateless_contract_addr_0".into(), name: "stateless_contract_addr_0".into(),
value: address_to_bytes_with_0x( value: address_to_bytes_with_0x(&pool_implementation),
&pool_implementation.try_into().unwrap(),
),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
}, },
], ],
@@ -405,9 +401,7 @@ pub fn address_map(
}, },
Attribute { Attribute {
name: "stateless_contract_addr_0".into(), name: "stateless_contract_addr_0".into(),
value: address_to_bytes_with_0x( value: address_to_bytes_with_0x(&pool_implementation),
&pool_implementation.try_into().unwrap(),
),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
}, },
], ],
@@ -467,8 +461,8 @@ pub fn address_map(
name: "stateless_contract_addr_0".into(), name: "stateless_contract_addr_0".into(),
// Call views_implementation() on CRYPTO_SWAP_NG_FACTORY // Call views_implementation() on CRYPTO_SWAP_NG_FACTORY
value: format!( value: format!(
"call:{}:views_implementation()", "call:0x{}:views_implementation()",
format!("0x{}", hex::encode(CRYPTO_SWAP_NG_FACTORY)) hex::encode(CRYPTO_SWAP_NG_FACTORY)
) )
.into(), .into(),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
@@ -536,8 +530,8 @@ pub fn address_map(
name: "stateless_contract_addr_0".into(), name: "stateless_contract_addr_0".into(),
// Call views_implementation() on CRYPTO_SWAP_NG_FACTORY // Call views_implementation() on CRYPTO_SWAP_NG_FACTORY
value: format!( value: format!(
"call:{}:views_implementation()", "call:0x{}:views_implementation()",
format!("0x{}", hex::encode(CRYPTO_SWAP_NG_FACTORY)) hex::encode(CRYPTO_SWAP_NG_FACTORY)
) )
.into(), .into(),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
@@ -546,8 +540,8 @@ pub fn address_map(
name: "stateless_contract_addr_1".into(), name: "stateless_contract_addr_1".into(),
// Call math_implementation() on CRYPTO_SWAP_NG_FACTORY // Call math_implementation() on CRYPTO_SWAP_NG_FACTORY
value: format!( value: format!(
"call:{}:math_implementation()", "call:0x{}:math_implementation()",
format!("0x{}", hex::encode(CRYPTO_SWAP_NG_FACTORY)) hex::encode(CRYPTO_SWAP_NG_FACTORY)
) )
.into(), .into(),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
@@ -595,8 +589,8 @@ pub fn address_map(
name: "stateless_contract_addr_0".into(), name: "stateless_contract_addr_0".into(),
// Call views_implementation() on TRICRYPTO_FACTORY // Call views_implementation() on TRICRYPTO_FACTORY
value: format!( value: format!(
"call:{}:views_implementation()", "call:0x{}:views_implementation()",
format!("0x{}", hex::encode(TRICRYPTO_FACTORY)) hex::encode(TRICRYPTO_FACTORY)
) )
.into(), .into(),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
@@ -605,8 +599,8 @@ pub fn address_map(
name: "stateless_contract_addr_1".into(), name: "stateless_contract_addr_1".into(),
// Call math_implementation() on TRICRYPTO_FACTORY // Call math_implementation() on TRICRYPTO_FACTORY
value: format!( value: format!(
"call:{}:math_implementation()", "call:0x{}:math_implementation()",
format!("0x{}", hex::encode(TRICRYPTO_FACTORY)) hex::encode(TRICRYPTO_FACTORY)
) )
.into(), .into(),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
@@ -726,9 +720,7 @@ pub fn address_map(
}, },
Attribute { Attribute {
name: "stateless_contract_addr_0".into(), name: "stateless_contract_addr_0".into(),
value: address_to_bytes_with_0x( value: address_to_bytes_with_0x(&pool_implementation),
&pool_implementation.try_into().unwrap(),
),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
}, },
], ],
@@ -858,8 +850,8 @@ pub fn address_map(
name: "stateless_contract_addr_0".into(), name: "stateless_contract_addr_0".into(),
// Call views_implementation() on TWOCRYPTO_FACTORY // Call views_implementation() on TWOCRYPTO_FACTORY
value: format!( value: format!(
"call:{}:views_implementation()", "call:0x{}:views_implementation()",
format!("0x{}", hex::encode(TWOCRYPTO_FACTORY)) hex::encode(TWOCRYPTO_FACTORY)
) )
.into(), .into(),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),
@@ -868,8 +860,8 @@ pub fn address_map(
name: "stateless_contract_addr_1".into(), name: "stateless_contract_addr_1".into(),
// Call math_implementation() on TWOCRYPTO_FACTORY // Call math_implementation() on TWOCRYPTO_FACTORY
value: format!( value: format!(
"call:{}:math_implementation()", "call:0x{}:math_implementation()",
format!("0x{}", hex::encode(TWOCRYPTO_FACTORY)) hex::encode(TWOCRYPTO_FACTORY)
) )
.into(), .into(),
change: ChangeType::Creation.into(), change: ChangeType::Creation.into(),

View File

@@ -126,6 +126,7 @@ mod tests {
"0xb71a66c1d93c525a2dd19a8db0da19e65be04f36e733af7f03e3c9dff41aa16a".to_string(), "0xb71a66c1d93c525a2dd19a8db0da19e65be04f36e733af7f03e3c9dff41aa16a".to_string(),
PoolQueryParams { PoolQueryParams {
address: "0x5F890841f657d90E081bAbdB532A05996Af79Fe6".to_string(), address: "0x5F890841f657d90E081bAbdB532A05996Af79Fe6".to_string(),
contracts: None,
tx_hash: "0xb71a66c1d93c525a2dd19a8db0da19e65be04f36e733af7f03e3c9dff41aa16a" tx_hash: "0xb71a66c1d93c525a2dd19a8db0da19e65be04f36e733af7f03e3c9dff41aa16a"
.to_string(), .to_string(),
tokens: vec![ tokens: vec![