refactor(substreams): Update ambient Substreams

This commit is contained in:
zizou
2024-10-14 18:09:17 +02:00
parent aff76f8cc7
commit 42f2f45aa7
31 changed files with 1567 additions and 724 deletions

View File

@@ -2,7 +2,7 @@ use std::collections::HashMap;
use substreams_ethereum::pb::eth::v2::{self as sf, StorageChange};
// re-export the protobuf types here.
pub use crate::pb::tycho::evm::v1::*;
pub use crate::pb::tycho::{ambient::v1::*, evm::v1::*};
impl TransactionContractChanges {
/// Creates a new empty `TransactionContractChanges` instance.

View File

@@ -1,5 +1,12 @@
// @generated
pub mod tycho {
pub mod ambient {
// @@protoc_insertion_point(attribute:tycho.ambient.v1)
pub mod v1 {
include!("tycho.ambient.v1.rs");
// @@protoc_insertion_point(tycho.ambient.v1)
}
}
pub mod evm {
// @@protoc_insertion_point(attribute:tycho.evm.v1)
pub mod v1 {

View File

@@ -0,0 +1,33 @@
// @generated
/// A change to a pool's balance. Ambient specific.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AmbientBalanceDelta {
/// The address of the ERC20 token whose balance changed.
#[prost(bytes="vec", tag="1")]
pub pool_hash: ::prost::alloc::vec::Vec<u8>,
/// The token type: it can be base or quote.
#[prost(string, tag="2")]
pub token_type: ::prost::alloc::string::String,
/// The delta of the token.
#[prost(bytes="vec", tag="3")]
pub token_delta: ::prost::alloc::vec::Vec<u8>,
/// Used to determine the order of the balance changes. Necessary for the balance store.
#[prost(uint64, tag="4")]
pub ordinal: u64,
/// Transaction where the balance changed.
#[prost(message, optional, tag="5")]
pub tx: ::core::option::Option<super::super::evm::v1::Transaction>,
}
/// Ambient pool changes within a single block
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BlockPoolChanges {
/// New protocol components added in this block
#[prost(message, repeated, tag="1")]
pub protocol_components: ::prost::alloc::vec::Vec<super::super::evm::v1::ProtocolComponent>,
/// Balance changes to pools in this block
#[prost(message, repeated, tag="2")]
pub balance_deltas: ::prost::alloc::vec::Vec<AmbientBalanceDelta>,
}
// @@protoc_insertion_point(module)

View File

@@ -84,7 +84,8 @@ pub struct ProtocolComponent {
/// Usually it is a single contract, but some protocols use multiple contracts.
#[prost(bytes="vec", repeated, tag="3")]
pub contracts: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
/// Attributes of the component. Used mainly be the native integration.
/// Static attributes of the component.
/// These attributes MUST be immutable. If it can ever change, it should be given as an EntityChanges for this component id.
/// The inner ChangeType of the attribute has to match the ChangeType of the ProtocolComponent.
#[prost(message, repeated, tag="4")]
pub static_att: ::prost::alloc::vec::Vec<Attribute>,
@@ -186,6 +187,7 @@ pub struct TransactionChanges {
pub balance_changes: ::prost::alloc::vec::Vec<BalanceChange>,
}
/// A set of transaction changes within a single block.
/// This message must be the output of your substreams module.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BlockChanges {