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

@@ -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,
}
}