refactor(curve): Remove unnecessary WETH stateless contracts
These contracts became unnecessary because we handle things differently on the Adapter side, we use native eth instead of WETH when possible.
This commit is contained in:
@@ -239,7 +239,6 @@ tests:
|
||||
lp_token: "0x393dad6c76d962abba489a77dbf37ae948a4a6ee" # 0x393dad6c76d962abba489a77dbf37ae948a4a6ee
|
||||
stateless_contract_addr_0: "0x307861383534363161666332646565633031626461323362356364323637643531663736356662613130" # 0xa85461afc2deec01bda23b5cd267d51f765fba10
|
||||
stateless_contract_addr_1: "0x307863303835353061346363353333336634306535393365636334633437323438303830383564333034" # 0xc08550a4cc5333f40e593ecc4c4724808085d304
|
||||
stateless_contract_addr_2: "0x307863303261616133396232323366653864306130653563346632376561643930383363373536636332" # 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
|
||||
creation_tx: "0x52f0f76d97e77579eebd32876de99f656930a99131dc4c4f1dec005786c8782b"
|
||||
skip_simulation: false
|
||||
|
||||
@@ -262,7 +261,6 @@ tests:
|
||||
name: "0x74726963727970746f75736463" # tricrypto_usdc
|
||||
stateless_contract_addr_0: "0x63616c6c3a3078306330653566326666306666313861336265396238333536333530333932353664633462343936333a76696577735f696d706c656d656e746174696f6e2829" # call:0x0c0e5f2ff0ff18a3be9b8356335039256dc4b4963:views_implementation()
|
||||
stateless_contract_addr_1: "0x63616c6c3a3078306330653566326666306666313861336265396238333536333530333932353664633462343936333a6d6174685f696d706c656d656e746174696f6e2829" # call:0x0c0e5f2ff0ff18a3be9b8356335039256dc4b4963:math_implementation()
|
||||
stateless_contract_addr_2: "0x307863303261616133396232323366653864306130653563346632376561643930383363373536636332" # 0xc02aaa39b223f8d0a0e5c4f27ead9083c756cc2
|
||||
pool_type: "0x74726963727970746f" # tricrypto
|
||||
creation_tx: "0x2bd59c19f993b83729fb23498f897a58567c6f0b3ee2f00613ba515a7b19fe23"
|
||||
skip_simulation: false
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use substreams::hex;
|
||||
use substreams_ethereum::{
|
||||
pb::eth::v2::{Call, Log, TransactionTrace},
|
||||
Event, Function,
|
||||
@@ -87,56 +86,6 @@ pub fn address_map(
|
||||
let token_implementation = extract_proxy_impl(call, tx, 0).unwrap_or([1u8; 20]);
|
||||
let pool_implementation = extract_proxy_impl(call, tx, 1).unwrap_or([1u8; 20]);
|
||||
|
||||
let mut static_attributes = vec![
|
||||
Attribute {
|
||||
name: "pool_type".into(),
|
||||
value: "crypto_pool".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "name".into(),
|
||||
value: pool_added.a.to_string().into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory_name".into(),
|
||||
value: "crypto_pool_factory".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory".into(),
|
||||
value: address_to_bytes_with_0x(&CRYPTO_POOL_FACTORY),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "lp_token".into(),
|
||||
value: pool_added.token.clone(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "stateless_contract_addr_0".into(),
|
||||
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),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
];
|
||||
|
||||
// This is relevant only if the contract has ETH
|
||||
if tokens.contains(Ð_ADDRESS.into()) {
|
||||
static_attributes.push(Attribute {
|
||||
name: "stateless_contract_addr_2".into(),
|
||||
// WETH
|
||||
value: address_to_bytes_with_0x(&hex!(
|
||||
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
||||
)),
|
||||
change: ChangeType::Creation.into(),
|
||||
})
|
||||
}
|
||||
|
||||
Some(ProtocolComponent {
|
||||
id: hex::encode(component_id),
|
||||
tx: Some(Transaction {
|
||||
@@ -146,8 +95,44 @@ pub fn address_map(
|
||||
index: tx.index.into(),
|
||||
}),
|
||||
tokens,
|
||||
contracts: vec![component_id.into(), pool_added.token],
|
||||
static_att: static_attributes,
|
||||
contracts: vec![component_id.into(), pool_added.token.clone()],
|
||||
static_att: vec![
|
||||
Attribute {
|
||||
name: "pool_type".into(),
|
||||
value: "crypto_pool".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "name".into(),
|
||||
value: pool_added.a.to_string().into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory_name".into(),
|
||||
value: "crypto_pool_factory".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory".into(),
|
||||
value: address_to_bytes_with_0x(&CRYPTO_POOL_FACTORY),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "lp_token".into(),
|
||||
value: pool_added.token,
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "stateless_contract_addr_0".into(),
|
||||
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),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
],
|
||||
change: ChangeType::Creation.into(),
|
||||
protocol_type: Some(ProtocolType {
|
||||
name: "curve_pool".into(),
|
||||
@@ -564,60 +549,6 @@ pub fn address_map(
|
||||
abi::tricrypto_factory::events::TricryptoPoolDeployed::match_and_decode(log)
|
||||
{
|
||||
let tokens = swap_weth_for_eth(pool_added.coins.into());
|
||||
let mut static_attributes = vec![
|
||||
Attribute {
|
||||
name: "pool_type".into(),
|
||||
value: "tricrypto".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "name".into(),
|
||||
value: pool_added.name.into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory_name".into(),
|
||||
value: "tricrypto_factory".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory".into(),
|
||||
value: address_to_bytes_with_0x(&TRICRYPTO_FACTORY),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "stateless_contract_addr_0".into(),
|
||||
// Call views_implementation() on TRICRYPTO_FACTORY
|
||||
value: format!(
|
||||
"call:0x{}:views_implementation()",
|
||||
hex::encode(TRICRYPTO_FACTORY)
|
||||
)
|
||||
.into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "stateless_contract_addr_1".into(),
|
||||
// Call math_implementation() on TRICRYPTO_FACTORY
|
||||
value: format!(
|
||||
"call:0x{}:math_implementation()",
|
||||
hex::encode(TRICRYPTO_FACTORY)
|
||||
)
|
||||
.into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
];
|
||||
|
||||
// This is relevant only if the contract has ETH
|
||||
if tokens.contains(Ð_ADDRESS.into()) {
|
||||
static_attributes.push(Attribute {
|
||||
name: "stateless_contract_addr_2".into(),
|
||||
// WETH
|
||||
value: address_to_bytes_with_0x(&hex!(
|
||||
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
||||
)),
|
||||
change: ChangeType::Creation.into(),
|
||||
})
|
||||
}
|
||||
|
||||
Some(ProtocolComponent {
|
||||
id: hex::encode(&pool_added.pool),
|
||||
@@ -629,7 +560,48 @@ pub fn address_map(
|
||||
}),
|
||||
tokens,
|
||||
contracts: vec![pool_added.pool, TRICRYPTO_FACTORY.into()],
|
||||
static_att: static_attributes,
|
||||
static_att: vec![
|
||||
Attribute {
|
||||
name: "pool_type".into(),
|
||||
value: "tricrypto".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "name".into(),
|
||||
value: pool_added.name.into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory_name".into(),
|
||||
value: "tricrypto_factory".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory".into(),
|
||||
value: address_to_bytes_with_0x(&TRICRYPTO_FACTORY),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "stateless_contract_addr_0".into(),
|
||||
// Call views_implementation() on TRICRYPTO_FACTORY
|
||||
value: format!(
|
||||
"call:0x{}:views_implementation()",
|
||||
hex::encode(TRICRYPTO_FACTORY)
|
||||
)
|
||||
.into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "stateless_contract_addr_1".into(),
|
||||
// Call math_implementation() on TRICRYPTO_FACTORY
|
||||
value: format!(
|
||||
"call:0x{}:math_implementation()",
|
||||
hex::encode(TRICRYPTO_FACTORY)
|
||||
)
|
||||
.into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
],
|
||||
change: ChangeType::Creation.into(),
|
||||
protocol_type: Some(ProtocolType {
|
||||
name: "curve_pool".into(),
|
||||
|
||||
Reference in New Issue
Block a user