refactor(curve): Update testing suite and remove metapools factories (#109)
* chore(lib): update testing suite with new naming * refactor(curve): remove metapool These pools aren't compatible yet due to how they are created (first the lp token and then later the pool). We will need DCI to handle this properly. * chore(lib): use correct package name for tycho-simulation --------- Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
This commit is contained in:
@@ -130,28 +130,28 @@ tests:
|
||||
base_pool: "0x307861353538386637636466353630383131373130613264383264336339633939373639646231646362" # 0xa5588f7cdf560811710a2d82d3c9c99769db1dcb
|
||||
factory: "0x307836613863626564373536383034623136653035653734316564616264356362353434616532316266" # 0x6a8cbed756804b16e05e741edabd5cb544ae21bf
|
||||
creation_tx: "0x3cfeecae1b43086ee5705f89b803e21eb0492d7d5db06c229586db8fc72f5665"
|
||||
skip_simulation: true # Reason: this pool use a base pool which is also one of its tokens, therefore our token override doesn't work here and it fails on transfers
|
||||
skip_simulation: false
|
||||
|
||||
# Metapool factory 0xB9fC157394Af804a3578134A6585C0dc9cc990d4 - MetaPool
|
||||
- name: test_metapool_factory_metapool
|
||||
start_block: 18028604
|
||||
stop_block: 18029610
|
||||
initialized_accounts:
|
||||
- "0xdcef968d416a41cdac0ed8702fac8128a64241a2"
|
||||
- "0xc4ad29ba4b3c580e6d59105fff484999997675ff" # Needed by another component that is created within this block range
|
||||
expected_components:
|
||||
- id: "0x61fA2c947e523F9ABfb8d7e2903A5D5218C119a7"
|
||||
tokens:
|
||||
- "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8"
|
||||
- "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC"
|
||||
static_attributes:
|
||||
name: "0x50415950414c465241584250" # PAYPALFRAXBP
|
||||
factory_name: "0x6d6574615f706f6f6c5f666163746f7279" # meta_pool_factory
|
||||
base_pool: "0x307864636566393638643431366134316364616330656438373032666163383132386136343234316132" # 0xdcfe968d416ac0ed8702fac8128a64241a2
|
||||
factory: "0x307862396663313537333934616638303461333537383133346136353835633064633963633939306434" # 0xb9fc157394af804a3578134a6585c0dcc993099d
|
||||
pool_type: "0x6d657461706f6f6c" # metapool
|
||||
creation_tx: "0xc9c6b879cbb19f7f26405335c3879c350592d530956878ff172e9efad786c63f"
|
||||
skip_simulation: true # Reason: this pool calls `totalSupply()` on the LP token during simulation. But this token is overridden and doesn't have anything for totalSupply
|
||||
# # Metapool factory 0xB9fC157394Af804a3578134A6585C0dc9cc990d4 - MetaPool
|
||||
# - name: test_metapool_factory_metapool
|
||||
# start_block: 18028604
|
||||
# stop_block: 18029610
|
||||
# initialized_accounts:
|
||||
# - "0xdcef968d416a41cdac0ed8702fac8128a64241a2"
|
||||
# - "0xc4ad29ba4b3c580e6d59105fff484999997675ff" # Needed by another component that is created within this block range
|
||||
# expected_components:
|
||||
# - id: "0x61fA2c947e523F9ABfb8d7e2903A5D5218C119a7"
|
||||
# tokens:
|
||||
# - "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8"
|
||||
# - "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC"
|
||||
# static_attributes:
|
||||
# name: "0x50415950414c465241584250" # PAYPALFRAXBP
|
||||
# factory_name: "0x6d6574615f706f6f6c5f666163746f7279" # meta_pool_factory
|
||||
# base_pool: "0x307864636566393638643431366134316364616330656438373032666163383132386136343234316132" # 0xdcfe968d416ac0ed8702fac8128a64241a2
|
||||
# factory: "0x307862396663313537333934616638303461333537383133346136353835633064633963633939306434" # 0xb9fc157394af804a3578134a6585c0dcc993099d
|
||||
# pool_type: "0x6d657461706f6f6c" # metapool
|
||||
# creation_tx: "0xc9c6b879cbb19f7f26405335c3879c350592d530956878ff172e9efad786c63f"
|
||||
# skip_simulation: true # Reason: this pool calls `totalSupply()` on the LP token during simulation. But this token is overridden and doesn't have anything for totalSupply
|
||||
|
||||
# Metapool factory 0xB9fC157394Af804a3578134A6585C0dc9cc990d4 - PlainPool
|
||||
- name: test_metapool_factory_plainpool
|
||||
@@ -294,23 +294,23 @@ tests:
|
||||
# - name: test_stableswap_factory_meta_pool
|
||||
# There was no metapool created from this factory yet.
|
||||
# https://etherscan.io/address/0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d#events search events with topic 0x01f31cd2abdeb4e5e10ba500f2db0f937d9e8c735ab04681925441b4ea37eda5.
|
||||
# related event is MetaPoolDeployed(address,address,uint256,uint256,address)
|
||||
# related event is MetaPoolDeployed(address,address,uint256,uint256,address).
|
||||
|
||||
- name: test_metapool_factory_old
|
||||
start_block: 11968730
|
||||
stop_block: 12028110
|
||||
initialized_accounts:
|
||||
- "0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7" # Linked pool of this metapool
|
||||
expected_components:
|
||||
- id: "0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B"
|
||||
tokens:
|
||||
- "0x853d955aCEf822Db058eb8505911ED77F175b99e"
|
||||
- "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"
|
||||
static_attributes:
|
||||
factory_name: "0x6d6574615f706f6f6c5f666163746f72795f6f6c64" # meta_pool_factory_old
|
||||
base_pool: "0x307862656263343437383263376462306131613630636236666539376430623438333033326666316337" # 0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7
|
||||
factory: "0x307830393539313538623630343064333264303463333031613732636266643662333965323163396165" # 0x0959158b6040d32d04c301a72cbfd6b39e21c9ae
|
||||
pool_type: "0x6d657461706f6f6c" # metapool
|
||||
name: "0x46726178" # Frax
|
||||
creation_tx: "0x1f2a0d4e1c1eca594bd7f27f9952480ccda422c3453e0c5074a63aa46a2ed628"
|
||||
skip_simulation: true # Reason: this pool calls `totalSupply()` on the LP token during simulation. But this token is overridden and doesn't have anything for totalSupply
|
||||
# - name: test_metapool_factory_old
|
||||
# start_block: 11968730
|
||||
# stop_block: 12028110
|
||||
# initialized_accounts:
|
||||
# - "0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7" # Linked pool of this metapool
|
||||
# expected_components:
|
||||
# - id: "0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B"
|
||||
# tokens:
|
||||
# - "0x853d955aCEf822Db058eb8505911ED77F175b99e"
|
||||
# - "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"
|
||||
# static_attributes:
|
||||
# factory_name: "0x6d6574615f706f6f6c5f666163746f72795f6f6c64" # meta_pool_factory_old
|
||||
# base_pool: "0x307862656263343437383263376462306131613630636236666539376430623438333033326666316337" # 0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7
|
||||
# factory: "0x307830393539313538623630343064333264303463333031613732636266643662333965323163396165" # 0x0959158b6040d32d04c301a72cbfd6b39e21c9ae
|
||||
# pool_type: "0x6d657461706f6f6c" # metapool
|
||||
# name: "0x46726178" # Frax
|
||||
# creation_tx: "0x1f2a0d4e1c1eca594bd7f27f9952480ccda422c3453e0c5074a63aa46a2ed628"
|
||||
# skip_simulation: true # Reason: this pool calls `totalSupply()` on the LP token during simulation. But this token is overridden and doesn't have anything for totalSupply
|
||||
|
||||
@@ -6,7 +6,7 @@ pub const META_REGISTRY: [u8; 20] = hex!("F98B45FA17DE75FB1aD0e7aFD971b0ca00e379
|
||||
// Factories
|
||||
pub const CRYPTO_POOL_FACTORY: [u8; 20] = hex!("F18056Bbd320E96A48e3Fbf8bC061322531aac99");
|
||||
pub const META_POOL_FACTORY: [u8; 20] = hex!("B9fC157394Af804a3578134A6585C0dc9cc990d4");
|
||||
pub const META_POOL_FACTORY_OLD: [u8; 20] = hex!("0959158b6040D32d04c301A72CBFD6b39E21c9AE");
|
||||
// pub const META_POOL_FACTORY_OLD: [u8; 20] = hex!("0959158b6040D32d04c301A72CBFD6b39E21c9AE");
|
||||
pub const CRYPTO_SWAP_NG_FACTORY: [u8; 20] = hex!("6A8cbed756804B16E05E741eDaBd5cB544AE21bf");
|
||||
pub const TRICRYPTO_FACTORY: [u8; 20] = hex!("0c0e5f2fF0ff18a3be9b835635039256dC4B4963");
|
||||
pub const TWOCRYPTO_FACTORY: [u8; 20] = hex!("98ee851a00abee0d95d08cf4ca2bdce32aeaaf7f");
|
||||
|
||||
@@ -253,185 +253,187 @@ pub fn address_map(
|
||||
}],
|
||||
}],
|
||||
))
|
||||
} else if let Some(pool_added) =
|
||||
abi::meta_pool_factory::events::MetaPoolDeployed::match_and_decode(log)
|
||||
{
|
||||
let add_pool =
|
||||
abi::meta_pool_factory::functions::DeployMetapool1::match_and_decode(call)
|
||||
.map(|add_pool| abi::meta_pool_factory::functions::DeployMetapool2 {
|
||||
base_pool: add_pool.base_pool,
|
||||
name: add_pool.name,
|
||||
symbol: add_pool.symbol,
|
||||
coin: add_pool.coin,
|
||||
a: add_pool.a,
|
||||
fee: add_pool.fee,
|
||||
implementation_idx: BigInt::from(0),
|
||||
})
|
||||
.or_else(|| {
|
||||
abi::meta_pool_factory::functions::DeployMetapool2::match_and_decode(
|
||||
call,
|
||||
)
|
||||
})?;
|
||||
}
|
||||
// else if let Some(pool_added) =
|
||||
// abi::meta_pool_factory::events::MetaPoolDeployed::match_and_decode(log)
|
||||
// {
|
||||
// let add_pool =
|
||||
// abi::meta_pool_factory::functions::DeployMetapool1::match_and_decode(call)
|
||||
// .map(|add_pool| abi::meta_pool_factory::functions::DeployMetapool2 {
|
||||
// base_pool: add_pool.base_pool,
|
||||
// name: add_pool.name,
|
||||
// symbol: add_pool.symbol,
|
||||
// coin: add_pool.coin,
|
||||
// a: add_pool.a,
|
||||
// fee: add_pool.fee,
|
||||
// implementation_idx: BigInt::from(0),
|
||||
// })
|
||||
// .or_else(|| {
|
||||
// abi::meta_pool_factory::functions::DeployMetapool2::match_and_decode(
|
||||
// call,
|
||||
// )
|
||||
// })?;
|
||||
|
||||
let component_id = &call.return_data[12..];
|
||||
// let component_id = &call.return_data[12..];
|
||||
|
||||
// The `add_pool.base_pool` may only refer to the contract of the base pool and not
|
||||
// the token itself. This means we **have** to make an RPC call to the
|
||||
// `meta_registry` in order to get the real LP token address.
|
||||
let get_lp_token =
|
||||
abi::meta_registry::functions::GetLpToken1 { pool: add_pool.base_pool.clone() };
|
||||
let lp_token = get_lp_token.call(META_REGISTRY.to_vec())?;
|
||||
// // The `add_pool.base_pool` may only refer to the contract of the base pool and
|
||||
// not // the token itself. This means we **have** to make an RPC call
|
||||
// to the // `meta_registry` in order to get the real LP token address.
|
||||
// let get_lp_token =
|
||||
// abi::meta_registry::functions::GetLpToken1 { pool: add_pool.base_pool.clone()
|
||||
// }; let lp_token = get_lp_token.call(META_REGISTRY.to_vec())?;
|
||||
|
||||
let pool_implementation = extract_proxy_impl(call, tx, 0).unwrap_or([1u8; 20]);
|
||||
// let pool_implementation = extract_proxy_impl(call, tx, 0).unwrap_or([1u8; 20]);
|
||||
|
||||
Some((
|
||||
ProtocolComponent {
|
||||
id: hex::encode(component_id),
|
||||
tx: Some(Transaction {
|
||||
to: tx.to.clone(),
|
||||
from: tx.from.clone(),
|
||||
hash: tx.hash.clone(),
|
||||
index: tx.index.into(),
|
||||
}),
|
||||
tokens: vec![pool_added.coin, lp_token],
|
||||
contracts: vec![component_id.into(), add_pool.base_pool.clone()],
|
||||
static_att: vec![
|
||||
Attribute {
|
||||
name: "pool_type".into(),
|
||||
value: "metapool".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "name".into(),
|
||||
value: add_pool.name.into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory_name".into(),
|
||||
value: "meta_pool_factory".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory".into(),
|
||||
value: address_to_bytes_with_0x(&META_POOL_FACTORY),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "base_pool".into(),
|
||||
value: address_to_bytes_with_0x(
|
||||
&add_pool.base_pool.try_into().unwrap(),
|
||||
),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
],
|
||||
change: ChangeType::Creation.into(),
|
||||
protocol_type: Some(ProtocolType {
|
||||
name: "curve_pool".into(),
|
||||
financial_type: FinancialType::Swap.into(),
|
||||
attribute_schema: Vec::new(),
|
||||
implementation_type: ImplementationType::Vm.into(),
|
||||
}),
|
||||
},
|
||||
vec![EntityChanges {
|
||||
component_id: address_to_string_with_0x(component_id),
|
||||
attributes: vec![Attribute {
|
||||
name: "stateless_contract_addr_0".into(),
|
||||
value: address_to_bytes_with_0x(&pool_implementation),
|
||||
change: ChangeType::Creation.into(),
|
||||
}],
|
||||
}],
|
||||
))
|
||||
} else {
|
||||
// Some((
|
||||
// ProtocolComponent {
|
||||
// id: hex::encode(component_id),
|
||||
// tx: Some(Transaction {
|
||||
// to: tx.to.clone(),
|
||||
// from: tx.from.clone(),
|
||||
// hash: tx.hash.clone(),
|
||||
// index: tx.index.into(),
|
||||
// }),
|
||||
// tokens: vec![pool_added.coin, lp_token],
|
||||
// contracts: vec![component_id.into(), add_pool.base_pool.clone()],
|
||||
// static_att: vec![
|
||||
// Attribute {
|
||||
// name: "pool_type".into(),
|
||||
// value: "metapool".into(),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "name".into(),
|
||||
// value: add_pool.name.into(),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "factory_name".into(),
|
||||
// value: "meta_pool_factory".into(),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "factory".into(),
|
||||
// value: address_to_bytes_with_0x(&META_POOL_FACTORY),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "base_pool".into(),
|
||||
// value: address_to_bytes_with_0x(
|
||||
// &add_pool.base_pool.try_into().unwrap(),
|
||||
// ),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// ],
|
||||
// change: ChangeType::Creation.into(),
|
||||
// protocol_type: Some(ProtocolType {
|
||||
// name: "curve_pool".into(),
|
||||
// financial_type: FinancialType::Swap.into(),
|
||||
// attribute_schema: Vec::new(),
|
||||
// implementation_type: ImplementationType::Vm.into(),
|
||||
// }),
|
||||
// },
|
||||
// vec![EntityChanges {
|
||||
// component_id: address_to_string_with_0x(component_id),
|
||||
// attributes: vec![Attribute {
|
||||
// name: "stateless_contract_addr_0".into(),
|
||||
// value: address_to_bytes_with_0x(&pool_implementation),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// }],
|
||||
// }],
|
||||
// ))
|
||||
// }
|
||||
else {
|
||||
None
|
||||
}
|
||||
}
|
||||
META_POOL_FACTORY_OLD => {
|
||||
if let Some(pool_added) =
|
||||
abi::meta_pool_factory::events::MetaPoolDeployed::match_and_decode(log)
|
||||
{
|
||||
let add_pool =
|
||||
abi::meta_pool_factory::functions::DeployMetapool1::match_and_decode(call)
|
||||
.map(|add_pool| abi::meta_pool_factory::functions::DeployMetapool2 {
|
||||
base_pool: add_pool.base_pool,
|
||||
name: add_pool.name,
|
||||
symbol: add_pool.symbol,
|
||||
coin: add_pool.coin,
|
||||
a: add_pool.a,
|
||||
fee: add_pool.fee,
|
||||
implementation_idx: BigInt::from(0),
|
||||
})
|
||||
.or_else(|| {
|
||||
abi::meta_pool_factory::functions::DeployMetapool2::match_and_decode(
|
||||
call,
|
||||
)
|
||||
})?;
|
||||
// META_POOL_FACTORY_OLD => {
|
||||
// if let Some(pool_added) =
|
||||
// abi::meta_pool_factory::events::MetaPoolDeployed::match_and_decode(log)
|
||||
// {
|
||||
// let add_pool =
|
||||
// abi::meta_pool_factory::functions::DeployMetapool1::match_and_decode(call)
|
||||
// .map(|add_pool| abi::meta_pool_factory::functions::DeployMetapool2 {
|
||||
// base_pool: add_pool.base_pool,
|
||||
// name: add_pool.name,
|
||||
// symbol: add_pool.symbol,
|
||||
// coin: add_pool.coin,
|
||||
// a: add_pool.a,
|
||||
// fee: add_pool.fee,
|
||||
// implementation_idx: BigInt::from(0),
|
||||
// })
|
||||
// .or_else(|| {
|
||||
// abi::meta_pool_factory::functions::DeployMetapool2::match_and_decode(
|
||||
// call,
|
||||
// )
|
||||
// })?;
|
||||
|
||||
let pool_implementation = extract_proxy_impl(call, tx, 0).unwrap_or([1u8; 20]);
|
||||
// let pool_implementation = extract_proxy_impl(call, tx, 0).unwrap_or([1u8; 20]);
|
||||
|
||||
let component_id = &call.return_data[12..];
|
||||
let lp_token = get_token_from_pool(&pool_added.base_pool);
|
||||
// let component_id = &call.return_data[12..];
|
||||
// let lp_token = get_token_from_pool(&pool_added.base_pool);
|
||||
|
||||
Some((
|
||||
ProtocolComponent {
|
||||
id: hex::encode(component_id),
|
||||
tx: Some(Transaction {
|
||||
to: tx.to.clone(),
|
||||
from: tx.from.clone(),
|
||||
hash: tx.hash.clone(),
|
||||
index: tx.index.into(),
|
||||
}),
|
||||
tokens: vec![pool_added.coin, lp_token],
|
||||
contracts: vec![component_id.into()],
|
||||
static_att: vec![
|
||||
Attribute {
|
||||
name: "pool_type".into(),
|
||||
value: "metapool".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "name".into(),
|
||||
value: add_pool.name.into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory_name".into(),
|
||||
value: "meta_pool_factory_old".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory".into(),
|
||||
value: address_to_bytes_with_0x(&META_POOL_FACTORY_OLD),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "base_pool".into(),
|
||||
value: address_to_bytes_with_0x(
|
||||
&add_pool.base_pool.try_into().unwrap(),
|
||||
),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
],
|
||||
change: ChangeType::Creation.into(),
|
||||
protocol_type: Some(ProtocolType {
|
||||
name: "curve_pool".into(),
|
||||
financial_type: FinancialType::Swap.into(),
|
||||
attribute_schema: Vec::new(),
|
||||
implementation_type: ImplementationType::Vm.into(),
|
||||
}),
|
||||
},
|
||||
vec![EntityChanges {
|
||||
component_id: address_to_string_with_0x(component_id),
|
||||
attributes: vec![Attribute {
|
||||
name: "stateless_contract_addr_0".into(),
|
||||
value: address_to_bytes_with_0x(&pool_implementation),
|
||||
change: ChangeType::Creation.into(),
|
||||
}],
|
||||
}],
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
// Some((
|
||||
// ProtocolComponent {
|
||||
// id: hex::encode(component_id),
|
||||
// tx: Some(Transaction {
|
||||
// to: tx.to.clone(),
|
||||
// from: tx.from.clone(),
|
||||
// hash: tx.hash.clone(),
|
||||
// index: tx.index.into(),
|
||||
// }),
|
||||
// tokens: vec![pool_added.coin, lp_token],
|
||||
// contracts: vec![component_id.into()],
|
||||
// static_att: vec![
|
||||
// Attribute {
|
||||
// name: "pool_type".into(),
|
||||
// value: "metapool".into(),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "name".into(),
|
||||
// value: add_pool.name.into(),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "factory_name".into(),
|
||||
// value: "meta_pool_factory_old".into(),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "factory".into(),
|
||||
// value: address_to_bytes_with_0x(&META_POOL_FACTORY_OLD),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "base_pool".into(),
|
||||
// value: address_to_bytes_with_0x(
|
||||
// &add_pool.base_pool.try_into().unwrap(),
|
||||
// ),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// ],
|
||||
// change: ChangeType::Creation.into(),
|
||||
// protocol_type: Some(ProtocolType {
|
||||
// name: "curve_pool".into(),
|
||||
// financial_type: FinancialType::Swap.into(),
|
||||
// attribute_schema: Vec::new(),
|
||||
// implementation_type: ImplementationType::Vm.into(),
|
||||
// }),
|
||||
// },
|
||||
// vec![EntityChanges {
|
||||
// component_id: address_to_string_with_0x(component_id),
|
||||
// attributes: vec![Attribute {
|
||||
// name: "stateless_contract_addr_0".into(),
|
||||
// value: address_to_bytes_with_0x(&pool_implementation),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// }],
|
||||
// }],
|
||||
// ))
|
||||
// } else {
|
||||
// None
|
||||
// }
|
||||
// }
|
||||
CRYPTO_SWAP_NG_FACTORY => {
|
||||
if let Some(pool_added) =
|
||||
abi::crypto_swap_ng_factory::events::PlainPoolDeployed::match_and_decode(log)
|
||||
@@ -759,85 +761,87 @@ pub fn address_map(
|
||||
}],
|
||||
}],
|
||||
))
|
||||
} else if let Some(pool_added) =
|
||||
abi::stableswap_factory::events::MetaPoolDeployed::match_and_decode(log)
|
||||
{
|
||||
let add_pool = if let Some(pool) =
|
||||
abi::stableswap_factory::functions::DeployMetapool1::match_and_decode(call)
|
||||
{
|
||||
abi::stableswap_factory::functions::DeployMetapool2 {
|
||||
base_pool: pool.base_pool,
|
||||
name: pool.name,
|
||||
symbol: pool.symbol,
|
||||
coin: pool.coin,
|
||||
a: pool.a,
|
||||
fee: pool.fee,
|
||||
implementation_idx: BigInt::from(0),
|
||||
}
|
||||
} else if let Some(pool) =
|
||||
abi::stableswap_factory::functions::DeployMetapool2::match_and_decode(call)
|
||||
{
|
||||
pool
|
||||
} else {
|
||||
return None;
|
||||
};
|
||||
let component_id = &call.return_data[12..];
|
||||
}
|
||||
// else if let Some(pool_added) =
|
||||
// abi::stableswap_factory::events::MetaPoolDeployed::match_and_decode(log)
|
||||
// {
|
||||
// let add_pool = if let Some(pool) =
|
||||
// abi::stableswap_factory::functions::DeployMetapool1::match_and_decode(call)
|
||||
// {
|
||||
// abi::stableswap_factory::functions::DeployMetapool2 {
|
||||
// base_pool: pool.base_pool,
|
||||
// name: pool.name,
|
||||
// symbol: pool.symbol,
|
||||
// coin: pool.coin,
|
||||
// a: pool.a,
|
||||
// fee: pool.fee,
|
||||
// implementation_idx: BigInt::from(0),
|
||||
// }
|
||||
// } else if let Some(pool) =
|
||||
// abi::stableswap_factory::functions::DeployMetapool2::match_and_decode(call)
|
||||
// {
|
||||
// pool
|
||||
// } else {
|
||||
// return None;
|
||||
// };
|
||||
// let component_id = &call.return_data[12..];
|
||||
|
||||
let get_lp_token =
|
||||
abi::meta_registry::functions::GetLpToken1 { pool: add_pool.base_pool.clone() };
|
||||
let lp_token = get_lp_token.call(META_REGISTRY.to_vec())?;
|
||||
// let get_lp_token =
|
||||
// abi::meta_registry::functions::GetLpToken1 { pool: add_pool.base_pool.clone()
|
||||
// }; let lp_token = get_lp_token.call(META_REGISTRY.to_vec())?;
|
||||
|
||||
Some((
|
||||
ProtocolComponent {
|
||||
id: hex::encode(component_id),
|
||||
tx: Some(Transaction {
|
||||
to: tx.to.clone(),
|
||||
from: tx.from.clone(),
|
||||
hash: tx.hash.clone(),
|
||||
index: tx.index.into(),
|
||||
}),
|
||||
tokens: vec![pool_added.coin, lp_token],
|
||||
contracts: vec![component_id.into()],
|
||||
static_att: vec![
|
||||
Attribute {
|
||||
name: "pool_type".into(),
|
||||
value: "metapool".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "name".into(),
|
||||
value: add_pool.name.into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory_name".into(),
|
||||
value: "stable_swap_factory".into(),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "factory".into(),
|
||||
value: address_to_bytes_with_0x(&STABLESWAP_FACTORY),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
Attribute {
|
||||
name: "base_pool".into(),
|
||||
value: address_to_bytes_with_0x(
|
||||
&pool_added.base_pool.try_into().unwrap(),
|
||||
),
|
||||
change: ChangeType::Creation.into(),
|
||||
},
|
||||
],
|
||||
change: ChangeType::Creation.into(),
|
||||
protocol_type: Some(ProtocolType {
|
||||
name: "curve_pool".into(),
|
||||
financial_type: FinancialType::Swap.into(),
|
||||
attribute_schema: Vec::new(),
|
||||
implementation_type: ImplementationType::Vm.into(),
|
||||
}),
|
||||
},
|
||||
vec![],
|
||||
))
|
||||
} else {
|
||||
// Some((
|
||||
// ProtocolComponent {
|
||||
// id: hex::encode(component_id),
|
||||
// tx: Some(Transaction {
|
||||
// to: tx.to.clone(),
|
||||
// from: tx.from.clone(),
|
||||
// hash: tx.hash.clone(),
|
||||
// index: tx.index.into(),
|
||||
// }),
|
||||
// tokens: vec![pool_added.coin, lp_token],
|
||||
// contracts: vec![component_id.into()],
|
||||
// static_att: vec![
|
||||
// Attribute {
|
||||
// name: "pool_type".into(),
|
||||
// value: "metapool".into(),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "name".into(),
|
||||
// value: add_pool.name.into(),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "factory_name".into(),
|
||||
// value: "stable_swap_factory".into(),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "factory".into(),
|
||||
// value: address_to_bytes_with_0x(&STABLESWAP_FACTORY),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// Attribute {
|
||||
// name: "base_pool".into(),
|
||||
// value: address_to_bytes_with_0x(
|
||||
// &pool_added.base_pool.try_into().unwrap(),
|
||||
// ),
|
||||
// change: ChangeType::Creation.into(),
|
||||
// },
|
||||
// ],
|
||||
// change: ChangeType::Creation.into(),
|
||||
// protocol_type: Some(ProtocolType {
|
||||
// name: "curve_pool".into(),
|
||||
// financial_type: FinancialType::Swap.into(),
|
||||
// attribute_schema: Vec::new(),
|
||||
// implementation_type: ImplementationType::Vm.into(),
|
||||
// }),
|
||||
// },
|
||||
// vec![],
|
||||
// ))
|
||||
// }
|
||||
else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,4 @@ PyYAML==6.0.1
|
||||
Requests==2.32.2
|
||||
web3==5.31.3
|
||||
tycho-indexer-client>=0.7.2
|
||||
protosim_py>=0.6.3
|
||||
tycho-simulation-py>=0.32.0
|
||||
|
||||
@@ -10,9 +10,9 @@ from pathlib import Path
|
||||
from typing import List
|
||||
|
||||
import yaml
|
||||
from protosim_py.evm.decoders import ThirdPartyPoolTychoDecoder
|
||||
from protosim_py.evm.storage import TychoDBSingleton
|
||||
from protosim_py.models import EVMBlock
|
||||
from tycho_simulation_py.evm.decoders import ThirdPartyPoolTychoDecoder
|
||||
from tycho_simulation_py.evm.storage import TychoDBSingleton
|
||||
from tycho_simulation_py.models import EVMBlock
|
||||
from pydantic import BaseModel
|
||||
from tycho_indexer_client.dto import (
|
||||
Chain,
|
||||
@@ -248,6 +248,8 @@ class TestRunner:
|
||||
self.config.adapter_build_args,
|
||||
)
|
||||
|
||||
TychoDBSingleton.clear_instance()
|
||||
|
||||
decoder = ThirdPartyPoolTychoDecoder(
|
||||
token_factory_func=self._token_factory_func,
|
||||
adapter_contract=adapter_contract,
|
||||
|
||||
@@ -2,7 +2,7 @@ from logging import getLogger
|
||||
from typing import Union
|
||||
|
||||
from eth_utils import to_checksum_address
|
||||
from protosim_py.models import EthereumToken
|
||||
from tycho_simulation_py.models import EthereumToken
|
||||
from tycho_indexer_client.dto import (
|
||||
ResponseProtocolState,
|
||||
ProtocolComponent,
|
||||
|
||||
Reference in New Issue
Block a user