Revert "Don't include balancer specific pb in tycho pbs."

This reverts commit a1864e3c.

We will actually make the balance delta messages part of the tycho packages since this makes a few things simpler when trying to factor out an sdk.
This commit is contained in:
kayibal
2024-03-13 12:11:38 +00:00
parent 7601072e87
commit 4b2437dab6
6 changed files with 49 additions and 59 deletions

View File

@@ -1,6 +1,6 @@
syntax = "proto3"; syntax = "proto3";
package balancer; package tycho.evm.v1;
import "tycho/evm/v1/common.proto"; import "tycho/evm/v1/common.proto";
@@ -8,7 +8,7 @@ import "tycho/evm/v1/common.proto";
message BalanceDelta { message BalanceDelta {
uint64 ord = 1; uint64 ord = 1;
// The tx hash of the transaction that caused the balance change. // The tx hash of the transaction that caused the balance change.
tycho.evm.v1.Transaction tx = 2; Transaction tx = 2;
// The address of the ERC20 token whose balance changed. // The address of the ERC20 token whose balance changed.
bytes token = 3; bytes token = 3;
// The delta balance of the token. // The delta balance of the token.
@@ -23,8 +23,8 @@ message BalanceDeltas {
} }
message TransactionProtocolComponents { message TransactionProtocolComponents {
tycho.evm.v1.Transaction tx = 1; Transaction tx = 1;
repeated tycho.evm.v1.ProtocolComponent components = 2; repeated ProtocolComponent components = 2;
} }
message GroupedTransactionProtocolComponents { message GroupedTransactionProtocolComponents {

View File

@@ -14,16 +14,14 @@ use substreams::scalar::BigInt;
use substreams_ethereum::pb::eth; use substreams_ethereum::pb::eth;
use itertools::Itertools; use itertools::Itertools;
use pb::tycho::evm::v1::{self as tycho};
use contract_changes::extract_contract_changes; use contract_changes::extract_contract_changes;
use substreams_ethereum::Event; use substreams_ethereum::Event;
use crate::pb::balancer::{ use crate::pb::tycho::evm::v1::{self as tycho};
BalanceDelta, BalanceDeltas, GroupedTransactionProtocolComponents, use crate::pb::tycho::evm::v1::{BalanceDelta, BalanceDeltas, GroupedTransactionProtocolComponents, TransactionProtocolComponents};
TransactionProtocolComponents, use crate::{abi, contract_changes, pool_factories};
};
use crate::{abi, contract_changes, pb, pool_factories};
const VAULT_ADDRESS: &[u8] = &hex!("BA12222222228d8Ba445958a75a0704d566BF2C8"); const VAULT_ADDRESS: &[u8] = &hex!("BA12222222228d8Ba445958a75a0704d566BF2C8");

View File

@@ -1,42 +0,0 @@
// @generated
/// A struct for following the changes of Total Value Locked (TVL).
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BalanceDelta {
#[prost(uint64, tag="1")]
pub ord: u64,
/// The tx hash of the transaction that caused the balance change.
#[prost(message, optional, tag="2")]
pub tx: ::core::option::Option<super::tycho::evm::v1::Transaction>,
/// The address of the ERC20 token whose balance changed.
#[prost(bytes="vec", tag="3")]
pub token: ::prost::alloc::vec::Vec<u8>,
/// The delta balance of the token.
#[prost(bytes="vec", tag="4")]
pub delta: ::prost::alloc::vec::Vec<u8>,
/// The id of the component whose TVL is tracked.
/// If the protocol component includes multiple contracts, the balance change must be aggregated to reflect how much tokens can be traded.
#[prost(bytes="vec", tag="5")]
pub component_id: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BalanceDeltas {
#[prost(message, repeated, tag="1")]
pub balance_deltas: ::prost::alloc::vec::Vec<BalanceDelta>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TransactionProtocolComponents {
#[prost(message, optional, tag="1")]
pub tx: ::core::option::Option<super::tycho::evm::v1::Transaction>,
#[prost(message, repeated, tag="2")]
pub components: ::prost::alloc::vec::Vec<super::tycho::evm::v1::ProtocolComponent>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GroupedTransactionProtocolComponents {
#[prost(message, repeated, tag="1")]
pub tx_components: ::prost::alloc::vec::Vec<TransactionProtocolComponents>,
}
// @@protoc_insertion_point(module)

View File

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

View File

@@ -267,4 +267,44 @@ pub struct BlockContractChanges {
#[prost(message, repeated, tag="2")] #[prost(message, repeated, tag="2")]
pub changes: ::prost::alloc::vec::Vec<TransactionContractChanges>, pub changes: ::prost::alloc::vec::Vec<TransactionContractChanges>,
} }
/// A struct for following the changes of Total Value Locked (TVL).
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BalanceDelta {
#[prost(uint64, tag="1")]
pub ord: u64,
/// The tx hash of the transaction that caused the balance change.
#[prost(message, optional, tag="2")]
pub tx: ::core::option::Option<Transaction>,
/// The address of the ERC20 token whose balance changed.
#[prost(bytes="vec", tag="3")]
pub token: ::prost::alloc::vec::Vec<u8>,
/// The delta balance of the token.
#[prost(bytes="vec", tag="4")]
pub delta: ::prost::alloc::vec::Vec<u8>,
/// The id of the component whose TVL is tracked.
/// If the protocol component includes multiple contracts, the balance change must be aggregated to reflect how much tokens can be traded.
#[prost(bytes="vec", tag="5")]
pub component_id: ::prost::alloc::vec::Vec<u8>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BalanceDeltas {
#[prost(message, repeated, tag="1")]
pub balance_deltas: ::prost::alloc::vec::Vec<BalanceDelta>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TransactionProtocolComponents {
#[prost(message, optional, tag="1")]
pub tx: ::core::option::Option<Transaction>,
#[prost(message, repeated, tag="2")]
pub components: ::prost::alloc::vec::Vec<ProtocolComponent>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GroupedTransactionProtocolComponents {
#[prost(message, repeated, tag="1")]
pub tx_components: ::prost::alloc::vec::Vec<TransactionProtocolComponents>,
}
// @@protoc_insertion_point(module) // @@protoc_insertion_point(module)

View File

@@ -7,10 +7,9 @@ protobuf:
files: files:
- tycho/evm/v1/vm.proto - tycho/evm/v1/vm.proto
- tycho/evm/v1/common.proto - tycho/evm/v1/common.proto
- balancer.proto - tycho/evm/v1/balancer.proto
importPaths: importPaths:
- ../../proto - ../../proto
- ./proto
binaries: binaries:
default: default: