fix(ci): clippy, fmt and remove substreams logs
This commit is contained in:
@@ -34,6 +34,7 @@ impl SerializableVecBigInt for Vec<BigInt> {
|
||||
/// - 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 corresponding call to gather
|
||||
|
||||
@@ -8,6 +8,8 @@ fn main() -> Result<()> {
|
||||
|
||||
let files = fs::read_dir(abi_folder)?;
|
||||
let mut mod_rs_content = String::new();
|
||||
mod_rs_content.push_str("#![allow(clippy::all)]\n");
|
||||
mod_rs_content.push_str("#[allow(non_snake_case)]\n");
|
||||
|
||||
for file in files {
|
||||
let file = file?;
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
}
|
||||
impl Allowance {
|
||||
const METHOD_ID: [u8; 4] = [221u8, 98u8, 237u8, 62u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
let maybe_data = call.input.get(4..);
|
||||
if maybe_data.is_none() {
|
||||
return Err("no data to decode".to_string());
|
||||
@@ -41,14 +39,10 @@
|
||||
})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(
|
||||
&[
|
||||
let data = ethabi::encode(&[
|
||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.owner)),
|
||||
ethabi::Token::Address(
|
||||
ethabi::Address::from_slice(&self.spender),
|
||||
),
|
||||
],
|
||||
);
|
||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.spender)),
|
||||
]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
@@ -60,10 +54,7 @@
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Uint(256usize)],
|
||||
data.as_ref(),
|
||||
)
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Uint(256usize)], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok({
|
||||
let mut v = [0 as u8; 32];
|
||||
@@ -85,9 +76,7 @@
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
@@ -102,7 +91,8 @@
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
@@ -114,17 +104,14 @@
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt>
|
||||
for Allowance {
|
||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt> for Allowance {
|
||||
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||
Self::output(data)
|
||||
}
|
||||
@@ -136,9 +123,7 @@
|
||||
}
|
||||
impl Approve {
|
||||
const METHOD_ID: [u8; 4] = [9u8, 94u8, 167u8, 179u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
let maybe_data = call.input.get(4..);
|
||||
if maybe_data.is_none() {
|
||||
return Err("no data to decode".to_string());
|
||||
@@ -170,13 +155,9 @@
|
||||
})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(
|
||||
&[
|
||||
ethabi::Token::Address(
|
||||
ethabi::Address::from_slice(&self.spender),
|
||||
),
|
||||
ethabi::Token::Uint(
|
||||
ethabi::Uint::from_big_endian(
|
||||
let data = ethabi::encode(&[
|
||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.spender)),
|
||||
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
|
||||
match self.value.clone().to_bytes_be() {
|
||||
(num_bigint::Sign::Plus, bytes) => bytes,
|
||||
(num_bigint::Sign::NoSign, bytes) => bytes,
|
||||
@@ -185,33 +166,24 @@
|
||||
}
|
||||
}
|
||||
.as_slice(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
)),
|
||||
]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<bool, String> {
|
||||
pub fn output_call(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<bool, String> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<bool, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Bool],
|
||||
data.as_ref(),
|
||||
)
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Bool], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(
|
||||
values
|
||||
Ok(values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_bool()
|
||||
.expect(INTERNAL_ERR),
|
||||
)
|
||||
.expect(INTERNAL_ERR))
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
@@ -222,9 +194,7 @@
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
@@ -239,7 +209,8 @@
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
@@ -251,9 +222,7 @@
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
@@ -271,17 +240,12 @@
|
||||
}
|
||||
impl BalanceOf {
|
||||
const METHOD_ID: [u8; 4] = [112u8, 160u8, 130u8, 49u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
let maybe_data = call.input.get(4..);
|
||||
if maybe_data.is_none() {
|
||||
return Err("no data to decode".to_string());
|
||||
}
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Address],
|
||||
maybe_data.unwrap(),
|
||||
)
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Address], maybe_data.unwrap())
|
||||
.map_err(|e| format!("unable to decode call.input: {:?}", e))?;
|
||||
values.reverse();
|
||||
Ok(Self {
|
||||
@@ -295,9 +259,8 @@
|
||||
})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(
|
||||
&[ethabi::Token::Address(ethabi::Address::from_slice(&self.owner))],
|
||||
);
|
||||
let data =
|
||||
ethabi::encode(&[ethabi::Token::Address(ethabi::Address::from_slice(&self.owner))]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
@@ -309,10 +272,7 @@
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Uint(256usize)],
|
||||
data.as_ref(),
|
||||
)
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Uint(256usize)], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok({
|
||||
let mut v = [0 as u8; 32];
|
||||
@@ -334,9 +294,7 @@
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
@@ -351,7 +309,8 @@
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
@@ -363,17 +322,14 @@
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt>
|
||||
for BalanceOf {
|
||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt> for BalanceOf {
|
||||
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||
Self::output(data)
|
||||
}
|
||||
@@ -382,9 +338,7 @@
|
||||
pub struct Decimals {}
|
||||
impl Decimals {
|
||||
const METHOD_ID: [u8; 4] = [49u8, 60u8, 229u8, 103u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Ok(Self {})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
@@ -400,10 +354,7 @@
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Uint(8usize)],
|
||||
data.as_ref(),
|
||||
)
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Uint(8usize)], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok({
|
||||
let mut v = [0 as u8; 32];
|
||||
@@ -425,9 +376,7 @@
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
@@ -442,7 +391,8 @@
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
@@ -454,17 +404,14 @@
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt>
|
||||
for Decimals {
|
||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt> for Decimals {
|
||||
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||
Self::output(data)
|
||||
}
|
||||
@@ -473,9 +420,7 @@
|
||||
pub struct Name {}
|
||||
impl Name {
|
||||
const METHOD_ID: [u8; 4] = [6u8, 253u8, 222u8, 3u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Ok(Self {})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
@@ -491,18 +436,13 @@
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<String, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::String],
|
||||
data.as_ref(),
|
||||
)
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::String], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(
|
||||
values
|
||||
Ok(values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_string()
|
||||
.expect(INTERNAL_ERR),
|
||||
)
|
||||
.expect(INTERNAL_ERR))
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
@@ -513,9 +453,7 @@
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<String> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
@@ -530,7 +468,8 @@
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
@@ -542,9 +481,7 @@
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
@@ -560,9 +497,7 @@
|
||||
pub struct Symbol {}
|
||||
impl Symbol {
|
||||
const METHOD_ID: [u8; 4] = [149u8, 216u8, 155u8, 65u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Ok(Self {})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
@@ -578,18 +513,13 @@
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<String, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::String],
|
||||
data.as_ref(),
|
||||
)
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::String], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(
|
||||
values
|
||||
Ok(values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_string()
|
||||
.expect(INTERNAL_ERR),
|
||||
)
|
||||
.expect(INTERNAL_ERR))
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
@@ -600,9 +530,7 @@
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<String> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
@@ -617,7 +545,8 @@
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
@@ -629,9 +558,7 @@
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
@@ -647,9 +574,7 @@
|
||||
pub struct TotalSupply {}
|
||||
impl TotalSupply {
|
||||
const METHOD_ID: [u8; 4] = [24u8, 22u8, 13u8, 221u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Ok(Self {})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
@@ -665,10 +590,7 @@
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Uint(256usize)],
|
||||
data.as_ref(),
|
||||
)
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Uint(256usize)], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok({
|
||||
let mut v = [0 as u8; 32];
|
||||
@@ -690,9 +612,7 @@
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<substreams::scalar::BigInt> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
@@ -707,7 +627,8 @@
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
@@ -719,17 +640,14 @@
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
self.encode()
|
||||
}
|
||||
}
|
||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt>
|
||||
for TotalSupply {
|
||||
impl substreams_ethereum::rpc::RPCDecodable<substreams::scalar::BigInt> for TotalSupply {
|
||||
fn output(data: &[u8]) -> Result<substreams::scalar::BigInt, String> {
|
||||
Self::output(data)
|
||||
}
|
||||
@@ -741,9 +659,7 @@
|
||||
}
|
||||
impl Transfer {
|
||||
const METHOD_ID: [u8; 4] = [169u8, 5u8, 156u8, 187u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
let maybe_data = call.input.get(4..);
|
||||
if maybe_data.is_none() {
|
||||
return Err("no data to decode".to_string());
|
||||
@@ -775,11 +691,9 @@
|
||||
})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(
|
||||
&[
|
||||
let data = ethabi::encode(&[
|
||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.to)),
|
||||
ethabi::Token::Uint(
|
||||
ethabi::Uint::from_big_endian(
|
||||
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
|
||||
match self.value.clone().to_bytes_be() {
|
||||
(num_bigint::Sign::Plus, bytes) => bytes,
|
||||
(num_bigint::Sign::NoSign, bytes) => bytes,
|
||||
@@ -788,33 +702,24 @@
|
||||
}
|
||||
}
|
||||
.as_slice(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
)),
|
||||
]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<bool, String> {
|
||||
pub fn output_call(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<bool, String> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<bool, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Bool],
|
||||
data.as_ref(),
|
||||
)
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Bool], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(
|
||||
values
|
||||
Ok(values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_bool()
|
||||
.expect(INTERNAL_ERR),
|
||||
)
|
||||
.expect(INTERNAL_ERR))
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
@@ -825,9 +730,7 @@
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
@@ -842,7 +745,8 @@
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
@@ -854,9 +758,7 @@
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
@@ -876,9 +778,7 @@
|
||||
}
|
||||
impl TransferFrom {
|
||||
const METHOD_ID: [u8; 4] = [35u8, 184u8, 114u8, 221u8];
|
||||
pub fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
pub fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
let maybe_data = call.input.get(4..);
|
||||
if maybe_data.is_none() {
|
||||
return Err("no data to decode".to_string());
|
||||
@@ -921,12 +821,10 @@
|
||||
})
|
||||
}
|
||||
pub fn encode(&self) -> Vec<u8> {
|
||||
let data = ethabi::encode(
|
||||
&[
|
||||
let data = ethabi::encode(&[
|
||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.from)),
|
||||
ethabi::Token::Address(ethabi::Address::from_slice(&self.to)),
|
||||
ethabi::Token::Uint(
|
||||
ethabi::Uint::from_big_endian(
|
||||
ethabi::Token::Uint(ethabi::Uint::from_big_endian(
|
||||
match self.value.clone().to_bytes_be() {
|
||||
(num_bigint::Sign::Plus, bytes) => bytes,
|
||||
(num_bigint::Sign::NoSign, bytes) => bytes,
|
||||
@@ -935,33 +833,24 @@
|
||||
}
|
||||
}
|
||||
.as_slice(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
)),
|
||||
]);
|
||||
let mut encoded = Vec::with_capacity(4 + data.len());
|
||||
encoded.extend(Self::METHOD_ID);
|
||||
encoded.extend(data);
|
||||
encoded
|
||||
}
|
||||
pub fn output_call(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<bool, String> {
|
||||
pub fn output_call(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<bool, String> {
|
||||
Self::output(call.return_data.as_ref())
|
||||
}
|
||||
pub fn output(data: &[u8]) -> Result<bool, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Bool],
|
||||
data.as_ref(),
|
||||
)
|
||||
let mut values = ethabi::decode(&[ethabi::ParamType::Bool], data.as_ref())
|
||||
.map_err(|e| format!("unable to decode output data: {:?}", e))?;
|
||||
Ok(
|
||||
values
|
||||
Ok(values
|
||||
.pop()
|
||||
.expect("one output data should have existed")
|
||||
.into_bool()
|
||||
.expect(INTERNAL_ERR),
|
||||
)
|
||||
.expect(INTERNAL_ERR))
|
||||
}
|
||||
pub fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
match call.input.get(0..4) {
|
||||
@@ -972,9 +861,7 @@
|
||||
pub fn call(&self, address: Vec<u8>) -> Option<bool> {
|
||||
use substreams_ethereum::pb::eth::rpc;
|
||||
let rpc_calls = rpc::RpcCalls {
|
||||
calls: vec![
|
||||
rpc::RpcCall { to_addr : address, data : self.encode(), }
|
||||
],
|
||||
calls: vec![rpc::RpcCall { to_addr: address, data: self.encode() }],
|
||||
};
|
||||
let responses = substreams_ethereum::rpc::eth_call(&rpc_calls).responses;
|
||||
let response = responses
|
||||
@@ -989,7 +876,8 @@
|
||||
use substreams_ethereum::Function;
|
||||
substreams::log::info!(
|
||||
"Call output for function `{}` failed to decode with error: {}",
|
||||
Self::NAME, err
|
||||
Self::NAME,
|
||||
err
|
||||
);
|
||||
None
|
||||
}
|
||||
@@ -1001,9 +889,7 @@
|
||||
fn match_call(call: &substreams_ethereum::pb::eth::v2::Call) -> bool {
|
||||
Self::match_call(call)
|
||||
}
|
||||
fn decode(
|
||||
call: &substreams_ethereum::pb::eth::v2::Call,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(call: &substreams_ethereum::pb::eth::v2::Call) -> Result<Self, String> {
|
||||
Self::decode(call)
|
||||
}
|
||||
fn encode(&self) -> Vec<u8> {
|
||||
@@ -1028,38 +914,9 @@
|
||||
}
|
||||
impl Approval {
|
||||
const TOPIC_ID: [u8; 32] = [
|
||||
140u8,
|
||||
91u8,
|
||||
225u8,
|
||||
229u8,
|
||||
235u8,
|
||||
236u8,
|
||||
125u8,
|
||||
91u8,
|
||||
209u8,
|
||||
79u8,
|
||||
113u8,
|
||||
66u8,
|
||||
125u8,
|
||||
30u8,
|
||||
132u8,
|
||||
243u8,
|
||||
221u8,
|
||||
3u8,
|
||||
20u8,
|
||||
192u8,
|
||||
247u8,
|
||||
178u8,
|
||||
41u8,
|
||||
30u8,
|
||||
91u8,
|
||||
32u8,
|
||||
10u8,
|
||||
200u8,
|
||||
199u8,
|
||||
195u8,
|
||||
185u8,
|
||||
37u8,
|
||||
140u8, 91u8, 225u8, 229u8, 235u8, 236u8, 125u8, 91u8, 209u8, 79u8, 113u8, 66u8, 125u8,
|
||||
30u8, 132u8, 243u8, 221u8, 3u8, 20u8, 192u8, 247u8, 178u8, 41u8, 30u8, 91u8, 32u8,
|
||||
10u8, 200u8, 199u8, 195u8, 185u8, 37u8,
|
||||
];
|
||||
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||
if log.topics.len() != 3usize {
|
||||
@@ -1068,23 +925,20 @@
|
||||
if log.data.len() != 32usize {
|
||||
return false;
|
||||
}
|
||||
return log.topics.get(0).expect("bounds already checked").as_ref()
|
||||
== Self::TOPIC_ID;
|
||||
return log
|
||||
.topics
|
||||
.get(0)
|
||||
.expect("bounds already checked")
|
||||
.as_ref() ==
|
||||
Self::TOPIC_ID;
|
||||
}
|
||||
pub fn decode(
|
||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
||||
) -> Result<Self, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Uint(256usize)],
|
||||
log.data.as_ref(),
|
||||
)
|
||||
pub fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||
let mut values =
|
||||
ethabi::decode(&[ethabi::ParamType::Uint(256usize)], log.data.as_ref())
|
||||
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
|
||||
values.reverse();
|
||||
Ok(Self {
|
||||
owner: ethabi::decode(
|
||||
&[ethabi::ParamType::Address],
|
||||
log.topics[1usize].as_ref(),
|
||||
)
|
||||
owner: ethabi::decode(&[ethabi::ParamType::Address], log.topics[1usize].as_ref())
|
||||
.map_err(|e| {
|
||||
format!(
|
||||
"unable to decode param 'owner' from topic of type 'address': {:?}",
|
||||
@@ -1097,10 +951,7 @@
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec(),
|
||||
spender: ethabi::decode(
|
||||
&[ethabi::ParamType::Address],
|
||||
log.topics[2usize].as_ref(),
|
||||
)
|
||||
spender: ethabi::decode(&[ethabi::ParamType::Address], log.topics[2usize].as_ref())
|
||||
.map_err(|e| {
|
||||
format!(
|
||||
"unable to decode param 'spender' from topic of type 'address': {:?}",
|
||||
@@ -1131,9 +982,7 @@
|
||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||
Self::match_log(log)
|
||||
}
|
||||
fn decode(
|
||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||
Self::decode(log)
|
||||
}
|
||||
}
|
||||
@@ -1145,38 +994,9 @@
|
||||
}
|
||||
impl Transfer {
|
||||
const TOPIC_ID: [u8; 32] = [
|
||||
221u8,
|
||||
242u8,
|
||||
82u8,
|
||||
173u8,
|
||||
27u8,
|
||||
226u8,
|
||||
200u8,
|
||||
155u8,
|
||||
105u8,
|
||||
194u8,
|
||||
176u8,
|
||||
104u8,
|
||||
252u8,
|
||||
55u8,
|
||||
141u8,
|
||||
170u8,
|
||||
149u8,
|
||||
43u8,
|
||||
167u8,
|
||||
241u8,
|
||||
99u8,
|
||||
196u8,
|
||||
161u8,
|
||||
22u8,
|
||||
40u8,
|
||||
245u8,
|
||||
90u8,
|
||||
77u8,
|
||||
245u8,
|
||||
35u8,
|
||||
179u8,
|
||||
239u8,
|
||||
221u8, 242u8, 82u8, 173u8, 27u8, 226u8, 200u8, 155u8, 105u8, 194u8, 176u8, 104u8,
|
||||
252u8, 55u8, 141u8, 170u8, 149u8, 43u8, 167u8, 241u8, 99u8, 196u8, 161u8, 22u8, 40u8,
|
||||
245u8, 90u8, 77u8, 245u8, 35u8, 179u8, 239u8,
|
||||
];
|
||||
pub fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||
if log.topics.len() != 3usize {
|
||||
@@ -1185,23 +1005,20 @@
|
||||
if log.data.len() != 32usize {
|
||||
return false;
|
||||
}
|
||||
return log.topics.get(0).expect("bounds already checked").as_ref()
|
||||
== Self::TOPIC_ID;
|
||||
return log
|
||||
.topics
|
||||
.get(0)
|
||||
.expect("bounds already checked")
|
||||
.as_ref() ==
|
||||
Self::TOPIC_ID;
|
||||
}
|
||||
pub fn decode(
|
||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
||||
) -> Result<Self, String> {
|
||||
let mut values = ethabi::decode(
|
||||
&[ethabi::ParamType::Uint(256usize)],
|
||||
log.data.as_ref(),
|
||||
)
|
||||
pub fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||
let mut values =
|
||||
ethabi::decode(&[ethabi::ParamType::Uint(256usize)], log.data.as_ref())
|
||||
.map_err(|e| format!("unable to decode log.data: {:?}", e))?;
|
||||
values.reverse();
|
||||
Ok(Self {
|
||||
from: ethabi::decode(
|
||||
&[ethabi::ParamType::Address],
|
||||
log.topics[1usize].as_ref(),
|
||||
)
|
||||
from: ethabi::decode(&[ethabi::ParamType::Address], log.topics[1usize].as_ref())
|
||||
.map_err(|e| {
|
||||
format!(
|
||||
"unable to decode param 'from' from topic of type 'address': {:?}",
|
||||
@@ -1214,15 +1031,9 @@
|
||||
.expect(INTERNAL_ERR)
|
||||
.as_bytes()
|
||||
.to_vec(),
|
||||
to: ethabi::decode(
|
||||
&[ethabi::ParamType::Address],
|
||||
log.topics[2usize].as_ref(),
|
||||
)
|
||||
to: ethabi::decode(&[ethabi::ParamType::Address], log.topics[2usize].as_ref())
|
||||
.map_err(|e| {
|
||||
format!(
|
||||
"unable to decode param 'to' from topic of type 'address': {:?}",
|
||||
e
|
||||
)
|
||||
format!("unable to decode param 'to' from topic of type 'address': {:?}", e)
|
||||
})?
|
||||
.pop()
|
||||
.expect(INTERNAL_ERR)
|
||||
@@ -1248,9 +1059,7 @@
|
||||
fn match_log(log: &substreams_ethereum::pb::eth::v2::Log) -> bool {
|
||||
Self::match_log(log)
|
||||
}
|
||||
fn decode(
|
||||
log: &substreams_ethereum::pb::eth::v2::Log,
|
||||
) -> Result<Self, String> {
|
||||
fn decode(log: &substreams_ethereum::pb::eth::v2::Log) -> Result<Self, String> {
|
||||
Self::decode(log)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(clippy::all)]
|
||||
#[allow(non_snake_case)]
|
||||
pub mod crypto_pool_factory;
|
||||
pub mod stableswap_factory;
|
||||
pub mod susd;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#![allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||
mod abi;
|
||||
mod consts;
|
||||
pub mod modules;
|
||||
|
||||
@@ -45,7 +45,7 @@ pub fn map_components(
|
||||
.logs_with_calls()
|
||||
.filter(|(_, call)| !call.call.state_reverted)
|
||||
.filter_map(|(log, call)| {
|
||||
Some(pool_factories::address_map(
|
||||
pool_factories::address_map(
|
||||
call.call
|
||||
.address
|
||||
.as_slice()
|
||||
@@ -54,11 +54,11 @@ pub fn map_components(
|
||||
log,
|
||||
call.call,
|
||||
tx,
|
||||
)?)
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if let Some(component) = emit_specific_pools(¶ms, &tx).expect(
|
||||
if let Some(component) = emit_specific_pools(¶ms, tx).expect(
|
||||
"An unexpected error occured when parsing params for emitting specific pools",
|
||||
) {
|
||||
components.push(component)
|
||||
@@ -95,8 +95,8 @@ pub fn store_component_tokens(map: BlockTransactionProtocolComponents, store: St
|
||||
&component
|
||||
.tokens
|
||||
.iter()
|
||||
.map(|token| hex::encode(token))
|
||||
.join(":".into()),
|
||||
.map(hex::encode)
|
||||
.join(":"),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -112,11 +112,10 @@ pub fn map_relative_balances(
|
||||
balance_deltas: {
|
||||
let mut deltas: Vec<_> = block
|
||||
.transactions()
|
||||
.into_iter()
|
||||
.flat_map(|tx| {
|
||||
emit_eth_deltas(&tx, &tokens_store)
|
||||
emit_eth_deltas(tx, &tokens_store)
|
||||
.into_iter()
|
||||
.chain(emit_deltas(&tx, &tokens_store))
|
||||
.chain(emit_deltas(tx, &tokens_store))
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -268,7 +267,7 @@ pub fn map_protocol_changes(
|
||||
}),
|
||||
changes: transaction_contract_changes
|
||||
.drain()
|
||||
.sorted_unstable_by_key(|(index, _)| index.clone())
|
||||
.sorted_unstable_by_key(|(index, _)| *index)
|
||||
.filter_map(|(_, change)| {
|
||||
if change.contract_changes.is_empty() &&
|
||||
change.component_changes.is_empty() &&
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
};
|
||||
|
||||
fn get_pool_tokens(pool_address: &Vec<u8>, tokens_store: &StoreGetString) -> Option<Vec<String>> {
|
||||
let pool_key = format!("pool:{}", hex::encode(&pool_address));
|
||||
let pool_key = format!("pool:{}", hex::encode(pool_address));
|
||||
Some(
|
||||
tokens_store
|
||||
.get_last(pool_key)?
|
||||
@@ -24,10 +24,8 @@ fn get_pool_tokens(pool_address: &Vec<u8>, tokens_store: &StoreGetString) -> Opt
|
||||
/// Tracks `Transfers` in and out of tracked pools if it matches the specific tokens.
|
||||
pub fn emit_deltas(tx: &TransactionTrace, tokens_store: &StoreGetString) -> Vec<BalanceDelta> {
|
||||
tx.logs_with_calls()
|
||||
.into_iter()
|
||||
.filter_map(|(log, _)| {
|
||||
let transfer = abi::erc20::events::Transfer::match_and_decode(log)?;
|
||||
|
||||
let (component_id, pool_tokens, is_incoming) =
|
||||
if let Some(pool_tokens) = get_pool_tokens(&transfer.to, tokens_store) {
|
||||
(hex::encode(&transfer.to), pool_tokens, true)
|
||||
@@ -53,7 +51,6 @@ pub fn emit_deltas(tx: &TransactionTrace, tokens_store: &StoreGetString) -> Vec<
|
||||
component_id: component_id.into(),
|
||||
})
|
||||
} else {
|
||||
substreams::log::info!("Token {:?} not in pool: {:?}", token_id, &component_id);
|
||||
None
|
||||
}
|
||||
})
|
||||
@@ -69,7 +66,6 @@ pub fn emit_deltas(tx: &TransactionTrace, tokens_store: &StoreGetString) -> Vec<
|
||||
/// - If neither, it's likely an erroneous ETH transactions that many older pools don't reject.
|
||||
pub fn emit_eth_deltas(tx: &TransactionTrace, tokens_store: &StoreGetString) -> Vec<BalanceDelta> {
|
||||
tx.calls()
|
||||
.into_iter()
|
||||
.flat_map(|call| {
|
||||
call.call
|
||||
.balance_changes
|
||||
|
||||
@@ -28,7 +28,7 @@ impl SerializableVecBigInt for Vec<BigInt> {
|
||||
fn deserialize_bytes(bytes: &[u8]) -> Vec<BigInt> {
|
||||
bytes
|
||||
.chunks_exact(32)
|
||||
.map(|chunk| BigInt::from_signed_bytes_be(chunk))
|
||||
.map(BigInt::from_signed_bytes_be)
|
||||
.collect::<Vec<BigInt>>()
|
||||
}
|
||||
}
|
||||
@@ -381,7 +381,7 @@ pub fn address_map(
|
||||
hash: tx.hash.clone(),
|
||||
index: tx.index.into(),
|
||||
}),
|
||||
tokens: pool_added.coins.into(),
|
||||
tokens: pool_added.coins,
|
||||
contracts: vec![component_id.into()],
|
||||
static_att: vec![
|
||||
Attribute {
|
||||
@@ -487,7 +487,7 @@ pub fn address_map(
|
||||
index: tx.index.into(),
|
||||
}),
|
||||
tokens,
|
||||
contracts: vec![pool_added.pool.into()],
|
||||
contracts: vec![pool_added.pool],
|
||||
static_att: vec![
|
||||
Attribute {
|
||||
name: "pool_type".into(),
|
||||
@@ -701,8 +701,7 @@ fn get_token_from_pool(pool: &Vec<u8>) -> Vec<u8> {
|
||||
.call(META_REGISTRY.to_vec())
|
||||
})
|
||||
.or_else(|| {
|
||||
substreams::log::info!(format!("Using pool tree with pool {}", hex::encode(&pool)));
|
||||
match hex::encode(&pool).as_str() {
|
||||
match hex::encode(pool).as_str() {
|
||||
// Curve.fi DAI/USDC/USDT (3Crv)
|
||||
"bebc44782c7db0a1a60cb6fe97d0b483032ff1c7" => {
|
||||
hex::decode("6c3F90f043a72FA612cbac8115EE7e52BDe6E490").ok()
|
||||
|
||||
@@ -29,7 +29,7 @@ struct PoolQueryParams {
|
||||
/// This function can error based on some basic parsing errors and deeper down hex decoding errors
|
||||
/// if various addresses are not formatted properly.
|
||||
pub fn emit_specific_pools(
|
||||
params: &String,
|
||||
params: &str,
|
||||
tx: &TransactionTrace,
|
||||
) -> Result<Option<ProtocolComponent>> {
|
||||
let pools = parse_params(params)?;
|
||||
@@ -60,12 +60,10 @@ fn create_component(
|
||||
static_att: zip(
|
||||
pool.attribute_keys
|
||||
.clone()
|
||||
.unwrap_or(vec![])
|
||||
.into_iter(),
|
||||
.unwrap_or(vec![]),
|
||||
pool.attribute_vals
|
||||
.clone()
|
||||
.unwrap_or(vec![])
|
||||
.into_iter(),
|
||||
.unwrap_or(vec![]),
|
||||
)
|
||||
.clone()
|
||||
.map(|(key, value)| Attribute {
|
||||
|
||||
Reference in New Issue
Block a user