feat: add twocrypto factory

This commit is contained in:
Florian Pellissier
2024-06-19 10:01:21 +02:00
committed by tvinagre
parent fe27fc397f
commit 3aa880a700
7 changed files with 4565 additions and 1 deletions

View File

@@ -4,6 +4,6 @@ pub mod stableswap_factory;
pub mod crypto_swap_ng_factory;
pub mod meta_registry;
pub mod tricrypto_factory;
pub mod main_registry;
pub mod twocrypto_factory;
pub mod erc20;
pub mod meta_pool_factory;

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,7 @@ pub const META_POOL_FACTORY: [u8; 20] = hex!("B9fC157394Af804a3578134A6585C0dc9c
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");
pub const STABLESWAP_FACTORY: [u8; 20] = hex!("4F8846Ae9380B90d2E71D5e3D042dff3E7ebb40d");
// Important addresses

View File

@@ -681,6 +681,54 @@ pub fn address_map(
None
}
}
TWOCRYPTO_FACTORY => {
if let Some(pool_added) =
abi::twocrypto_factory::events::TwocryptoPoolDeployed::match_and_decode(log)
{
Some(ProtocolComponent {
id: hex::encode(&pool_added.pool),
tx: Some(Transaction {
to: tx.to.clone(),
from: tx.from.clone(),
hash: tx.hash.clone(),
index: tx.index.into(),
}),
tokens: pool_added.coins.into(),
contracts: vec![pool_added.pool],
static_att: vec![
Attribute {
name: "pool_type".into(),
value: "twocrypto".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "name".into(),
value: pool_added.name.into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory_name".into(),
value: "twocrypto_factory".into(),
change: ChangeType::Creation.into(),
},
Attribute {
name: "factory".into(),
value: address_to_bytes_with_0x(&TWOCRYPTO_FACTORY),
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(),
}),
})
} else {
None
}
}
_ => None,
}
}