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
|
base_pool: "0x307861353538386637636466353630383131373130613264383264336339633939373639646231646362" # 0xa5588f7cdf560811710a2d82d3c9c99769db1dcb
|
||||||
factory: "0x307836613863626564373536383034623136653035653734316564616264356362353434616532316266" # 0x6a8cbed756804b16e05e741edabd5cb544ae21bf
|
factory: "0x307836613863626564373536383034623136653035653734316564616264356362353434616532316266" # 0x6a8cbed756804b16e05e741edabd5cb544ae21bf
|
||||||
creation_tx: "0x3cfeecae1b43086ee5705f89b803e21eb0492d7d5db06c229586db8fc72f5665"
|
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
|
# # Metapool factory 0xB9fC157394Af804a3578134A6585C0dc9cc990d4 - MetaPool
|
||||||
- name: test_metapool_factory_metapool
|
# - name: test_metapool_factory_metapool
|
||||||
start_block: 18028604
|
# start_block: 18028604
|
||||||
stop_block: 18029610
|
# stop_block: 18029610
|
||||||
initialized_accounts:
|
# initialized_accounts:
|
||||||
- "0xdcef968d416a41cdac0ed8702fac8128a64241a2"
|
# - "0xdcef968d416a41cdac0ed8702fac8128a64241a2"
|
||||||
- "0xc4ad29ba4b3c580e6d59105fff484999997675ff" # Needed by another component that is created within this block range
|
# - "0xc4ad29ba4b3c580e6d59105fff484999997675ff" # Needed by another component that is created within this block range
|
||||||
expected_components:
|
# expected_components:
|
||||||
- id: "0x61fA2c947e523F9ABfb8d7e2903A5D5218C119a7"
|
# - id: "0x61fA2c947e523F9ABfb8d7e2903A5D5218C119a7"
|
||||||
tokens:
|
# tokens:
|
||||||
- "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8"
|
# - "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8"
|
||||||
- "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC"
|
# - "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC"
|
||||||
static_attributes:
|
# static_attributes:
|
||||||
name: "0x50415950414c465241584250" # PAYPALFRAXBP
|
# name: "0x50415950414c465241584250" # PAYPALFRAXBP
|
||||||
factory_name: "0x6d6574615f706f6f6c5f666163746f7279" # meta_pool_factory
|
# factory_name: "0x6d6574615f706f6f6c5f666163746f7279" # meta_pool_factory
|
||||||
base_pool: "0x307864636566393638643431366134316364616330656438373032666163383132386136343234316132" # 0xdcfe968d416ac0ed8702fac8128a64241a2
|
# base_pool: "0x307864636566393638643431366134316364616330656438373032666163383132386136343234316132" # 0xdcfe968d416ac0ed8702fac8128a64241a2
|
||||||
factory: "0x307862396663313537333934616638303461333537383133346136353835633064633963633939306434" # 0xb9fc157394af804a3578134a6585c0dcc993099d
|
# factory: "0x307862396663313537333934616638303461333537383133346136353835633064633963633939306434" # 0xb9fc157394af804a3578134a6585c0dcc993099d
|
||||||
pool_type: "0x6d657461706f6f6c" # metapool
|
# pool_type: "0x6d657461706f6f6c" # metapool
|
||||||
creation_tx: "0xc9c6b879cbb19f7f26405335c3879c350592d530956878ff172e9efad786c63f"
|
# 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
|
# 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
|
# Metapool factory 0xB9fC157394Af804a3578134A6585C0dc9cc990d4 - PlainPool
|
||||||
- name: test_metapool_factory_plainpool
|
- name: test_metapool_factory_plainpool
|
||||||
@@ -294,23 +294,23 @@ tests:
|
|||||||
# - name: test_stableswap_factory_meta_pool
|
# - name: test_stableswap_factory_meta_pool
|
||||||
# There was no metapool created from this factory yet.
|
# There was no metapool created from this factory yet.
|
||||||
# https://etherscan.io/address/0x4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d#events search events with topic 0x01f31cd2abdeb4e5e10ba500f2db0f937d9e8c735ab04681925441b4ea37eda5.
|
# 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
|
# - name: test_metapool_factory_old
|
||||||
start_block: 11968730
|
# start_block: 11968730
|
||||||
stop_block: 12028110
|
# stop_block: 12028110
|
||||||
initialized_accounts:
|
# initialized_accounts:
|
||||||
- "0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7" # Linked pool of this metapool
|
# - "0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7" # Linked pool of this metapool
|
||||||
expected_components:
|
# expected_components:
|
||||||
- id: "0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B"
|
# - id: "0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B"
|
||||||
tokens:
|
# tokens:
|
||||||
- "0x853d955aCEf822Db058eb8505911ED77F175b99e"
|
# - "0x853d955aCEf822Db058eb8505911ED77F175b99e"
|
||||||
- "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"
|
# - "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"
|
||||||
static_attributes:
|
# static_attributes:
|
||||||
factory_name: "0x6d6574615f706f6f6c5f666163746f72795f6f6c64" # meta_pool_factory_old
|
# factory_name: "0x6d6574615f706f6f6c5f666163746f72795f6f6c64" # meta_pool_factory_old
|
||||||
base_pool: "0x307862656263343437383263376462306131613630636236666539376430623438333033326666316337" # 0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7
|
# base_pool: "0x307862656263343437383263376462306131613630636236666539376430623438333033326666316337" # 0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7
|
||||||
factory: "0x307830393539313538623630343064333264303463333031613732636266643662333965323163396165" # 0x0959158b6040d32d04c301a72cbfd6b39e21c9ae
|
# factory: "0x307830393539313538623630343064333264303463333031613732636266643662333965323163396165" # 0x0959158b6040d32d04c301a72cbfd6b39e21c9ae
|
||||||
pool_type: "0x6d657461706f6f6c" # metapool
|
# pool_type: "0x6d657461706f6f6c" # metapool
|
||||||
name: "0x46726178" # Frax
|
# name: "0x46726178" # Frax
|
||||||
creation_tx: "0x1f2a0d4e1c1eca594bd7f27f9952480ccda422c3453e0c5074a63aa46a2ed628"
|
# 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
|
# 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
|
// Factories
|
||||||
pub const CRYPTO_POOL_FACTORY: [u8; 20] = hex!("F18056Bbd320E96A48e3Fbf8bC061322531aac99");
|
pub const CRYPTO_POOL_FACTORY: [u8; 20] = hex!("F18056Bbd320E96A48e3Fbf8bC061322531aac99");
|
||||||
pub const META_POOL_FACTORY: [u8; 20] = hex!("B9fC157394Af804a3578134A6585C0dc9cc990d4");
|
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 CRYPTO_SWAP_NG_FACTORY: [u8; 20] = hex!("6A8cbed756804B16E05E741eDaBd5cB544AE21bf");
|
||||||
pub const TRICRYPTO_FACTORY: [u8; 20] = hex!("0c0e5f2fF0ff18a3be9b835635039256dC4B4963");
|
pub const TRICRYPTO_FACTORY: [u8; 20] = hex!("0c0e5f2fF0ff18a3be9b835635039256dC4B4963");
|
||||||
pub const TWOCRYPTO_FACTORY: [u8; 20] = hex!("98ee851a00abee0d95d08cf4ca2bdce32aeaaf7f");
|
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)
|
// 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)
|
// let add_pool =
|
||||||
.map(|add_pool| abi::meta_pool_factory::functions::DeployMetapool2 {
|
// abi::meta_pool_factory::functions::DeployMetapool1::match_and_decode(call)
|
||||||
base_pool: add_pool.base_pool,
|
// .map(|add_pool| abi::meta_pool_factory::functions::DeployMetapool2 {
|
||||||
name: add_pool.name,
|
// base_pool: add_pool.base_pool,
|
||||||
symbol: add_pool.symbol,
|
// name: add_pool.name,
|
||||||
coin: add_pool.coin,
|
// symbol: add_pool.symbol,
|
||||||
a: add_pool.a,
|
// coin: add_pool.coin,
|
||||||
fee: add_pool.fee,
|
// a: add_pool.a,
|
||||||
implementation_idx: BigInt::from(0),
|
// fee: add_pool.fee,
|
||||||
})
|
// implementation_idx: BigInt::from(0),
|
||||||
.or_else(|| {
|
// })
|
||||||
abi::meta_pool_factory::functions::DeployMetapool2::match_and_decode(
|
// .or_else(|| {
|
||||||
call,
|
// 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 `add_pool.base_pool` may only refer to the contract of the base pool and
|
||||||
// the token itself. This means we **have** to make an RPC call to the
|
// not // the token itself. This means we **have** to make an RPC call
|
||||||
// `meta_registry` in order to get the real LP token address.
|
// to the // `meta_registry` in order to get the real LP token address.
|
||||||
let get_lp_token =
|
// let get_lp_token =
|
||||||
abi::meta_registry::functions::GetLpToken1 { pool: add_pool.base_pool.clone() };
|
// abi::meta_registry::functions::GetLpToken1 { pool: add_pool.base_pool.clone()
|
||||||
let lp_token = get_lp_token.call(META_REGISTRY.to_vec())?;
|
// }; 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((
|
// Some((
|
||||||
ProtocolComponent {
|
// ProtocolComponent {
|
||||||
id: hex::encode(component_id),
|
// id: hex::encode(component_id),
|
||||||
tx: Some(Transaction {
|
// tx: Some(Transaction {
|
||||||
to: tx.to.clone(),
|
// to: tx.to.clone(),
|
||||||
from: tx.from.clone(),
|
// from: tx.from.clone(),
|
||||||
hash: tx.hash.clone(),
|
// hash: tx.hash.clone(),
|
||||||
index: tx.index.into(),
|
// index: tx.index.into(),
|
||||||
}),
|
// }),
|
||||||
tokens: vec![pool_added.coin, lp_token],
|
// tokens: vec![pool_added.coin, lp_token],
|
||||||
contracts: vec![component_id.into(), add_pool.base_pool.clone()],
|
// contracts: vec![component_id.into(), add_pool.base_pool.clone()],
|
||||||
static_att: vec![
|
// static_att: vec![
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "pool_type".into(),
|
// name: "pool_type".into(),
|
||||||
value: "metapool".into(),
|
// value: "metapool".into(),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "name".into(),
|
// name: "name".into(),
|
||||||
value: add_pool.name.into(),
|
// value: add_pool.name.into(),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "factory_name".into(),
|
// name: "factory_name".into(),
|
||||||
value: "meta_pool_factory".into(),
|
// value: "meta_pool_factory".into(),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "factory".into(),
|
// name: "factory".into(),
|
||||||
value: address_to_bytes_with_0x(&META_POOL_FACTORY),
|
// value: address_to_bytes_with_0x(&META_POOL_FACTORY),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "base_pool".into(),
|
// name: "base_pool".into(),
|
||||||
value: address_to_bytes_with_0x(
|
// value: address_to_bytes_with_0x(
|
||||||
&add_pool.base_pool.try_into().unwrap(),
|
// &add_pool.base_pool.try_into().unwrap(),
|
||||||
),
|
// ),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
protocol_type: Some(ProtocolType {
|
// protocol_type: Some(ProtocolType {
|
||||||
name: "curve_pool".into(),
|
// name: "curve_pool".into(),
|
||||||
financial_type: FinancialType::Swap.into(),
|
// financial_type: FinancialType::Swap.into(),
|
||||||
attribute_schema: Vec::new(),
|
// attribute_schema: Vec::new(),
|
||||||
implementation_type: ImplementationType::Vm.into(),
|
// implementation_type: ImplementationType::Vm.into(),
|
||||||
}),
|
// }),
|
||||||
},
|
// },
|
||||||
vec![EntityChanges {
|
// vec![EntityChanges {
|
||||||
component_id: address_to_string_with_0x(component_id),
|
// component_id: address_to_string_with_0x(component_id),
|
||||||
attributes: vec![Attribute {
|
// attributes: vec![Attribute {
|
||||||
name: "stateless_contract_addr_0".into(),
|
// name: "stateless_contract_addr_0".into(),
|
||||||
value: address_to_bytes_with_0x(&pool_implementation),
|
// value: address_to_bytes_with_0x(&pool_implementation),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
}],
|
// }],
|
||||||
}],
|
// }],
|
||||||
))
|
// ))
|
||||||
} else {
|
// }
|
||||||
|
else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
META_POOL_FACTORY_OLD => {
|
// META_POOL_FACTORY_OLD => {
|
||||||
if let Some(pool_added) =
|
// if let Some(pool_added) =
|
||||||
abi::meta_pool_factory::events::MetaPoolDeployed::match_and_decode(log)
|
// abi::meta_pool_factory::events::MetaPoolDeployed::match_and_decode(log)
|
||||||
{
|
// {
|
||||||
let add_pool =
|
// let add_pool =
|
||||||
abi::meta_pool_factory::functions::DeployMetapool1::match_and_decode(call)
|
// abi::meta_pool_factory::functions::DeployMetapool1::match_and_decode(call)
|
||||||
.map(|add_pool| abi::meta_pool_factory::functions::DeployMetapool2 {
|
// .map(|add_pool| abi::meta_pool_factory::functions::DeployMetapool2 {
|
||||||
base_pool: add_pool.base_pool,
|
// base_pool: add_pool.base_pool,
|
||||||
name: add_pool.name,
|
// name: add_pool.name,
|
||||||
symbol: add_pool.symbol,
|
// symbol: add_pool.symbol,
|
||||||
coin: add_pool.coin,
|
// coin: add_pool.coin,
|
||||||
a: add_pool.a,
|
// a: add_pool.a,
|
||||||
fee: add_pool.fee,
|
// fee: add_pool.fee,
|
||||||
implementation_idx: BigInt::from(0),
|
// implementation_idx: BigInt::from(0),
|
||||||
})
|
// })
|
||||||
.or_else(|| {
|
// .or_else(|| {
|
||||||
abi::meta_pool_factory::functions::DeployMetapool2::match_and_decode(
|
// abi::meta_pool_factory::functions::DeployMetapool2::match_and_decode(
|
||||||
call,
|
// 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 component_id = &call.return_data[12..];
|
||||||
let lp_token = get_token_from_pool(&pool_added.base_pool);
|
// let lp_token = get_token_from_pool(&pool_added.base_pool);
|
||||||
|
|
||||||
Some((
|
// Some((
|
||||||
ProtocolComponent {
|
// ProtocolComponent {
|
||||||
id: hex::encode(component_id),
|
// id: hex::encode(component_id),
|
||||||
tx: Some(Transaction {
|
// tx: Some(Transaction {
|
||||||
to: tx.to.clone(),
|
// to: tx.to.clone(),
|
||||||
from: tx.from.clone(),
|
// from: tx.from.clone(),
|
||||||
hash: tx.hash.clone(),
|
// hash: tx.hash.clone(),
|
||||||
index: tx.index.into(),
|
// index: tx.index.into(),
|
||||||
}),
|
// }),
|
||||||
tokens: vec![pool_added.coin, lp_token],
|
// tokens: vec![pool_added.coin, lp_token],
|
||||||
contracts: vec![component_id.into()],
|
// contracts: vec![component_id.into()],
|
||||||
static_att: vec![
|
// static_att: vec![
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "pool_type".into(),
|
// name: "pool_type".into(),
|
||||||
value: "metapool".into(),
|
// value: "metapool".into(),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "name".into(),
|
// name: "name".into(),
|
||||||
value: add_pool.name.into(),
|
// value: add_pool.name.into(),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "factory_name".into(),
|
// name: "factory_name".into(),
|
||||||
value: "meta_pool_factory_old".into(),
|
// value: "meta_pool_factory_old".into(),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "factory".into(),
|
// name: "factory".into(),
|
||||||
value: address_to_bytes_with_0x(&META_POOL_FACTORY_OLD),
|
// value: address_to_bytes_with_0x(&META_POOL_FACTORY_OLD),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "base_pool".into(),
|
// name: "base_pool".into(),
|
||||||
value: address_to_bytes_with_0x(
|
// value: address_to_bytes_with_0x(
|
||||||
&add_pool.base_pool.try_into().unwrap(),
|
// &add_pool.base_pool.try_into().unwrap(),
|
||||||
),
|
// ),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
protocol_type: Some(ProtocolType {
|
// protocol_type: Some(ProtocolType {
|
||||||
name: "curve_pool".into(),
|
// name: "curve_pool".into(),
|
||||||
financial_type: FinancialType::Swap.into(),
|
// financial_type: FinancialType::Swap.into(),
|
||||||
attribute_schema: Vec::new(),
|
// attribute_schema: Vec::new(),
|
||||||
implementation_type: ImplementationType::Vm.into(),
|
// implementation_type: ImplementationType::Vm.into(),
|
||||||
}),
|
// }),
|
||||||
},
|
// },
|
||||||
vec![EntityChanges {
|
// vec![EntityChanges {
|
||||||
component_id: address_to_string_with_0x(component_id),
|
// component_id: address_to_string_with_0x(component_id),
|
||||||
attributes: vec![Attribute {
|
// attributes: vec![Attribute {
|
||||||
name: "stateless_contract_addr_0".into(),
|
// name: "stateless_contract_addr_0".into(),
|
||||||
value: address_to_bytes_with_0x(&pool_implementation),
|
// value: address_to_bytes_with_0x(&pool_implementation),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
}],
|
// }],
|
||||||
}],
|
// }],
|
||||||
))
|
// ))
|
||||||
} else {
|
// } else {
|
||||||
None
|
// None
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
CRYPTO_SWAP_NG_FACTORY => {
|
CRYPTO_SWAP_NG_FACTORY => {
|
||||||
if let Some(pool_added) =
|
if let Some(pool_added) =
|
||||||
abi::crypto_swap_ng_factory::events::PlainPoolDeployed::match_and_decode(log)
|
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)
|
// 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)
|
// 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,
|
// abi::stableswap_factory::functions::DeployMetapool2 {
|
||||||
name: pool.name,
|
// base_pool: pool.base_pool,
|
||||||
symbol: pool.symbol,
|
// name: pool.name,
|
||||||
coin: pool.coin,
|
// symbol: pool.symbol,
|
||||||
a: pool.a,
|
// coin: pool.coin,
|
||||||
fee: pool.fee,
|
// a: pool.a,
|
||||||
implementation_idx: BigInt::from(0),
|
// fee: pool.fee,
|
||||||
}
|
// implementation_idx: BigInt::from(0),
|
||||||
} else if let Some(pool) =
|
// }
|
||||||
abi::stableswap_factory::functions::DeployMetapool2::match_and_decode(call)
|
// } else if let Some(pool) =
|
||||||
{
|
// abi::stableswap_factory::functions::DeployMetapool2::match_and_decode(call)
|
||||||
pool
|
// {
|
||||||
} else {
|
// pool
|
||||||
return None;
|
// } else {
|
||||||
};
|
// return None;
|
||||||
let component_id = &call.return_data[12..];
|
// };
|
||||||
|
// let component_id = &call.return_data[12..];
|
||||||
|
|
||||||
let get_lp_token =
|
// let get_lp_token =
|
||||||
abi::meta_registry::functions::GetLpToken1 { pool: add_pool.base_pool.clone() };
|
// abi::meta_registry::functions::GetLpToken1 { pool: add_pool.base_pool.clone()
|
||||||
let lp_token = get_lp_token.call(META_REGISTRY.to_vec())?;
|
// }; let lp_token = get_lp_token.call(META_REGISTRY.to_vec())?;
|
||||||
|
|
||||||
Some((
|
// Some((
|
||||||
ProtocolComponent {
|
// ProtocolComponent {
|
||||||
id: hex::encode(component_id),
|
// id: hex::encode(component_id),
|
||||||
tx: Some(Transaction {
|
// tx: Some(Transaction {
|
||||||
to: tx.to.clone(),
|
// to: tx.to.clone(),
|
||||||
from: tx.from.clone(),
|
// from: tx.from.clone(),
|
||||||
hash: tx.hash.clone(),
|
// hash: tx.hash.clone(),
|
||||||
index: tx.index.into(),
|
// index: tx.index.into(),
|
||||||
}),
|
// }),
|
||||||
tokens: vec![pool_added.coin, lp_token],
|
// tokens: vec![pool_added.coin, lp_token],
|
||||||
contracts: vec![component_id.into()],
|
// contracts: vec![component_id.into()],
|
||||||
static_att: vec![
|
// static_att: vec![
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "pool_type".into(),
|
// name: "pool_type".into(),
|
||||||
value: "metapool".into(),
|
// value: "metapool".into(),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "name".into(),
|
// name: "name".into(),
|
||||||
value: add_pool.name.into(),
|
// value: add_pool.name.into(),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "factory_name".into(),
|
// name: "factory_name".into(),
|
||||||
value: "stable_swap_factory".into(),
|
// value: "stable_swap_factory".into(),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "factory".into(),
|
// name: "factory".into(),
|
||||||
value: address_to_bytes_with_0x(&STABLESWAP_FACTORY),
|
// value: address_to_bytes_with_0x(&STABLESWAP_FACTORY),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
Attribute {
|
// Attribute {
|
||||||
name: "base_pool".into(),
|
// name: "base_pool".into(),
|
||||||
value: address_to_bytes_with_0x(
|
// value: address_to_bytes_with_0x(
|
||||||
&pool_added.base_pool.try_into().unwrap(),
|
// &pool_added.base_pool.try_into().unwrap(),
|
||||||
),
|
// ),
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
change: ChangeType::Creation.into(),
|
// change: ChangeType::Creation.into(),
|
||||||
protocol_type: Some(ProtocolType {
|
// protocol_type: Some(ProtocolType {
|
||||||
name: "curve_pool".into(),
|
// name: "curve_pool".into(),
|
||||||
financial_type: FinancialType::Swap.into(),
|
// financial_type: FinancialType::Swap.into(),
|
||||||
attribute_schema: Vec::new(),
|
// attribute_schema: Vec::new(),
|
||||||
implementation_type: ImplementationType::Vm.into(),
|
// implementation_type: ImplementationType::Vm.into(),
|
||||||
}),
|
// }),
|
||||||
},
|
// },
|
||||||
vec![],
|
// vec![],
|
||||||
))
|
// ))
|
||||||
} else {
|
// }
|
||||||
|
else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ PyYAML==6.0.1
|
|||||||
Requests==2.32.2
|
Requests==2.32.2
|
||||||
web3==5.31.3
|
web3==5.31.3
|
||||||
tycho-indexer-client>=0.7.2
|
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
|
from typing import List
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from protosim_py.evm.decoders import ThirdPartyPoolTychoDecoder
|
from tycho_simulation_py.evm.decoders import ThirdPartyPoolTychoDecoder
|
||||||
from protosim_py.evm.storage import TychoDBSingleton
|
from tycho_simulation_py.evm.storage import TychoDBSingleton
|
||||||
from protosim_py.models import EVMBlock
|
from tycho_simulation_py.models import EVMBlock
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from tycho_indexer_client.dto import (
|
from tycho_indexer_client.dto import (
|
||||||
Chain,
|
Chain,
|
||||||
@@ -247,6 +247,8 @@ class TestRunner:
|
|||||||
self.config.adapter_build_signature,
|
self.config.adapter_build_signature,
|
||||||
self.config.adapter_build_args,
|
self.config.adapter_build_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
TychoDBSingleton.clear_instance()
|
||||||
|
|
||||||
decoder = ThirdPartyPoolTychoDecoder(
|
decoder = ThirdPartyPoolTychoDecoder(
|
||||||
token_factory_func=self._token_factory_func,
|
token_factory_func=self._token_factory_func,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from logging import getLogger
|
|||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
from eth_utils import to_checksum_address
|
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 (
|
from tycho_indexer_client.dto import (
|
||||||
ResponseProtocolState,
|
ResponseProtocolState,
|
||||||
ProtocolComponent,
|
ProtocolComponent,
|
||||||
|
|||||||
Reference in New Issue
Block a user