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 crate::{
consts::{
CONTRACTS_TO_INDEX, NEW_SUSD, OLD_SUSD,
},
consts::{CONTRACTS_TO_INDEX, NEW_SUSD, OLD_SUSD},
pool_changes::emit_eth_deltas,
pool_factories,
pools::emit_specific_pools,
@@ -149,12 +147,11 @@ pub fn map_relative_balances(
extract_balance_deltas_from_tx(tx, |token, transactor| {
let pool_key = format!("pool:{}", hex::encode(transactor));
if let Some(tokens) = tokens_store.get_last(pool_key) {
let token_id;
if token == OLD_SUSD {
token_id = hex::encode(NEW_SUSD);
let token_id = if token == OLD_SUSD {
hex::encode(NEW_SUSD)
} else {
token_id = hex::encode(token);
}
hex::encode(token)
};
tokens.split(':').any(|t| t == token_id)
} else {
false
@@ -294,7 +291,10 @@ pub fn map_protocol_changes(
non_component_accounts_store
.get_last(hex::encode(addr))
.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,
);

View File

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

View File

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