From aff76f8cc77e8767629b938df175e44027fd22e1 Mon Sep 17 00:00:00 2001 From: zizou <111426680+flopell@users.noreply.github.com> Date: Fri, 11 Oct 2024 14:24:55 +0200 Subject: [PATCH] chore: fix CI --- substreams/crates/substreams-helper/src/common.rs | 1 + .../crates/substreams-helper/src/event_handler.rs | 2 +- substreams/ethereum-ambient/src/lib.rs | 13 ++++++++----- .../ethereum-uniswap-v2/proto/v1/uniswap.proto | 8 ++++---- .../src/modules/3_map_pool_events.rs | 3 ++- .../src/pb/tycho.evm.uniswap.v2.rs | 8 ++++---- .../src/modules/5_map_pool_events.rs | 2 +- substreams/rustfmt.toml | 2 ++ 8 files changed, 23 insertions(+), 16 deletions(-) diff --git a/substreams/crates/substreams-helper/src/common.rs b/substreams/crates/substreams-helper/src/common.rs index cdc12d8..e0a83ac 100644 --- a/substreams/crates/substreams-helper/src/common.rs +++ b/substreams/crates/substreams-helper/src/common.rs @@ -8,6 +8,7 @@ use substreams::store::{ use crate::hex::Hexable; /// HasAddresser is a trait that a few functionalities in this crate depend on. +/// /// Every time we need to filter something by address (events emmited by a set of addresses, /// storage changes occurring on certain contracts, etc) you'll likely need /// to provide a HasAddresser. diff --git a/substreams/crates/substreams-helper/src/event_handler.rs b/substreams/crates/substreams-helper/src/event_handler.rs index 8a91342..2b550c2 100644 --- a/substreams/crates/substreams-helper/src/event_handler.rs +++ b/substreams/crates/substreams-helper/src/event_handler.rs @@ -100,4 +100,4 @@ impl<'a> EventHandler<'a> { } } } -} \ No newline at end of file +} diff --git a/substreams/ethereum-ambient/src/lib.rs b/substreams/ethereum-ambient/src/lib.rs index e279ea5..5537a72 100644 --- a/substreams/ethereum-ambient/src/lib.rs +++ b/substreams/ethereum-ambient/src/lib.rs @@ -52,13 +52,15 @@ impl From for tycho::ContractChange { /// Extracts all contract changes relevant to vm simulations /// -/// This is the main logic of the substreams integration. It takes a raw ethereum block on input and extracts the BlockContractChanges stream. It includes tracking: +/// This is the main logic of the substreams integration. It takes a raw ethereum block on input and +/// extracts the BlockContractChanges stream. It includes tracking: /// - new pool initializations /// - all storage slot changes for the Ambient contract /// - all ERC20 balance changes for the Ambient pools /// - all code changes and balance updates of the Ambient contract -/// -/// Generally we detect all changes in transactions sequentially and detect if it is a CREATE or UPDATE change based on already present data. +/// +/// Generally we detect all changes in transactions sequentially and detect if it is a CREATE or +/// UPDATE change based on already present data. #[substreams::handlers::map] fn map_changes( block: eth::v2::Block, @@ -83,7 +85,8 @@ fn map_changes( for block_tx in block.transactions() { // Extract storage changes for all contracts relevant to this protocol system. - // Ambient is a protocol system consisting of many ProtocolComponents (one for each pool), but they all share the same AMBIENT_CONTRACT contract. + // Ambient is a protocol system consisting of many ProtocolComponents (one for each pool), + // but they all share the same AMBIENT_CONTRACT contract. let mut storage_changes = block_tx .calls .iter() @@ -105,7 +108,7 @@ fn map_changes( .collect::>(); // Detect all pool initializations - // Official documentation: https://docs.ambient.finance/developers/dex-contract-interface/pool-initialization + // Official documentation: https://docs.ambient.finance/developers/dex-contract-interface/pool-initialization for call in ambient_calls { if call.input.len() < 4 { continue; diff --git a/substreams/ethereum-uniswap-v2/proto/v1/uniswap.proto b/substreams/ethereum-uniswap-v2/proto/v1/uniswap.proto index 3f26fd1..962d9fe 100644 --- a/substreams/ethereum-uniswap-v2/proto/v1/uniswap.proto +++ b/substreams/ethereum-uniswap-v2/proto/v1/uniswap.proto @@ -21,10 +21,10 @@ message Events { message Event { oneof type { - DepositEvent deposit_type = 10; - WithdrawEvent withdraw_type = 20; - SyncEvent sync_type = 30; - SwapEvent swap_type = 40; + DepositEvent deposit = 10; + WithdrawEvent withdraw = 20; + SyncEvent sync = 30; + SwapEvent swap = 40; } string hash = 100; diff --git a/substreams/ethereum-uniswap-v2/src/modules/3_map_pool_events.rs b/substreams/ethereum-uniswap-v2/src/modules/3_map_pool_events.rs index 2e6b264..5c428fa 100644 --- a/substreams/ethereum-uniswap-v2/src/modules/3_map_pool_events.rs +++ b/substreams/ethereum-uniswap-v2/src/modules/3_map_pool_events.rs @@ -141,8 +141,9 @@ fn handle_sync( /// handle_sync /// - block_entity_changes: The BlockChanges struct that will be updated with the changes from the /// sync events. +/// /// This HashMap comes pre-filled with the changes for the create_pool events, mapped in -/// 1_map_pool_created. +/// 1_map_pool_created. /// /// This function is called after the handle_sync function, and it is expected that /// block_entity_changes will be complete after this function ends. diff --git a/substreams/ethereum-uniswap-v2/src/pb/tycho.evm.uniswap.v2.rs b/substreams/ethereum-uniswap-v2/src/pb/tycho.evm.uniswap.v2.rs index c814ee4..26362b2 100644 --- a/substreams/ethereum-uniswap-v2/src/pb/tycho.evm.uniswap.v2.rs +++ b/substreams/ethereum-uniswap-v2/src/pb/tycho.evm.uniswap.v2.rs @@ -51,13 +51,13 @@ pub mod event { #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Type { #[prost(message, tag="10")] - DepositType(super::DepositEvent), + Deposit(super::DepositEvent), #[prost(message, tag="20")] - WithdrawType(super::WithdrawEvent), + Withdraw(super::WithdrawEvent), #[prost(message, tag="30")] - SyncType(super::SyncEvent), + Sync(super::SyncEvent), #[prost(message, tag="40")] - SwapType(super::SwapEvent), + Swap(super::SwapEvent), } } #[allow(clippy::derive_partial_eq_without_eq)] diff --git a/substreams/ethereum-uniswap-v3/src/modules/5_map_pool_events.rs b/substreams/ethereum-uniswap-v3/src/modules/5_map_pool_events.rs index 008201e..32cee7f 100644 --- a/substreams/ethereum-uniswap-v3/src/modules/5_map_pool_events.rs +++ b/substreams/ethereum-uniswap-v3/src/modules/5_map_pool_events.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, usize, vec}; +use std::{collections::HashMap, vec}; use substreams::store::{StoreGet, StoreGetBigInt, StoreGetProto}; use substreams_ethereum::pb::eth::v2::{self as eth, TransactionTrace}; diff --git a/substreams/rustfmt.toml b/substreams/rustfmt.toml index c0b67b2..1f8b922 100644 --- a/substreams/rustfmt.toml +++ b/substreams/rustfmt.toml @@ -12,4 +12,6 @@ ignore = [ "crates/tycho-substreams/src/pb", "ethereum-balancer/src/abi", "ethereum-curve/src/abi", + "ethereum-uniswap-v2/src/abi", + "ethereum-uniswap-v3/src/abi", ]