Use manual updates on singleton template.

This commit is contained in:
kayibal
2025-02-06 10:11:06 -06:00
committed by Alan Höng
parent 22f70ca110
commit 7302989617
4 changed files with 67 additions and 51 deletions

View File

@@ -1,7 +1,7 @@
use serde::Deserialize;
use substreams_ethereum::pb::eth::v2::{Call, Log, TransactionTrace};
use tycho_substreams::models::{
ChangeType, FinancialType, ImplementationType, ProtocolComponent, ProtocolType,
Attribute, ChangeType, FinancialType, ImplementationType, ProtocolComponent, ProtocolType,
};
#[derive(Deserialize)]
@@ -31,10 +31,18 @@ pub fn maybe_create_component(
// TODO: add the components tokens
],
contracts: vec![
// TODO: any contracts required during swapping
config.vault_address.clone(),
// TODO: any additional contracts required during swapping
],
static_att: vec![
// TODO: any additional metadata required, e.g. for swap encoding
// Singleton components are marked as manual updates since we can't
// infer component updates from vault storage updates. The template
// later sets update markers on components that had a balance change.
Attribute {
name: "manual_updates".to_string(),
value: vec![1u8],
change: ChangeType::Creation.into(),
}, // TODO: any additional metadata required, e.g. for swap encoding
],
change: ChangeType::Creation.into(),
protocol_type: Some(ProtocolType {