fix: curve substream issues
This commit is contained in:
2
substreams/ethereum-curve/Cargo.lock
generated
2
substreams/ethereum-curve/Cargo.lock
generated
@@ -885,7 +885,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "substreams-balancer"
|
||||
name = "substreams-curve"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[package]
|
||||
name = "substreams-balancer"
|
||||
name = "substreams-curve"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
name = "substreams_balancer"
|
||||
name = "substreams_curve"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
@@ -98,8 +98,8 @@ pub fn store_pools_created(map: tycho::GroupedTransactionProtocolComponents, sto
|
||||
|
||||
/// Simply stores the `ProtocolComponent`s with the pool id as the key
|
||||
#[substreams::handlers::store]
|
||||
pub fn store_pool_tokens(map: tycho::GroupedTransactionProtocolComponents, store: StoreSetString) {
|
||||
&map.tx_components
|
||||
pub fn store_pools_tokens(map: tycho::GroupedTransactionProtocolComponents, store: StoreSetString) {
|
||||
map.tx_components
|
||||
.iter()
|
||||
.flat_map(|tx_components| &tx_components.components)
|
||||
.for_each(|component| {
|
||||
@@ -120,7 +120,7 @@ pub fn store_pool_tokens(map: tycho::GroupedTransactionProtocolComponents, store
|
||||
#[substreams::handlers::map]
|
||||
pub fn map_balance_deltas(
|
||||
block: eth::v2::Block,
|
||||
store: StoreGetInt64,
|
||||
pools_store: StoreGetInt64,
|
||||
tokens_store: StoreGetString,
|
||||
) -> Result<tycho::BalanceDeltas, anyhow::Error> {
|
||||
let mut deltas = block
|
||||
@@ -130,7 +130,7 @@ pub fn map_balance_deltas(
|
||||
Some((log, event))
|
||||
})
|
||||
.filter(|(log, _)| {
|
||||
store
|
||||
pools_store
|
||||
.get_last(format!("pool:{0}", hex::encode(&log.address())))
|
||||
.is_some()
|
||||
})
|
||||
@@ -163,7 +163,7 @@ pub fn map_balance_deltas(
|
||||
Some((log, event))
|
||||
})
|
||||
.filter(|(log, _)| {
|
||||
store
|
||||
pools_store
|
||||
.get_last(format!("pool:{0}", hex::encode(&log.address())))
|
||||
.is_none()
|
||||
})
|
||||
@@ -198,7 +198,7 @@ pub fn map_balance_deltas(
|
||||
Some((log, event))
|
||||
})
|
||||
.filter(|(log, _)| {
|
||||
store
|
||||
pools_store
|
||||
.get_last(format!("pool:{0}", hex::encode(&log.address())))
|
||||
.is_none()
|
||||
})
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
// @generated
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Pools {
|
||||
#[prost(message, repeated, tag="1")]
|
||||
pub pools: ::prost::alloc::vec::Vec<Pool>,
|
||||
}
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Pool {
|
||||
#[prost(bytes="vec", tag="1")]
|
||||
pub pool_id: ::prost::alloc::vec::Vec<u8>,
|
||||
#[prost(fixed64, tag="2")]
|
||||
pub log_ordinal: u64,
|
||||
}
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Transfer {
|
||||
#[prost(bytes="vec", tag="1")]
|
||||
pub from: ::prost::alloc::vec::Vec<u8>,
|
||||
#[prost(bytes="vec", tag="2")]
|
||||
pub to: ::prost::alloc::vec::Vec<u8>,
|
||||
#[prost(string, tag="3")]
|
||||
pub token: ::prost::alloc::string::String,
|
||||
#[prost(string, tag="4")]
|
||||
pub amount: ::prost::alloc::string::String,
|
||||
}
|
||||
// @@protoc_insertion_point(module)
|
||||
@@ -1,28 +0,0 @@
|
||||
// @generated
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Pools {
|
||||
#[prost(message, repeated, tag="1")]
|
||||
pub pools: ::prost::alloc::vec::Vec<Pool>,
|
||||
}
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Pool {
|
||||
#[prost(bytes="vec", tag="1")]
|
||||
pub pool_id: ::prost::alloc::vec::Vec<u8>,
|
||||
#[prost(fixed64, tag="2")]
|
||||
pub log_ordinal: u64,
|
||||
}
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Transfer {
|
||||
#[prost(bytes="vec", tag="1")]
|
||||
pub from: ::prost::alloc::vec::Vec<u8>,
|
||||
#[prost(bytes="vec", tag="2")]
|
||||
pub to: ::prost::alloc::vec::Vec<u8>,
|
||||
#[prost(string, tag="3")]
|
||||
pub token: ::prost::alloc::string::String,
|
||||
#[prost(string, tag="4")]
|
||||
pub amount: ::prost::alloc::string::String,
|
||||
}
|
||||
// @@protoc_insertion_point(module)
|
||||
@@ -1,22 +0,0 @@
|
||||
// @generated
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Transfers {
|
||||
#[prost(message, repeated, tag="1")]
|
||||
pub transfers: ::prost::alloc::vec::Vec<Transfer>,
|
||||
}
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Transfer {
|
||||
#[prost(string, tag="1")]
|
||||
pub from: ::prost::alloc::string::String,
|
||||
#[prost(string, tag="2")]
|
||||
pub to: ::prost::alloc::string::String,
|
||||
#[prost(uint64, tag="3")]
|
||||
pub token_id: u64,
|
||||
#[prost(string, tag="4")]
|
||||
pub trx_hash: ::prost::alloc::string::String,
|
||||
#[prost(uint64, tag="5")]
|
||||
pub ordinal: u64,
|
||||
}
|
||||
// @@protoc_insertion_point(module)
|
||||
@@ -4,7 +4,7 @@ use substreams_ethereum::{Event, Function};
|
||||
use crate::abi;
|
||||
use crate::pb;
|
||||
use pb::tycho::evm::v1::{self as tycho};
|
||||
use substreams::{hex, log};
|
||||
use substreams::hex;
|
||||
|
||||
use substreams::scalar::BigInt;
|
||||
|
||||
@@ -38,17 +38,6 @@ impl SerializableVecBigInt for Vec<BigInt> {
|
||||
}
|
||||
}
|
||||
|
||||
/// This is the main function that handles the creation of `ProtocolComponent`s with `Attribute`s
|
||||
/// based on the specific factory address. There's 3 factory groups that are represented here:
|
||||
/// - Weighted Pool Factories
|
||||
/// - Linear Pool Factories
|
||||
/// - Stable Pool Factories
|
||||
/// (Balancer does have a bit more (esp. in the deprecated section) that could be implemented as
|
||||
/// desired.)
|
||||
/// We use the specific ABIs to decode both the log event and cooresponding call to gather
|
||||
/// `PoolCreated` event information alongside the `Create` calldata that provide us details to
|
||||
/// fufill both the required details + any extra `Attributes`
|
||||
/// Ref: https://docs.balancer.fi/reference/contracts/deployment-addresses/mainnet.html
|
||||
pub fn address_map(
|
||||
call_address: &[u8; 20],
|
||||
log: &Log,
|
||||
|
||||
@@ -14,7 +14,7 @@ protobuf:
|
||||
binaries:
|
||||
default:
|
||||
type: wasm/rust-v1
|
||||
file: target/wasm32-unknown-unknown/release/substreams_balancer.wasm
|
||||
file: target/wasm32-unknown-unknown/release/substreams_curve.wasm
|
||||
|
||||
modules:
|
||||
- name: map_pools_created
|
||||
@@ -36,7 +36,7 @@ modules:
|
||||
- name: store_pools_tokens
|
||||
kind: store
|
||||
initialBlock: 19128828
|
||||
updatePolicy: add
|
||||
updatePolicy: set
|
||||
valueType: string
|
||||
inputs:
|
||||
- map: map_pools_created
|
||||
@@ -47,6 +47,7 @@ modules:
|
||||
inputs:
|
||||
- source: sf.ethereum.type.v2.Block
|
||||
- store: store_pools_created
|
||||
- store: store_pools_tokens
|
||||
output:
|
||||
type: proto:tycho.evm.v1.BalanceDeltas
|
||||
|
||||
|
||||
Reference in New Issue
Block a user