Skip to content

Commit

Permalink
chore: remove dependency on common message types
Browse files Browse the repository at this point in the history
This allows us to isoluate the ambient specific messages within the ambient module
  • Loading branch information
louise-poole committed Jan 22, 2025
1 parent ad69009 commit f90c33b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
1 change: 0 additions & 1 deletion buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ modules:
- path: proto
excludes:
- proto/sf
- path: substreams/ethereum-ambient/proto
lint:
use:
- BASIC
Expand Down
23 changes: 16 additions & 7 deletions substreams/ethereum-ambient/proto/ambient.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ syntax = "proto3";

package tycho.ambient.v1;

import "tycho/evm/v1/common.proto";

// A change to a pool's balance. Ambient specific.
message AmbientBalanceDelta {
// The address of the ERC20 token whose balance changed.
Expand All @@ -14,14 +12,25 @@ message AmbientBalanceDelta {
bytes token_delta = 3;
// Used to determine the order of the balance changes. Necessary for the balance store.
uint64 ordinal = 4;
// Transaction where the balance changed.
tycho.evm.v1.Transaction tx = 5;
// Transaction index of the balance change
uint64 tx_index = 5;
}

message AmbientProtocolComponent {
// A unique identifier for the component within the protocol.
string id = 1;
// Addresses of the ERC20 tokens used by the component.
repeated bytes tokens = 2;
// Ambient pool index [static attribute for ambient pools]
bytes pool_index = 3;
// Transaction index for the component creation
uint64 tx_index = 4;
}

// Ambient pool changes within a single block
message BlockPoolChanges {
// Balance changes on this block
repeated AmbientBalanceDelta balances = 1;
// New protocol components added in this block
repeated tycho.evm.v1.ProtocolComponent protocol_components = 1;
// Balance changes to pools in this block
repeated AmbientBalanceDelta balance_deltas = 2;
repeated AmbientProtocolComponent new_components = 2;
}
30 changes: 23 additions & 7 deletions substreams/ethereum-ambient/src/pb/tycho.ambient.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,35 @@ pub struct AmbientBalanceDelta {
/// 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>,
/// Transaction index of the balance change
#[prost(uint64, tag="5")]
pub tx_index: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AmbientProtocolComponent {
/// A unique identifier for the component within the protocol.
#[prost(string, tag="1")]
pub id: ::prost::alloc::string::String,
/// Addresses of the ERC20 tokens used by the component.
#[prost(bytes="vec", repeated, tag="2")]
pub tokens: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
/// Ambient pool index [static attribute for ambient pools]
#[prost(bytes="vec", tag="3")]
pub pool_index: ::prost::alloc::vec::Vec<u8>,
/// Transaction index for the component creation
#[prost(uint64, tag="4")]
pub tx_index: u64,
}
/// 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
/// Balance changes on 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
pub balances: ::prost::alloc::vec::Vec<AmbientBalanceDelta>,
/// New protocol components added in this block
#[prost(message, repeated, tag="2")]
pub balance_deltas: ::prost::alloc::vec::Vec<AmbientBalanceDelta>,
pub new_components: ::prost::alloc::vec::Vec<AmbientProtocolComponent>,
}
// @@protoc_insertion_point(module)

0 comments on commit f90c33b

Please sign in to comment.